/* ============================================================
   Google Fonts
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT,WONK@0,9..144,300..700,0..100,0..1;1,9..144,300..700,0..100,0..1&family=DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  /* Per-client accent — overridden at runtime by dashboard.js from config.js */
  --primary:        #b85a3f;   /* terracotta default; client primary_color overrides */
  --secondary:      #f1d9cf;   /* client secondary_color overrides */

  /* Warm "paper" base palette (fixed — the editorial look) */
  --paper:          #f3ecdc;
  --paper-2:        #ebe2cd;
  --paper-card:     #fbf6e9;
  --paper-card-2:   #fefaf0;
  --ink:            #1c1916;
  --ink-soft:       #5a544b;
  --ink-mute:       #8d8678;
  --navy:           #1e2d40;
  --navy-mid:       #44546d;
  --sage:           #5d7e63;
  --gold:           #c79633;
  --rule:           #d6c8ad;
  --rule-soft:      #e3d7bd;

  /* Semantic aliases (kept so existing component rules just re-theme) */
  --primary-dark:   var(--navy);
  --primary-mid:    var(--navy-mid);
  --primary-light:  var(--secondary);
  --accent:         var(--gold);
  --accent-light:   rgba(199,150,51,.14);
  --text:           var(--ink);
  --text-muted:     var(--ink-soft);
  --border:         var(--rule);
  --bg:             var(--paper);
  --white:          var(--paper-card);
  --danger:         #b3402a;
  --success:        var(--sage);
  --warn:           #9a6b16;

  --sidebar-width:  240px;
  --radius:         10px;
  --radius-lg:      20px;
  --shadow:         0 1px 0 rgba(28,25,22,.03), 0 14px 32px -20px rgba(28,25,22,.20);
  --shadow-lg:      0 24px 60px -24px rgba(28,25,22,.30);

  --font-display:   'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-ui:        'DM Sans', system-ui, sans-serif;
  --font-mono:      'JetBrains Mono', ui-monospace, monospace;

  /* Paper texture overlays */
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .1 0 0 0 0 .09 0 0 0 0 .07 0 0 0 .30 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  --grid: radial-gradient(circle at 1px 1px, rgba(28,25,22,.05) 1px, transparent 0);

  /* Theme engine helpers — overridden per-theme by theme.js */
  --topbar-bg:     rgba(251,246,233,.82);
  --surface-alt:   #fafbfd;
  --border-dashed: #cdd6e2;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  background-image: var(--noise), var(--grid);
  background-size: 160px 160px, 22px 22px;
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Fraunces — soft, warm display axes */
h1, h2, h3, h4 {
  font-variation-settings: "opsz" 48, "SOFT" 100, "WONK" 0;
  font-feature-settings: "ss01", "kern";
}

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

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse 70% 55% at 18% 50%, rgba(184,90,63,.10) 0%, transparent 62%),
    radial-gradient(ellipse 50% 50% at 85% 12%, rgba(199,150,51,.12) 0%, transparent 55%),
    var(--noise), var(--grid);
  background-size: auto, auto, 160px 160px, 22px 22px;
  position: relative;
  overflow: hidden;
}

/* Subtle grid overlay */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 64px, rgba(255,255,255,.024) 64px, rgba(255,255,255,.024) 65px),
    repeating-linear-gradient(90deg, transparent, transparent 64px, rgba(255,255,255,.024) 64px, rgba(255,255,255,.024) 65px);
  pointer-events: none;
}

/* Decorative gold ring */
.login-page::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  border: 1px solid rgba(184,147,42,.1);
  top: -160px;
  right: -160px;
  pointer-events: none;
}

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--white);
  border-radius: 18px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-lg);
  animation: cardIn .55s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo img {
  height: 60px;
  object-fit: contain;
  margin-bottom: 14px;
}
.login-logo h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: .02em;
  line-height: 1.2;
}
.login-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 6px;
}

/* Gold divider under logo */
.login-logo::after {
  content: '';
  display: block;
  width: 36px;
  height: 2px;
  background: var(--accent);
  margin: 14px auto 0;
  border-radius: 2px;
}

.login-footer {
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.login-forgot {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--primary-mid);
  text-decoration: underline;
}
.login-forgot:hover { color: var(--primary-dark); }
.info-msg {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 12px;
}

