:root {
  --bg: #101614;
  --raise: #1a2420;
  --ink: #e7f0ea;
  --muted: #9bb0a6;
  --line: #2c3b34;
  --brass: #e0a45a;
  --brass-ink: #2a1c08;
  --good: #8fceab;
  --bad: #f0a090;
  --serif: Fraunces, "Iowan Old Style", Palatino, Georgia, serif;
  --sans: Outfit, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); }
body { min-height: 100vh; overflow-x: hidden; }
a { color: var(--brass); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; }
h1 { font-size: 2.1rem; margin: 0 0 0.3rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.6rem; }
p { line-height: 1.5; }

.boot, .signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin-card, .panel, .sheet {
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}
.signin-card { width: min(440px, 100%); }
.signin-card h1 { margin-top: 12px; }
.mark {
  display: inline-grid; place-items: center; width: 42px; height: 42px;
  border-radius: 12px; background: var(--brass); color: var(--brass-ink);
  font-family: var(--serif); font-size: 1.4rem;
}
.lede, .muted { color: var(--muted); }
.error { color: var(--bad); }
.ok { color: var(--good); }
.empty { color: var(--muted); }

.button, .ghost, .signout {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 0.55rem 0.95rem; border: 1px solid transparent;
  cursor: pointer; background: var(--brass); color: var(--brass-ink); font-weight: 600;
}
.ghost, .signout { background: transparent; color: var(--ink); border-color: var(--line); }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px 14px; border-right: 1px solid var(--line); background: #0c1210;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); }
.word { font-family: var(--serif); font-size: 1.25rem; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { padding: 0.55rem 0.7rem; border-radius: 10px; color: var(--muted); }
.nav a.active { background: #24312b; color: var(--ink); }
.who { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.92rem; }
.who div { display: flex; flex-direction: column; min-width: 0; }
.who strong { color: var(--ink); }
.who .signout { flex: 0 0 auto; }
.workspace { min-width: 0; }
.topbar { display: none; }
.content { padding: 28px 28px 64px; max-width: 1100px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.stats article, .row, .bill {
  background: #141c19; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.stats span, .row span { display: block; color: var(--muted); font-size: 0.86rem; }
.stats strong { font-family: var(--serif); font-size: 1.6rem; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.panel { margin: 14px 0; }
.row, .bill { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 8px 0; }
.row.link, a.row { color: inherit; }
.actions, .filters, .grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.grid { display: grid; grid-template-columns: 1fr 1fr; }
.wide { grid-column: 1 / -1; }
.split { display: grid; grid-template-columns: 1.3fr 0.9fr; gap: 14px; align-items: start; }
label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 0.92rem; color: var(--muted); min-width: 0; }
input, select, textarea {
  background: #0e1512; border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.7rem; width: 100%;
}
textarea { min-height: 72px; }
.check { flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; }
.bill input { width: auto; }
.demo { margin-top: 18px; color: var(--muted); }
.demo code, code { color: var(--brass); }
.sheet { background: white; color: #1c1915; }
.sheet a { color: #8a5a12; }

@media (max-width: 840px) {
  .shell { display: block; }
  .sidebar {
    position: sticky; top: 0; height: auto; width: 100%; z-index: 5;
    flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px;
  }
  .who { display: flex; margin-top: 0; margin-left: auto; order: 2; }
  .nav { order: 3; width: 100%; flex-direction: row; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 0; }
  .sidebar .signout { display: inline-flex; }
  .content { padding: 16px 14px 48px; }
  .stats, .split, .grid { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.7rem; }
}

@media print {
  .sidebar, .topbar, .no-print, .nav, .signout { display: none !important; }
  .shell, .workspace, .content { display: block; padding: 0; max-width: none; }
  body, .sheet { background: white; color: black; }
  .sheet { border: 0; }
}
