:root {
  --bg: #f6f1e8; --surface: #fffdf8; --ink: #2b2a27; --muted: #8a857c; --line: #e6dfd1;
  --accent: #c2542d; --up: #2f7a4f; --down: #b3412a; --radius: 12px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 0 0 12px; } h2.section { margin: 28px 0 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 13px; }
[hidden] { display: none !important; }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; }
.brand { font-weight: 700; font-size: 17px; }
nav { display: flex; flex-direction: column; gap: 4px; }
nav a { color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
nav a.active, nav a:hover { background: var(--bg); color: var(--accent); }
.link { background: none; border: 0; color: var(--muted); text-align: left; padding: 8px 10px; cursor: pointer; margin-top: auto; }
.view { padding: 24px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.summary { display: grid; gap: 8px; margin-bottom: 16px; }
.summary-line { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; color: var(--ink); text-decoration: none; }
.summary-k { color: var(--muted); min-width: 150px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card { margin-bottom: 16px; }
.tile.stale { border-style: dashed; }
.tile-head, .card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); }
.tile-value { font-size: 26px; font-weight: 700; margin: 6px 0 2px; }
.tile-delta { font-size: 13px; } .tile-delta.up { color: var(--up); } .tile-delta.down { color: var(--down); }
.tile-sub { font-size: 13px; color: var(--muted); }
.spark { height: 40px; position: relative; margin: 6px 0; }
.chart { position: relative; height: 260px; }
.trend-head { margin: 8px 0 12px; flex-wrap: wrap; } .trend-head h2 { margin: 0; color: var(--ink); }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; margin-bottom: 16px; }
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.mini.stale { border-style: dashed; }
.mini h3 { font-size: 14px; margin: 0; color: var(--ink); }
.mini-now { margin-left: auto; font-size: 13px; color: var(--ink); font-weight: 600; }
.mini-chart { position: relative; height: 150px; margin-top: 6px; }
.mini-note { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.legend { list-style: none; padding: 0; margin: 6px 0 0; font-size: 12px; display: grid; gap: 2px; }
.legend li { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.mk { display: inline-block; width: 12px; flex: none; }
.mk.line { height: 3px; border-radius: 2px; transform: translateY(-3px); }
.mk.bar { height: 10px; border-radius: 2px; }
.mk.today { width: 9px; height: 9px; border: 2px solid var(--muted); border-radius: 50%; background: var(--surface); }
.fresh { font-size: 12px; color: var(--muted); margin-top: 6px; }
.info { border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 50%; width: 20px; height: 20px; font-size: 12px; cursor: pointer; padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.table-wrap { overflow-x: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; color: var(--ink); }
.seg button.active { background: var(--accent); color: #fff; }
.events { list-style: none; padding: 0; margin: 0; } .events li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.tag { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; font-size: 15px; cursor: pointer; text-decoration: none; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 420px; width: 100%; display: grid; gap: 12px; }
.code-form { display: grid; gap: 8px; }
.code-form input { font-size: 22px; letter-spacing: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; }
.error { background: var(--surface); border: 1px solid var(--down); border-radius: var(--radius); padding: 14px; color: var(--down); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); max-width: 520px; width: calc(100% - 32px); }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; overflow-x: auto; }
  nav { flex-direction: row; }
  .link { margin-top: 0; margin-left: auto; }
  .view { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .summary-line { flex-direction: column; gap: 2px; }
  .summary-k { min-width: 0; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-value { font-size: 20px; }
  .minis { grid-template-columns: 1fr; }
}
