:root {
  --ink:        #16191f;
  --ink-soft:   #3a4150;
  --paper:      #f6f5f2;
  --surface:    #ffffff;
  --primary:    #0e5c4d;
  --primary-dk: #0a4439;
  --accent:     #c89b3c;
  --danger:     #c0392b;
  --danger-bg:  #fbecea;
  --line:       #e4e2dc;
  --muted:      #7a8190;
  --radius:     12px;
  --shadow:     0 1px 3px rgba(22,25,31,0.06), 0 8px 24px rgba(22,25,31,0.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.tnum { font-variant-numeric: tabular-nums; }

/* ---- Shell ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--ink);
  color: #cfd4dc;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: baseline; gap: 8px;
  padding: 0 10px 28px;
}
.brand .mark {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.25rem; color: #fff;
  letter-spacing: -0.02em;
}
.brand .mark b { color: var(--accent); }
.brand .sub { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: #cfd4dc;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  display: flex; align-items: center; gap: 10px;
}
.nav a:hover { background: rgba(255,255,255,0.06); text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }
.nav a .ico { width: 18px; height: 18px; opacity: 0.85; }

.sidebar .foot { margin-top: auto; padding: 0 10px; font-size: 0.8rem; }
.sidebar .foot .who { color: #fff; font-weight: 500; }
.sidebar .foot a { color: var(--muted); }

.main { flex: 1; padding: 36px 44px; max-width: 1200px; }
.page-head { margin-bottom: 28px; }
.page-head .eyebrow {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 6px;
}
.page-head h1 { font-size: 1.7rem; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 60ch; }

/* ---- Cards / stats ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.stat .label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .value { font-family: 'Space Grotesk', sans-serif; font-size: 2.1rem; font-weight: 600; margin-top: 8px; }
.stat .value.accent { color: var(--primary); }

/* ---- Hero chart panel ---- */
.panel { padding: 24px 26px; margin-bottom: 24px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 4px; }
.panel .panel-sub { color: var(--muted); font-size: 0.85rem; margin-bottom: 20px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 34px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dk) 100%);
  border-radius: 5px 5px 0 0;
  min-height: 3px;
  transition: height 0.6s cubic-bezier(.2,.7,.2,1);
}
.bar-col .blabel { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }
.bar-col .bcount { font-size: 0.72rem; font-weight: 600; color: var(--ink-soft); }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-weight: 600;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #faf9f6; }
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 0.74rem;
  background: #eef3f1; color: var(--primary-dk); font-weight: 500;
}

/* ---- Forms / buttons ---- */
label.field { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 7px; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 0.92rem; background: var(--surface); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 9px; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.92rem; font-weight: 500;
  background: var(--primary); color: #fff; transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--primary-dk); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--muted); background: #faf9f6; }

.toolbar { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 220px; }

/* ---- Empty / notices ---- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; color: var(--ink-soft); margin-bottom: 6px; }
.notice { padding: 12px 16px; border-radius: 9px; font-size: 0.88rem; margin-bottom: 16px; }
.notice.err { background: var(--danger-bg); color: var(--danger); }
.notice.ok { background: #e7f3ef; color: var(--primary-dk); }

/* ---- Responsive ---- */
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
  .brand { padding: 0 10px 0 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .foot { margin: 0 0 0 auto; }
  .main { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
