:root {
  --bg: #f5eee2; --surface: #fffcf7; --sunk: #efe6d8; --ink: #16131c; --muted: #5f5560;
  --line: #16131c1a; --line-strong: #16131c33;
  --brand: #16131c; --on-brand: #f5eee2; --on-brand-muted: #b9b0a6;
  --accent: #c8471f; --on-accent: #fff; --amber: #f4a62a;
  --good: #0f6b4f; --warn: #8a5300; --bad: #bb0c1d; --good-bg: #dcebe2; --warn-bg: #f7e7c6; --bad-bg: #f7dad6;
  --shadow: 0 1px 0 #16131c08, 0 12px 28px -16px #16131c33;
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  --sans: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121015; --surface: #1c1920; --sunk: #25212a; --ink: #f2ebe0; --muted: #b0a6a0;
    --line: #f2ebe01a; --line-strong: #f2ebe033;
    --brand: #0b0a0d; --on-brand: #f2ebe0;
    --accent: #ec7a52; --on-accent: #1b0d07;
    --good: #6fd0a7; --warn: #f2bb5c; --bad: #ff8a80; --good-bg: #173027; --warn-bg: #352812; --bad-bg: #3a1a1c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.5 var(--sans); -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* top bar */
.bar { background: var(--brand); color: var(--on-brand); padding: calc(env(safe-area-inset-top) + 14px) 16px 14px; }
.bar-in { max-width: 960px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.wordmark { font-weight: 800; letter-spacing: 0.32em; font-size: 18px; }
.wordmark small { display: block; font-size: 10px; letter-spacing: 0.24em; font-weight: 600; color: var(--on-brand-muted); }
.bar .sp { flex: 1; }
.bar button, .bar a.link { background: none; border: 1px solid #f5eee233; color: var(--on-brand); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.bar button:hover, .bar a.link:hover { border-color: #f5eee280; }

main { max-width: 960px; margin: 0 auto; padding: 20px 16px calc(env(safe-area-inset-bottom) + 40px); }
h1 { font-size: 24px; font-weight: 700; margin: 4px 0 2px; letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 28px 0 10px; }

/* tool tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; margin-top: 18px; }
.tile { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); min-width: 0; transition: transform .12s ease, border-color .12s ease; }
.tile:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.tile-head { display: flex; align-items: center; gap: 12px; }
.tile-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--sunk); color: var(--accent); flex: none; }
.tile-icon svg { width: 24px; height: 24px; }
.tile-head b { display: block; font-size: 17px; font-weight: 700; }
.tile-head small { display: block; color: var(--muted); font-size: 13px; }
.tile .go { margin-left: auto; color: var(--muted); font-size: 22px; line-height: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; min-height: 58px; }
.stat { min-width: 0; }
.stat span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat b { display: block; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.bad b { color: var(--bad); } .stat.warn b { color: var(--warn); } .stat.good b { color: var(--good); }
.stats .note { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.skel { height: 14px; border-radius: 6px; background: var(--sunk); width: 70%; margin-top: 6px; }

/* forms and cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select { width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); font-size: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.errorbox { background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.okbox { background: var(--good-bg); color: var(--good); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--brand); }
.login .card { width: 100%; max-width: 380px; }
.login .wordmark { color: var(--on-brand); text-align: center; font-size: 30px; margin-bottom: 22px; }
.login .wordmark small { font-size: 11px; margin-top: 6px; }

/* team */
.people { display: flex; flex-direction: column; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; min-width: 0; }
.person:hover { border-color: var(--line-strong); }
.person.off { opacity: .55; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; }
.person .who small { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--sunk); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .sp { flex: 1; }

.ticks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.tick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; }
.tick input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.tick small { display: block; color: var(--muted); font-size: 12px; }
.tick.no { opacity: .5; cursor: not-allowed; }

.sheet-bg { position: fixed; inset: 0; background: #16131c80; display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { background: var(--bg); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px); }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; padding: 24px; } }
.sheet h3 { margin: 0 0 16px; font-size: 19px; }
.switch { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; z-index: 20; }
