/* Tinker: same look as the other Gins apps (Plus Jakarta Sans, brand #0B6B4E). Amber #D97706 only on the icon tile and avatar. */
:root {
  --bg: #F4F7F5; --card: #FFFFFF; --line: #E1E8E4; --line2: #EEF2F0; --fg: #0E1C17; --muted: #52625C;
  --brand: #0B6B4E; --brand-fg: #FFFFFF; --hero: #0B3D2E; --hero-2: #072B20; --hero-sub: #CFE6DC; --soft: #E3ECE7;
  --ok-fg: #166534; --ok-bg: #DCFCE7; --warn-fg: #92400E; --warn-bg: #FEF3C7; --bad-fg: #991B1B; --bad-bg: #FEE2E2; --none-fg: #475569; --none-bg: #EEF2F6;
  --input: #C9D4CF; --accent: #D97706; --shadow: 0 1px 2px rgba(7, 43, 32, .06), 0 6px 18px rgba(7, 43, 32, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1310; --card: #121E19; --line: #23332C; --line2: #1A2822; --fg: #E6EFEA; --muted: #9DB2A9;
    --brand: #3CC58F; --brand-fg: #062117; --hero: #0F3B2D; --hero-2: #0A2A20; --hero-sub: #BFDCCF; --soft: #1C2B25;
    --ok-fg: #6EE7A0; --ok-bg: #11291C; --warn-fg: #FCD34D; --warn-bg: #2C220B; --bad-fg: #FCA5A5; --bad-bg: #2E1515; --none-fg: #B4C0CC; --none-bg: #1E2630;
    --input: #33463E; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1310; --card: #121E19; --line: #23332C; --line2: #1A2822; --fg: #E6EFEA; --muted: #9DB2A9;
  --brand: #3CC58F; --brand-fg: #062117; --hero: #0F3B2D; --hero-2: #0A2A20; --hero-sub: #BFDCCF; --soft: #1C2B25;
  --ok-fg: #6EE7A0; --ok-bg: #11291C; --warn-fg: #FCD34D; --warn-bg: #2C220B; --bad-fg: #FCA5A5; --bad-bg: #2E1515; --none-fg: #B4C0CC; --none-bg: #1E2630;
  --input: #33463E; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
h1, h2, h3, p { margin: 0; }
svg { flex: none; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-weight: 600; letter-spacing: .04em; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- shell: bottom tabs on a phone, icon rail on iPad, sidebar on desktop ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.main { width: 100%; max-width: 760px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; align-items: flex-end;
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; min-height: 48px; padding: 4px 0; color: var(--muted);
  font-size: 11px; font-weight: 600; text-decoration: none; border-radius: 12px; }
.nav a svg { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.nav .addic { width: 54px; height: 54px; margin-top: -24px; border-radius: 18px; background: var(--brand); color: var(--brand-fg); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(11, 107, 78, .35); }
.nav .addic svg { width: 26px; height: 26px; }
.nav .addbtn { color: var(--fg); }
.nav .brand, .nav .wideonly { display: none; }
@media (min-width: 700px) {
  .main { padding: 24px 28px 40px calc(104px + 28px); max-width: 980px; }
  .nav { top: 0; right: auto; width: 96px; flex-direction: column; justify-content: flex-start; align-items: center; gap: 8px; border-top: 0; border-right: 1px solid var(--line); padding: 18px 0; overflow-y: auto; }
  .nav .phoneonly { display: none; }
  .nav .wideonly { display: flex; }
  .nav .brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 6px; }
  .nav .brand span:last-child { display: none; }
  .nav .addic { margin-top: 0; width: 48px; height: 48px; border-radius: 16px; }
  .nav a { min-width: 80px; }
}
@media (min-width: 1024px) {
  .main { padding-left: calc(248px + 32px); max-width: none; padding-right: 32px; }
  .main > * { max-width: 1180px; }
  .nav { width: 248px; align-items: stretch; padding: 20px 14px; gap: 4px; }
  .nav a { flex-direction: row; gap: 12px; min-height: 44px; padding: 0 12px; font-size: 14px; font-weight: 500; color: var(--fg); }
  .nav a[aria-current="page"] { background: var(--soft); color: var(--brand); font-weight: 700; }
  .nav .brand { flex-direction: row; gap: 12px; padding: 0 8px 12px; }
  .nav .brand span:last-child { display: flex; flex-direction: column; }
  .nav .brand small { color: var(--muted); font-size: 12px; }
  .nav .addbtn { order: -1; justify-content: center; background: var(--brand); color: var(--brand-fg) !important; font-weight: 700 !important; margin: 0 0 8px; }
  .nav .addbtn .addic { width: auto; height: auto; background: none; box-shadow: none; color: inherit; }
  .nav .addbtn .addic svg { width: 20px; height: 20px; }
  .nav .brand { order: -2; }
}
.tile { width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.tile svg { width: 24px; height: 24px; }

/* ---------- headers, banners ---------- */
.top { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.top h1 { flex: 1; font-size: 26px; font-weight: 800; letter-spacing: -.02em; display: flex; flex-direction: column; }
.top h1 .sub { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.iconbtn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--fg); display: grid; place-items: center; flex: none; text-decoration: none; }
.iconbtn.bare { border: 0; background: none; }
.iconbtn svg { width: 22px; height: 22px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--none-bg); color: var(--none-fg); font-size: 13px; }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); } .banner.bad { background: var(--bad-bg); color: var(--bad-fg); }
.banner svg { width: 18px; height: 18px; } .banner span { flex: 1; }
.linkbtn { background: none; border: 0; padding: 0; min-height: 32px; color: var(--brand); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }

/* ---------- cards, rows ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.card.list { padding: 2px 16px; }
.card.empty, .empty { color: var(--muted); text-align: center; padding: 22px 16px; }
.section { display: flex; flex-direction: column; gap: 8px; }
.section .head h2 { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.irow { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line2); text-decoration: none; color: inherit; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.card.list > .irow:first-child, .card.list > :first-child .irow { border-top: 0; }
.irow.sel { background: var(--soft); margin: 0 -16px; padding: 11px 16px; width: calc(100% + 32px); }
.irow .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.irow .t1 { font-size: 14px; font-weight: 600; } .irow .t2 { font-size: 12px; color: var(--muted); }
.irow .end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.irow .chev { width: 16px; height: 16px; color: var(--muted); }
.logo { width: 36px; height: 36px; border-radius: 12px; background: var(--line2); color: var(--muted); display: grid; place-items: center; flex: none; }
.logo svg { width: 19px; height: 19px; }
.logo.bad { background: var(--bad-bg); color: var(--bad-fg); } .logo.warn { background: var(--warn-bg); color: var(--warn-fg); } .logo.brand { background: var(--soft); color: var(--brand); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; flex: none; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); } .pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.bad { background: var(--bad-bg); color: var(--bad-fg); } .pill.none { background: var(--none-bg); color: var(--none-fg); }
.pill { padding: 3px 9px; font-size: 11.5px; }
.pill.grey { background: var(--line2); color: var(--muted); } .pill.brand { background: var(--soft); color: var(--brand); }
.pill.lime { background: #ECF6DD; color: #3F6A07; }
:root[data-theme="dark"] .pill.lime { background: #22300F; color: #B5E07A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.lime { background: #22300F; color: #B5E07A; } }

.search input { flex: 1; border: 0; background: none; outline: none; font-size: 16px; min-width: 0; min-height: 44px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; } .chips.wrap { flex-wrap: wrap; }
.chipbtn { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.chipbtn.on { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.chipradio input { position: absolute; opacity: 0; pointer-events: none; }
.chipradio span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px; cursor: pointer; }
.chipradio input:checked + span { border: 1.5px solid var(--brand); background: var(--soft); color: var(--brand); }
.chipradio input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; min-width: 0; }
.form input, .form select, .form textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--input); background: var(--card); font-size: 16px; }
.form fieldset { border: 0; padding: 0; margin: 0; } .form legend { font-size: 13px; font-weight: 600; padding: 0; }
.form.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .form .span2 { grid-column: 1 / -1; }
.newex { margin-top: 10px; } .newex summary { font-weight: 700; color: var(--brand); min-height: 40px; display: flex; align-items: center; cursor: pointer; }

/* sets */
.bar i { display: block; width: 100%; max-width: 40px; background: var(--brand); opacity: .8; border-radius: 6px 6px 2px 2px; }
.bar.on i { background: var(--accent); opacity: 1; } .bar span { font-size: 10px; color: var(--muted); }
.chart { display: block; width: 100%; height: auto; max-height: 220px; overflow: visible; }
.chart .ct { font-size: 10px; fill: var(--muted); font-family: inherit; }
.chart-empty { padding: 10px 0; }
h3.ch { font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 4px; }
.warnc { border-color: var(--warn-bg); background: var(--warn-bg); }
.spin { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* two panes on wide screens */
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 700px) { .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .col.side { position: sticky; top: 20px; } }
@media (min-width: 1100px) { .cols { grid-template-columns: minmax(0, 620px) minmax(0, 1fr); } }

