/* ===========================================================================
   J1 Hub - portal design system  (clean, modern, calm; light + dark)
   ASCII-only by design. Icons are inline SVG (currentColor); no emoji.
   =========================================================================== */

:root {
  color-scheme: light dark;

  /* Warm-neutral foundation + refined brand blue + functional accents (LIGHT) */
  --bg:           #f7f5f1;   /* warm off-white canvas */
  --surface:      #ffffff;
  --surface-2:    #f0ede7;   /* sunken: inputs, wells */
  --border:       #e4dfd5;
  --border-strong:#cbc4b6;
  --ink:          #1c2530;   /* primary text */
  --ink-soft:     #56606e;   /* secondary */
  --ink-faint:    #6e7771;   /* hints (AA on white) */
  --brand:        #1a5598;
  --brand-hover:  #15487f;
  --brand-ink:    #ffffff;
  --brand-tint:   #e7eff7;
  --good:         #2e7d5b;   /* reward / positive */
  --good-tint:    #e4f1ea;
  --warn:         #c0492e;
  --warn-tint:    #fbeae5;
  --gold:         #e8a13a;   /* rare celebration only */

  --sh-1: 0 1px 2px rgba(20,28,40,.05), 0 1px 3px rgba(20,28,40,.08);
  --sh-2: 0 6px 16px rgba(20,28,40,.08), 0 12px 32px rgba(20,28,40,.10);

  /* Spacing (4px base) */
  --s1:.25rem; --s2:.5rem; --s3:.75rem; --s4:1rem; --s5:1.5rem; --s6:2rem; --s7:3rem;
  /* Radius */
  --r-sm:8px; --r-md:12px; --r-lg:16px; --r-xl:20px; --r-pill:999px;
  /* Type scale */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --fs-cap:  .75rem;
  --fs-sm:   .875rem;
  --fs-body: 1rem;
  --fs-h3:   1.0625rem;
  --fs-h2:   1.25rem;
  --fs-h1:   clamp(1.4rem, 1.2rem + .9vw, 1.75rem);
  --fs-disp: clamp(1.7rem, 1.4rem + 1.4vw, 2.25rem);

  --ease: cubic-bezier(.2,.6,.2,1);
  --dur: 160ms;
  --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #13181f;
    --surface:      #1b222c;
    --surface-2:    #222b37;
    --border:       #2c3744;
    --border-strong:#3c4859;
    --ink:          #edeff2;
    --ink-soft:     #a6b0bd;
    --ink-faint:    #7b8694;
    --brand:        #5b9bd8;
    --brand-hover:  #7ab0e2;
    --brand-ink:    #06121f;
    --brand-tint:   #1e2e40;
    --good:         #52b889;
    --good-tint:    #16261f;
    --warn:         #e8765c;
    --warn-tint:    #2a1813;
    --sh-1: 0 1px 2px rgba(0,0,0,.4);
    --sh-2: 0 10px 30px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs-body); line-height: 1.55;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
  min-height: 100dvh; display: flex; flex-direction: column;
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; font-weight: 700; }
svg.ic { width: 24px; height: 24px; flex: none; stroke: currentColor; fill: none; vertical-align: middle; }

:where(a,button,.tile):focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-sm); }

/* ---- App bar ---- */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) clamp(var(--s3), 4vw, var(--s6));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand .mk { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: .85rem; letter-spacing: -.02em; }
.brand .tx { font-size: var(--fs-sm); line-height: 1.1; }
.brand .tx small { display: block; color: var(--ink-faint); font-weight: 500; font-size: .72em; letter-spacing: .04em; text-transform: uppercase; }
.bar .sp { flex: 1; }
.who { display: flex; align-items: center; gap: .5rem; padding: .3rem .35rem .3rem .7rem;
  border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); }
.who b { font-weight: 650; font-size: var(--fs-sm); }
.who .rl { font-size: var(--fs-cap); color: var(--ink-faint); }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: .78rem; }
.iconbtn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft); }
.iconbtn:hover { color: var(--ink); border-color: var(--border-strong); text-decoration: none; }

/* ---- Layout ---- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; flex: 1;
  padding: clamp(var(--s4), 4vw, var(--s7)) clamp(var(--s3), 4vw, var(--s6)); }
.wrap > * + * { margin-top: var(--s6); }
.eyebrow { font-size: var(--fs-cap); font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 var(--s3); }

/* ---- Today header + waterline ---- */
.today h1 { font-size: var(--fs-disp); margin-bottom: .15em; }
.today p { margin: 0; color: var(--ink-soft); font-size: var(--fs-h2); }
.wave { display: block; width: 100%; height: 14px; margin-top: var(--s4); color: var(--brand); opacity: .22; }

