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

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

:root {
  /* Navy scale */
  --navy-900: #0B2545;
  --navy-800: #0D2E5C;
  --navy-700: #13365E;
  --navy-600: #134074;
  --navy-500: #1B3A6B;

  /* Accent */
  --teal: #0ABAB5;
  --teal-dark: #089690;
  --teal-light: #E0F7F6;
  --blue: #1A8CFF;
  --blue-hover: #1578DB;
  --blue-light: #E8F4FD;

  /* Page backgrounds */
  --bg-page: #F0F4F8;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;

  /* Text */
  --text-heading: #0F2B46;
  --text-body: #334E68;
  --text-muted: #627D98;
  --text-caption: #9FB3C8;
  --text-link: #1A8CFF;

  /* Borders */
  --border-card: #E2E8F0;
  --border-divider: #EDF2F7;
  --border-input: #CBD5E1;

  /* Status badge colours */
  --badge-active-bg: #E6F9F0;      --badge-active-text: #0D9F6E;
  --badge-onboarding-bg: #E0F7F6;  --badge-onboarding-text: #0ABAB5;
  --badge-engagement-bg: #E8F4FD;  --badge-engagement-text: #1A8CFF;
  --badge-evidence-bg: #FFF3E0;    --badge-evidence-text: #E8850C;
  --badge-ird-bg: #FFF8E1;         --badge-ird-text: #D4A017;
  --badge-arrangement-bg: #E6F9F0; --badge-arrangement-text: #0D9F6E;
  --badge-closed-bg: #F1F5F9;      --badge-closed-text: #64748B;
  --badge-qualification-bg: #F1F5F9; --badge-qualification-text: #64748B;
  --badge-high-bg: #FEE2E2;        --badge-high-text: #DC2626;
  --badge-medium-bg: #FFF8E1;      --badge-medium-text: #D4A017;
  --badge-low-bg: #F1F5F9;         --badge-low-text: #64748B;
  --badge-hot-bg: #FEE2E2;         --badge-hot-text: #DC2626;
  --badge-warm-bg: #FFF3E0;        --badge-warm-text: #E8850C;
  --badge-cold-bg: #EFF6FF;        --badge-cold-text: #3B82F6;
  --badge-new-bg: #E0F7F6;         --badge-new-text: #0ABAB5;

  /* Layout */
  --sidebar-w: 70px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(11,37,69,0.07), 0 1px 2px rgba(11,37,69,0.04);
  --shadow-elevated: 0 4px 16px rgba(11,37,69,0.10);
  --shadow-panel: -4px 0 20px rgba(11,37,69,0.10);
  --shadow-dropdown: 0 8px 24px rgba(11,37,69,0.12);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ─── Buttons ─────────────────────────────────────────── */
button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
  line-height: 1;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-hover); }

.btn-secondary {
  background: #fff;
  color: var(--text-body);
  border: 1px solid var(--border-input);
}
.btn-secondary:hover { background: var(--bg-page); }

.btn-ghost {
  background: transparent;
  color: var(--blue);
  padding: 7px 14px;
}
.btn-ghost:hover { background: var(--blue-light); }

.btn-danger {
  background: #DC2626;
  color: #fff;
}
.btn-danger:hover { background: #B91C1C; }

.btn-teal {
  background: var(--teal);
  color: #fff;
}
.btn-teal:hover { background: var(--teal-dark); }

.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
}

/* ─── Cards ───────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-card);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* ─── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge-active       { background: var(--badge-active-bg); color: var(--badge-active-text); }
.badge-onboarding   { background: var(--badge-onboarding-bg); color: var(--badge-onboarding-text); }
.badge-engagement   { background: var(--badge-engagement-bg); color: var(--badge-engagement-text); }
.badge-evidence     { background: var(--badge-evidence-bg); color: var(--badge-evidence-text); }
.badge-ird_engaged  { background: var(--badge-ird-bg); color: var(--badge-ird-text); }
.badge-arrangement  { background: var(--badge-arrangement-bg); color: var(--badge-arrangement-text); }
.badge-closed       { background: var(--badge-closed-bg); color: var(--badge-closed-text); }
.badge-qualification { background: var(--badge-qualification-bg); color: var(--badge-qualification-text); }
.badge-high         { background: var(--badge-high-bg); color: var(--badge-high-text); }
.badge-medium       { background: var(--badge-medium-bg); color: var(--badge-medium-text); }
.badge-low          { background: var(--badge-low-bg); color: var(--badge-low-text); }
.badge-hot          { background: var(--badge-hot-bg); color: var(--badge-hot-text); }
.badge-warm         { background: var(--badge-warm-bg); color: var(--badge-warm-text); }
.badge-cold         { background: var(--badge-cold-bg); color: var(--badge-cold-text); }
.badge-new          { background: var(--badge-new-bg); color: var(--badge-new-text); }
.badge-open         { background: var(--badge-engagement-bg); color: var(--badge-engagement-text); }

/* ─── Top Bar ─────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 56px;
  background: var(--navy-900);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.topbar-app-name {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-search {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  min-height: unset;
}
.topbar-search:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ─── App shell ───────────────────────────────────────── */
.app-main {
  flex: 1;
  min-height: 100vh;
  padding-top: 56px;
}

