:root {
  color-scheme: dark;
  --bg: #0a0d0c;
  --panel: #101513;
  --panel-strong: #151b18;
  --line: #25302a;
  --line-bright: #35443a;
  --text: #e9f0eb;
  --muted: #8c9b91;
  --faint: #617067;
  --accent: #c2f36b;
  --accent-dark: #172407;
  --blue: #91c8ff;
  --orange: #ffc477;
  --red: #ff8d86;
  --mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 82% -10%, #1d3221 0, transparent 36rem), var(--bg); color: var(--text); font: 15px/1.55 var(--sans); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 28px; }
.login-view { width: min(620px, 100%); min-height: 74vh; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { color: var(--accent); font: 11px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { margin-top: 14px; max-width: 800px; font-size: clamp(2rem, 4.8vw, 4.6rem); line-height: 1.02; letter-spacing: -.06em; font-weight: 650; }
h2 { margin-top: 6px; font-size: clamp(1.5rem, 2.2vw, 2.2rem); letter-spacing: -.045em; font-weight: 650; }
h3 { font-size: 1rem; letter-spacing: -.01em; }
.lede { max-width: 540px; margin-top: 24px; color: var(--muted); font-size: 1.05rem; }
.button { border: 1px solid transparent; border-radius: 7px; padding: 9px 14px; font: 12px var(--mono); transition: .18s ease; }
.button-primary { width: fit-content; margin-top: 30px; background: var(--accent); color: #101707; font-weight: 700; }
.button-primary:hover { background: #d4ff86; transform: translateY(-1px); }
.button-quiet { background: transparent; border-color: var(--line); color: var(--muted); }
.button-quiet:hover { border-color: var(--line-bright); color: var(--text); }
.security-note { margin-top: 22px; color: var(--faint); font: 11px var(--mono); }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 13px rgba(194,243,107,.65); }
.status { min-height: 24px; margin-top: 14px; color: var(--red); font: 12px var(--mono); }

.dashboard-view { padding-bottom: 16px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin-top: 8px; font-size: clamp(1.8rem, 4vw, 3.5rem); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: end; }
.connection-status { color: var(--accent); font: 11px var(--mono); white-space: nowrap; }
.app-status { min-height: 26px; padding-top: 12px; color: var(--muted); font: 12px var(--mono); }
.app-status.is-error { color: var(--red); }
.tabs { display: flex; gap: 24px; margin: 20px 0 34px; border-bottom: 1px solid var(--line); }
.tab { position: relative; border: 0; padding: 0 0 13px; background: transparent; color: var(--muted); font: 12px var(--mono); }
.tab:hover, .tab.is-active { color: var(--text); }
.tab.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--accent); content: ""; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-note { color: var(--faint); font: 11px var(--mono); }
.search { width: min(300px, 100%); border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; outline: 0; background: var(--panel); color: var(--text); font: 12px var(--mono); }
.search:focus { border-color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-card { display: grid; gap: 10px; min-height: 148px; border: 1px solid var(--line); border-radius: 10px; padding: 18px; text-align: left; background: linear-gradient(145deg, var(--panel-strong), var(--panel)); color: var(--text); transition: .18s ease; }
.stat-card:hover { border-color: var(--line-bright); transform: translateY(-2px); }
.stat-label, .stat-foot { color: var(--muted); font: 11px var(--mono); }
.stat-card strong { color: var(--accent); font-size: 2.7rem; font-weight: 500; letter-spacing: -.08em; }
.stat-foot { color: var(--faint); }
.overview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 18px; background: rgba(16,21,19,.7); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.text-button { border: 0; padding: 0; background: transparent; color: var(--accent); font: 11px var(--mono); }
.card-list { display: grid; gap: 10px; }
.compact-list { max-height: 390px; overflow: auto; }
.record-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--panel); }
.record-card:hover { border-color: var(--line-bright); }
.record-topline { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.record-title { min-width: 0; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.record-meta { flex: 0 0 auto; color: var(--faint); font: 10px var(--mono); text-align: right; }
.record-body { margin-top: 9px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.record-body.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
.record-footer { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.chip { border: 1px solid var(--line-bright); border-radius: 99px; padding: 3px 7px; color: var(--muted); font: 10px var(--mono); }
.chip.status-todo { color: var(--blue); }
.chip.status-in_progress { color: var(--orange); }
.chip.status-done { color: var(--accent); }
.chip.status-canceled, .chip.status-revoked { color: var(--red); }
.empty { border: 1px dashed var(--line); border-radius: 8px; padding: 22px 16px; color: var(--faint); font: 12px var(--mono); }
.footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 42px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--faint); font: 10px var(--mono); }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 28px, 620px); padding-top: 24px; }
  .topbar, .section-heading { align-items: start; flex-direction: column; }
  .topbar-actions { justify-content: start; }
  .stat-grid, .overview-grid { grid-template-columns: 1fr; }
  .tabs { gap: 16px; overflow-x: auto; }
  .footer { flex-direction: column; gap: 5px; }
}