/* ---------- Tinker ---------- */
.nav a { position: relative; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 800; }
.top .pill { font-size: 12.5px; padding: 5px 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px; color: var(--fg); }
.chip.on, .chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.chip small { opacity: .75; font-weight: 500; margin-left: 4px; }

/* feed: one card per screen, swipe up */
.feedview .main.feedmain { height: 100vh; height: 100dvh; padding-bottom: calc(80px + env(safe-area-inset-bottom)); gap: 10px; overflow: hidden; }
.feed { flex: 1; min-height: 0; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; overscroll-behavior: contain; }
.feed::-webkit-scrollbar { display: none; }
.slot { height: 100%; scroll-snap-align: start; padding: 4px 0 10px; display: flex; justify-content: center; }
.tcard { flex: 1; max-width: 560px; border-radius: 22px; overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; }
.tcard .art { --cat: #1D4E89; background: var(--cat); background-image: linear-gradient(160deg, rgba(255,255,255,.08), rgba(0,0,0,.18)); color: #fff; padding: 14px 18px 12px; flex: none; }
.tcard .row { display: flex; gap: 8px; align-items: center; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.tcard .tag { background: rgba(0,0,0,.28); padding: 4px 10px; border-radius: 99px; }
.tcard .new { background: #fff; color: #111; padding: 3px 8px; border-radius: 99px; font-size: 10.5px; font-weight: 800; }
.tcard .hook { font-size: clamp(21px, 5.8vw, 30px); line-height: 1.1; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 8px; text-wrap: balance; }
.tcard .hook em { font-style: normal; color: #FDE68A; }
.tcard .diagram { background: rgba(255,255,255,.1); border-radius: 14px; height: clamp(84px, 17vh, 170px); display: grid; place-items: center; padding: 6px; }
.tcard .diagram svg { width: 100%; height: 100%; display: block; }
.tcard .diagram.none { font-size: 56px; }
.tcard .body { padding: 14px 16px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.tcard .q { font-weight: 700; font-size: 15.5px; margin-bottom: 10px; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; font-weight: 600; min-height: 50px; background: var(--card); color: var(--fg); }
.opt b { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--line2); display: grid; place-items: center; font-size: 13px; }
.opt:not([disabled]):hover { border-color: var(--brand); }
.opt.right { border-color: var(--ok-fg); background: var(--ok-bg); } .opt.right b { background: var(--ok-fg); color: var(--card); }
.opt.wrong { border-color: var(--bad-fg); background: var(--bad-bg); } .opt.wrong b { background: var(--bad-fg); color: var(--card); }
.opt.dim { opacity: .5; } .opt[disabled] { cursor: default; }
.reveal { font-size: 14.5px; display: flex; flex-direction: column; gap: 8px; }
.verdict { font-weight: 800; font-size: 16px; } .verdict.ok { color: var(--ok-fg); } .verdict.bad { color: var(--bad-fg); }
.take { padding: 10px 12px; background: var(--soft); border-radius: 12px; font-size: 14px; }
.take small { display: block; font-size: 10.5px; font-weight: 800; color: var(--brand); letter-spacing: .06em; }
details.more { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
details.more summary { font-weight: 700; cursor: pointer; min-height: 24px; }
details.more p { margin-top: 6px; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 99px; padding: 0 14px; min-height: 44px; font-weight: 700; font-size: 13.5px; }
.btn svg { width: 18px; height: 18px; }
.btn.on { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
.hint { color: var(--muted); font-size: 12.5px; }
.src { color: var(--muted); font-size: 11.5px; }
.endcard { align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 24px; }
.endcard .big { font-size: 44px; } .endcard h2 { font-size: 20px; }
.side { display: none; }
.sheetcard .tcard { box-shadow: none; max-width: none; }
.sheetcard .tcard .body { overflow: visible; }

/* review, saved, stats */
.irow .emo, .emo { font-size: 22px; flex: none; }
.irow .end.due { color: var(--accent); font-weight: 700; font-size: 12.5px; }
.irow .end { font-size: 12px; color: var(--muted); white-space: nowrap; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--input); border-radius: 14px; padding: 0 12px; min-height: 46px; }
.search svg { width: 18px; height: 18px; color: var(--muted); }
.search input { flex: 1; border: 0; background: none; font-size: 16px; min-height: 44px; outline: none; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tiles .kpi { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.tiles .kpi b { font-size: 26px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) 3em; align-items: center; gap: 10px; font-size: 13.5px; }
.bar small { grid-column: 2 / 4; margin-top: -8px; color: var(--muted); font-size: 11px; }
.bar .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar b { text-align: right; }
.track { height: 10px; background: var(--line2); border-radius: 99px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.weeks { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; align-items: end; height: 150px; margin-bottom: 8px; }
.wk { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.wk i { display: block; width: 100%; max-width: 34px; min-height: 3px; background: var(--brand); border-radius: 6px 6px 0 0; opacity: .85; }
.wk b { font-size: 11px; } .wk small { font-size: 10px; color: var(--muted); white-space: nowrap; }

/* first open */
.pickview .main { padding-bottom: 40px; }
.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick { border: 2px solid var(--line); border-radius: 16px; padding: 14px; text-align: left; background: var(--card); color: var(--fg); min-height: 92px; display: flex; flex-direction: column; gap: 4px; }
.pick .emo { font-size: 26px; } .pick.on { border-color: var(--brand); background: var(--soft); }
.g-btn[disabled] { opacity: .5; }

/* sheets */
.form.inline { flex-direction: row; gap: 8px; align-items: stretch; margin-top: 10px; }
.form.inline input, .form.inline select { min-width: 0; }
.form.inline .emo-in { width: 64px; flex: none; text-align: center; }
.subh { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin: 14px 0 6px; }
.topics { display: flex; gap: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* iPad: centred card */
@media (min-width: 700px) {
  .feedview .main.feedmain { padding-bottom: 24px; }
  .chips { margin: 0; padding: 0; }
  .feed { margin: 0; padding: 0; }
}
/* desktop: sidebar + card + answer pane */
@media (min-width: 1024px) {
  .feedview .main.feedmain { padding-right: calc(400px + 32px); }
  .feedview .side { display: block; position: fixed; top: 0; right: 0; bottom: 0; width: 400px; overflow-y: auto; background: var(--card); border-left: 1px solid var(--line); padding: 24px 22px; }
  .feedview .tcard .reveal-inline { display: none; }
  .side .sidehead { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .05em; }
  .side h3 { font-size: 18px; margin: 6px 0 12px; }
}
@media (prefers-reduced-motion: reduce) { .feed { scroll-behavior: auto; } }
.tiles .kpi b { display: block; font-size: 24px; font-weight: 800; line-height: 1.2; }
.tiles .kpi span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
