/* ============================================================
   Thanlwin Legal — MIS / Practice Management
   App-level styles. Tokens come from tokens.css.
   ============================================================ */

* { box-sizing: border-box; }

html, body, #root {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ----------------------------- App shell --------------------- */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 100vh;
  width: 100%;
  background: var(--cream-50);
}

/* =============================================================
   SIDEBAR
   ============================================================= */
.sidebar {
  background: #14100D;          /* near-ink, deeper than ink-900 */
  color: var(--cream-100);
  border-right: 1px solid #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand-mark {
  width: 32px; height: 32px;
  color: var(--cream-50);
  flex: none;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 13px;
  color: var(--cream-50);
  line-height: 1;
}
.brand-name small {
  display: block;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold-500);
  font-size: 9px;
  font-weight: 600;
  margin-top: 4px;
}

.firm-switcher {
  margin: 12px 12px 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--cream-200);
  cursor: pointer;
}
.firm-switcher:hover { background: rgba(255,255,255,0.06); }
.firm-switcher .label { font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-400); }
.firm-switcher .name { color: var(--cream-50); font-weight: 500; }
.firm-switcher .chev { margin-left: auto; opacity: 0.5; }

.nav-section {
  padding: 10px 0 4px;
}
.nav-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.32);
  padding: 6px 18px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.72);
  cursor: pointer;
  border-left: 2px solid transparent;
  position: relative;
}
.nav-item:hover { color: var(--cream-50); background: rgba(255,255,255,0.04); }
.nav-item.active {
  color: var(--cream-50);
  border-left-color: var(--gold-500);
  background: rgba(157, 40, 51, 0.18);
}
.nav-item .icon {
  width: 14px; height: 14px;
  flex: none;
  color: rgba(255,255,255,0.5);
}
.nav-item.active .icon { color: var(--gold-500); }
.nav-item .badge {
  margin-left: auto;
  font-size: 10px;
  background: var(--crimson-700);
  color: white;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}
.nav-item .count {
  margin-left: auto;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--crimson-700);
  color: white;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.05em;
  flex: none;
}
.user-name { font-size: 12px; color: var(--cream-50); font-weight: 500; line-height: 1.1; }
.user-role { font-size: 10px; color: rgba(255,255,255,0.4); margin-top: 2px; letter-spacing: 0.05em; }

/* =============================================================
   MAIN
   ============================================================= */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 52px;
  background: var(--cream-50);
  border-bottom: 1px solid var(--ink-200);
  flex: none;
}
.crumbs {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.crumbs .sep { margin: 0 8px; color: var(--ink-300); }
.crumbs .here { color: var(--ink-900); }

.search {
  flex: 1;
  max-width: 480px;
  margin-left: auto;
  position: relative;
}
.search input {
  width: 100%;
  height: 30px;
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  padding: 0 10px 0 30px;
  font-size: 12px;
}
.search input:focus { outline: 2px solid var(--crimson-700); outline-offset: 1px; border-color: var(--crimson-700); }
.search .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--ink-400); }
.search .kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-400);
  border: 1px solid var(--ink-200);
  border-radius: 3px;
  padding: 1px 4px;
  background: var(--cream-100);
}

.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--ink-700);
  display: grid;
  place-items: center;
  position: relative;
}
.icon-btn:hover { background: var(--cream-100); border-color: var(--ink-200); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 7px;
  width: 6px; height: 6px;
  background: var(--crimson-700);
  border-radius: 50%;
  border: 1.5px solid var(--cream-50);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 30px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-900);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.btn-primary { background: var(--crimson-700); color: white; border-color: var(--crimson-700); }
.btn-primary:hover { background: var(--crimson-800); border-color: var(--crimson-800); }
.btn-ghost { color: var(--ink-700); }
.btn-ghost:hover { background: var(--cream-100); }
.btn-outline { border-color: var(--ink-200); background: white; }
.btn-outline:hover { border-color: var(--ink-300); background: var(--cream-50); }
.btn-sm { height: 26px; padding: 0 10px; font-size: 11px; }

/* =============================================================
   PAGE CONTENT
   ============================================================= */