/* ============================================================
   Forms
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 7px;
  color: var(--text-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-card-2);
  transition: border-color .15s, box-shadow .15s, background .15s;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  background: var(--paper-card-2, #fff);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.error-msg {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  color: var(--danger);
  padding: 10px 13px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 22px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: background .15s, box-shadow .15s, transform .1s;
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,.08) 0%, transparent 100%);
  pointer-events: none;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(15,35,71,.28);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary:where(form *) { width: 100%; margin-top: 6px; }

/* Login page: gold accent on primary button */
.login-card .btn-primary {
  background: var(--accent);
  color: #fff;
}
.login-card .btn-primary:hover {
  background: #9e7c22;
  box-shadow: 0 4px 18px rgba(184,147,42,.35);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  background: var(--white);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover {
  background: var(--bg);
  border-color: #c5cdd8;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--navy-mid);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .04em;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-logout:hover {
  background: var(--secondary);
  border-color: var(--primary);
  color: var(--primary);
}

.link { color: var(--primary-mid); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================
   Dashboard Layout
   ============================================================ */
.dashboard-page {
  display: block;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #152340 0%, #0b1830 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 2px 0 24px rgba(0,0,0,.22);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(184,147,42,.2);
}
.sidebar-logo img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}
.sidebar-logo span {
  color: var(--white);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.2;
  white-space: normal;
  overflow: hidden;
}

/* Gold decorative dot before firm name */
.sidebar-logo::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 6px;
  color: rgba(255,255,255,.58);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  transition: background .15s, color .15s, border-color .15s;
  border-left: 2px solid transparent;
  position: relative;
}
.nav-item svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  opacity: .85;
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
  border-left-color: rgba(184,147,42,.4);
}
.nav-item.active {
  background: rgba(255,255,255,.1);
  color: var(--white);
  border-left-color: var(--accent);
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-email {
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
  letter-spacing: .02em;
}

/* Main content */
.main-content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 28px 56px;
}

/* ============================================================
   Top header + horizontal tab bar (katychavez-style)
   ============================================================ */
.topbar {
  background: var(--topbar-bg, rgba(251,246,233,.82));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 100;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 0 28px; height: 66px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.topbar-brand { display: flex; align-items: center; gap: 13px; }
.topbar-seal {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.topbar-seal img { width: 100%; height: 100%; object-fit: cover; }
.topbar-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-name {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 24, "SOFT" 100, "WONK" 0;
  font-size: 19px; font-weight: 500; color: var(--navy); letter-spacing: .005em;
}
.topbar-tagline {
  font-family: var(--font-mono);
  font-size: 9.5px; color: var(--ink-soft);
  letter-spacing: .22em; text-transform: uppercase; margin-top: 3px;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-meta {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
  color: var(--ink-soft);
}
.topbar-meta-label { text-transform: uppercase; letter-spacing: .18em; color: var(--ink-mute); }
.topbar-date { color: var(--ink); }
.topbar-status { display: inline-flex; align-items: center; gap: 6px; color: var(--sage); font-weight: 600; }
.topbar-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 22%, transparent);
}
/* Admin Users link lives in the header (not an automation tab) */
.topbar-users {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--navy-mid);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px; font-weight: 500; letter-spacing: .04em;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.topbar-users svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.topbar-users:hover,
.topbar-users.active { background: var(--secondary); border-color: var(--primary); color: var(--primary); }

.tabbar {
  max-width: 1180px; margin: 0 auto; width: 100%;
  padding: 0 28px;
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
}
.tabbar::-webkit-scrollbar { height: 5px; }
.tabbar::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
/* Override the old vertical-sidebar nav-item styling for horizontal tabs */
.tabbar .nav-item {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  background: transparent;
  border: 0; border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -1px;
  padding: 15px 16px;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 13.5px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tabbar .nav-item svg { display: none; }
.tabbar .nav-item:hover { background: transparent; color: var(--navy); border-left: 0; }
.tabbar .nav-item.active {
  background: transparent;
  color: var(--navy);
  border-left: 0;
  border-bottom-color: var(--primary);
}

/* ============================================================
   Tab sections
   ============================================================ */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeUp .3s cubic-bezier(.16,1,.3,1) both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tab-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1.5px solid var(--border);
}
.tab-header h2 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: .01em;
  line-height: 1;
}
.tab-header .btn-primary { margin-left: auto; align-self: center; }
.tab-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  align-self: center;
}

/* ============================================================
   Cards & Upload
   ============================================================ */
.upload-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.upload-card > p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.65;
}