@media (max-width: 640px) {
  .app-main {
    margin-left: 0;
    margin-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    min-height: unset;
  }
}

/* ─── Page layout ─────────────────────────────────────── */
.page-content {
  padding: 28px 32px;
  max-width: 1280px;
}

@media (max-width: 640px) {
  .page-content { padding: 16px 16px; }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

@media (max-width: 640px) {
  .page-header {
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .page-header .btn-primary,
  .page-header button {
    flex-shrink: 0;
  }
}

.page-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 4px;
}

.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 16px;
}

.empty-text {
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px 0;
  text-align: center;
}

/* ─── Tables ──────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--border-divider);
}

td {
  padding: 12px 12px 12px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-divider);
  color: var(--text-body);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(240,244,248,0.5); }

/* ─── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-body);
  background: var(--bg-input);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,140,255,0.12);
}

textarea { resize: vertical; min-height: 72px; }

/* ─── Modals ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(11,37,69,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-dropdown);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 24px;
}

/* ─── Empty state ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.empty-state p { font-size: 14px; max-width: 320px; margin: 0 auto; }

/* ─── KPI icon circles ────────────────────────────────── */
.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-navy { background: var(--navy-900); }
.kpi-icon-teal { background: var(--teal); }
.kpi-icon-amber { background: #F59E0B; }
.kpi-icon-blue { background: var(--blue); }
.kpi-icon-red { background: #EF4444; }

/* ─── Utility ─────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-heading { color: var(--text-heading); }
.text-teal { color: var(--teal); }
.text-blue { color: var(--blue); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ─── Global mobile overrides ─────────────────────────── */
@media (max-width: 640px) {
  /* Touch targets: min 44px tall */
  .btn, button { min-height: 44px; }

  /* Modals: full-width sheet on mobile */
  .modal {
    padding: 24px 20px;
    border-radius: 12px 12px 0 0;
    max-width: 100%;
    align-self: flex-end;
    max-height: 85vh;
  }
  .modal-overlay { align-items: flex-end; }

  /* Inputs: 16px font to prevent iOS zoom */
  input, select, textarea { font-size: 16px !important; }
}

/* ─── Filter bar mobile scroll ────────────────────────── */
@media (max-width: 640px) {
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 6px;
  }
  .filter-btn { flex-shrink: 0; font-size: 13px; padding: 7px 12px; }
}
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0B2545 0%, #1B3A6B 60%, #134074 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Subtle bg circles */
.login-page::before,
.login-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  opacity: 0.06;
  background: #fff;
  pointer-events: none;
}
.login-page::before {
  width: 500px; height: 500px;
  top: -150px; right: -100px;
}
.login-page::after {
  width: 360px; height: 360px;
  bottom: -120px; left: -80px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 44px 40px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(11,37,69,0.35);
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.login-logo-text {
  display: flex;
  flex-direction: column;
}

.login-brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.login-brand-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 1px;
}

.login-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.login-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-form .form-group {
  margin-bottom: 18px;
}

.login-form .form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
  display: block;
}

.login-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border-input);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-body);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.login-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,140,255,0.13);
}

.login-submit {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s, transform 0.1s;
}

.login-submit:hover { background: var(--blue-hover); }
.login-submit:active { transform: scale(0.99); }

.login-error {
  background: #FEE2E2;
  border: 1px solid #FECACA;
  color: #DC2626;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 18px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-caption);
}

/* ─── Mobile ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .login-card { padding: 32px 24px 28px; border-radius: 12px; }
  .login-form input { font-size: 16px; } /* prevents iOS auto-zoom */
  .login-submit { font-size: 16px; padding: 14px 20px; }
}
.dashboard {
  padding: 28px 32px;
  max-width: 1300px;
}

