:root {
  --bg: #fbf9f6; --surface: #ffffff; --surface-2: #f4f1ec; --line: #e3ded6;
  --ink: #1e2430; --ink-2: #5a6472; --ink-3: #8b94a1;
  --accent: #1f3a5f; --accent-ink: #ffffff; --accent-soft: #eaf0f7;
  --warm: #9a5f2e; --good: #2e6b4f; --bad: #9b3232;
  --radius: 12px; --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(20,28,40,.06), 0 6px 20px rgba(20,28,40,.06);
  --maxw: 1080px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181f; --surface: #1b212b; --surface-2: #232b37; --line: #303a48;
    --ink: #eef2f7; --ink-2: #b3bdcb; --ink-3: #7d8899;
    --accent: #8fb4de; --accent-ink: #0f1621; --accent-soft: #223143;
    --warm: #d9a066; --good: #79c9a3; --bad: #e08a8a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #14181f; --surface: #1b212b; --surface-2: #232b37; --line: #303a48;
  --ink: #eef2f7; --ink-2: #b3bdcb; --ink-3: #7d8899;
  --accent: #8fb4de; --accent-ink: #0f1621; --accent-soft: #223143;
  --warm: #d9a066; --good: #79c9a3; --bad: #e08a8a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.22; margin: 0 0 .4em; letter-spacing: -.011em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.32rem; } h3 { font-size: 1.06rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.tiny { font-size: .8rem; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: var(--maxw); margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 640;
  text-decoration: none; color: var(--ink); letter-spacing: -.01em; }
.brand .crest { width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  color: var(--accent-ink); display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.topnav { display: flex; gap: 2px; margin-left: 6px; flex: 1; overflow-x: auto; }
.topnav a { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2);
  font-size: .92rem; white-space: nowrap; }
.topnav a:hover { background: var(--surface-2); color: var(--ink); }
.topnav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 560; }
.topbar .spacer { flex: 1; }

.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: .76rem; font-weight: 650; color: #fff; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar.sm { width: 24px; height: 24px; font-size: .66rem; }

/* ---------- buttons & fields ---------- */
.btn { font: inherit; font-size: .92rem; padding: 8px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: .84rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

label.field { display: block; margin: 0 0 14px; }
label.field > span { display: block; font-size: .85rem; font-weight: 560; color: var(--ink-2); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
.hint { font-size: .8rem; color: var(--ink-3); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card h2 { margin-bottom: .15em; }

.cardgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); }
.pagecard { display: block; text-decoration: none; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease; }
.pagecard:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20,28,40,.08), 0 12px 28px rgba(20,28,40,.10); }
.pagecard .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; margin-bottom: 10px; }
.pagecard h3 { margin-bottom: .2em; }
.pagecard.planned { opacity: .62; pointer-events: none; box-shadow: none; border-style: dashed; }
.pagecard .badge { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 650; }

/* ---------- attention strip ---------- */
.attention { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--warm);
  border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; }
.attention + .attention { margin-top: 8px; }
.attention .a-body { flex: 1; }
.attention h4 { margin: 0 0 2px; font-size: .95rem; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { font: inherit; font-size: .93rem; background: none; border: none; cursor: pointer;
  padding: 9px 13px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 580; }

/* ---------- lists & tables ---------- */
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--surface); }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-weight: 560; }
.chip { display: inline-block; font-size: .74rem; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); border-color: transparent; }

.checkline { display: flex; gap: 11px; align-items: flex-start; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.checkline + .checkline { margin-top: 8px; }
.checkline input { margin-top: 3px; width: 17px; height: 17px; flex: none; accent-color: var(--accent); }
.checkline.on { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- splash ---------- */
.splash { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.splash-box { width: 100%; max-width: 380px; text-align: center; }
.splash .crest-lg { width: 62px; height: 62px; border-radius: 18px; background: var(--accent);
  color: var(--accent-ink); display: grid; place-items: center; margin: 0 auto 18px;
  font-weight: 700; font-size: 1.4rem; }
.splash h1 { font-size: 1.5rem; }
.btn.google { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px; font-size: .97rem; font-weight: 560; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: .8rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- misc ---------- */
.banner { background: var(--warm); color: #fff; text-align: center; padding: 6px 14px; font-size: .84rem; }
.banner a { color: #fff; text-decoration: underline; }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin: 22px 0 18px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 200px; }
main { padding-bottom: 60px; }
.empty { text-align: center; padding: 34px 18px; color: var(--ink-2); }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 999px;
  font-size: .88rem; box-shadow: var(--shadow); animation: rise .2s ease; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.modal-wrap { position: fixed; inset: 0; background: rgba(15,20,28,.45); z-index: 80;
  display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius-lg); padding: 22px;
  max-width: 460px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

.err { color: var(--bad); font-size: .87rem; margin-top: 8px; min-height: 1.2em; }