.upload-zone {
  border: 2px dashed var(--border-dashed, #cdd6e2);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 16px;
  background: var(--surface-alt, #fafbfd);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary-mid);
  background: var(--primary-light);
}
.upload-zone svg {
  width: 34px;
  height: 34px;
  stroke: #a0aec0;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 10px;
}
.upload-zone p { color: var(--text-muted); font-size: 13px; }

.file-name {
  background: var(--primary-light);
  border: 1.5px solid rgba(44,95,138,.3);
  color: var(--primary);
  border-radius: var(--radius);
  padding: 8px 13px;
  font-size: 13px;
  margin-bottom: 16px;
  font-weight: 500;
}

/* ============================================================
   Results Area
   ============================================================ */
.results-area {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1.5px solid var(--border);
  background: var(--surface-alt, #fafbfd);
}
.results-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  color: var(--primary-dark);
  letter-spacing: .01em;
}
.results-content {
  padding: 24px;
  max-height: 600px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.75;
}

/* Proof scan HTML result styling */
.results-content h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 20px 0 10px;
  color: var(--primary);
}
.results-content h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
}
.results-content table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.results-content th {
  background: var(--surface-alt, #f5f7fa);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.results-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.results-content ul, .results-content ol { padding-left: 20px; margin: 8px 0; }
.results-content li { margin-bottom: 4px; }
.results-content strong { font-weight: 600; }
.results-content p { margin-bottom: 8px; }

/* ============================================================
   Client Grid
   ============================================================ */
.search-bar {
  margin-bottom: 22px;
}
.search-bar input {
  width: 100%;
  max-width: 380px;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--border);
  border-radius: 40px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 14px center no-repeat;
  outline: none;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.search-bar input:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(44,95,138,.12);
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.client-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  border: 1.5px solid var(--border);
  position: relative;
  overflow: hidden;
}
.client-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .2s cubic-bezier(.16,1,.3,1);
  border-radius: 3px 0 0 3px;
}
.client-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: #c5cdd8;
}
.client-card:hover::before { transform: scaleY(1); }

.client-card-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--primary-dark);
  letter-spacing: .01em;
}
.client-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.client-card-docs {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 44px;
  height: 44px;
  stroke: #c5cdd8;
  fill: none;
  stroke-width: 1.5;
  margin-bottom: 16px;
}
.empty-state p { font-size: 14px; }

/* ============================================================
   History
   ============================================================ */
.history-section { margin-top: 10px; }
.history-section h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 14px;
  color: var(--text-muted);
}