.page {
  flex: 1;
  overflow: auto;
  padding: 18px 24px 32px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink-200);
}
.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  line-height: 1;
  margin: 0 0 6px;
}
.page-meta {
  font-size: 11px;
  color: var(--ink-500);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.page-meta .ornament { color: var(--gold-500); margin: 0 8px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* =============================================================
   KPI BAND
   ============================================================= */
.kpi-band {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--ink-200);
  background: white;
  border-radius: 4px;
  margin-bottom: 16px;
  overflow: hidden;
}
.kpi {
  padding: 12px 14px;
  border-right: 1px solid var(--ink-100);
  position: relative;
}
.kpi:last-child { border-right: 0; }
.kpi-label {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 600;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  color: var(--ink-900);
  line-height: 1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.kpi-value .unit { font-family: var(--font-sans); font-size: 11px; font-weight: 500; color: var(--ink-500); letter-spacing: 0.04em; }
.kpi-foot {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  gap: 4px;
}
.delta-up { color: #2D7A4F; font-weight: 600; }
.delta-down { color: var(--crimson-700); font-weight: 600; }
.kpi-spark {
  position: absolute; right: 10px; top: 12px;
  width: 56px; height: 22px;
  opacity: 0.85;
}

/* =============================================================
   GRID — main dashboard layout
   ============================================================= */
.dash-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card {
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card-gold-top { border-top: 2px solid var(--gold-500); }
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--ink-100);
  flex: none;
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
  margin: 0;
  letter-spacing: 0.01em;
}
.card-sub {
  font-size: 10px;
  color: var(--ink-500);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-left: 6px;
}
.card-actions { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.card-tab {
  font-size: 11px;
  color: var(--ink-500);
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
}
.card-tab:hover { color: var(--ink-900); background: var(--cream-50); }
.card-tab.active { color: var(--ink-900); background: var(--cream-100); font-weight: 600; }
.card-body { padding: 12px 14px; }
.card-body.flush { padding: 0; }

/* =============================================================
   TABLE
   ============================================================= */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tbl th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-500);
  border-bottom: 1px solid var(--ink-200);
  background: var(--cream-50);
  white-space: nowrap;
}
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-800);
  vertical-align: middle;
}
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--cream-50); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .ref {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-600);
  letter-spacing: 0.02em;
}
.tbl .matter { font-weight: 500; color: var(--ink-900); }
.tbl .client { color: var(--ink-500); font-size: 11px; }
.tbl .matter-cell { display: flex; flex-direction: column; gap: 1px; }

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid;
  white-space: nowrap;
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-active   { color: #2D7A4F; border-color: #B5D9C4; background: #EAF4EE; }
.pill-pending  { color: #B8860B; border-color: #F0DEA0; background: #FAF1D6; }
.pill-urgent   { color: var(--crimson-700); border-color: var(--crimson-300); background: var(--crimson-50); }
.pill-closed   { color: var(--ink-500); border-color: var(--ink-200); background: var(--cream-100); }
.pill-review   { color: #2D5A7A; border-color: #B0CADC; background: #E4EFF5; }

.priority { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.priority::before { content: ''; width: 3px; height: 12px; border-radius: 1px; background: currentColor; }
.priority-p1 { color: var(--crimson-700); }
.priority-p2 { color: #B8860B; }
.priority-p3 { color: var(--ink-500); }

/* People avatars stack */
.people {
  display: inline-flex;
}
.people .av {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid white;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 600;
  color: white;
  margin-left: -6px;
  letter-spacing: 0.02em;
}
.people .av:first-child { margin-left: 0; }
.av-c1 { background: #6D1B23; }
.av-c2 { background: #2D5A7A; }
.av-c3 { background: #2D7A4F; }
.av-c4 { background: #7A5A2D; }
.av-c5 { background: #5A2D7A; }
.av-c6 { background: #3D2F26; }

/* =============================================================
   ACTIVITY FEED / TIMELINE
   ============================================================= */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ink-100);
  font-size: 12px;
  align-items: flex-start;
}
.feed-item:last-child { border-bottom: 0; }
.feed-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--cream-100);
  color: var(--ink-700);
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
}
.feed-icon.crimson { background: var(--crimson-100); color: var(--crimson-700); }
.feed-icon.gold { background: var(--gold-100); color: var(--gold-700); }
.feed-icon.green { background: #EAF4EE; color: #2D7A4F; }
.feed-icon.blue { background: #E4EFF5; color: #2D5A7A; }
.feed-text { color: var(--ink-800); line-height: 1.45; }
.feed-text b { font-weight: 600; color: var(--ink-900); }
.feed-text .matter-link { color: var(--crimson-700); font-weight: 500; }
.feed-text .quiet { color: var(--ink-500); }
.feed-time { font-size: 10.5px; color: var(--ink-500); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* =============================================================
   TASKS
   ============================================================= */
.task-list { display: flex; flex-direction: column; }
.task {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--ink-100);
  font-size: 12px;
  align-items: center;
}
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--cream-50); }
.task input[type=checkbox] {
  appearance: none;
  width: 14px; height: 14px;
  border: 1.5px solid var(--ink-300);
  border-radius: 3px;
  background: white;
  cursor: pointer;
  display: grid;
  place-items: center;
  margin: 0;
}
.task input[type=checkbox]:checked {
  background: var(--crimson-700);
  border-color: var(--crimson-700);
}
.task input[type=checkbox]:checked::after {
  content: '';
  width: 7px; height: 4px;
  border: 1.5px solid white;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}
.task.done .task-text { color: var(--ink-400); text-decoration: line-through; }
.task-text { color: var(--ink-900); }
.task-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 10.5px;
  color: var(--ink-500);
  white-space: nowrap;
}
.task-meta .due-overdue { color: var(--crimson-700); font-weight: 600; }
.task-meta .due-today { color: #B8860B; font-weight: 600; }

/* =============================================================
   CALENDAR / SCHEDULE
   ============================================================= */
.schedule { display: flex; flex-direction: column; }
.schedule-day {
  padding: 6px 14px 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-500);
  background: var(--cream-50);
  border-top: 1px solid var(--ink-100);
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  justify-content: space-between;
}
.schedule-day:first-child { border-top: 0; }
.schedule-day .date { color: var(--ink-900); font-weight: 700; letter-spacing: 0.04em; text-transform: none; font-family: var(--font-display); font-size: 12px; }
.schedule-item {
  display: grid;
  grid-template-columns: 56px 4px 1fr;
  gap: 10px;
  padding: 8px 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--ink-100);
  align-items: flex-start;
}
.schedule-item:hover { background: var(--cream-50); cursor: pointer; }
.schedule-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-700);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  padding-top: 1px;
}
.schedule-bar { background: var(--ink-300); border-radius: 1px; align-self: stretch; }
.schedule-bar.hearing { background: var(--crimson-700); }
.schedule-bar.deadline { background: var(--gold-500); }
.schedule-bar.client { background: #2D5A7A; }
.schedule-bar.internal { background: #2D7A4F; }
.schedule-title { color: var(--ink-900); font-weight: 500; }
.schedule-sub { color: var(--ink-500); font-size: 11px; margin-top: 1px; }

/* =============================================================
   BILLING SUMMARY
   ============================================================= */
.billing-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--ink-100);
  font-size: 12px;
}
.billing-row:last-child { border-bottom: 0; }
.billing-row .label { color: var(--ink-700); }
.billing-row .val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-900); }
.billing-row.total { background: var(--cream-50); }
.billing-row.total .label { font-weight: 600; }
.billing-row.total .val { font-weight: 700; color: var(--crimson-800); font-size: 13px; }

.bar-stack {
  display: flex;
  height: 8px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--cream-100);
  margin: 8px 14px 4px;
}
.bar-stack .seg { height: 100%; }
.bar-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 14px 12px;
  font-size: 10.5px;
  color: var(--ink-600);
}
.bar-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* =============================================================
   FILTER ROW
   ============================================================= */
