/* Foyer — shared design tokens */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,300;1,6..72,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Surfaces */
  --bg: #F7F7F5;
  --bg-elevated: #FCFCFA;
  --bg-card: #FFFFFF;
  --bg-sidebar: #F1F1ED;
  --bg-inverse: #0A1628;

  /* Ink */
  --ink: #0A1628;
  --ink-2: #2B364A;
  --ink-3: #5C6577;
  --ink-4: #8B92A1;
  --ink-5: #B5BAC5;

  /* Lines */
  --line: #E6E5E0;
  --line-2: #DAD8D1;
  --line-strong: #0A1628;

  /* Gold — whisper only */
  --gold: #D4AF37;
  --gold-soft: #E8D58A;
  --gold-bg: #F5EFD9;

  /* Status — muted, restrained */
  --green: #2F7D5C;
  --green-bg: #E5EFE9;
  --amber: #B07D2B;
  --amber-bg: #F5ECD9;
  --red: #A1432B;
  --red-bg: #F2E1DC;
  --blue: #2D547A;
  --blue-bg: #E1E8F0;

  /* Type */
  --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --serif: 'Newsreader', 'Times New Roman', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing */
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- TYPE ---------- */
.t-display {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  font-optical-sizing: auto;
}
.t-serif { font-family: var(--serif); font-weight: 400; }
.t-serif-italic { font-family: var(--serif); font-style: italic; font-weight: 300; }
.t-mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.t-tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.t-eyebrow {
  font-family: var(--sans);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  font-weight: 500;
}

/* ---------- LAYOUT PRIMITIVES ---------- */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.02em;
  font-weight: 500;
  background: var(--bg-elevated);
}
.brand-name {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.brand-name em {
  font-style: italic;
  font-weight: 300;
}
.brand-name { font-feature-settings: "ss01"; }

.nav-section { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  padding: 10px 8px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-4);
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.nav-item:hover { background: rgba(10, 22, 40, 0.04); }
.nav-item.active {
  background: var(--bg-elevated);
  color: var(--ink);
  font-weight: 500;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--gold);
}
.nav-item .icon { width: 14px; height: 14px; opacity: 0.75; flex-shrink: 0; }
.nav-item.active .icon { opacity: 1; }
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

/* User block */
.user-block {
  margin-top: auto;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-inverse);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar.xl { width: 56px; height: 56px; font-size: 18px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Main content */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.client-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-elevated);
  font-size: 13px;
  cursor: pointer;
  min-width: 240px;
}
.client-switcher:hover { border-color: var(--line-2); }
.client-switcher .avatar { width: 22px; height: 22px; font-size: 9px; }
.client-switcher .label { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.client-switcher .label small { font-size: 10.5px; color: var(--ink-4); }
.client-switcher .label strong { font-weight: 500; font-size: 12.5px; }
.client-switcher .chev { margin-left: auto; color: var(--ink-4); }

.global-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-elevated);
  color: var(--ink-3);
  font-size: 13px;
}
.global-search .kbd {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink-4);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--ink-3);
  background: transparent;
}
.icon-btn:hover { background: rgba(10, 22, 40, 0.04); color: var(--ink); }

/* Page content */
.page {
  padding: 28px 32px 40px;
  flex: 1;
  min-width: 0;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.page-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0 0 6px 0;
}
.page-subtitle {
  font-size: 13px;
  color: var(--ink-3);
  margin: 0;
}
.page-actions { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--ink);
  cursor: pointer;
  transition: background 80ms ease;
}
.btn:hover { background: var(--bg-card); border-color: var(--line-2); }
.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-primary:hover { background: #16243C; border-color: #16243C; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(10, 22, 40, 0.05); }
.btn-sm { padding: 4px 9px; font-size: 12px; }

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card-header {
  padding: 16px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.card-body { padding: 4px 18px 16px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--line); }

/* KPI tile */
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px 18px;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 12px;
}
.kpi-value {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.kpi-value .unit {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink-3);
  margin-left: 2px;
  letter-spacing: 0;
}
.kpi-meta {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-meta .delta-up { color: var(--green); }
.kpi-meta .delta-down { color: var(--red); }
.kpi-divider {
  position: absolute;
  top: 14px;
  left: 0;
  width: 24px;
  height: 1px;
  background: var(--gold);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-sidebar);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); border-color: transparent; }
