/* Payday: Liquid Glass look.
   Sizing rules (docs/design-rules.md): 5 type sizes, 3 radii, 4/8 spacing grid, 44px hit targets.
   Material: translucent fill + backdrop blur + a bright 1px rim + a soft specular sheen. */
:root {
  /* type: display numeral, Title 1, Body/Headline, Subhead, Footnote */
  --t-display: clamp(40px, 12.5vw, 48px); --t-title: 28px; --t-body: 17px; --t-sub: 15px; --t-cap: 13px;
  --w-reg: 400; --w-semi: 600; --w-bold: 700;
  /* spacing: 4pt baseline on an 8pt grid */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  /* radii: containers 24, anything nested 24 - 16 padding = 8, controls are capsules */
  --r-lg: 24px; --r-sm: 8px; --r-pill: 999px;
  --hit: 44px;

  --fill: rgba(255, 255, 255, .44); --fill-hi: rgba(255, 255, 255, .66); --fill-solid: rgba(255, 255, 255, .94); --line: rgba(255, 255, 255, .7);
  --shadow: 0 12px 32px rgba(48, 66, 120, .18);
  --ink: #0e1a27; --muted: rgba(14, 26, 39, .66);
  --tint: #1d8f5a; --tint-soft: rgba(52, 199, 89, .22); --amber: #c77700; --red: #d92d20;
  --track: rgba(120, 130, 150, .24);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fill: rgba(30, 36, 50, .46); --fill-hi: rgba(44, 52, 72, .7); --fill-solid: rgba(24, 30, 44, .94); --line: rgba(255, 255, 255, .17);
    --shadow: 0 14px 36px rgba(0, 0, 0, .45);
    --ink: #f1f5fb; --muted: rgba(241, 245, 251, .66);
    --tint: #4ade80; --tint-soft: rgba(74, 222, 128, .2); --amber: #ffb340; --red: #ff6b61;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); background: transparent;
  font: var(--w-reg) var(--t-body)/1.3 -apple-system, "SF Pro Text", system-ui, sans-serif;
  padding-bottom: calc(var(--s5) + env(safe-area-inset-bottom));
}
.bg { position: fixed; inset: 0; z-index: -1; background-color: #dbe6f3;
  background-image:
    radial-gradient(52% 44% at 12% 8%, #6fd8c0 0, transparent 62%),
    radial-gradient(46% 42% at 92% 18%, #b3a2ff 0, transparent 62%),
    radial-gradient(60% 50% at 78% 96%, #ffc489 0, transparent 62%),
    radial-gradient(40% 36% at 8% 80%, #8fc1ff 0, transparent 62%); }
@media (prefers-color-scheme: dark) {
  .bg { background-color: #0a0f19;
    background-image:
      radial-gradient(52% 44% at 12% 8%, rgba(32, 160, 140, .6) 0, transparent 62%),
      radial-gradient(46% 42% at 92% 18%, rgba(110, 88, 230, .6) 0, transparent 62%),
      radial-gradient(60% 50% at 78% 96%, rgba(210, 128, 50, .5) 0, transparent 62%),
      radial-gradient(40% 36% at 8% 80%, rgba(50, 110, 220, .5) 0, transparent 62%); }
}
#app { max-width: 560px; margin: 0 auto; padding: 0 var(--s4); }
h1, h2, h3 { font-size: var(--t-body); font-weight: var(--w-semi); line-height: 1.3; margin: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; }
.muted { color: var(--muted); font-size: var(--t-cap); }

/* header */
.top { display: flex; justify-content: space-between; align-items: center; padding: calc(var(--s4) + env(safe-area-inset-top)) var(--s1) var(--s2); }
.top-r { display: flex; gap: var(--s2); align-items: center; }
.seg { display: inline-flex; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--line); background: var(--fill); overflow: hidden; }
.seg button { background: transparent; border: 0; min-height: var(--hit); min-width: var(--hit); padding: 0 var(--s3); font-size: var(--t-sub); font-weight: var(--w-semi); }
.seg button.on { background: var(--fill-hi); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6); }

/* the glass material */
.card, .dock, .cap, .step, .seg {
  -webkit-backdrop-filter: blur(28px) saturate(185%); backdrop-filter: blur(28px) saturate(185%);
}
.card, .dock { position: relative; background: var(--fill); border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -1px 0 rgba(255, 255, 255, .1); }
.card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, .5) 0, rgba(255, 255, 255, 0) 38%); opacity: .55; }
.card > * { position: relative; }
.card { border-radius: var(--r-lg); padding: var(--s4); display: grid; gap: var(--s4); }