.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink-700);
  cursor: pointer;
}
.chip:hover { border-color: var(--ink-300); }
.chip.active { background: var(--ink-900); color: white; border-color: var(--ink-900); }
.chip .x { opacity: 0.5; font-size: 14px; line-height: 0; }

/* =============================================================
   ORNAMENT
   ============================================================= */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--gold-600);
  margin: 4px 0;
  font-size: 8px;
}
.ornament::before, .ornament::after {
  content: '';
  height: 1px;
  background: var(--ink-200);
  flex: 1;
  max-width: 80px;
}

/* =============================================================
   Compliance / Trust
   ============================================================= */
.trust-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: var(--cream-50);
  border-top: 1px solid var(--ink-100);
  font-size: 10.5px;
  color: var(--ink-600);
}
.trust-strip .item { display: flex; align-items: center; gap: 5px; }
.trust-strip .ok { color: #2D7A4F; }

/* =============================================================
   GENERIC — secondary screens
   ============================================================= */
.two-col {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.list-panel { background: white; border: 1px solid var(--ink-200); border-radius: 4px; }
.list-search { padding: 10px; border-bottom: 1px solid var(--ink-100); }
.list-search input {
  width: 100%; height: 28px; border: 1px solid var(--ink-200);
  border-radius: 3px; padding: 0 8px; font-size: 12px; background: var(--cream-50);
}
.list-row {
  display: flex; flex-direction: column;
  padding: 9px 12px;
  border-bottom: 1px solid var(--ink-100);
  font-size: 12px;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.list-row:hover { background: var(--cream-50); }
.list-row.active { background: var(--cream-100); border-left-color: var(--crimson-700); }
.list-row-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.list-row .ref { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-500); }
.list-row .title { color: var(--ink-900); font-weight: 500; margin-top: 2px; }
.list-row .sub { color: var(--ink-500); font-size: 11px; margin-top: 1px; display: flex; gap: 8px; }

/* Detail */
.detail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail-head {
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  padding: 16px 18px;
  border-top: 2px solid var(--gold-500);
}
.detail-eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--crimson-700);
  font-family: var(--font-mono);
  font-weight: 600;
}
.detail-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  margin: 4px 0 8px;
  color: var(--ink-900);
  line-height: 1.15;
}
.detail-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-600);
}
.detail-meta .k { letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-500); font-weight: 600; font-size: 9.5px; display: block; }
.detail-meta .v { color: var(--ink-900); font-weight: 500; }

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--ink-200);
  margin-bottom: -1px;
}
.tabs .tab {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--ink-600);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tabs .tab:hover { color: var(--ink-900); }
.tabs .tab.active { color: var(--crimson-700); border-bottom-color: var(--crimson-700); }
.tabs .tab .count { font-size: 10px; color: var(--ink-400); margin-left: 4px; font-variant-numeric: tabular-nums; }
.tabs .tab.active .count { color: var(--crimson-500); }

