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

/* Studio ledger. Paper, ink, and one gold that means "this needs you".
   Everything else stays black and grey so the gold is never wallpaper. */
:root {
  --bg: #f6f4ee;          /* the page, warm paper */
  --surface: #fffefa;     /* panels */
  --surface2: #f1eee6;    /* inputs, quiet fills */
  --border: #e4dfd3;
  --border-med: #cfc8b8;
  --text: #121210;
  --text-2: #5f5c54;
  --text-3: #9a968b;
  --accent: #121210;      /* ink: primary buttons, focus */
  --gold: #b8974a;        /* brand gold: dots and rules */
  --gold-text: #7f6427;   /* gold dark enough to read as text */
  --gold-bg: #f6efdc;
  --done: #3d5a3a;        /* paid / delivered, used sparingly */
  --danger: #8a2a22;
  --danger-bg: #f8e9e6;

  /* Old color names, still used in a few inline styles. They all fold into the
     ledger palette so nothing turns pastel again. */
  --green-bg: var(--surface2);  --green-text: var(--done);
  --amber-bg: var(--gold-bg);   --amber-text: var(--gold-text);
  --blue-bg: var(--surface2);   --blue-text: var(--text-2);
  --red-bg: var(--danger-bg);   --red-text: var(--danger);
  --purple-bg: var(--surface2); --purple-text: var(--text-2);

  --radius: 6px;
  --radius-sm: 4px;
  --sidebar: 224px;
  --mono: 'DM Mono', ui-monospace, monospace;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }

/* ---- Shell: fixed sidebar + scrolling page ---- */
.shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 200;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid var(--border); }
.brand-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--accent); color: #f4ede0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'UnifrakturMaguntia', serif; font-size: 17px; line-height: 1;
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.brand-handle { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

.nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.nav-group {
  font-size: 10px; font-weight: 500; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 16px 8px 6px;
}
.tab-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--text-2); text-align: left;
  padding: 7px 8px; margin: 1px 0;
  border: none; background: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.tab-btn i { font-size: 17px; color: var(--text-3); }
.tab-btn:hover { background: var(--surface2); color: var(--text); }
.tab-btn.active { background: var(--surface2); color: var(--text); font-weight: 500; box-shadow: inset 2px 0 0 var(--gold); }
.tab-btn.active i { color: var(--text); }
.nav-soon {
  margin-left: auto; font-size: 10px; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 3px; padding: 0 5px;
}

.user-pill {
  display: flex; align-items: center; gap: 10px; margin: 0 10px 12px; padding: 10px 8px;
  border: none; border-top: 1px solid var(--border); background: none; cursor: pointer;
  font-size: 13px; color: var(--text-2); text-align: left;
}
.user-pill span { flex: 1; }
.user-pill i { font-size: 16px; color: var(--text-3); }
.user-pill:hover, .user-pill:hover i { color: var(--text); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; font-family: var(--mono);
}

.mobile-bar, .sidebar-scrim { display: none; }

.main { margin-left: var(--sidebar); padding: 28px 36px 64px; max-width: calc(1080px + var(--sidebar)); }

.section { display: none; }
.section.active { display: block; }

/* ---- Page header: title, one line on what the tab is for, one main button ---- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--border);
}
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.page-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.primary-btn {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  font-size: 13px; font-weight: 500; padding: 8px 14px;
  background: var(--accent); color: #f7f3ea; border: 1px solid var(--accent);
  border-radius: var(--radius-sm); cursor: pointer; transition: background 0.12s;
}
.primary-btn:hover { background: #2a2925; }
.primary-btn i { font-size: 15px; }

/* ---- Key numbers: one ruled strip, not floating cards ---- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 !important; }
.metric { padding: 16px 18px; border-left: 1px solid var(--border); }
.metric:first-child { border-left: none; }
.metric-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.metric-value { font-size: 26px; font-weight: 500; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.1; }
.metric-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Tablet and phone ---- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,0.18); }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(18,18,16,0.3); z-index: 150; }
  .mobile-bar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 100;
    height: 52px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .brand-icon { width: 26px; height: 26px; font-size: 14px; }
  .mobile-title { font-weight: 600; font-size: 15px; }
  .menu-btn { border: none; background: none; font-size: 22px; padding: 6px; cursor: pointer; color: var(--text); display: flex; }
  .main { margin-left: 0; padding: 20px 20px 48px; }
}
@media (max-width: 700px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3) { border-left: none; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--border); }
  .two-col { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .main { padding: 16px 16px 40px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
  .page-title { font-size: 20px; }
  .primary-btn { justify-content: center; padding: 10px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .msg-grid { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .metric { padding: 12px 14px; }
  .metric-value { font-size: 22px; }
}
