/* ============================================================
   CA Practice Manager — visual identity v2
   Compact, professional, bordered admin-dashboard aesthetic.
   One clean sans-serif throughout (no serif/sans mixing), a
   restrained navy+gold brand identity, and colour used only for
   semantic meaning (status, KPI category) rather than decoration.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --ink-900: #0F2C46;      /* deep navy - primary brand */
  --ink-950: #0A2036;      /* darker navy - sidebar depth */
  --ink-800: #17416A;
  --ink-700: #1F5686;

  --gold-600: #B8860B;     /* brand gold - used sparingly: CTAs, active state */
  --gold-700: #966E08;
  --gold-100: #FBF0D9;

  --paper-0:  #FFFFFF;
  --paper-50: #F6F7F9;     /* page background */
  --paper-100: #EEF0F3;
  --line: #E2E5EA;         /* the border colour used EVERYWHERE */
  --line-strong: #CBD1DA;

  --text-900: #16202B;
  --text-600: #5B6672;
  --text-400: #8D96A1;

  /* Semantic colours - distinct from brand gold, used consistently
     for status pills, KPI accents, chart series. */
  --ok-600: #15803D;   --ok-100: #E7F5EC; --ok-border: #BFE3CC;
  --warn-600: #B45309; --warn-100: #FDF1E1; --warn-border: #F3D9AE;
  --danger-600: #B91C1C; --danger-100: #FBEAEA; --danger-border: #F2C6C6;
  --info-600: #0E6FA5; --info-100: #E8F3F9; --info-border: #C3E0EE;
  --neutral-600: #5B6672; --neutral-100: #EEF0F3; --neutral-border: #DDE1E7;

  --radius-sm: 4px;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(16,24,32,0.04);
  --shadow-md: 0 4px 16px rgba(16,24,32,0.10);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--paper-50);
  color: var(--text-900);
  font-family: 'Inter', -apple-system, "Segoe UI", sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  color: var(--ink-950);
  letter-spacing: -0.01em;
}

a { color: var(--ink-700); text-decoration: none; }
a:hover { color: var(--gold-700); }

.tabular-num { font-variant-numeric: tabular-nums; font-family: 'IBM Plex Mono', monospace; font-size: 0.97em; }

/* icon + text alignment, used everywhere an icon sits next to a label */
.icon-inline { display: inline-flex; align-items: center; gap: 6px; line-height: 1; }
.icon-inline i { line-height: 1; }

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

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ink-950) 0%, var(--ink-900) 100%);
  color: #DDE6EE;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.sidebar-brand {
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 9px;
}
.sidebar-brand .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: var(--gold-600);
  border-radius: var(--radius-sm); color: var(--ink-950); font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-brand .brandtext { min-width: 0; }
.sidebar-brand .name { color: #fff; font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.sidebar-brand .tag { color: #8CA0B4; font-size: 10.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-section { padding: 10px 8px 2px; }
.nav-section-title {
  font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; color: #63768A;
  padding: 8px 8px 4px; font-weight: 700;
}
.nav-link-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; margin: 1px 2px; border-radius: var(--radius-sm);
  color: #C3D1DD; font-size: 12.5px; font-weight: 500; border-left: 2px solid transparent;
}
.nav-link-item i { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; }
.nav-link-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link-item.active {
  background: rgba(184,134,11,0.16); color: #fff; border-left-color: var(--gold-600); font-weight: 600;
}