.history-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
  border: 1px solid var(--border);
}
.history-item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateX(3px);
}
.history-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.history-item-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--primary-mid);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.history-item-info { flex: 1; min-width: 0; }
.history-item-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.history-item-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: .04em;
}
.status-success          { background: #dcfce7; color: var(--success); }
.status-pass             { background: #dcfce7; color: var(--success); }
.status-completed        { background: #dcfce7; color: var(--success); }
.status-error            { background: #fef2f2; color: var(--danger); }
.status-pending          { background: #fef9c3; color: var(--warn); }
.status-needs_correction { background: #fff7ed; color: var(--warn); }

/* ============================================================
   Calendar  (compact — fits without scrolling)
   ============================================================ */
.calendar-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-top: 20px;
  border: 1px solid var(--border);
  max-width: 460px;      /* keep cells from sprawling across full width */
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.calendar-header h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: .01em;
}
.calendar-header button {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 14px;
  color: var(--text-muted);
  transition: background .15s, border-color .15s, color .15s;
}
.calendar-header button:hover {
  background: var(--bg);
  border-color: #a0aec0;
  color: var(--text);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day-header {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 5px 0 6px;
}
.cal-day {
  height: 34px;                /* fixed height — no aspect-ratio sprawl */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 12px;
  cursor: default;
  padding: 2px;
  transition: background .12s, color .12s;
}
.cal-day.has-mail {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}
.cal-day.has-mail:hover { background: var(--primary); color: var(--white); }
.cal-day.today {
  border: 2px solid var(--accent);
  color: var(--primary-dark);
  font-weight: 600;
}
.cal-day.other-month { color: #d1d8e4; }
.cal-day-count {
  font-size: 9px;
  line-height: 1;
  opacity: .8;
}

/* ============================================================
   Modal
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7,14,29,.6);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: cardIn .35s cubic-bezier(.16,1,.3,1) both;
}
.modal-header {
  display: flex;
  align-items: center;
  padding: 22px 26px;
  border-bottom: 1.5px solid var(--border);
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  flex: 1;
  color: var(--primary-dark);
  letter-spacing: .01em;
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-card form {
  padding: 24px 26px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* ============================================================
   Loading spinner
   ============================================================ */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Wide modal variant (client detail, scan result)
   ============================================================ */
.modal-card--wide {
  max-width: 720px;
}

/* ============================================================
   Client detail modal — tabs
   ============================================================ */
.detail-tabs {
  display: flex;
  border-bottom: 1.5px solid var(--border);
  background: #fafbfd;
  padding: 0 24px;
}
.detail-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 18px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .04em;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1.5px;
}
.detail-tab:hover  { color: var(--primary); }
.detail-tab.active { color: var(--primary); border-bottom-color: var(--accent); }

.detail-tab-pane {
  display: none;
  padding: 24px 26px;
  min-height: 220px;
  max-height: 60vh;
  overflow-y: auto;
}
.detail-tab-pane.active { display: block; animation: fadeUp .2s ease both; }

.cd-loading { color: var(--text-muted); font-size: 13px; }
.cd-error   { color: var(--danger);     font-size: 13px; }
.cd-empty   { color: var(--text-muted); font-size: 13px; font-style: italic; }

/* Overview */
.cd-overview-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1.5px solid var(--border);
}
.cd-avatar {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: .02em;
}
.cd-overview-name h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.2;
}
.cd-a-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .06em;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
  display: inline-block;
}
.cd-fields { display: flex; flex-direction: column; gap: 10px; }
.cd-field  { display: flex; gap: 16px; font-size: 13px; align-items: baseline; }
.cd-field-label {
  width: 100px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cd-field-value { color: var(--text); }

/* Activity feed */
.cd-activity-feed { display: flex; flex-direction: column; gap: 2px; }
.cd-activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  transition: background .12s;
}
.cd-activity-item:hover { background: var(--bg); }
.cd-activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cd-activity-icon svg {
  width: 15px; height: 15px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.cd-icon--proof_scan  { background: #eef2ff; color: #3730a3; }
.cd-icon--translation { background: #f0fdf4; color: #166534; }
.cd-icon--mail_sort   { background: #fff7ed; color: #9a3412; }

.cd-activity-body { flex: 1; min-width: 0; }
.cd-activity-desc { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-activity-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Related tab */
.cd-relation-list  { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.cd-relation-item  { display: flex; align-items: center; gap: 10px; }
.cd-relation-chip  {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
}
.cd-relation-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 7px;
  border-radius: 20px;
}
.cd-relation-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Add relationship section */
.cd-add-relation {
  border-top: 1.5px solid var(--border);
  padding-top: 18px;
  margin-top: 4px;
}
.cd-add-relation-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.cd-relate-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.cd-relate-input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.cd-relate-input:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(44,95,138,.12);
}
.cd-relate-results { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.cd-relate-candidate {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .12s, border-color .12s;
}
.cd-relate-candidate:hover  { background: var(--primary-light); }
.cd-relate-candidate.selected { border-color: var(--primary-mid); background: var(--primary-light); }

.cd-relate-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
}
.cd-relate-target {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}
.cd-relate-select {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  background: var(--white);
}

/* ============================================================
   Link panel (post-scan client linking)
   ============================================================ */
.link-panel {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  animation: fadeUp .25s ease both;
}
.link-panel-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--border);
}
.link-panel-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
}
.link-panel-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.link-person-list { display: flex; flex-direction: column; gap: 10px; }
.link-person-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.link-person-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}
.link-person-fullname { font-size: 13px; font-weight: 600; }
.link-person-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--border);
  padding: 2px 6px;
  border-radius: 20px;
}
.link-person-status {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

/* Match badges */
.link-match-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
}
.link-match-badge--exact { background: #dcfce7; color: var(--success); }

.link-match-name { font-size: 13px; color: var(--text); }

/* Fuzzy candidates */
.link-fuzzy-header { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; width: 100%; }
.link-fuzzy-footer { display: flex; gap: 8px; margin-top: 8px; width: 100%; }
.link-candidates   { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.link-candidate {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.link-candidate-name { font-weight: 600; flex: 1; }
.link-candidate-meta { color: var(--text-muted); font-size: 11px; }

/* Link buttons */
.link-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
  border: none;
  white-space: nowrap;
}
.link-btn--confirm { background: var(--primary); color: #fff; }
.link-btn--confirm:hover { background: var(--primary-dark); }
.link-btn--new  { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(184,147,42,.3); }
.link-btn--new:hover { background: rgba(184,147,42,.22); }
.link-btn--skip { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.link-btn--skip:hover { background: var(--border); }
.link-btn--view { background: var(--primary-light); color: var(--primary); border: 1px solid rgba(44,95,138,.2); flex-shrink: 0; }
.link-btn--view:hover { background: var(--primary); color: #fff; }

/* Status states */
.link-no-match      { font-size: 12px; color: var(--text-muted); font-style: italic; }
.link-status-ok     { font-size: 12px; font-weight: 600; color: var(--success); }
.link-status-skipped{ font-size: 12px; color: var(--text-muted); font-style: italic; }
.link-status-error  { font-size: 12px; color: var(--danger); }

/* Inline spinner (smaller than btn spinner) */
.spinner-sm {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(44,95,138,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}

/* ============================================================
   Mail summary recipients panel
   ============================================================ */
.mail-notify-section {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-top: 24px;
  box-shadow: var(--shadow);
}

.mail-notify-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
}
.mail-notify-section-header h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 4px;
}
.mail-notify-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.mail-notify-form {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  animation: fadeUp .18s ease both;
}
.mail-notify-form-fields {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.mail-notify-form-fields input {
  flex: 1;
  min-width: 180px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  background: var(--white);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.mail-notify-form-fields input:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(44,95,138,.1);
}
.mail-notify-form-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
  margin-bottom: 8px;
}
.mail-notify-form-actions {
  display: flex;
  gap: 8px;
}

.mail-notify-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mail-notify-empty {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 0;
}
.mail-notify-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background .12s;
}
.mail-notify-row:hover { background: var(--primary-light); }
.mail-notify-row-info  { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.mail-notify-email     { font-size: 13px; font-weight: 500; color: var(--text); }
.mail-notify-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.mail-notify-remove {
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color .12s, background .12s;
  flex-shrink: 0;
}
.mail-notify-remove:hover { color: var(--danger); background: #fee2e2; }
.mail-notify-remove svg  { width: 14px; height: 14px; }

/* client-card A-number chip */
.client-card-anum {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-muted);
  display: inline-block;
  margin-top: 2px;
}

/* Scan result modal */
.sr-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sr-html-result { font-size: 13px; line-height: 1.7; }
.sr-preview {
  white-space: pre-wrap;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}
.sr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sr-table th {
  background: var(--bg); padding: 8px 12px; text-align: left;
  font-weight: 600; border: 1px solid var(--border);
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
}
.sr-table td { padding: 8px 12px; border: 1px solid var(--border); vertical-align: top; }

/* ============================================================
   Rules Editor (Proof Scan customization)
   ============================================================ */
.rules-editor-section {
  margin-bottom: 24px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.rules-editor-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .04em;
  transition: background .15s, color .15s;
}
.rules-editor-toggle:hover {
  background: var(--bg);
  color: var(--text);
}
.rules-editor-toggle.open {
  color: var(--primary);
  border-bottom: 1.5px solid var(--border);
}
.rules-editor-toggle svg:first-child {
  width: 15px; height: 15px;
  stroke: currentColor; flex-shrink: 0;
}
.rules-editor-toggle span { flex: 1; }
.rules-chevron {
  width: 14px; height: 14px;
  stroke: currentColor;
  transition: transform .2s;
  flex-shrink: 0;
}
.rules-editor-toggle.open .rules-chevron { transform: rotate(180deg); }

.rules-editor-body {
  padding: 20px;
  animation: fadeUp .2s ease both;
}

.rules-editor-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 14px;
}

.rules-editor-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #fafbfd;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
  line-height: 1.65;
  resize: vertical;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 140px;
}
.rules-editor-textarea:focus {
  border-color: var(--primary-mid);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(44,95,138,.12);
}

.rules-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 12px;
}
.rules-editor-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* Feedback panels */
.rules-feedback {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.6;
}
.rules-feedback--ok {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 8px;
}
.rules-feedback--error {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 8px;
}
.rules-feedback--warn {
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  color: #78350f;
}
.rules-feedback--block {
  background: #fff1f2;
  border: 1.5px solid #fda4af;
  color: #881337;
}
.rules-feedback-icon { font-size: 15px; flex-shrink: 0; }

.rules-feedback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 6px;
}
.rules-feedback-summary {
  font-size: 12px;
  margin-bottom: 12px;
  opacity: .85;
}

/* Concern list */
.concern-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.concern-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255,255,255,.6);
  border-radius: 6px;
  padding: 10px 12px;
}
.concern-severity {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.concern-severity--high   { background: #fecdd3; color: #9f1239; }
.concern-severity--medium { background: #fed7aa; color: #9a3412; }
.concern-severity--low    { background: #fef9c3; color: #713f12; }

.concern-text { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.concern-text strong { font-weight: 600; }
.concern-suggestion { opacity: .75; font-style: italic; }

.rules-feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}
.btn-danger {
  background: #be123c !important;
}
.btn-danger:hover { background: #9f1239 !important; }

/* ============================================================
   Users tab (admin User Manager)
   ============================================================ */
.users-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.field-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.users-table-wrap {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.users-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #fafbfd;
  padding: 12px 18px;
  border-bottom: 1.5px solid var(--border);
}
.users-table tbody td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover { background: #fafbfd; }
.users-muted { color: var(--text-muted); }
.users-empty { text-align: center; color: var(--text-muted); padding: 28px; }
.users-actions-col { white-space: nowrap; text-align: right; }

.role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 3px 10px;
  border-radius: 999px;
}
.role-admin {
  background: var(--accent-light);
  color: var(--warn);
}
.role-user {
  background: var(--primary-light);
  color: var(--primary-mid);
}

.btn-row {
  background: var(--white);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: var(--radius);
  margin-left: 6px;
  transition: border-color .12s, color .12s, background .12s;
}
.btn-row:hover { border-color: var(--primary-mid); color: var(--primary-dark); }
.btn-row-danger:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  margin: -4px 0 14px;
  cursor: pointer;
}
.checkbox-row input { width: 15px; height: 15px; accent-color: var(--primary); }

/* ============================================================
   Proof scan rules — view / reset actions + modal
   ============================================================ */
.rules-editor-actions {
  display: flex;
  gap: 18px;
  margin: 12px 0 4px;
}
.btn-link-action {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link-action:hover { color: var(--primary-dark); }
.btn-link-danger { color: var(--danger); }
.btn-link-danger:hover { color: #7f1d1d; }

.rules-view-body {
  padding: 20px 26px 4px;
  max-height: 62vh;
  overflow-y: auto;
}
.rules-view-section { margin-bottom: 22px; }
.rules-view-section h4 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}
.rules-view-tag {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}
.rules-view-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 8px;
}
.rules-view-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* ============================================================
   Client Intake Docs
   ============================================================ */
.intake-review {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-top: 18px;
}
.intake-review-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.intake-review-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--primary-dark);
}
.intake-doc-type {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--primary-mid);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 999px;
}
.intake-review-hint { font-size: 13px; color: var(--text-muted); margin: 4px 0 14px; }
.intake-muted { color: var(--text-muted); font-size: 13px; }

.intake-people-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.intake-chip {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.intake-chip.active { border-color: var(--primary-mid); background: var(--primary-light); color: var(--primary-dark); }

.intake-match { margin-bottom: 14px; }
.intake-match-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fafbfd;
  border: 1px solid var(--border);
  font-size: 14px;
}
.intake-match-strong { background: var(--accent-light); border-color: var(--accent); }
.intake-match-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--warn);
  background: var(--white);
  border: 1px solid var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
}
.intake-match-badge-soft { color: var(--primary-mid); border-color: var(--primary-mid); }

