/* Kithwise app. Tokens first; every colour below comes from here. */
:root {
  --ink: #16181D;
  --ink-2: #565C53;        /* secondary text, 6.4:1 on paper */
  --ink-3: #7A8076;        /* inactive tab labels only */
  --sage-deep: #3F5B3A;    /* switches on, links, progress */
  --sage: #93A88C;         /* accent marks, never text */
  --sage-pale: #DCE2D6;    /* soft fills, secondary buttons */
  --paper: #F4F5F1;        /* page ground */
  --card: #FFFFFF;
  --line: #E1E4DC;
  --line-soft: #ECEEE8;
  --amber-bg: #F6E3C4; --amber-fg: #7A4A06; --amber-line: #E8CF9F; --amber-card: #FFFBF3;
  --stone-bg: #E6E7E3; --stone-fg: #4A4E47;
  --ok-fg: #2F4A2B;
  --blue-bg: #E4E9F2; --blue-fg: #2B3E5E;
  --off: #C9CCC5;
  --radius: 16px;
  --font: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--sage-deep); }
:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 2px; border-radius: 8px; }

.app { min-height: 100%; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }
.top {
  position: sticky; top: 0; z-index: 5; height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--paper); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.wordmark { font-family: var(--mono); font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.avatar {
  width: 44px; height: 44px; border: 0; background: none; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.avatar span {
  width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--paper);
  font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}

main { flex: 1; padding: 20px 16px calc(100px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding: 6px 6px calc(10px + env(safe-area-inset-bottom));
}
.tabs-inner { display: flex; width: 100%; max-width: 720px; }
.tab {
  flex: 1; min-height: 56px; border: 0; background: none; cursor: pointer; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-3); font-size: 11px; font-weight: 500; text-decoration: none;
}
.tab[aria-current="page"] { color: var(--ink); font-weight: 600; }

h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
.sub { font-size: 14px; color: var(--ink-2); line-height: 1.45; margin: 6px 0 0; }
.lbl { font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.mono { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: 13px; line-height: 1.45; }
.tiny { font-size: 12px; line-height: 1.45; }
.row { display: flex; align-items: center; gap: 12px; }
.row.top-align { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 8px; }
.wrap { flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.flush { padding: 0; }
.card.attention { border-color: var(--amber-line); background: var(--amber-card); }
.card.soft { background: var(--sage-pale); border-color: var(--sage-pale); }
.sec { border-top: 1px solid var(--line-soft); padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.btn, .btn2 {
  min-height: 44px; border-radius: 12px; border: 0; font-weight: 600; font-size: 15px; padding: 0 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; gap: 8px;
}
.btn { background: var(--ink); color: var(--paper); }
.btn2 { background: var(--sage-pale); color: var(--ink); }
.btn:disabled, .btn2:disabled { opacity: 0.5; cursor: default; }
.btn.block, .btn2.block { width: 100%; }
.link { background: none; border: 0; padding: 0; min-height: 44px; font-size: 13px; font-weight: 600; color: var(--sage-deep); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.plain { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: left; width: 100%; }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.working { background: var(--sage-pale); color: var(--ok-fg); }
.chip.needs { background: var(--amber-bg); color: var(--amber-fg); }
.chip.off { background: var(--stone-bg); color: var(--stone-fg); }
.chip.info { background: var(--blue-bg); color: var(--blue-fg); }
.chip.dark { background: var(--ink); color: var(--paper); }

.switch { width: 52px; height: 32px; border-radius: 999px; border: 0; position: relative; cursor: pointer; flex-shrink: 0; padding: 0; background: var(--off); transition: background .15s; }
.switch[aria-checked="true"] { background: var(--sage-deep); }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch[aria-checked="true"]::after { left: 24px; }
.switch:disabled { opacity: .5; cursor: default; }

.stepper { display: flex; align-items: center; gap: 6px; }
.step { width: 44px; height: 44px; border-radius: 12px; border: 1px solid #D5D9CF; background: var(--card); font-size: 20px; cursor: pointer; }
.step:disabled { opacity: .4; cursor: default; }
.step-val { min-width: 76px; text-align: center; font-size: 15px; font-weight: 600; }

.li { font-size: 14px; line-height: 1.45; margin: 0; padding-left: 16px; position: relative; }
.li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 2px; background: var(--sage); }

.pills { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex-shrink: 0; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid #D5D9CF; background: var(--card); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.seg { display: flex; background: var(--sage-pale); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: none; font-weight: 600; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.promptq { font-size: 16px; font-weight: 600; line-height: 1.35; }
.fill { background: var(--amber-bg); color: var(--amber-fg); border-radius: 5px; padding: 0 4px; }
.example { background: var(--paper); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.5; white-space: pre-line; }

.search { width: 100%; height: 48px; border-radius: 12px; border: 1px solid #D5D9CF; background: var(--card); padding: 0 14px; font-size: 16px; }
.field { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid #D5D9CF; background: var(--card); padding: 0 12px; font-size: 15px; }

.progress { height: 6px; border-radius: 3px; background: var(--line-soft); }
.progress > div { height: 6px; border-radius: 3px; background: var(--sage-deep); }
.check { width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 1px solid #B9BEB3; background: var(--card); }
.check.done { background: var(--sage-deep); border-color: var(--sage-deep); }
.dot { width: 8px; height: 8px; border-radius: 2px; background: var(--sage); flex-shrink: 0; margin-top: 7px; }
.tile-num { font-size: 24px; font-weight: 600; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 10;
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px);
}
.banner { background: var(--blue-bg); color: var(--blue-fg); font-size: 13px; padding: 10px 16px; text-align: center; }
.center { text-align: center; }
.signin { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; gap: 20px; max-width: 420px; margin: 0 auto; }
.error { color: #8A2A12; font-size: 13px; line-height: 1.45; }
.skeleton { background: linear-gradient(90deg, var(--line-soft), #F7F8F5, var(--line-soft)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); height: 96px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .switch, .switch::after { transition: none; } }
@media (min-width: 720px) { main { padding-left: 24px; padding-right: 24px; } }
a.plain { text-decoration: none; display: block; color: inherit; }
a.btn, a.btn2 { text-decoration: none; }
.card[id] { scroll-margin-top: 84px; }