/* ---- Focus card (primary action) ---- */
.focus { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
.fcard { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--sh-1); padding: clamp(var(--s4), 3vw, var(--s5)); }
.fcard .badge { width: 52px; height: 52px; border-radius: var(--r-md); display: grid; place-items: center;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.fcard .badge svg.ic { width: 28px; height: 28px; }
.fcard .grow { flex: 1; min-width: 200px; }
.fcard h2 { font-size: var(--fs-h2); margin-bottom: .15em; }
.fcard .muted { color: var(--ink-soft); font-size: var(--fs-sm); }

/* ---- Module groups + tiles ---- */
.group + .group { margin-top: var(--s5); }
.tiles { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.tile { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  color: inherit; text-decoration: none; min-height: 84px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
@media (hover: hover) { .tile:hover { transform: translateY(-2px); box-shadow: var(--sh-2);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); text-decoration: none; } }
.tile.soon { opacity: .6; }
.tile.soon:hover { transform: none; box-shadow: var(--sh-1); border-color: var(--border); }
.tile .tic { width: 42px; height: 42px; border-radius: var(--r-md); display: grid; place-items: center; flex: none;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 11%, transparent); }
.tile .body { flex: 1; min-width: 0; }
.tile .nm { font-size: var(--fs-h3); font-weight: 650; line-height: 1.25; }
.tile .hint { font-size: var(--fs-sm); color: var(--ink-soft); margin-top: .1rem; }
.tile .chev { color: var(--ink-faint); margin-top: .3rem; }
.pill { display: inline-block; font-size: var(--fs-cap); font-weight: 600; padding: .12rem .5rem; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-faint); border: 1px solid var(--border); }
.pill.live { background: var(--good-tint); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, var(--border)); }

/* ---- GRITS footer strip ---- */
.foot { margin-top: var(--s7); padding: var(--s6) var(--s4) var(--s5); text-align: center; border-top: 1px solid var(--border); }
.values { display: inline-flex; flex-wrap: wrap; gap: .35rem 1.1rem; justify-content: center; margin-bottom: var(--s3); }
.values span { font-size: var(--fs-cap); letter-spacing: .04em; color: var(--ink-faint); }
.values b { color: var(--ink-soft); font-weight: 650; }
.paddle { color: var(--ink-soft); font-style: italic; }
.foot .sub { color: var(--ink-faint); font-size: var(--fs-sm); margin-top: .35rem; }

@media (max-width: 560px) {
  .brand .tx small { display: none; }
  .who b { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---- Page head + sub-nav ---- */
.pagehead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.pagehead h1 { font-size: var(--fs-h1); }
.pagehead .lead { color: var(--ink-soft); font-size: var(--fs-sm); }
.subnav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: var(--s5); }
.subnav a { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-soft); padding: .45rem .8rem; border-radius: var(--r-pill); border: 1px solid transparent; }
.subnav a:hover { color: var(--ink); text-decoration: none; background: var(--surface); border-color: var(--border); }
.subnav a.on { color: var(--brand); background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 25%, var(--border)); }

/* ---- Balance / stat cards ---- */
.cards { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(100%,200px), 1fr)); }
.bcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--s5); }
.bcard .lbl { font-size: var(--fs-cap); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 600; }
.bcard .big { font-size: clamp(1.8rem, 1.4rem + 1.3vw, 2.3rem); font-weight: 700; letter-spacing: -.02em; margin-top: .1rem; font-variant-numeric: tabular-nums; }
.bcard .big small { font-size: .48em; font-weight: 600; color: var(--ink-faint); margin-left: .25rem; }
.bcard .sub { font-size: var(--fs-sm); color: var(--ink-soft); margin-top: .25rem; }