.intake-fields-group { margin-bottom: 18px; }
.intake-fields-grouplabel {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 4px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.intake-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}
.intake-field { display: flex; flex-direction: column; gap: 4px; }
.intake-field label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.intake-field input {
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14.5px;
  background: var(--paper-card-2);
}
.intake-field input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}
.intake-field label { font-family: var(--font-mono); letter-spacing: .1em; }

.intake-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.intake-commit-msg { font-size: 13px; margin-top: 10px; }
.intake-saved { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.intake-saved-ok { color: var(--success); font-weight: 600; font-size: 14px; }

.cd-fields-grouplabel {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 18px 0 8px;
}

/* ============================================================
   Editable client card modal
   ============================================================ */
.modal-card--card {
  max-width: 880px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.modal-card--card .modal-close { position: absolute; top: 18px; right: 20px; z-index: 2; }

.cd-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 26px 28px 18px;
  border-bottom: 1.5px solid var(--border);
}
.cd-header .cd-avatar {
  width: 56px; height: 56px; flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary-dark);
  font-family: var(--font-display); font-weight: 700; font-size: 22px;
}
.cd-header-text h2 {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700; color: var(--primary-dark);
  line-height: 1.1; letter-spacing: .01em;
}
.cd-header-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.modal-card--card .detail-tabs { padding: 0 28px; flex-wrap: wrap; }
.detail-tab-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 28px;
}
.modal-card--card .detail-tab-pane { padding: 0; }