.sidebar-foot { margin-top: auto; padding: 10px 14px; font-size: 10.5px; color: #63768A; border-top: 1px solid rgba(255,255,255,0.08); line-height: 1.5; }

/* ---------- Topbar ---------- */
.topbar {
  height: 50px; display: flex; align-items: center; gap: 14px;
  padding: 0 18px; background: var(--paper-0); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar form.search-form { flex: 1; max-width: 380px; }
.topbar input.search-input {
  width: 100%; border: 1px solid var(--line); background: var(--paper-50);
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12.5px;
}
.topbar input.search-input:focus { outline: none; border-color: var(--ink-700); background: #fff; box-shadow: 0 0 0 3px rgba(15,44,70,0.08); }
.topbar .spacer { flex: 1; }
.badge-role {
  font-size: 10.5px; padding: 3px 9px; border-radius: 20px; background: var(--info-100);
  color: var(--info-600); font-weight: 600; border: 1px solid var(--info-border);
}
.bell-btn { position: relative; color: var(--text-600); font-size: 16px; }
.bell-dot { position: absolute; top: -2px; right: -2px; width: 7px; height: 7px; background: var(--danger-600); border-radius: 50%; border: 1.5px solid #fff; }

/* ---------- Content ---------- */
.content { flex: 1; padding: 20px 24px 48px; max-width: 1440px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 18px; margin: 0; }
.page-sub { color: var(--text-600); font-size: 12px; margin-top: 3px; }

/* ---------- KPI tiles: icon badge + value, colour-coded by meaning ---------- */
.tile {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; align-items: center; gap: 11px; box-shadow: var(--shadow-sm);
}
.tile .tile-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.tile .tile-label { font-size: 10.5px; color: var(--text-600); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.tile .tile-value { font-size: 20px; font-weight: 700; color: var(--ink-950); line-height: 1.25; }
.tile.neutral .tile-icon { background: var(--info-100); color: var(--info-600); }
.tile.warn .tile-icon { background: var(--warn-100); color: var(--warn-600); }
.tile.danger .tile-icon { background: var(--danger-100); color: var(--danger-600); }
.tile.ok .tile-icon { background: var(--ok-100); color: var(--ok-600); }
.tile.gold .tile-icon { background: var(--gold-100); color: var(--gold-700); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-head {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.panel-head h2 { font-size: 13px; margin: 0; font-weight: 700; }
.panel-head a { font-size: 11.5px; font-weight: 600; }
.panel-body { padding: 14px; }

/* ---------- Tables ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table thead th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-600);
  border-bottom: 1px solid var(--line); padding: 7px 12px; background: var(--paper-50);
  position: static; font-weight: 700;
}
table.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tbody tr:hover { background: var(--paper-50); }
table.data-table tbody tr:last-child td { border-bottom: none; }

.status-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; border: 1px solid transparent; line-height: 1.6; white-space: nowrap;
}
.status-ok { background: var(--ok-100); color: var(--ok-600); border-color: var(--ok-border); }
.status-warn { background: var(--warn-100); color: var(--warn-600); border-color: var(--warn-border); }
.status-danger { background: var(--danger-100); color: var(--danger-600); border-color: var(--danger-border); }
.status-info { background: var(--info-100); color: var(--info-600); border-color: var(--info-border); }
.status-neutral { background: var(--neutral-100); color: var(--neutral-600); border-color: var(--neutral-border); }

/* ---------- Buttons & forms: consistent size + real borders ---------- */
.btn { border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; padding: 6px 13px; border: 1px solid transparent; }
.btn-sm { font-size: 11.5px; padding: 4px 10px; }
.btn-brand { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.btn-brand:hover { background: var(--ink-950); border-color: var(--ink-950); color: #fff; }
.btn-gold { background: var(--gold-600); border-color: var(--gold-600); color: #fff; }
.btn-gold:hover { background: var(--gold-700); border-color: var(--gold-700); color: #fff; }
.btn-outline-brand { border: 1px solid var(--line-strong); color: var(--ink-800); background: #fff; }
.btn-outline-brand:hover { background: var(--paper-50); border-color: var(--ink-700); color: var(--ink-900); }
.btn-light { border: 1px solid var(--line); background: #fff; color: var(--text-600); }
.btn-light:hover { background: var(--paper-50); }

.form-control, .form-select { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 12.5px; padding: 6px 10px; }
.form-control:focus, .form-select:focus { border-color: var(--ink-700); box-shadow: 0 0 0 3px rgba(15,44,70,0.08); }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-900); margin-bottom: 4px; }

/* ---------- Kanban ---------- */
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: var(--paper-100); border: 1px solid var(--line); border-radius: var(--radius); min-width: 250px; flex: 1; padding: 9px; }
.kanban-col-head { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: var(--text-600); padding: 3px 5px 8px; text-transform: uppercase; }
.kanban-card {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--info-600);
  border-radius: var(--radius-sm); padding: 9px 10px; margin-bottom: 7px; font-size: 12px; box-shadow: var(--shadow-sm);
}
.kanban-card.priority-urgent { border-left-color: var(--danger-600); }
.kanban-card.priority-high { border-left-color: var(--warn-600); }
.kanban-card .k-title { font-weight: 600; margin-bottom: 3px; }
.kanban-card .k-meta { color: var(--text-600); font-size: 10.5px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #163E63 0%, var(--ink-950) 65%);
}
.login-card { background: #fff; border-radius: var(--radius); padding: 34px 32px; width: 368px; box-shadow: var(--shadow-md); border: 1px solid var(--line); }
.login-card .mark {
  width: 40px; height: 40px; background: var(--gold-600); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 800; font-size: 17px; margin-bottom: 14px;
}
.login-card h1 { font-size: 18px; margin-bottom: 2px; }
.login-card p.lede { color: var(--text-600); font-size: 12.5px; margin-bottom: 18px; }

.empty-state { text-align: center; padding: 36px 20px; color: var(--text-600); font-size: 12.5px; }
.empty-state i { font-size: 26px; color: var(--line-strong); display: block; margin-bottom: 8px; }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; height: 240px; }
.chart-wrap.chart-sm { height: 190px; }
.legend-row { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-600); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -240px; z-index: 40; transition: left .18s; }
  .sidebar.open { left: 0; }
  .content { padding: 16px; }
}