@media (max-width: 640px) {
  .dashboard { padding: 16px 16px; }
}

/* ─── Page Header ─────────────────────────────────────── */
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.dashboard-header-meta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 4px;
}

/* ─── KPI Cards ───────────────────────────────────────── */
.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 1100px) {
  .dashboard-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .dashboard-kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
  .kpi-card { padding: 14px 12px; gap: 10px; }
  .kpi-value { font-size: 24px; }
}

.kpi-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 16px;
}

.kpi-card-body { flex: 1; min-width: 0; }

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.1;
}

.kpi-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.kpi-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.kpi-trend-up { color: #0D9F6E; }
.kpi-trend-down { color: #DC2626; }
.kpi-trend-neutral { color: var(--text-muted); }

/* ─── Kanban Pipeline ─────────────────────────────────── */
.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kanban-col {
  background: #F7F9FC;
  border-radius: 12px;
  border: 1px solid var(--border-card);
  overflow: hidden;
}

.kanban-col-header {
  padding: 14px 16px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-divider);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.kanban-col-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
}

.kanban-col-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}

.kanban-count {
  background: var(--navy-900);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kanban-cards {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}

.matter-card {
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border-card);
  padding: 14px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}

.matter-card:hover {
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}

.matter-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.matter-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
}

.matter-card-chevron {
  color: var(--text-caption);
  font-size: 16px;
  line-height: 1;
}

.matter-card-ref {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.matter-card-owner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.matter-card-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy-600);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.matter-card-owner-info {
  flex: 1;
  min-width: 0;
}

.matter-card-owner-label {
  font-size: 10px;
  color: var(--text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

.matter-card-owner-name {
  font-size: 12.5px;
  color: var(--text-body);
  font-weight: 500;
  line-height: 1.3;
}

.matter-card-due {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-divider);
  padding-top: 9px;
  margin-top: 2px;
}

.matter-card-due svg {
  width: 13px;
  height: 13px;
  stroke: var(--teal);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.matter-card-due.overdue { color: #DC2626; }
.matter-card-due.overdue svg { stroke: #DC2626; }

/* Stage accent colours on left border */
.kanban-col.stage-onboarding  .matter-card { border-left: 3px solid var(--teal); }
.kanban-col.stage-evidence     .matter-card { border-left: 3px solid #F59E0B; }
.kanban-col.stage-ird_engaged  .matter-card { border-left: 3px solid #3B82F6; }
.kanban-col.stage-arrangement  .matter-card { border-left: 3px solid #0D9F6E; }
.kanban-col.stage-qualification .matter-card { border-left: 3px solid var(--text-caption); }
.kanban-col.stage-closed       .matter-card { border-left: 3px solid var(--text-caption); }
.kanban-col.stage-engagement   .matter-card { border-left: 3px solid var(--blue); }

/* ─── Bottom Grid ─────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .kanban-board {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }
  .kanban-col {
    min-width: 240px;
    scroll-snap-align: start;
    flex-shrink: 0;
  }
  .kanban-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .dashboard-header { flex-direction: column; gap: 8px; }
}

/* ─── Task list ───────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-divider);
}

.task-item:last-child { border-bottom: none; }

.task-title {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-body);
}

.task-due {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.matter-detail { padding: 28px 32px; max-width: 1200px; }

/* ─── Client header banner ────────────────────────────── */
.client-banner {
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  padding: 24px 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.client-banner-logo {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-500));
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.client-banner-info { flex: 1; min-width: 0; }
.client-banner-name { font-size: 22px; font-weight: 700; color: var(--text-heading); line-height: 1.2; }
.client-banner-ref  { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.client-banner-meta {
  display: flex;
  gap: 24px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.client-meta-item { display: flex; flex-direction: column; gap: 2px; }
.client-meta-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-caption); }
.client-meta-value { font-size: 13.5px; font-weight: 600; color: var(--text-body); }

.client-banner-status { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }

/* ─── Tabs ────────────────────────────────────────────── */
.matter-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-divider);
  margin-bottom: 24px;
  gap: 2px;
}

.matter-tab {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color 0.15s, border-color 0.15s;
}

.matter-tab:hover { color: var(--text-heading); }

.matter-tab.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
  font-weight: 600;
}

/* ─── 2-column layout ─────────────────────────────────── */
.matter-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .matter-layout { grid-template-columns: 1fr; }
}

/* ─── Timeline ────────────────────────────────────────── */
.timeline { position: relative; }

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.timeline-filter {
  padding: 7px 12px;
  border: 1.5px solid var(--border-input);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-body);
  background: #fff;
  cursor: pointer;
  outline: none;
  width: auto;
}

.timeline-list { position: relative; }

/* Vertical line */
.timeline-list::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border-divider);
}