/* controls: capsules, every one 44px tall */
.cap { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--hit); padding: 0 var(--s4);
  color: var(--ink); background: var(--fill); border: 1px solid var(--line); border-radius: var(--r-pill);
  font-size: var(--t-body); font-weight: var(--w-semi); line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 2px 8px rgba(48, 66, 120, .1); transition: transform .15s, background .15s; }
.cap:hover { background: var(--fill-hi); } .cap:active { transform: scale(.97); }
.cap.on { background: var(--tint-soft); border-color: var(--tint); }
.cap.sm { padding: 0 var(--s3); min-width: var(--hit); font-size: var(--t-sub); }
.cap em { font-style: normal; font-size: var(--t-cap); font-weight: var(--w-semi); background: var(--tint); color: #fff; border-radius: var(--r-pill); padding: 2px var(--s2); min-width: 24px; text-align: center; line-height: 1.3; }
.step { width: var(--hit); height: var(--hit); padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--fill); color: var(--ink); font-size: var(--t-title); line-height: 1; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55); }
.step:active { transform: scale(.94); }
.ghost { min-height: var(--hit); padding: 0 var(--s4); background: transparent; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--ink); font-size: var(--t-sub); font-weight: var(--w-semi); }
input, select { font: inherit; font-size: var(--t-body); min-height: var(--hit); padding: 0 var(--s3); width: 100%; min-width: 0; color: var(--ink); background: rgba(255, 255, 255, .34); border: 1px solid var(--line); border-radius: var(--r-sm); }
@media (prefers-color-scheme: dark) { input, select { background: rgba(255, 255, 255, .08); } select option { color: #111; } }
input.invalid { border-color: var(--red); }
.field { display: flex; flex-direction: column; gap: var(--s1); color: var(--muted); font-size: var(--t-cap); }
.field.inline { flex-direction: row; align-items: center; gap: var(--s2); margin-top: var(--s2); } .field.inline input { width: 112px; }
.chip { display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 var(--s3); background: var(--tint-soft); border-radius: var(--r-pill); font-size: var(--t-sub); font-weight: var(--w-semi); color: var(--ink); }
.rate-row { display: flex; gap: var(--s2); align-items: center; } .rate-row select { flex: 1; }

/* hours */
.hours { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s2) var(--s3); align-items: end; }
.hours label { display: flex; flex-direction: column; gap: var(--s1); text-align: center; font-size: var(--t-cap); color: var(--muted); }
.hours input { font-size: var(--t-title); line-height: 1.2; font-weight: var(--w-semi); text-align: center; padding: 0 var(--s2); background: transparent; border-color: transparent; border-bottom: 2px solid var(--line); border-radius: 0; }
.hours input:focus-visible { outline: none; border-bottom-color: var(--tint); }
.hours .quick { grid-column: 1 / -1; justify-self: center; }

/* answer */
.answer { text-align: center; }
.answer-title { font-size: var(--t-display); line-height: 1; font-weight: var(--w-bold); letter-spacing: -.03em; }
.answer.tone-warn .answer-title { color: var(--amber); } .answer.tone-bad .answer-title { color: var(--red); }
.answer-sub { margin-top: var(--s2); font-size: var(--t-sub); color: var(--muted); }
.answer-note { font-size: var(--t-cap); color: var(--muted); }
.days-left { text-align: center; font-size: var(--t-sub); color: var(--muted); } .days-left b { font-size: var(--t-body); font-weight: var(--w-semi); color: var(--ink); }

/* month progress bar: bar = share of target earned, marker = how far through the month, colour = ahead / behind */
.pbar { --c: var(--tint); }
.pbar.s-behind { --c: var(--amber); } .pbar.s-far { --c: var(--red); }
.pb-track { position: relative; height: 12px; border-radius: var(--r-pill); background: var(--track); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .16); }
.pb-fill, .pb-plan { position: absolute; top: 0; bottom: 0; left: 0; border-radius: var(--r-pill); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.pb-fill { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 8px color-mix(in srgb, var(--c) 40%, transparent); }
.pb-plan { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 38%, transparent) 0 6px, transparent 6px 12px); }
.pb-now { position: absolute; top: calc(var(--s2) * -1); bottom: calc(var(--s2) * -1); width: 4px; margin-left: -2px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); transition: left .5s cubic-bezier(.2, .8, .2, 1); }
.pb-foot { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); margin-top: var(--s3); font-size: var(--t-cap); color: var(--muted); }
.pb-foot strong { flex: 1; text-align: center; font-size: var(--t-sub); font-weight: var(--w-semi); color: color-mix(in srgb, var(--c) 78%, var(--ink)); }

/* dock and sheet */
.dock { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); padding: var(--s2); margin: var(--s4) 0; border-radius: var(--r-lg); }
.dock .cap { box-shadow: none; }
.sheet { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: calc(var(--s4) + env(safe-area-inset-bottom)); width: min(544px, calc(100% - var(--s4)));
  max-height: 60dvh; overflow: auto; padding: var(--s4); border-radius: var(--r-lg); background: var(--fill-solid); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise .28s cubic-bezier(.2, .8, .2, 1); }