/* ---- Panels, tables, definition lists ---- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: clamp(var(--s4), 3vw, var(--s5)); }
.panel + .panel { margin-top: var(--s4); }
.panel h2 { font-size: var(--fs-h2); margin-bottom: var(--s3); }
.ftable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.ftable th { text-align: left; font-size: var(--fs-cap); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 600; padding: .5rem .55rem; border-bottom: 1px solid var(--border); }
.ftable td { padding: .7rem .55rem; border-bottom: 1px solid var(--border); }
.ftable tr:last-child td { border-bottom: none; }
.ftable .num { text-align: right; font-variant-numeric: tabular-nums; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.3rem; font-size: var(--fs-sm); }
.dl dt { color: var(--ink-faint); } .dl dd { margin: 0; color: var(--ink); }

/* ---- Tags ---- */
.tag { display: inline-block; font-size: var(--fs-cap); font-weight: 600; padding: .12rem .5rem; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-soft); }
.tag.ok   { background: var(--good-tint); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, var(--border)); }
.tag.warn { background: var(--warn-tint); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
.tag.wait { background: color-mix(in srgb, var(--gold) 16%, var(--surface)); color: color-mix(in srgb, var(--gold) 78%, var(--ink)); border-color: color-mix(in srgb, var(--gold) 35%, var(--border)); }

/* ---- Forms ---- */
.field { display: block; margin-bottom: var(--s4); }
.field > span { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-soft); margin-bottom: .3rem; }
.inp { width: 100%; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .6rem .7rem; }
.inp:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
textarea.inp { min-height: 80px; resize: vertical; }
.grid2 { display: grid; gap: var(--s4); grid-template-columns: 1fr; } @media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.btn { display: inline-flex; align-items: center; gap: .5rem; font: inherit; font-weight: 650; cursor: pointer; padding: .6rem 1.1rem; border-radius: var(--r-sm); border: 1px solid transparent; text-decoration: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); } .btn-primary:hover { background: var(--brand-hover); text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border); } .btn-ghost:hover { border-color: var(--border-strong); text-decoration: none; }
.btn-row { display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s3); }

/* ---- Misc ---- */
.note { background: var(--brand-tint); border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--border)); border-radius: var(--r-md); padding: var(--s3) var(--s4); font-size: var(--fs-sm); color: var(--ink-soft); }
.note.good { background: var(--good-tint); border-color: color-mix(in srgb, var(--good) 25%, var(--border)); }
.empty { text-align: center; color: var(--ink-soft); padding: var(--s6) var(--s4); }
.empty svg.ic { width: 34px; height: 34px; color: var(--ink-faint); margin-bottom: var(--s2); }
.stacklg > * + * { margin-top: var(--s5); }
.right { text-align: right; }

/* ---- Progress bar ---- */
.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--good)); border-radius: 999px; }

/* ---- Engagement radar ---- */
.radar-wrap { display: flex; gap: var(--s5); flex-wrap: wrap; align-items: center; }
.radar { width: min(280px, 74vw); height: auto; }
.radar .grid, .radar .axis { stroke: var(--border); fill: none; }
.radar .shape { fill: color-mix(in srgb, var(--brand) 20%, transparent); stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.radar .dot { fill: var(--brand); }
.radar .lab { fill: var(--ink-soft); font: 600 9px var(--font); }
.axes { flex: 1; min-width: 230px; }
.axis-row { margin-bottom: var(--s3); }
.axis-row .top { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-sm); margin-bottom: .25rem; }
.axis-row .top b { font-weight: 600; }
.abar { height: 7px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.abar > i { display: block; height: 100%; border-radius: 999px; }
.trend { font-size: var(--fs-cap); font-weight: 600; }
.trend.up { color: var(--good); } .trend.down { color: var(--warn); } .trend.flat { color: var(--ink-faint); }
.person { display: flex; align-items: center; gap: var(--s4); padding: var(--s4); border-top: 1px solid var(--border); text-decoration: none; color: inherit; }
.person:first-of-type { border-top: none; }
.person:hover { background: var(--surface-2); text-decoration: none; }
.person .who2 { min-width: 0; flex: 0 0 auto; }
.person .nm { font-weight: 650; } .person .ro { font-size: var(--fs-sm); color: var(--ink-faint); }
.person .spark { flex: 1; display: flex; gap: 3px; align-items: flex-end; height: 32px; }
.person .spark i { flex: 1; background: color-mix(in srgb, var(--brand) 50%, var(--surface-2)); border-radius: 2px 2px 0 0; min-height: 3px; }
.attn { font-size: var(--fs-cap); font-weight: 600; color: var(--warn); white-space: nowrap; }
.attn.ok { color: var(--good); }

/* ---- Check-in options ---- */
.qblock { margin-bottom: var(--s5); }
.qblock > .q { font-weight: 600; margin-bottom: var(--s2); }
.opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt span { display: inline-block; padding: .5rem .85rem; border: 1px solid var(--border); border-radius: var(--r-pill); font-size: var(--fs-sm); cursor: pointer; background: var(--surface); color: var(--ink-soft); }
.opt input:checked + span { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.opt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