.timeline-entry {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  position: relative;
}

.timeline-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.timeline-dot-email   { background: #EBF5FF; }
.timeline-dot-note    { background: #FFF8E1; }
.timeline-dot-doc     { background: #E0F7F6; }
.timeline-dot-status  { background: #F3E8FF; }
.timeline-dot-default { background: var(--bg-page); }

.timeline-dot svg {
  width: 18px; height: 18px;
  stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}

.timeline-content { flex: 1; min-width: 0; }

.timeline-entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.timeline-entry-type {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-entry-time {
  font-size: 11.5px;
  color: var(--text-caption);
  white-space: nowrap;
}

.timeline-entry-body {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.timeline-entry-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.timeline-entry-text {
  font-size: 13px;
  color: var(--text-body);
  line-height: 1.5;
}

/* ─── Right panel ─────────────────────────────────────── */
.matter-panel { display: flex; flex-direction: column; gap: 16px; }

/* Hearing countdown */
.hearing-countdown {
  background: #FFF5F5;
  border: 1px solid #FECACA;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hearing-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #FEE2E2;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.hearing-label { font-size: 11px; font-weight: 600; color: #DC2626; text-transform: uppercase; letter-spacing: 0.05em; }
.hearing-value { font-size: 22px; font-weight: 700; color: var(--text-heading); line-height: 1.1; }
.hearing-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Key dates timeline */
.key-dates { }
.key-dates-title { font-size: 14px; font-weight: 700; color: var(--text-heading); margin-bottom: 16px; }

.key-date-item {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  position: relative;
}

.key-date-item::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 20px;
  bottom: -14px;
  width: 2px;
  background: var(--border-divider);
}

.key-date-item:last-child::before { display: none; }

.key-date-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-card);
  background: var(--bg-page);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  display: flex; align-items: center; justify-content: center;
}

.key-date-dot.done {
  background: var(--teal);
  border-color: var(--teal);
}

.key-date-dot.done::after {
  content: '';
  width: 6px; height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

.key-date-dot.current {
  background: var(--blue);
  border-color: var(--blue);
}

.key-date-info { flex: 1; }
.key-date-name { font-size: 13px; font-weight: 600; color: var(--text-body); line-height: 1.3; }
.key-date-val  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* Next action */
.next-action {
  background: var(--blue-light);
  border: 1px solid rgba(26,140,255,0.15);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.next-action-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.next-action-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--blue); margin-bottom: 3px; }
.next-action-title { font-size: 14px; font-weight: 700; color: var(--text-heading); }
.next-action-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Evidence progress */
.evidence-ring-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.evidence-ring {
  position: relative;
  width: 64px; height: 64px;
  flex-shrink: 0;
}

.evidence-ring svg {
  width: 64px; height: 64px;
  transform: rotate(-90deg);
}

.evidence-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
}

.evidence-info-title { font-size: 14px; font-weight: 700; color: var(--text-heading); }
.evidence-info-sub   { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ─── Details grid ────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-item { }
.detail-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.detail-value { font-size: 13.5px; color: var(--text-body); font-weight: 500; }

/* Notes */
.matter-notes {
  background: var(--bg-page);
  border-radius: 8px;
  padding: 14px;
  font-size: 13.5px;
  color: var(--text-body);
  line-height: 1.55;
  white-space: pre-wrap;
  min-height: 80px;
}

/* Stage stepper */
.stage-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.stage-step {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: default;
}

.stage-step-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-muted);
}

.stage-step.done .stage-step-inner   { color: var(--teal); }
.stage-step.active .stage-step-inner { background: var(--navy-900); color: #fff; }

.stage-step-arrow {
  color: var(--border-input);
  font-size: 18px;
  margin: 0 2px;
  flex-shrink: 0;
}

.stage-step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--border-divider);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stage-step.done .stage-step-num { background: var(--teal); color: #fff; }
.stage-step.active .stage-step-num { background: rgba(255,255,255,0.25); color: #fff; }

/* ─── Mobile ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .matter-detail { padding: 16px 16px; }

  .client-banner { padding: 16px; flex-direction: column; gap: 12px; }
  .client-banner-actions { flex-wrap: wrap; gap: 8px; }

  .matter-tabs { gap: 4px; }
  .matter-tab { font-size: 12px; padding: 7px 10px; }

  .timeline-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .timeline-filter { font-size: 16px; } /* prevent iOS zoom */
}
/* ─── Compliance page layout ───────────────────────────── */
.comp-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.comp-header-area {
  padding-bottom: 0;
}

.comp-filters {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  padding-bottom: 4px;
  flex-wrap: wrap;
}

.comp-filter-pill {
  padding: 7px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border-card);
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  min-height: unset;
}

.comp-filter-pill:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.comp-filter-pill.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

/* ─── Body: calendar + right panel ────────────────────── */
.comp-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  padding-top: 16px;
  padding-bottom: 8px;
  align-items: start;
}

/* ─── Calendar card ────────────────────────────────────── */
.comp-calendar-card {
  padding: 20px;
}

.comp-calendar-month {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 14px;
}

.comp-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.comp-dow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0 8px;
  letter-spacing: 0.05em;
}