.sheet:focus { outline: none; }
@keyframes rise { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.pn-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s3); }
.pn-body { display: grid; gap: var(--s3); }

/* panel content: nested shapes use the 8px radius */
.sug { display: grid; grid-template-columns: auto 1fr auto; gap: 0 var(--s3); align-items: center; min-height: 56px; padding: var(--s2) var(--s3); margin-bottom: var(--s2); background: var(--fill); border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; }
.sug input { width: 24px; height: 24px; min-height: 0; padding: 0; accent-color: var(--tint); grid-row: span 2; }
.sug.plan { border-color: var(--tint); }
.sg-main { font-size: var(--t-body); font-weight: var(--w-semi); }
.sg-date { grid-column: 2; font-size: var(--t-cap); color: var(--muted); }
.sg-add { grid-column: 3; grid-row: 1 / span 2; font-size: var(--t-sub); font-weight: var(--w-semi); }
.sug-total { font-size: var(--t-sub); font-weight: var(--w-semi); }
.balanced { padding: var(--s3); border: 1px dashed var(--tint); border-radius: var(--r-sm); font-size: var(--t-sub); }
.notes { margin: 0; padding-left: var(--s4); font-size: var(--t-sub); } .notes li { margin: var(--s2) 0; }
.warns { padding: var(--s3); border-radius: var(--r-sm); background: color-mix(in srgb, var(--amber) 22%, transparent); font-size: var(--t-sub); }
.bars { display: grid; gap: var(--s2); }
.bar-row { display: grid; grid-template-columns: 72px 1fr 88px; gap: var(--s2); align-items: center; font-size: var(--t-sub); }
.bar-row.hit .bl { font-weight: var(--w-semi); } .bar-row.nope { opacity: .45; }
.bt { position: relative; height: 12px; border-radius: var(--r-pill); background: var(--track); }
.bt i { position: absolute; inset: 0 auto 0 0; border-radius: var(--r-pill); background: rgba(120, 130, 150, .55); } .bt i.reach { background: var(--tint); }
.bt u { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--red); }
.bv { text-align: right; font-variant-numeric: tabular-nums; }
.sources { font-size: var(--t-cap); color: var(--muted); }

/* calendar */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s1); }
.cal-head span { text-align: center; font-size: var(--t-cap); color: var(--muted); padding-bottom: var(--s1); }
.day { position: relative; height: var(--hit); display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--r-sm); color: var(--ink); background: var(--tint-soft); font-size: var(--t-sub); }
.day i { font-style: normal; font-weight: var(--w-semi); }
.day:disabled { cursor: default; }
.s-passed { background: rgba(120, 130, 150, .2); color: var(--muted); } .s-weekend { background: rgba(120, 130, 150, .12); color: var(--muted); }
.s-off { background: color-mix(in srgb, var(--amber) 35%, transparent); } .s-holiday { background: color-mix(in srgb, var(--red) 28%, transparent); }
.s-rest { background: rgba(120, 130, 150, .12); outline: 2px dashed var(--amber); outline-offset: -3px; }
.day.hol::after { content: ""; position: absolute; top: var(--s1); right: var(--s1); width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
/* block markers are dots: green = evening, amber = weekend, filled = ticked */
.mk { position: absolute; bottom: var(--s1); left: 50%; margin-left: -4px; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--tint); background: transparent; }
.mk.on { background: var(--tint); } .mk.weekend { border-color: var(--amber); } .mk.weekend.on { background: var(--amber); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); font-size: var(--t-cap); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: var(--s1); }
.legend .dot, .legend .mk { position: static; flex: none; margin: 0; width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* settings drawer */
.drawer { position: fixed; inset: 0; z-index: 30; display: flex; justify-content: flex-end; background: rgba(10, 16, 30, .3); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.drawer-panel { width: min(420px, 100%); height: 100%; overflow-y: auto; padding: var(--s4); padding-top: calc(var(--s4) + env(safe-area-inset-top)); background: var(--fill-solid); border-left: 1px solid var(--line); border-radius: var(--r-lg) 0 0 var(--r-lg); }
.drawer-panel section { margin-bottom: var(--s4); display: grid; gap: var(--s3); }
.rate-edit { display: grid; grid-template-columns: 80px 1fr auto; gap: var(--s2); align-items: center; padding: var(--s3); background: var(--fill); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: var(--t-sub); }
.radio { grid-column: 1 / 3; display: flex; align-items: center; gap: var(--s2); } .radio input { width: 24px; min-height: 0; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