.badge-amber { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.badge-red { background: var(--red-bg); color: var(--red); border-color: transparent; }
.badge-blue { background: var(--blue-bg); color: var(--blue); border-color: transparent; }
.badge-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge-outline { background: transparent; }
.badge .check { font-size: 9px; }

.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-4);
}
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}
.table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg-elevated); }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(240px, 1fr));
  gap: 14px;
  align-items: flex-start;
}
.kanban.cols-5 { grid-template-columns: repeat(5, minmax(240px, 1fr)); }
.kan-col {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  min-height: 160px;
  max-height: calc(100vh - 220px);
}
.kan-col-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.kan-col-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--ink);
}
.kan-col-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
}
.kan-col-add {
  margin-left: auto;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--ink-4);
  border-radius: 4px;
}
.kan-col-add:hover { background: var(--bg); color: var(--ink); }
.kan-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.kan-col.lost .kan-col-title { color: var(--ink-3); }

.kan-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: grab;
}
.kan-card:hover { border-color: var(--line-2); }
.kan-card .name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.15;
}
.kan-card .sub {
  font-size: 11.5px;
  color: var(--ink-3);
}
.kan-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--ink-4);
}
.kan-card .checks {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.kan-card .chk {
  font-size: 10.5px;
  font-family: var(--mono);
  color: var(--ink-4);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
}
.kan-card .chk.done {
  color: var(--green);
  border-color: var(--green-bg);
  background: var(--green-bg);
}

/* Empty state */
.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-4);
  font-size: 12px;
}
.empty .icon { font-size: 18px; margin-bottom: 8px; opacity: 0.5; }

/* Status pills (kanban lost reasons) */
.reason-pill {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-3);
}

/* Filter bar */
.filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-elevated);
  color: var(--ink-2);
}
.filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-chip .x { color: var(--ink-4); margin-left: 2px; }

/* Hairline gold separator (eyebrow detail) */
.hr-gold {
  height: 1px;
  background: var(--gold);
  width: 28px;
  border: 0;
  margin: 0 0 12px 0;
}

/* Activity feed */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.feed-item:last-child { border-bottom: 0; }
.feed-bullet {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 11px;
  color: var(--ink-3);
}
.feed-text { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.feed-text strong { font-weight: 500; color: var(--ink); }
.feed-time { font-size: 11px; color: var(--ink-4); white-space: nowrap; }

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  position: relative;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}
.tab .count {
  font-family: var(--mono);
  font-size: 10.5px;
  margin-left: 4px;
  color: var(--ink-4);
}

/* Cmd-K palette (visual) */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 22, 40, 0.18);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 50;
}
.cmdk-overlay.open { display: flex; }
.cmdk {
  width: 540px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px rgba(10, 22, 40, 0.18);
  overflow: hidden;
}
.cmdk-input {
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  background: transparent;
  outline: none;
}
.cmdk-list { padding: 6px; max-height: 360px; overflow-y: auto; }
.cmdk-section { padding: 8px 12px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-4); font-weight: 500; }
.cmdk-row {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  border-radius: var(--r);
  cursor: pointer;
}
.cmdk-row:hover, .cmdk-row.active { background: var(--bg-elevated); }
.cmdk-row .meta { margin-left: auto; font-size: 11px; color: var(--ink-4); font-family: var(--mono); }

/* --- ICONS (simple, hand-tuned strokes) --- */
.i { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.i-lg { width: 16px; height: 16px; }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* Helper */
.flex { display: flex; }
.col { flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-ink-3 { color: var(--ink-3); }
.text-ink-4 { color: var(--ink-4); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.muted { color: var(--ink-3); }
.grid { display: grid; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.gap-card { gap: 14px; }

/* Section heading on page */
.section-h {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.005em;
  margin: 0;
}

/* Sparkline / chart container */
.chart-frame {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-card);
  padding: 18px 20px;
}