.comp-cell {
  min-height: 72px;
  border-radius: 8px;
  padding: 6px 5px 4px;
  position: relative;
  transition: background 0.12s;
}

.comp-cell:hover {
  background: rgba(10, 186, 181, 0.05);
}

.comp-cell.today {
  background: rgba(10, 186, 181, 0.08);
  outline: 1.5px solid var(--teal);
}

.comp-cell-day {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-body);
  display: block;
  margin-bottom: 3px;
}

.comp-cell.today .comp-cell-day {
  color: var(--teal);
}

.comp-cell-badges {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.comp-cell-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}

/* ─── Badge ────────────────────────────────────────────── */
.comp-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

/* ─── Right panel ──────────────────────────────────────── */
.comp-right-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comp-next7-card {
  padding: 18px;
}

.comp-overdue-list-card {
  padding: 18px;
}

.comp-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.comp-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
}

.comp-panel-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-page);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.comp-next7-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.comp-next7-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}

.comp-next7-item:hover {
  background: var(--bg-page);
}

.comp-overdue-item {
  border-left: 3px solid #EF4444;
  padding-left: 10px;
}

.comp-next7-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  width: 36px;
  flex-shrink: 0;
  text-align: center;
}

.comp-next7-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.comp-next7-client {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.comp-next7-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.comp-status-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.comp-status-upcoming { background: #EFF6FF; color: #3B82F6; }
.comp-status-filed { background: #E6F9F0; color: #0D9F6E; }
.comp-status-overdue { background: #FEE2E2; color: #DC2626; }

.comp-chevron {
  width: 14px;
  height: 14px;
  stroke: var(--text-caption);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Stats bar ────────────────────────────────────────── */
.comp-stats-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border-card);
  padding: 18px 28px;
  margin-top: 4px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
  gap: 16px;
}

.comp-stat {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comp-stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1;
}

.comp-stat-num.comp-stat-green { color: #0D9F6E; }
.comp-stat-num.comp-stat-blue  { color: #3B82F6; }
.comp-stat-num.comp-stat-red   { color: #DC2626; }

.comp-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.4;
}

.comp-stat-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-caption);
}

.comp-stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border-divider);
  margin: 0 8px;
}

.comp-stat-tag {
  margin-left: auto;
  background: var(--teal-light);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
}

/* ─── Slide-out panel ──────────────────────────────────── */
.comp-slide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 37, 69, 0.4);
  z-index: 300;
  display: flex;
  justify-content: flex-end;
  backdrop-filter: blur(2px);
}

.comp-slide-panel {
  width: 380px;
  max-width: 100vw;
  background: #fff;
  height: 100%;
  overflow-y: auto;
  padding: 28px 24px;
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comp-slide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.comp-slide-warning {
  font-size: 13px;
  font-weight: 700;
  color: #DC2626;
  background: #FEE2E2;
  padding: 6px 12px;
  border-radius: 8px;
}

.comp-slide-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  min-height: unset;
}

.comp-slide-close:hover {
  background: var(--bg-page);
  color: var(--text-heading);
}

.comp-slide-client {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
}