.cd-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px 18px;
}
.cd-edit-field { display: flex; flex-direction: column; gap: 5px; }
.cd-edit-field--full { grid-column: 1 / -1; }
.cd-edit-field label {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-soft);
}
.cd-input {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14.5px; background: var(--paper-card-2); color: var(--text);
}
.cd-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}
.cd-textarea { resize: vertical; font-family: inherit; line-height: 1.5; }

.cd-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  padding: 16px 28px;
  border-top: 1.5px solid var(--border);
  background: #fafbfd;
}
.cd-dirty-msg { font-size: 13px; color: var(--text-muted); }
.cd-dirty-active { color: var(--warn); font-weight: 600; }
.cd-footer .btn-primary { width: auto; margin: 0; }

select.cd-input { cursor: pointer; background: var(--white); }

/* Marriages tab */
.cd-marriage-section { margin-bottom: 22px; }
.cd-marriage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cd-marriage-head .btn-secondary { font-size: 12px; padding: 6px 12px; }
.cd-prior-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.cd-prior-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #fafbfd;
}
.cd-prior-row .cd-prior-spouse { flex: 2 1 160px; }
.cd-prior-row .cd-prior-date   { flex: 1 1 130px; }
.cd-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.cd-check input { width: 15px; height: 15px; accent-color: var(--primary); }
.cd-prior-remove { margin-left: auto; }

