:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1d2330; --muted: #5d6677; --line: #e2e6ec;
  --accent: #2f5bd3; --ok: #1f7a4d; --ok-bg: #e3f4ea; --warn: #8a5a00; --warn-bg: #fff2d6;
  --error: #a3262d; --error-bg: #fde6e7; --info: #2f5bd3; --info-bg: #e6edfc; --muted-bg: #eef0f3;
  --radius: 10px; --sidebar: 230px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c; --panel: #1a2029; --text: #e6e9ee; --muted: #9aa4b5; --line: #2b3340;
    --accent: #7ea2ff; --ok: #6fd3a0; --ok-bg: #173327; --warn: #f2c46b; --warn-bg: #3a2e12;
    --error: #ff8f95; --error-bg: #3d1c1f; --info: #9db7ff; --info-bg: #1d2a47; --muted-bg: #262d38;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .75rem; }

.mode-banner { padding: .4rem 1rem; font-weight: 700; letter-spacing: .03em; text-align: center; font-size: .85rem; }
.mode-banner.demo { background: var(--warn-bg); color: var(--warn); }
.mode-banner.real { background: var(--ok-bg); color: var(--ok); }
.mode-banner.error, .mode-banner.loading { background: var(--error-bg); color: var(--error); }

.topbar { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; flex: 1; }
.icon-btn, .btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: .35rem .7rem; cursor: pointer; font: inherit; }
.icon-btn { display: none; }

.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: calc(100vh - 90px); }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .5rem; display: flex; flex-direction: column; gap: .15rem; }
.sidebar a { padding: .5rem .75rem; border-radius: 8px; color: var(--text); }
.sidebar a:hover { background: var(--muted-bg); text-decoration: none; }
.sidebar a.active { background: var(--info-bg); color: var(--info); font-weight: 600; }
main { padding: 1.5rem; max-width: 1200px; width: 100%; outline: none; min-width: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.grid > .card { margin-bottom: 0; }

.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .35rem .75rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.error { background: var(--error-bg); color: var(--error); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: var(--muted-bg); color: var(--muted); }
.mono, code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.mono { overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.empty { color: var(--muted); font-style: italic; }
.note { color: var(--muted); font-size: .9rem; }
.ok-msg { color: var(--ok); font-weight: 600; margin: 0; }
.big { font-size: 1.6rem; margin: 0; }

.pipeline { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; counter-reset: s; }
.stage { border: 1px solid var(--line); border-radius: 8px; padding: .6rem; display: flex; flex-direction: column; gap: .15rem; position: relative; }
.stage.available { background: var(--ok-bg); border-color: transparent; }
.stage.not_implemented { background: repeating-linear-gradient(45deg, var(--muted-bg), var(--muted-bg) 6px, transparent 6px, transparent 12px); color: var(--muted); }
.stage-name { font-weight: 600; }
.stage-status, .stage-count { font-size: .8rem; }

pre.post { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .9rem; margin: 0; font-family: inherit; font-size: .95rem; }
pre.post.muted { color: var(--muted); }
.cmd pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .6rem; overflow-x: auto; }
.claims li, .findings li { margin-bottom: .35rem; }
.timeline { padding-left: 1.2rem; margin: 0; }
.timeline li { margin-bottom: .4rem; }
.timeline time { color: var(--muted); font-size: .85rem; }
.codes { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow { font-size: .75rem; color: var(--muted); text-align: center; padding: .2rem 0; }
.day { min-height: 74px; border: 1px solid var(--line); border-radius: 6px; padding: .25rem; font-size: .8rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.day.blank { border-color: transparent; }
.day.has { background: var(--info-bg); }
.day .num { color: var(--muted); }
.entry { display: flex; flex-direction: column; gap: .15rem; color: var(--text); overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .icon-btn { display: inline-block; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; inset: 88px 0 auto 0; z-index: 4; border-bottom: 1px solid var(--line); box-shadow: 0 8px 20px rgba(0,0,0,.15); }
  .sidebar.open { display: flex; }
  main { padding: 1rem; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { font-size: .8rem; margin-top: .35rem; }
  .day { min-height: 48px; }
  .entry span:not(.badge) { display: none; }
}