.comp-slide-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.comp-slide-due {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.comp-overdue-tag {
  background: #FEE2E2;
  color: #DC2626;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
}

.comp-slide-owner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-page);
  border-radius: 10px;
}

.comp-owner-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.comp-owner-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
}

.comp-owner-title {
  font-size: 12px;
  color: var(--text-muted);
}

.comp-slide-desc {
  font-size: 14px;
  color: var(--text-body);
  padding: 12px;
  background: var(--bg-page);
  border-radius: 8px;
  border-left: 3px solid var(--teal);
}

.comp-slide-btn {
  width: 100%;
  text-align: center;
}

.comp-slide-related {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comp-related-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.comp-related-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-body);
}
/* ─── Assistant page: 3-column layout ──────────────────── */
.ast-page {
  display: grid;
  grid-template-columns: 38fr 38fr 24fr;
  gap: 0;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ─── Column base ───────────────────────────────────────── */
.ast-col {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--border-divider);
}

.ast-col:last-child {
  border-right: none;
}

.ast-col-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--border-divider);
  flex-shrink: 0;
  background: #fff;
}

.ast-col-header-approvals {
  align-items: center;
}

.ast-col-header-left {
  flex: 1;
}

.ast-col-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

.ast-col-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  max-width: 260px;
}

/* ─── User badge (top-right of chat) ───────────────────── */
.ast-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-page);
  padding: 6px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}

.ast-user-badge-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.ast-user-badge-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1;
}

.ast-user-badge-role {
  font-size: 10px;
  color: var(--text-muted);
}

/* ─── Chat messages ─────────────────────────────────────── */
.ast-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg-page);
}

.ast-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.ast-msg-avatar {
  flex-shrink: 0;
}

.ast-avatar-user {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.ast-avatar-ai {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.ast-msg-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ast-msg-text {
  font-size: 13.5px;
  color: var(--text-body);
  line-height: 1.6;
  background: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  max-width: 95%;
}

.ast-msg-user .ast-msg-text {
  background: var(--navy-900);
  color: rgba(255,255,255,0.92);
}

.ast-msg-time {
  font-size: 11px;
  color: var(--text-caption);
  padding-left: 2px;
}

/* ─── Attachment card ───────────────────────────────────── */
.ast-doc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 10px 14px;
  max-width: 280px;
  cursor: pointer;
  transition: box-shadow 0.15s;
  box-shadow: var(--shadow-card);
}

.ast-doc-card:hover {
  box-shadow: var(--shadow-elevated);
}

.ast-doc-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.ast-doc-info {
  flex: 1;
}

.ast-doc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.ast-doc-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.ast-doc-chevron {
  font-size: 18px;
  color: var(--text-caption);
}

/* ─── Pending approval card ─────────────────────────────── */
.ast-pending-card {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  padding: 12px 14px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ast-pending-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ast-pending-clock {
  font-size: 14px;
}

.ast-pending-label {
  font-size: 13px;
  font-weight: 600;
  color: #92400E;
}

.ast-pending-badge {
  margin-left: auto;
  background: #FEF3C7;
  color: #D97706;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.ast-pending-desc {
  font-size: 12px;
  color: #78350F;
}

.ast-pending-doc {
  font-size: 11px;
  color: #92400E;
  opacity: 0.7;
}

/* ─── Input bar ─────────────────────────────────────────── */
.ast-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-divider);
  background: #fff;
  flex-shrink: 0;
}

.ast-input-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ast-mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-page);
  border: 1.5px solid var(--border-card);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-height: unset;
  padding: 0;
  transition: all 0.15s;
}

.ast-mic-btn.holding {
  background: var(--teal);
  border-color: var(--teal);
}

.ast-ptt-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.ast-input-right {
  display: flex;
  flex: 1;
  gap: 8px;
  align-items: center;
}

.ast-text-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border-input);
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  width: auto;
  transition: border-color 0.15s;
}

.ast-text-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(10, 186, 181, 0.1);
}

.ast-send-btn {
  border-radius: 20px;
  min-height: unset;
}

/* ─── Approval queue ────────────────────────────────────── */
.ast-pending-count {
  background: var(--teal-light);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  margin-left: 8px;
}

.ast-view-all {
  margin-left: auto;
  font-size: 12px;
  color: var(--blue);
  min-height: unset;
}

.ast-approvals-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-page);
}

.ast-approval-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border-card);
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ast-approval-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ast-approval-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ast-approval-info {
  flex: 1;
}