/* Financials tab rows */
.cd-fin-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.cd-fin-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--paper-card-2);
}
.cd-fin-row .cd-fin-source   { flex: 0 0 130px; }
.cd-fin-row .cd-fin-employer { flex: 2 1 160px; }
.cd-fin-row .cd-fin-year     { flex: 0 0 90px; }
.cd-fin-row .cd-fin-wages,
.cd-fin-row .cd-fin-total    { flex: 1 1 120px; }
.cd-fin-row .cd-fin-remove   { margin-left: auto; }
.cd-relate-isthe { color: var(--ink-soft); font-size: 13px; white-space: nowrap; }

/* Mail Sort — calendar day drill-in summary */
.cal-day.has-mail { cursor: pointer; }
.cal-day.has-mail:hover { border-color: var(--primary); }
.mail-day-panel {
  margin-top: 16px;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.mail-day-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.mail-day-head h4 { font-family: var(--font-display); font-size: 18px; color: var(--navy); }
.mail-day-head-right { display: flex; align-items: center; gap: 12px; }
.mail-day-count {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-soft);
}
.mail-day-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mail-day-table th {
  text-align: left; font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid var(--rule);
}
.mail-day-table td { padding: 9px 10px; border-bottom: 1px solid var(--rule-soft); }
.mail-day-table tr:last-child td { border-bottom: none; }
.mail-day-empty, .mail-day-loading { color: var(--ink-soft); font-size: 13px; padding: 8px 0; }

/* ============================================================
   Theme system — background overrides for dark / neutral themes
   (removes the warm paper noise texture for non-paper themes)
   ============================================================ */
[data-theme="midnight"] body,
[data-theme="ocean"] body,
[data-theme="light"] body {
  background-image: var(--grid);
  background-size: 22px 22px;
}

/* Login page background adaptations */
[data-theme="midnight"] .login-page,
[data-theme="ocean"] .login-page {
  background: var(--bg);
  background-image: var(--grid);
  background-size: 22px 22px;
}
[data-theme="light"] .login-page {
  background: var(--bg);
  background-image: var(--grid);
  background-size: 22px 22px;
}

/* ============================================================
   Theme transition — applied only during the switch animation
   ============================================================ */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition:
    background-color 0.25s ease,
    border-color     0.22s ease,
    color            0.20s ease,
    box-shadow       0.25s ease !important;
}

/* ============================================================
   Theme Picker Modal
   ============================================================ */
.modal-card--theme {
  max-width: 640px;
}

.theme-picker-intro {
  padding: 4px 26px 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 20px;
}

.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 0 26px 6px;
}
@media (max-width: 600px) {
  .theme-picker-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 380px) {
  .theme-picker-grid { grid-template-columns: repeat(2, 1fr); }
}