/* Doc icons */
.doc-icon {
  width: 26px; height: 32px;
  background: var(--cream-100);
  border: 1px solid var(--ink-200);
  border-radius: 2px;
  position: relative;
  flex: none;
  display: grid; place-items: center;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-700);
}
.doc-icon::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 7px; height: 7px;
  background: linear-gradient(225deg, white 50%, var(--ink-200) 50%);
  border-left: 1px solid var(--ink-200);
  border-bottom: 1px solid var(--ink-200);
}
.doc-pdf { color: var(--crimson-700); background: var(--crimson-50); }
.doc-doc { color: #2D5A7A; background: #E4EFF5; }
.doc-xls { color: #2D7A4F; background: #EAF4EE; }

/* =============================================================
   Compact info grid
   ============================================================= */
.kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  padding: 14px 18px;
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 4px;
}
.kv .k {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 600;
  margin-bottom: 1px;
}
.kv .v { font-size: 12.5px; color: var(--ink-900); }
.kv-row { padding: 4px 0; }

/* =============================================================
   Reports / charts
   ============================================================= */
.bars-h { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.bar-h-row { display: grid; grid-template-columns: 130px 1fr 70px; gap: 10px; align-items: center; font-size: 12px; }
.bar-h-row .name { color: var(--ink-800); }
.bar-h-row .track {
  height: 14px; background: var(--cream-100); border-radius: 2px; position: relative; overflow: hidden;
}
.bar-h-row .fill {
  height: 100%; background: var(--crimson-700); border-radius: 2px;
}
.bar-h-row .fill.gold { background: var(--gold-500); }
.bar-h-row .fill.ink { background: var(--ink-700); }
.bar-h-row .val { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-700); font-family: var(--font-mono); font-size: 11px; }

/* =============================================================
   Misc
   ============================================================= */
.empty {
  padding: 32px; text-align: center; color: var(--ink-500); font-size: 13px;
}
.empty .gd { color: var(--gold-600); font-size: 18px; margin-bottom: 8px; }

.scroll-y { overflow-y: auto; }
.muted { color: var(--ink-500); }

/* DARK MODE */
.app.dark { background: #14100D; color: var(--cream-100); }
.app.dark .topbar { background: #1A1310; border-bottom-color: rgba(255,255,255,0.08); color: var(--cream-100); }
.app.dark .crumbs, .app.dark .crumbs .here { color: var(--cream-100); }
.app.dark .page { background: #1A1310; }
.app.dark .card,
.app.dark .kpi-band,
.app.dark .list-panel,
.app.dark .detail-head,
.app.dark .kv {
  background: #221A15; border-color: rgba(255,255,255,0.08); color: var(--cream-100);
}
.app.dark .card-head { border-bottom-color: rgba(255,255,255,0.08); }
.app.dark .kpi { border-right-color: rgba(255,255,255,0.06); }
.app.dark .kpi-value, .app.dark .card-title, .app.dark .page-title, .app.dark .detail-title { color: var(--cream-50); }
.app.dark .tbl th { background: #1A1310; color: var(--ink-300); border-bottom-color: rgba(255,255,255,0.08); }
.app.dark .tbl td { color: var(--cream-100); border-bottom-color: rgba(255,255,255,0.06); }
.app.dark .tbl tbody tr:hover { background: rgba(255,255,255,0.04); }
.app.dark .schedule-day { background: #1A1310; color: var(--ink-300); border-color: rgba(255,255,255,0.06); }
.app.dark .schedule-day .date { color: var(--cream-50); }
.app.dark .schedule-item, .app.dark .feed-item, .app.dark .task, .app.dark .billing-row,
.app.dark .list-row { border-bottom-color: rgba(255,255,255,0.06); }
.app.dark .schedule-item:hover, .app.dark .task:hover, .app.dark .list-row:hover { background: rgba(255,255,255,0.04); }
.app.dark .schedule-title, .app.dark .task-text, .app.dark .feed-text, .app.dark .feed-text b { color: var(--cream-50); }
.app.dark .billing-row.total { background: #1A1310; }
.app.dark .trust-strip { background: #1A1310; border-color: rgba(255,255,255,0.06); color: var(--ink-300); }
.app.dark .btn-outline { background: #221A15; border-color: rgba(255,255,255,0.12); color: var(--cream-100); }
.app.dark .icon-btn { color: var(--cream-100); }
.app.dark .icon-btn:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.10); }
.app.dark .search input { background: #221A15; border-color: rgba(255,255,255,0.10); color: var(--cream-50); }
.app.dark .search .kbd { background: #1A1310; border-color: rgba(255,255,255,0.10); color: var(--ink-300); }
.app.dark .chip { background: #221A15; border-color: rgba(255,255,255,0.10); color: var(--cream-100); }
.app.dark .pill-pending { background: #2A2310; border-color: #4A3D1A; }
.app.dark .pill-active { background: #15291E; border-color: #2A4A38; }
.app.dark .pill-urgent { background: #2A1418; border-color: #5A1F28; }
.app.dark .pill-closed { background: #1A1310; border-color: rgba(255,255,255,0.08); color: var(--ink-300); }
.app.dark .pill-review { background: #14222A; border-color: #2A4A5E; }
.app.dark .doc-icon { background: #1A1310; border-color: rgba(255,255,255,0.10); color: var(--cream-100); }

/* DENSITY OVERRIDES */
.app.density-compact { font-size: 12px; }
.app.density-compact .card-body, .app.density-compact .feed-item, .app.density-compact .task,
.app.density-compact .schedule-item, .app.density-compact .billing-row, .app.density-compact .tbl td,
.app.density-compact .list-row { padding-top: 5px; padding-bottom: 5px; }
.app.density-compact .kpi { padding: 9px 12px; }
.app.density-compact .kpi-value { font-size: 22px; }
.app.density-compact .nav-item { padding-top: 4px; padding-bottom: 4px; font-size: 12px; }

.app.density-relaxed { font-size: 13.5px; }
.app.density-relaxed .card-body, .app.density-relaxed .feed-item, .app.density-relaxed .task,
.app.density-relaxed .schedule-item, .app.density-relaxed .billing-row, .app.density-relaxed .tbl td,
.app.density-relaxed .list-row { padding-top: 12px; padding-bottom: 12px; }
.app.density-relaxed .kpi { padding: 16px 18px; }
.app.density-relaxed .kpi-value { font-size: 30px; }

/* Tweaks panel z-index just in case */
.tweaks-panel { z-index: 5000 !important; }