.ast-approval-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.3;
}

.ast-approval-category {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ast-approval-status-badge {
  background: #FEF3C7;
  color: #D97706;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
  flex-shrink: 0;
}

.ast-approval-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

.ast-approval-doc {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-page);
  padding: 8px 10px;
  border-radius: 8px;
}

.ast-approval-doc-icon {
  font-size: 16px;
}

.ast-approval-doc-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-heading);
  flex: 1;
}

.ast-approval-doc-size {
  font-size: 11px;
  color: var(--text-muted);
}

.ast-approval-actions {
  display: flex;
  gap: 8px;
}

.ast-approval-actions button {
  min-height: unset;
}

/* ─── Context panel ─────────────────────────────────────── */
.ast-col-context {
  overflow-y: auto;
  background: var(--bg-page);
  border-right: none;
  gap: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.ast-context-card {
  padding: 14px 16px;
}

.ast-context-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.ast-context-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-divider);
  gap: 8px;
}

.ast-context-row:last-child {
  border-bottom: none;
}

.ast-context-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.ast-context-value {
  font-size: 12.5px;
  color: var(--text-body);
  text-align: right;
}

.ast-contact-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ast-contact-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #E2E8F0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

/* Activity */
.ast-activity-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
}

.ast-activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.ast-dot-green  { background: #0D9F6E; }
.ast-dot-orange { background: #E8850C; }
.ast-dot-red    { background: #DC2626; }
.ast-dot-blue   { background: #3B82F6; }

.ast-activity-text {
  flex: 1;
  font-size: 12px;
  color: var(--text-body);
  line-height: 1.4;
}

.ast-activity-time {
  font-size: 10px;
  color: var(--text-caption);
  flex-shrink: 0;
}

/* Scope */
.ast-scope-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-page);
  border: 1px solid var(--border-card);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 8px;
}

.ast-scope-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.ast-scope-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Quick reference */
.ast-quickref-card {
  gap: 0;
}

.ast-qr-module {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-caption);
  margin-bottom: 4px;
}

.ast-qr-section {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-heading);
  margin-bottom: 12px;
}

.ast-qr-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 10px;
  font-style: italic;
}

.ast-qr-heading {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 12px;
  margin-bottom: 5px;
}

.ast-qr-text {
  font-size: 12px;
  color: var(--text-body);
  line-height: 1.55;
}

.ast-qr-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ast-qr-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12px;
  color: var(--text-body);
  line-height: 1.4;
}

.ast-qr-check {
  color: var(--teal);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy-900);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  padding-bottom: 12px;
}

/* ─── Mobile: bottom tab bar ──────────────────────────── */
@media (max-width: 640px) {
  .sidebar {
    width: 100%;
    min-height: unset;
    height: 60px;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  .sidebar-logo { display: none; }

  .sidebar-nav {
    flex: 1;
    flex-direction: row;
    align-items: stretch;
    padding: 0;
    gap: 0;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-link {
    flex: 1;
    width: auto;
    padding: 6px 4px 4px;
    border-radius: 0;
    min-width: 50px;
    justify-content: center;
  }

  .sidebar-link.active::before {
    left: 50%;
    top: -1px;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
  }

  .sidebar-divider { display: none; }

  .sidebar-footer {
    flex-direction: row;
    align-items: center;
    border-top: none;
    border-left: 1px solid rgba(255,255,255,0.07);
    padding: 0 10px;
    gap: 4px;
    width: auto;
  }

  .sidebar-logout-btn { display: none; }
}

/* Logo mark */
.sidebar-logo {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.sidebar-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 2px;
  width: 100%;
}

.sidebar-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50px;
  padding: 9px 0 8px;
  border-radius: 10px;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  position: relative;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
}

.sidebar-link.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 28px;
  background: var(--teal);
  border-radius: 0 3px 3px 0;
}

.sidebar-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 4px;
  text-transform: uppercase;
  opacity: 0.85;
}

/* Divider */
.sidebar-divider {
  width: 32px;
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 6px auto;
  flex-shrink: 0;
}

/* Footer avatar */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
  border-top: 1px solid rgba(255,255,255,0.07);
  width: 100%;
  gap: 8px;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy-600);
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.15);
  transition: border-color 0.15s;
}

.sidebar-avatar:hover {
  border-color: var(--teal);
}

.sidebar-logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.3);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.sidebar-logout-btn:hover {
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.07);
}