.theme-card {
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  text-align: left;
  position: relative;
}
.theme-card:hover {
  border-color: var(--primary);
}
.theme-card.theme-card--active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.theme-preview {
  border-radius: 6px;
  overflow: hidden;
  height: 64px;
  margin-bottom: 9px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.theme-preview-bar {
  height: 14px;
  width: 100%;
  flex-shrink: 0;
}
.theme-preview-body {
  flex: 1;
  padding: 5px 5px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.theme-preview-accent {
  height: 4px;
  border-radius: 2px;
  width: 55%;
}
.theme-preview-card {
  flex: 1;
  border-radius: 3px;
  opacity: .85;
}

.theme-check {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 17px;
  height: 17px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
}

.theme-card-info {
  padding: 0 1px;
}
.theme-card-name {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
  margin-bottom: 1px;
}
.theme-card-desc {
  display: block;
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ============================================================
   Signature Pages module
   ============================================================ */

/* Status banner below the form selector */
.sig-status {
  padding: 9px 13px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 14px;
}
.sig-status--info    { background: var(--secondary); color: var(--primary-dark); }
.sig-status--success { background: rgba(93,126,99,.12); color: var(--sage); }
.sig-status--warning { background: rgba(154,107,22,.10); color: var(--warn); }
.sig-status--error   { background: rgba(179,64,42,.10);  color: var(--danger); }

/* Download + Generate row */
.sig-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.sig-action-row .btn-primary,
.sig-action-row .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.sig-action-row svg {
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Helper text below the action buttons */
.sig-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Signature preview (before upload) */
.sig-preview {
  margin: 14px 0;
}
.sig-preview-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.sig-preview-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  max-width: 480px;
}
.sig-preview-frame img {
  max-height: 80px;
  max-width: 100%;
  display: block;
}

/* Upload row: choose + upload buttons */
.sig-upload-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0 10px;
}
.sig-choose-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.sig-choose-label svg {
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Upload status messages */
.sig-upload-status {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius);
  line-height: 1.45;
}
.sig-upload-status--info    { background: var(--secondary); color: var(--primary-dark); }
.sig-upload-status--success { background: rgba(93,126,99,.12); color: var(--sage); }
.sig-upload-status--error   { background: rgba(179,64,42,.10);  color: var(--danger); }

/* Signature sanitizer controls */
.sig-sanitize {
  margin: 4px 0 14px;
}
.sig-thresh-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.sig-thresh-label span { color: var(--primary-dark); }
.sig-thresh-range {
  width: 100%;
  max-width: 480px;
  accent-color: var(--primary);
}
/* Checkerboard so the removed (transparent) background is visible in preview */
.sig-preview-frame--checker {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e6e1d4 25%, transparent 25%),
    linear-gradient(-45deg, #e6e1d4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e6e1d4 75%),
    linear-gradient(-45deg, transparent 75%, #e6e1d4 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* Signature best-results tips */
.sig-tips {
  margin: 12px 0 16px;
  padding: 12px 16px;
  background: var(--secondary);
  border-radius: var(--radius);
}
.sig-tips-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--primary-dark);
  margin: 0 0 8px;
}
.sig-tips ul { margin: 0; padding-left: 18px; }
.sig-tips li {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 4px;
}
/* Current active signature block */
.sig-current { margin: 14px 0; }

/* G-28 counter-sign tool */
.cs-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.cs-pageinfo { font-size: 13px; color: var(--text-muted); min-width: 84px; text-align: center; }
.cs-viewer {
  position: relative; display: inline-block; max-width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff;
}
.cs-viewer canvas { display: block; max-width: 100%; height: auto; }
.cs-sig-overlay {
  position: absolute; cursor: move; box-sizing: border-box;
  border: 1.5px dashed var(--primary); background: rgba(255,90,31,.04); touch-action: none;
}
.cs-sig-overlay img { width: 100%; height: 100%; opacity: .85; pointer-events: none; display: block; }
.cs-resize {
  position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px;
  background: var(--primary); border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; touch-action: none;
}

/* Sig Pages: signature thumbnail + "manage in Profile" link */
.sig-thumb { max-width: 320px; }
.sig-thumb img { max-height: 90px; }
.sig-manage-link { color: var(--primary); font-weight: 600; text-decoration: none; font-size: 13px; }
.sig-manage-link:hover { text-decoration: underline; }

/* Profile sub-tabs (Firm Information / Attorney Signature / Users) */
.profile-subtabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); margin-bottom: 18px;
}
.profile-subtab {
  background: none; border: none; cursor: pointer;
  padding: 9px 16px; font-size: 14px; font-weight: 600; font-family: inherit;
  color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.profile-subtab:hover { color: var(--text); }
.profile-subtab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================================
   Header kebab menu + Firm Profile form (restored)
   ============================================================ */
.topbar-menu { position: relative; }

.topbar-kebab {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  background: transparent; border: 1.5px solid transparent; border-radius: 10px;
  color: var(--text-muted); cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.topbar-kebab:hover { background: var(--accent-light); border-color: var(--border); color: var(--text); }
.topbar-kebab svg { width: 20px; height: 20px; fill: currentColor; }

.topbar-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  min-width: 190px; padding: 6px;
  background: var(--paper-card); border: 1.5px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg);
}
.topbar-dropdown[hidden] { display: none; }

.topbar-dropdown .menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: none; background: transparent;
  font: inherit; font-size: 14px; color: var(--text); text-align: left;
  border-radius: 8px; cursor: pointer; text-decoration: none;
}
.topbar-dropdown .menu-item:hover { background: var(--accent-light); }
.topbar-dropdown .menu-item svg {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; color: var(--primary-mid);
}
.menu-item--logout { color: var(--danger); }
.menu-item--logout svg { color: var(--danger); }
.menu-divider { height: 1px; margin: 5px 8px; background: var(--border); }

/* Firm Profile form */
.firm-profile-form { max-width: 900px; }
.fp-section {
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px 18px; margin: 0 0 18px; background: var(--paper-card);
}
.fp-section legend {
  padding: 0 8px; font-family: var(--font-display); font-size: 15px;
  font-weight: 600; color: var(--primary-dark);
}
.fp-grow { flex: 2; }
.fp-checks { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.fp-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.fp-status { font-size: 13px; color: var(--text-muted); }
.fp-status.fp-status-ok { color: var(--success); font-weight: 600; }
