/* ========================================================================
   Scoplio — Cartographic Mission-Control UI
   Brand palette (spec §1.1):
     Light     #FCF9F9
     Accent    #59BBD7
     Primary   #1D5B94
     Secondary #2888C2
     Dark      #171B33
   Typography: Exo 2 (spec §1.3).
   ======================================================================== */

:root {
  --c-light: #FCF9F9;
  --c-accent: #59BBD7;
  --c-primary: #1D5B94;
  --c-secondary: #2888C2;
  --c-dark: #171B33;

  --c-bg: #0b0e1a;
  --c-surface: #131728;
  --c-surface-2: #1b2040;
  --c-text: #dce4f2;
  --c-text-muted: #7585a8;
  --c-border: rgba(255, 255, 255, 0.07);

  --c-good: #2fa37a;
  --c-warn: #d99a2b;
  --c-bad: #c44545;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-2: 0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-glow-accent: 0 0 0 0 rgba(89, 187, 215, 0.35);

  --font-body: 'Exo 2', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --t-fast: 120ms ease;
  --t-base: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── Reset / base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  background-image:
    radial-gradient(ellipse 1400px 900px at 80% 10%, rgba(89, 187, 215, 0.07), transparent 60%),
    radial-gradient(ellipse 1000px 700px at 5% 90%, rgba(40, 136, 194, 0.06), transparent 60%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { color: var(--c-light); }

h1, h2, h3, h4 { font-family: var(--font-body); margin: 0 0 0.5em; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-weight: 700; font-size: 32px; }
h2 { font-weight: 600; font-size: 24px; }
h3 { font-weight: 500; font-size: 18px; }

.h-hero { font-size: 42px; font-weight: 700; letter-spacing: -0.02em; }

small, .caption { font-size: 13px; color: var(--c-text-muted); }

code, pre, .mono { font-family: var(--font-mono); }

/* ── App shell ───────────────────────────────────────────────────────── */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.app-main { padding: 32px 40px; max-width: 1400px; }

.sidebar {
  background: var(--c-dark);
  color: var(--c-light);
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar__brand {
  padding: 22px 24px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background var(--t-fast);
}
.sidebar__brand:hover {
  background: rgba(89, 187, 215, 0.06);
}
.sidebar__brand-logo {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--c-accent), var(--c-primary) 70%);
  box-shadow: 0 0 0 2px rgba(89, 187, 215, 0.25), 0 0 14px rgba(89, 187, 215, 0.5);
  position: relative;
  flex-shrink: 0;
}
.sidebar__brand-logo::after {
  content: '';
  position: absolute; inset: -4px;
  border: 1px dashed rgba(89, 187, 215, 0.4);
  border-radius: 50%;
  animation: scoplio-rotate 18s linear infinite;
}
.sidebar__brand-name {
  font-size: 20px; font-weight: 700; letter-spacing: 0.02em;
}
.sidebar__brand-name span { color: var(--c-accent); }

.sidebar__nav { padding: 18px 12px; flex: 1; }
.sidebar__nav-section { margin-bottom: 24px; }
.sidebar__nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: rgba(252, 249, 249, 0.4);
  padding: 0 12px 8px;
}
.sidebar__nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  color: rgba(252, 249, 249, 0.78);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.sidebar__nav a svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar__nav a:hover { background: rgba(89, 187, 215, 0.08); color: var(--c-light); }
.sidebar__nav a.active {
  background: rgba(89, 187, 215, 0.12);
  color: var(--c-light);
}
.sidebar__nav a.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px;
  background: var(--c-accent);
  border-radius: 2px;
}

/* ── Inbox ───────────────────────────────────────────────────────────── */
.inbox-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  transition: border-color .15s;
  position: relative;
}
.inbox-card:hover { border-color: rgba(89, 187, 215, 0.25); }

.inbox-card__sender {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
}

.inbox-card__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--c-primary);
  color: var(--c-light);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.inbox-card__content {
  padding: 0 20px 16px 68px;
}
.inbox-card__subject {
  font-size: 15px; font-weight: 600;
  color: var(--c-text);
  margin-bottom: 6px;
  line-height: 1.4;
}
.inbox-card__snippet {
  font-size: 13px;
  color: var(--c-text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.inbox-card__snippet.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}
.inbox-card__expand-btn {
  display: none;
  background: none;
  border: none;
  color: var(--c-accent);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0 0;
  font-weight: 500;
  letter-spacing: .02em;
}
.inbox-card__expand-btn:hover { text-decoration: underline; }

.inbox-card__actions {
  border-top: 1px solid var(--c-border);
  background: rgba(255,255,255,.02);
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inbox-card__matches {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inbox-card__matches-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-muted);
  margin-right: 2px;
  flex-shrink: 0;
}

.inbox-card__assign-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inbox-dismiss-btn {
  background: none;
  border: none;
  color: var(--c-text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 4px;
  transition: color .15s;
  flex-shrink: 0;
}
.inbox-dismiss-btn:hover { color: var(--c-bad); }

.inbox-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.inbox-dropdown__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background .1s;
}
.inbox-dropdown__item:not(:last-child) { border-bottom: 1px solid var(--c-border); }
.inbox-dropdown__item.is-highlighted,
.inbox-dropdown__item:hover { background: rgba(89,187,215,.08); }
.inbox-dropdown__item-title {
  font-size: 14px;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-dropdown__item-status {
  font-size: 11px;
  color: var(--c-text-muted);
  flex-shrink: 0;
  text-transform: capitalize;
}

.nav-badge {
  margin-left: auto;
  background: var(--c-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar__user {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.sidebar__user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c-primary);
  color: var(--c-light);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}
.sidebar__user-name { color: var(--c-light); font-weight: 500; }
.sidebar__user-role { color: rgba(252, 249, 249, 0.5); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.sidebar__user-form { margin-left: auto; }
.sidebar__user-form button {
  background: none; border: none; color: rgba(252, 249, 249, 0.6); cursor: pointer;
  font-size: 12px; padding: 4px 6px; border-radius: var(--radius-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.sidebar__user-form button:hover { color: var(--c-light); background: rgba(255,255,255,0.06); }

@keyframes scoplio-rotate { to { transform: rotate(360deg); } }

/* ── Cards / surfaces ────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-1);
}
.card--bare { padding: 0; overflow: hidden; }
.card__header { padding: 18px 24px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; }
.card__body { padding: 24px; }

/* ── Stat tiles ──────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat-tile {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative; overflow: hidden;
  text-decoration: none;
}
.stat-tile::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--c-accent);
}
.stat-tile__label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--c-text-muted); }
.stat-tile__value { font-size: 36px; font-weight: 700; color: var(--c-text); margin-top: 4px; line-height: 1; }
.stat-tile__sub { font-size: 13px; color: var(--c-text-muted); margin-top: 6px; }

/* ── Global form element baseline ────────────────────────────────────── */
/* Applies dark-theme styling to ALL inputs/selects/textareas regardless
   of parent context (filter bars, inline action forms, etc.) so that no
   element falls back to the browser's native light-mode appearance.    */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=submit]):not([type=button]):not([type=reset]):not([type=hidden]):not([type=color]),
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  transition: border var(--t-fast), box-shadow var(--t-fast);
}

input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=submit]):not([type=button]):not([type=reset]):not([type=hidden]):not([type=color]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(29, 91, 148, 0.15);
}

/* Disabled fields: visual cue without hiding content */
input:disabled, select:disabled, textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Custom dropdown chevron — restores the visual affordance lost with
   appearance:none while keeping the native arrow out of the design.  */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237585a8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

/* Command-palette input opts out of the global baseline */
#cmd-input {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 17px;
}

/* ── Forms ───────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 520px; }
.form__row { display: flex; flex-direction: column; gap: 6px; }
.form__row label { font-size: 13px; font-weight: 500; color: var(--c-text); }
.form__row input:not([type="checkbox"]),
.form__row select,
.form__row textarea {
  width: 100%;
}
.form__row input:focus,
.form__row select:focus,
.form__row textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(29, 91, 148, 0.15);
}
.form__row .hint { font-size: 12px; color: var(--c-text-muted); }
.form__row .field-validation-error,
.form__error { color: #f07070; font-size: 13px; }
.form__error-summary { background: rgba(196,69,69,0.1); border: 1px solid rgba(196,69,69,0.3); color: #f07070; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; }

/* ── Utility: stacked form column inside a card body ─────────────────── */
/* Replaces the pattern: style="display:flex;flex-direction:column;gap:20px;" */
.form-col { display: flex; flex-direction: column; gap: 20px; }

/* ── Utility: flex-grow for filter-bar inputs ────────────────────────── */
.flex-1 { flex: 1 1 0; min-width: 0; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; font-family: var(--font-body); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn--primary { background: var(--c-primary); color: var(--c-light); }
.btn--primary:hover { background: var(--c-secondary); color: var(--c-light); }
.btn--secondary { background: transparent; color: var(--c-accent); border-color: var(--c-accent); }
.btn--secondary:hover { background: rgba(89, 187, 215, 0.08); }
.btn--ghost { background: transparent; color: var(--c-text); border-color: var(--c-border); }
.btn--ghost:hover { background: var(--c-surface-2); }
.btn--danger { background: var(--c-bad); color: var(--c-light); }
.btn--danger:hover { background: #a93535; }
.btn--sm { padding: 6px 12px; font-size: 13px; }

/* ── Badges / pills ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 999px;
  background: var(--c-surface-2); color: var(--c-text);
}
.badge--accent { background: rgba(89,187,215,0.14); color: var(--c-accent); }
.badge--primary { background: rgba(40,136,194,0.15); color: var(--c-secondary); }
.badge--good { background: rgba(47,163,122,0.15); color: #5fd9a5; }
.badge--warn { background: rgba(217,154,43,0.15); color: #e0b55a; }
.badge--bad { background: rgba(196,69,69,0.15); color: #f07070; }
.badge--muted { background: rgba(255,255,255,0.06); color: var(--c-text-muted); }
.badge--live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 0 currentColor;
  animation: scoplio-pulse 1.6s ease-out infinite;
}
@keyframes scoplio-pulse {
  0% { box-shadow: 0 0 0 0 rgba(89,187,215,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(89,187,215,0); }
  100% { box-shadow: 0 0 0 0 rgba(89,187,215,0); }
}

/* ── Tables ──────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--c-border); }
.table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-text-muted); background: var(--c-surface-2); }
.table tbody tr:hover { background: rgba(89,187,215,0.04); }
.table .row-muted { color: var(--c-text-muted); }
.table .row-muted td { background: rgba(0,0,0,0.02); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── URL chip — compact link with copy + full-URL tooltip ────────────── */
/* Apply data-url-cell to any <td> containing a URL <a> to activate.     */
[data-url-cell] { max-width: 260px; }
[data-url-cell] > a {
  display: block; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 240px;
}

.url-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
}
.url-chip__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--c-accent);
  text-decoration: none;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color var(--t-fast);
}
.url-chip__link:hover { color: var(--c-light); }
.url-chip__link svg { flex-shrink: 0; opacity: 0.6; }
.url-chip__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--t-fast), color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.url-chip:hover .url-chip__copy,
.url-chip__copy.is-copied { opacity: 1; }
.url-chip__copy:hover {
  color: var(--c-accent);
  border-color: rgba(89,187,215,0.25);
  background: rgba(89,187,215,0.08);
}
.url-chip__copy.is-copied {
  color: var(--c-good);
  border-color: rgba(47,163,122,0.3);
  background: rgba(47,163,122,0.1);
}
.url-chip__tooltip {
  position: absolute;
  bottom: calc(100% + 9px);
  left: -8px;
  z-index: 200;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--c-text-muted);
  white-space: nowrap;
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-2);
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 140ms ease, transform 140ms ease;
}
.url-chip:hover .url-chip__tooltip { opacity: 1; transform: translateY(0); }
.url-chip__tooltip::after {
  content: '';
  position: absolute;
  top: 100%; left: 16px;
  border: 5px solid transparent;
  border-top-color: var(--c-border);
}
.url-chip__tooltip::before {
  content: '';
  position: absolute;
  top: 100%; left: 17px;
  border: 4px solid transparent;
  border-top-color: var(--c-surface-2);
  z-index: 1;
}

/* ── Toast / messages ────────────────────────────────────────────────── */
.toast {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
}
.toast--success { background: rgba(47,163,122,0.12); border-color: rgba(47,163,122,0.3); color: #5fd9a5; }
.toast--error { background: rgba(196,69,69,0.12); border-color: rgba(196,69,69,0.3); color: #f07070; }

/* ── Chip badges ─────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; padding: 2px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; border: 1px solid transparent;
}
.chip--ok   { background: rgba(47,163,122,0.14);  color: #5fd9a5; border-color: rgba(47,163,122,0.25); }
.chip--warn { background: rgba(217,154,43,0.14);  color: #f0b64e; border-color: rgba(217,154,43,0.25); }
.chip--err  { background: rgba(196,69,69,0.14);   color: #f07070; border-color: rgba(196,69,69,0.25); }

/* ── Inline flash banners (local page alerts) ────────────────────── */
.flash { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid; }
.flash--ok  { background: rgba(47,163,122,0.10); border-color: rgba(47,163,122,0.30); color: #5fd9a5; }
.flash--err { background: rgba(196,69,69,0.10);  border-color: rgba(196,69,69,0.30); color: #f07070; }

/* ── Table inputs — fills the cell width ─────────────────────────── */
.table-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%; min-width: 0; box-sizing: border-box;
  font-family: var(--font-body); font-size: 14px;
  padding: 7px 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  transition: border var(--t-fast), box-shadow var(--t-fast);
}
.table-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(29, 91, 148, 0.15);
}

/* ── Page header ─────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-head__title { font-size: 28px; font-weight: 700; color: var(--c-text); }
.page-head__sub { color: var(--c-text-muted); font-size: 14px; margin-top: 4px; }
.page-head__actions { display: flex; gap: 10px; }

/* ── Login page ──────────────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  background: var(--c-dark);
  color: var(--c-light);
  display: grid; place-items: center;
  position: relative; overflow: hidden;
}
.auth-shell::before,
.auth-shell::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 1200px; height: 1200px;
  border-radius: 50%;
  border: 1px solid rgba(89,187,215,0.08);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.auth-shell::after {
  width: 1800px; height: 1800px;
  border-color: rgba(89,187,215,0.04);
}
.auth-radar {
  position: absolute; left: 50%; top: 50%;
  width: 600px; height: 600px;
  margin: -300px 0 0 -300px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.25;
}
.auth-radar::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 270deg, rgba(89,187,215,0.55) 359deg, transparent 360deg);
  animation: scoplio-rotate 6s linear infinite;
}
.auth-card {
  position: relative;
  background: rgba(252,249,249,0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(89,187,215,0.18);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  z-index: 1;
}
.auth-card h1 {
  font-size: 28px; font-weight: 700; margin-bottom: 4px;
  display: flex; align-items: center; gap: 12px;
}
.auth-card h1 .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--c-accent), var(--c-primary) 70%);
  box-shadow: 0 0 12px rgba(89,187,215,0.6);
}
.auth-card .subtitle { color: rgba(252,249,249,0.55); font-size: 13px; margin-bottom: 28px; letter-spacing: 0.04em; }
.auth-card .form__row label { color: rgba(252,249,249,0.7); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.auth-card .form__row input {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(89,187,215,0.25);
  color: var(--c-light);
  padding: 12px 14px;
}
.auth-card .form__row input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(89,187,215,0.18);
}
.auth-card .btn { width: 100%; padding: 12px; font-size: 14px; }
.auth-card .form__error-summary { background: rgba(196,69,69,0.15); border-color: rgba(196,69,69,0.4); color: #f07070; }
.auth-card .meta {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 12px; color: rgba(252,249,249,0.4); text-align: center; letter-spacing: 0.06em; text-transform: uppercase;
}

/* ── Utility ─────────────────────────────────────────────────────────── */
.muted { color: var(--c-text-muted); }
.row { display: flex; gap: 12px; align-items: center; }
.row--space { justify-content: space-between; }
.gap-sm { gap: 8px; } .gap-md { gap: 16px; } .gap-lg { gap: 24px; }
.mt-0 { margin-top: 0; } .mt-sm { margin-top: 8px; } .mt-md { margin-top: 16px; } .mt-lg { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-sm { margin-bottom: 8px; } .mb-md { margin-bottom: 16px; } .mb-lg { margin-bottom: 32px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-upper { text-transform: uppercase; }

/* ── Map & areas ─────────────────────────────────────────────────────── */
.map-shell {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  height: calc(100vh - 80px);
  min-height: 500px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  box-shadow: var(--shadow-1);
}
.map-panel {
  overflow-y: auto;
  border-right: 1px solid var(--c-border);
  background: var(--c-surface);
}
.map-panel__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-dark);
  color: var(--c-light);
  position: sticky; top: 0; z-index: 5;
}
.map-panel__title { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--c-accent); margin-bottom: 2px; }
.map-panel__sub { font-size: 12px; color: rgba(252,249,249,0.5); }
.map-panel__body { padding: 8px; }
.map-panel__empty { padding: 40px 20px; text-align: center; color: var(--c-text-muted); font-size: 14px; }
.map-canvas { position: relative; height: 100%; background: #e6e9ee; }
.leaflet-container { height: 100%; width: 100%; background: #e6e9ee; font-family: var(--font-body); }

.area-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.area-card:hover { border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(89,187,215,0.12); }
.area-card.is-selected { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(29,91,148,0.18); }
.area-card__head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.area-card__name { font-weight: 600; font-size: 15px; color: var(--c-text); margin: 0 0 2px; }
.area-card__meta { font-size: 11px; color: var(--c-text-muted); }
.area-card__progress {
  margin-top: 8px; height: 3px; background: #eceff4; border-radius: 2px; overflow: hidden;
}
.area-card__progress-bar { height: 100%; background: var(--c-accent); transition: width 400ms ease; }
.area-card__stats { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--c-text-muted); }
.area-card__stats strong { color: var(--c-text); }

.area-drawer {
  position: absolute;
  top: 16px; right: 16px; z-index: 400;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  padding: 18px 20px;
  width: 340px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
}
.area-drawer h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--c-accent); margin-bottom: 14px; }
.area-drawer__close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none; font-size: 18px; color: var(--c-text-muted); cursor: pointer;
}
.checkbox-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 13px; }
.checkbox-list label { display: grid; grid-template-columns: 16px 1fr; gap: 6px; align-items: center; cursor: pointer; }
.checkbox-category { font-size: 11px; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 10px; grid-column: 1/-1; }

.draw-hint {
  position: absolute; top: 16px; left: 16px; z-index: 400;
  background: var(--c-dark); color: var(--c-light);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-2);
  display: flex; align-items: center; gap: 8px;
}
.draw-hint .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); animation: scoplio-pulse 1.6s ease-out infinite; }

/* ── Tech signals / business detail ──────────────────────────────────── */
.kv-grid { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; font-size: 14px; }
.kv-grid dt { color: var(--c-text-muted); font-weight: 500; }
.kv-grid dd { margin: 0; color: var(--c-text); }
.tech-signals { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-signal { font-size: 11px; background: var(--c-surface-2); padding: 3px 8px; border-radius: 999px; color: var(--c-text); border: 1px solid var(--c-border); }

/* ── Banner ───────────────────────────────────────────────────────── */
.banner {
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid;
  font-size: 13px; margin-bottom: 16px;
}
.banner--warn { background: rgba(217,154,43,0.1); border-color: rgba(217,154,43,0.28); color: #e0b55a; }
.banner--error { background: rgba(196,69,69,0.1); border-color: rgba(196,69,69,0.28); color: #f07070; }

/* ── Sidebar search trigger ──────────────────────────────────────── */
.sidebar__search-btn {
  display: flex; align-items: center; gap: 10px;
  width: calc(100% - 24px); margin: 0 12px 16px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: rgba(252,249,249,0.5);
  font-family: var(--font-body); font-size: 13px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.sidebar__search-btn:hover {
  background: rgba(89,187,215,0.08);
  border-color: rgba(89,187,215,0.2);
  color: var(--c-light);
}
.sidebar__search-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.sidebar__search-btn span { flex: 1; text-align: left; }
.sidebar__search-btn kbd {
  font-family: var(--font-mono); font-size: 10px;
  padding: 2px 5px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: rgba(252,249,249,0.4);
}

/* ── Command palette ──────────────────────────────────────────────── */
.cmd-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,7,18,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 900;
  animation: cmd-fade-in 0.15s ease;
}
@keyframes cmd-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cmd-slide-in { from { opacity: 0; transform: translateY(-14px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.cmd-palette {
  position: fixed;
  top: 15vh;
  left: 50%; transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  background: #141929;
  border: 1px solid rgba(89,187,215,0.18);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(89,187,215,0.06);
  z-index: 901;
  overflow: hidden;
  animation: cmd-slide-in 0.18s cubic-bezier(0.22,1,0.36,1);
}
.cmd-palette__input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.cmd-palette__icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--c-text-muted); }
#cmd-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font-body); font-size: 17px;
  color: var(--c-text); caret-color: var(--c-accent);
}
#cmd-input::placeholder { color: rgba(255,255,255,0.25); }
.cmd-palette__esc {
  font-family: var(--font-mono); font-size: 11px;
  padding: 3px 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: rgba(252,249,249,0.35); flex-shrink: 0;
}
.cmd-palette__results { max-height: 380px; overflow-y: auto; }
.gs-section {
  padding: 8px 20px 5px;
  font-size: 10px; font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.gs-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  text-decoration: none; color: var(--c-text);
  transition: background var(--t-fast);
  cursor: pointer; border-left: 2px solid transparent;
}
.gs-item:hover, .gs-item.is-active {
  background: rgba(89,187,215,0.08);
}
.gs-item.is-active { border-left-color: var(--c-accent); padding-left: 18px; }
.gs-item__icon {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  display: grid; place-items: center;
}
.gs-item__icon svg { width: 15px; height: 15px; stroke: var(--c-text-muted); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.gs-item__body { flex: 1; min-width: 0; }
.gs-title { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.gs-sub { font-size: 12px; color: var(--c-text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item__arrow { color: rgba(255,255,255,0.2); font-size: 16px; flex-shrink: 0; }
.gs-empty { padding: 32px 20px; color: var(--c-text-muted); text-align: center; font-size: 14px; }
.gs-hint { padding: 28px 20px; color: rgba(255,255,255,0.2); text-align: center; font-size: 13px; }
.cmd-palette__footer {
  display: flex; gap: 16px; align-items: center;
  padding: 10px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px; color: rgba(255,255,255,0.25);
}
.cmd-palette__footer kbd {
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 5px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px; margin-right: 4px;
}

/* ── Case detail ──────────────────────────────────────────────────── */
.case-grid { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.case-grid__main { min-width: 0; }
.case-grid__side { position: sticky; top: 16px; }
@media (max-width: 1100px) { .case-grid { grid-template-columns: 1fr; } .case-grid__side { position: static; } }

.case-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-border); margin-bottom: 16px; }
.case-tab { padding: 10px 18px; cursor: pointer; border: none; background: none; font-size: 13px; font-weight: 500; color: var(--c-text-muted); border-bottom: 2px solid transparent; font-family: inherit; }
.case-tab.is-active { color: var(--c-accent); border-bottom-color: var(--c-accent); }
.case-tab:hover { color: var(--c-text); }
.case-panel { display: none; }
.case-panel.is-active { display: block; }

/* ─── Email Pane (two-panel thread browser) ──────────────────────────────── */
.email-pane { display: flex; border: 1px solid var(--c-border); border-radius: var(--radius-md); overflow: hidden; height: 640px; background: var(--c-surface); }

/* Thread list (left column) */
.email-pane__list { width: 260px; flex-shrink: 0; border-right: 1px solid var(--c-border); display: flex; flex-direction: column; overflow: hidden; }
.email-pane__list-hd { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--c-border); flex-shrink: 0; }
.email-pane__list-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--c-text-muted); }
.email-pane__list-body { flex: 1; overflow-y: auto; }
.email-pane__list-empty { padding: 20px 14px; font-size: 13px; color: var(--c-text-muted); text-align: center; }

.thread-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: none; background: none; width: 100%; cursor: pointer; text-align: left; border-bottom: 1px solid var(--c-border); transition: background 0.12s; font-family: inherit; }
.thread-row:hover { background: rgba(255,255,255,0.03); }
.thread-row.is-active { background: rgba(89,187,215,0.08); border-right: 2px solid var(--c-accent); }
.thread-row__av { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--c-accent), var(--c-primary)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.thread-row__body { flex: 1; min-width: 0; }
.thread-row__subj { font-size: 13px; font-weight: 600; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-row__prev { font-size: 11px; color: var(--c-text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-row__aside { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.thread-row__time { font-size: 10px; color: var(--c-text-muted); white-space: nowrap; }
.thread-row__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-accent); }

/* Right panel */
.email-pane__view { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.email-pane__start { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--c-text-muted); padding: 32px; }
.email-pane__start-icon { font-size: 40px; opacity: 0.3; }
.email-pane__threads-area { flex: 1; overflow-y: auto; position: relative; }

/* Individual thread views */
.thread-view { display: none; flex-direction: column; gap: 8px; padding: 16px; animation: epFadeIn 0.18s ease; }
.thread-view.is-active { display: flex; }
@keyframes epFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Message cards */
.msg-card { border: 1px solid var(--c-border); border-radius: var(--radius-md); background: var(--c-surface); overflow: hidden; transition: border-color 0.15s; }
.msg-card:hover { border-color: rgba(255,255,255,0.12); }
.msg-card--in { border-left: 3px solid var(--c-accent); }
.msg-card--out { border-left: 3px solid var(--c-primary); }
.msg-card--failed { border-left: 3px solid var(--c-bad); background: rgba(196,69,69,0.06); }
.msg-card__hd { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; -webkit-user-select: none; user-select: none; }
.msg-card__av { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--c-accent), var(--c-secondary)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.msg-card__av--you { background: linear-gradient(135deg, var(--c-primary), var(--c-secondary)); }
.msg-card__meta { flex: 1; min-width: 0; }
.msg-card__sender { font-size: 13px; font-weight: 600; color: var(--c-text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-card__detail { font-size: 11px; color: var(--c-text-muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-card__time { font-size: 11px; color: var(--c-text-muted); white-space: nowrap; flex-shrink: 0; }
.msg-card__chevron { width: 16px; height: 16px; flex-shrink: 0; color: var(--c-text-muted); transition: transform 0.2s ease; display: flex; align-items: center; justify-content: center; }
.msg-card__chevron::before { content: '›'; font-size: 18px; line-height: 1; }
.msg-card:not(.is-collapsed) .msg-card__chevron { transform: rotate(90deg); }
.msg-card__body { max-height: 0; overflow: hidden; transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1), padding 0.2s ease; padding: 0 14px; }
.msg-card:not(.is-collapsed) .msg-card__body { max-height: 800px; padding: 0 14px 14px; }
.msg-card__text { white-space: pre-wrap; font-size: 13px; line-height: 1.65; color: var(--c-text); }
.msg-card__foot { display: flex; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--c-border); }

/* Compose box */
.compose-box { border-top: 2px solid var(--c-border); background: var(--c-surface-2); flex-shrink: 0; animation: composeSlideUp 0.2s cubic-bezier(0.4,0,0.2,1); }
@keyframes composeSlideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.compose-box__hd { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 8px; border-bottom: 1px solid var(--c-border); }
.compose-box__title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--c-text-muted); }
.compose-cc-toggle { background: none; border: none; font-size: 11px; font-weight: 600; color: var(--c-text-muted); cursor: pointer; padding: 2px 6px; border-radius: var(--radius-sm); transition: color 0.12s, background 0.12s; font-family: inherit; }
.compose-cc-toggle:hover { color: var(--c-accent); background: rgba(89,187,215,0.08); }
.compose-box__close { background: none; border: none; color: var(--c-text-muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; transition: color 0.12s; }
.compose-box__close:hover { color: var(--c-text); }
.compose-field-row { display: flex; align-items: center; gap: 10px; padding: 6px 16px; border-bottom: 1px solid var(--c-border); }
.compose-field-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-text-muted); width: 42px; flex-shrink: 0; }
.compose-subject { flex: 1; border: none; background: none; color: var(--c-text); font-size: 13px; outline: none; font-family: inherit; }
.compose-subject::placeholder { color: var(--c-text-muted); }
.compose-body { width: 100%; box-sizing: border-box; border: none; background: none; color: var(--c-text); font-size: 13px; line-height: 1.65; resize: vertical; outline: none; padding: 12px 16px; font-family: inherit; min-height: 100px; }
.compose-body::placeholder { color: var(--c-text-muted); }
.compose-box__foot { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 10px; gap: 8px; flex-wrap: wrap; }

/* Chip input */
.chip-input { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; flex: 1; cursor: text; min-height: 28px; }
.chip { display: flex; align-items: center; gap: 4px; background: rgba(89,187,215,0.14); color: var(--c-accent); border-radius: 100px; padding: 2px 6px 2px 9px; font-size: 12px; font-weight: 500; white-space: nowrap; animation: chipPop 0.14s ease; }
@keyframes chipPop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.chip__remove { background: none; border: none; color: var(--c-accent); cursor: pointer; padding: 0; font-size: 15px; line-height: 1; opacity: 0.65; transition: opacity 0.1s; }
.chip__remove:hover { opacity: 1; }
.chip-input__field { border: none; background: none; color: var(--c-text); font-size: 13px; outline: none; min-width: 100px; flex: 1; font-family: inherit; padding: 0; }
.chip-input__field::placeholder { color: var(--c-text-muted); }

/* Mobile: collapse list behind thread view */
@media (max-width: 680px) {
  .email-pane { height: auto; flex-direction: column; }
  .email-pane__list { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--c-border); max-height: 180px; }
  .email-pane__view { min-height: 400px; }
}

/* Legacy classes preserved for inline resend forms */
.email-thread { display: flex; flex-direction: column; gap: 12px; }
.email-card { border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--c-surface); }
.email-card--inbound { border-left: 3px solid var(--c-accent); }
.email-card--outbound { border-left: 3px solid var(--c-primary); }
.email-card--failed { border-left: 3px solid var(--c-bad); background: rgba(196,69,69,0.08); }
.email-card__head { display: flex; justify-content: space-between; font-size: 12px; color: var(--c-text-muted); margin-bottom: 6px; }
.email-card__subject { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.email-card__body { white-space: pre-wrap; font-size: 13px; color: var(--c-text); line-height: 1.5; }

.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--c-border); }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); }
.timeline__event { font-weight: 500; color: var(--c-text); }
.timeline__meta { font-size: 11px; color: var(--c-text-muted); margin-top: 1px; }

.owner-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--c-surface-2); padding: 3px 10px; border-radius: 999px; font-size: 12px; margin: 2px; }
.owner-chip form { display: inline; margin: 0; }
.owner-chip button { background: none; border: none; color: var(--c-text-muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px; }
.owner-chip button:hover { color: var(--c-bad); }

/* ── Dashboard ───────────────────────────────────────────────────────── */
@keyframes scop-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scop-roadmap-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(29,91,148,0.22); }
  50%       { box-shadow: 0 0 0 9px rgba(29,91,148,0.06); }
}

/* Hero banner */
.dash-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; margin-bottom: 28px;
  padding: 28px 36px;
  background: linear-gradient(130deg, #0e1320 0%, #122544 55%, #0f1a30 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(89,187,215,0.14);
  position: relative; overflow: hidden;
  animation: scop-fade-up 0.4s ease both;
}
.dash-hero::before {
  content: '';
  position: absolute; right: -80px; top: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(89,187,215,0.14) 0%, transparent 70%);
  pointer-events: none;
}
.dash-hero::after {
  content: '';
  position: absolute; left: 35%; bottom: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(40,136,194,0.1) 0%, transparent 70%);
  pointer-events: none;
}
.dash-hero__left { position: relative; z-index: 1; }
.dash-hero__eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--c-accent); margin-bottom: 6px;
}
.dash-hero__title {
  font-size: 32px; font-weight: 700; margin: 0 0 8px;
  color: var(--c-light); letter-spacing: -0.02em; line-height: 1.1;
}
.dash-hero__meta {
  font-size: 13px; color: rgba(252,249,249,0.45); letter-spacing: 0.03em;
  display: flex; align-items: center; gap: 8px;
}
.dash-hero__status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--c-good);
  box-shadow: 0 0 7px rgba(47,163,122,0.7); flex-shrink: 0;
}
.dash-hero__right {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-end; gap: 16px;
}
.dash-hero__pills {
  display: flex; align-items: center; gap: 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.dash-hero__pill {
  padding: 10px 20px; text-align: center;
}
.dash-hero__pill-sep {
  width: 1px; align-self: stretch; background: rgba(255,255,255,0.07);
}
.dash-hero__pill-val {
  font-size: 22px; font-weight: 700; color: var(--c-light); line-height: 1;
}
.dash-hero__pill-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(252,249,249,0.4); margin-top: 4px;
}

/* Stat tile enhancements */
.stat-tile { transition: transform var(--t-base), box-shadow var(--t-base); }
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat-tile::before { background: var(--tile-accent, var(--c-accent)); }
.stat-tile--members  { --tile-accent: var(--c-secondary); }
.stat-tile--audit-d  { --tile-accent: var(--c-accent); }
.stat-tile--audit-w  { --tile-accent: #8b5cf6; }
.stat-tile--phase    { --tile-accent: var(--c-good); }

.stat-tile__icon-bg {
  position: absolute; top: 14px; right: 14px;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--tile-accent, var(--c-accent)); opacity: 0.1;
}
.stat-tile__icon-svg {
  position: absolute; top: 21px; right: 21px;
  width: 26px; height: 26px; opacity: 0.2;
  color: var(--tile-accent, var(--c-accent));
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.stat-grid .stat-tile:nth-child(1) { animation: scop-fade-up 0.4s 0.08s ease both; }
.stat-grid .stat-tile:nth-child(2) { animation: scop-fade-up 0.4s 0.14s ease both; }
.stat-grid .stat-tile:nth-child(3) { animation: scop-fade-up 0.4s 0.20s ease both; }
.stat-grid .stat-tile:nth-child(4) { animation: scop-fade-up 0.4s 0.26s ease both; }
.stat-grid .stat-tile:nth-child(5) { animation: scop-fade-up 0.4s 0.32s ease both; }
.stat-grid .stat-tile:nth-child(6) { animation: scop-fade-up 0.4s 0.38s ease both; }

/* Section heading */
.section-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.section-head__label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--c-text-muted); white-space: nowrap;
}
.section-head__rule { flex: 1; height: 1px; background: var(--c-border); }

/* Two-column dashboard layout */
.dash-cols {
  display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start;
}
.dash-col-main { min-width: 0; }
.dash-col-side { min-width: 0; }
@media (max-width: 1100px) { .dash-cols { grid-template-columns: 1fr; } }

/* Case pipeline chart */
.pipeline { padding: 16px 0; }
.pipeline__row {
  display: grid; grid-template-columns: 120px 1fr 48px;
  align-items: center; gap: 12px; padding: 8px 20px;
  transition: background var(--t-fast);
}
.pipeline__row:hover { background: rgba(255,255,255,0.02); }
.pipeline__label { font-size: 12px; font-weight: 500; color: var(--c-text-muted); white-space: nowrap; }
.pipeline__track {
  height: 8px; background: rgba(255,255,255,0.05);
  border-radius: 4px; overflow: hidden;
}
.pipeline__bar {
  height: 100%; border-radius: 4px;
  background: var(--c-secondary);
  min-width: 4px;
}
.pipeline__bar--contacted  { background: linear-gradient(90deg, var(--c-secondary), var(--c-accent)); }
.pipeline__bar--progress   { background: linear-gradient(90deg, var(--c-accent), #7dd3fc); }
.pipeline__bar--proposal   { background: linear-gradient(90deg, #8b5cf6, var(--c-accent)); }
.pipeline__bar--won        { background: linear-gradient(90deg, var(--c-good), #5fd9a5); }
.pipeline__bar--lost       { background: var(--c-bad); opacity: 0.7; }
.pipeline__bar--hold       { background: var(--c-warn); opacity: 0.7; }
.pipeline__count { justify-content: center; min-width: 32px; }

/* Activity feed */
.activity-feed { padding: 8px 0; }
.activity-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 10px 20px;
  transition: background var(--t-fast);
}
.activity-row:hover { background: rgba(255,255,255,0.02); }
.activity-row__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-text-muted);
  flex-shrink: 0; margin-top: 5px;
}
.activity-row__dot.dot--accent    { background: var(--c-accent); box-shadow: 0 0 6px rgba(89,187,215,0.5); }
.activity-row__dot.dot--secondary { background: var(--c-secondary); }
.activity-row__dot.dot--primary   { background: var(--c-primary); }
.activity-row__dot.dot--good      { background: var(--c-good); box-shadow: 0 0 6px rgba(47,163,122,0.5); }
.activity-row__dot.dot--bad       { background: var(--c-bad); }
.activity-row__body {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex: 1; min-width: 0;
}
.activity-row__event { font-size: 13px; font-weight: 500; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-row__time { font-size: 11px; color: var(--c-text-muted); white-space: nowrap; flex-shrink: 0; }

/* Areas in sidebar */
.dash-areas { padding: 8px 0; }
.dash-area-row { padding: 12px 18px; transition: background var(--t-fast); }
.dash-area-row:hover { background: rgba(255,255,255,0.02); }
.dash-area-row__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.dash-area-row__name { font-size: 13px; font-weight: 600; color: var(--c-text); }
.dash-area-row__prog {
  height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px;
  overflow: hidden; margin-bottom: 6px;
}
.dash-area-row__prog-bar {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-secondary));
}
.dash-area-row__stats { font-size: 11px; color: var(--c-text-muted); display: flex; gap: 10px; }
.dash-area-row__leads { color: var(--c-good); font-weight: 500; }
.dash-area-row + .dash-area-row { border-top: 1px solid var(--c-border); }

/* Financial snapshot */
.fin-snap { display: flex; flex-direction: column; gap: 12px; }
.fin-snap__row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.fin-snap__label { font-size: 13px; color: var(--c-text-muted); }
.fin-snap__val { font-size: 15px; font-weight: 700; color: var(--c-text); font-variant-numeric: tabular-nums; }
.fin-snap__val--good { color: #5fd9a5; }
.fin-snap__val--warn { color: #e0b55a; }
.fin-snap__bar-wrap { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.fin-snap__bar {
  height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden;
}
.fin-snap__bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--c-good), #5fd9a5);
}
.fin-snap__bar-label { font-size: 11px; color: var(--c-text-muted); text-align: right; }

/* Empty states */
.dash-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 20px; text-align: center;
}
.dash-empty--sm { padding: 20px; }
.dash-empty__symbol {
  font-size: 28px; color: rgba(255,255,255,0.1);
  margin-bottom: 12px; line-height: 1;
}
.dash-empty__text { font-size: 14px; font-weight: 500; color: var(--c-text-muted); }
.dash-empty__sub { font-size: 12px; color: rgba(255,255,255,0.25); margin-top: 4px; max-width: 260px; line-height: 1.5; }

.badge--sm { font-size: 10px; padding: 2px 7px; }

/* ── Phase 4: Financial document builder ─────────────────────────── */
.totals-panel { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
.totals-panel > div { display: flex; justify-content: space-between; }
.totals-panel > div.grand { border-top: 1px solid var(--c-border); padding-top: 6px; margin-top: 2px; font-weight: 600; font-size: 15px; }
.li-row input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
.li-total { font-variant-numeric: tabular-nums; font-weight: 500; }

/* ── Settings form — shared components ───────────────────────────── */
.settings-form-stack { display: flex; flex-direction: column; gap: 20px; max-width: 780px; }

.settings-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--c-text-muted);
}

/* 2-column responsive form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.form-grid__full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid__full { grid-column: 1; } }

/* Required field star */
.req { color: var(--c-bad); margin-left: 2px; font-size: 11px; }

/* Screen-reader only */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── File / logo upload zone ─────────────────────────────────────── */
.file-zone {
  display: flex; align-items: center; gap: 20px;
  padding: 18px 20px;
  border: 2px dashed rgba(255,255,255,0.10);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  position: relative;
}
.file-zone:hover {
  border-color: rgba(89,187,215,0.45);
  background: rgba(89,187,215,0.04);
  box-shadow: 0 0 0 4px rgba(89,187,215,0.06);
}
.file-zone.is-drag-over {
  border-color: var(--c-accent);
  background: rgba(89,187,215,0.08);
  box-shadow: 0 0 0 6px rgba(89,187,215,0.1);
}
.file-zone__thumb {
  width: 76px; height: 76px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  transition: border-color var(--t-fast);
}
.file-zone:hover .file-zone__thumb { border-color: rgba(89,187,215,0.3); }
.file-zone__img { width: 100%; height: 100%; object-fit: contain; }
.file-zone__icon { color: rgba(255,255,255,0.18); }
.file-zone__body { flex: 1; min-width: 0; }
.file-zone__label {
  font-size: 14px; font-weight: 600; color: var(--c-text); margin-bottom: 4px;
}
.file-zone__hint { font-size: 12px; color: var(--c-text-muted); line-height: 1.5; }
.file-zone__action {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px; padding: 7px 14px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  color: var(--c-accent); background: rgba(89,187,215,0.08);
  border: 1px solid rgba(89,187,215,0.2); border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast);
}
.file-zone__action:hover { background: rgba(89,187,215,0.15); border-color: rgba(89,187,215,0.35); }
.file-zone__filename {
  margin-top: 8px; font-size: 12px; color: var(--c-accent);
  font-family: var(--font-mono);
  display: none;
}
.file-zone__filename.is-visible { display: block; }

/* ═══════════════════════════════════════════════════════════════════════
   Areas page — full-viewport immersive map rework
   ═══════════════════════════════════════════════════════════════════════ */

/* Viewport container */
.areas-viewport {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #0b0e1a;
}

/* Full-screen map canvas */
#areas-map {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.leaflet-container {
  height: 100%;
  width: 100%;
  font-family: var(--font-body);
  background: #0d1117;
}

/* Dark map attribution */
.leaflet-control-attribution {
  background: rgba(11,14,26,0.7) !important;
  color: rgba(255,255,255,0.3) !important;
  font-size: 10px !important;
  backdrop-filter: blur(4px);
}
.leaflet-control-attribution a { color: rgba(89,187,215,0.6) !important; }

/* Hide the default Leaflet draw toolbar (we use custom buttons) */
.leaflet-draw-toolbar { display: none !important; }

/* ── Topbar ─────────────────────────────────────────────────────────── */
.areas-topbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 500;
}
.areas-topbar__draw {
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 0 1px rgba(89,187,215,0.15);
  backdrop-filter: blur(4px);
}

/* ── Panel toggle button (lives outside the panel, always accessible) ── */
.areas-panel-toggle {
  position: absolute;
  top: 20px;
  left: calc(340px + 16px + 8px); /* right of open panel */
  z-index: 401;
  width: 28px;
  height: 28px;
  background: rgba(13, 16, 32, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(89, 187, 215, 0.12);
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: left 260ms cubic-bezier(0.4,0,0.2,1),
              background var(--t-fast), color var(--t-fast);
  animation: panel-slide-in 0.3s 0.05s cubic-bezier(0.22,1,0.36,1) both;
}
.areas-panel-toggle:hover { background: rgba(89,187,215,0.12); color: var(--c-accent); }
.areas-panel-toggle svg { transition: transform 260ms cubic-bezier(0.4,0,0.2,1); }
/* When collapsed: button slides left to left edge of map */
.areas-viewport.panel-collapsed .areas-panel-toggle { left: 16px; }
/* Rotate chevron to point right when collapsed */
.areas-viewport.panel-collapsed .areas-panel-toggle svg { transform: rotate(180deg); }

/* ── Floating panel ─────────────────────────────────────────────────── */
.areas-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  bottom: 16px;
  z-index: 400;
  width: 340px;
  background: rgba(13, 16, 32, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(89, 187, 215, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 260ms cubic-bezier(0.4,0,0.2,1);
  animation: panel-slide-in 0.3s cubic-bezier(0.22,1,0.36,1) backwards;
}
@keyframes panel-slide-in {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
/* Collapsed: fully off-screen, nothing visible */
.areas-panel.is-collapsed {
  transform: translateX(calc(-100% - 24px));
}

/* Panel header */
.areas-panel__header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.areas-panel__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-accent);
}
.areas-panel__count-wrap {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 2px;
}

/* Panel body — scrollable cards list */
.areas-panel__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(89,187,215,0.2) transparent;
}
.areas-panel__body::-webkit-scrollbar { width: 4px; }
.areas-panel__body::-webkit-scrollbar-track { background: transparent; }
.areas-panel__body::-webkit-scrollbar-thumb { background: rgba(89,187,215,0.2); border-radius: 2px; }

/* Panel footer */
.areas-panel__footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}


/* ── Area cards v2 ──────────────────────────────────────────────────── */
.area-card-v2 {
  position: relative;
  flex-shrink: 0;
  background: rgba(27, 32, 64, 0.7);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-fast);
  animation: card-appear 0.25s ease both;
}
@keyframes card-appear {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.area-card-v2:hover {
  border-color: rgba(89,187,215,0.3);
  background: rgba(27, 32, 64, 0.95);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.area-card-v2.is-selected {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 2px rgba(89,187,215,0.2), 0 4px 16px rgba(0,0,0,0.3);
  background: rgba(27, 32, 64, 0.98);
}

/* Left accent stripe (color-coded by status) */
.area-card-v2__accent {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  transition: background 0.4s ease;
}

.area-card-v2__inner {
  padding: 12px 14px 12px 17px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.area-card-v2__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.area-card-v2__name {
  font-weight: 600;
  font-size: 14px;
  color: var(--c-text);
  line-height: 1.3;
}
.area-card-v2__meta {
  font-size: 11px;
  color: var(--c-text-muted);
}

/* Progress bar */
.area-card-v2__progress {
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
}
.area-card-v2__progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--c-accent), var(--c-secondary));
  border-radius: 2px;
  transition: width 600ms cubic-bezier(0.4,0,0.2,1);
}

/* Stats */
.area-card-v2__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11px;
  color: var(--c-text-muted);
}
.area-card-v2__stats strong { color: var(--c-text); }
.area-card__leads {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--c-good);
  font-weight: 600;
}
.area-card__leads svg { width: 10px; height: 10px; }

/* Error state */
.area-card__error {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 11px;
  color: #f07070;
  background: rgba(196,69,69,0.1);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
}
.area-card__error svg { width: 10px; height: 10px; flex-shrink: 0; margin-top: 1px; }

/* Card actions */
.area-card-v2__actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.area-card-v2__delete { color: var(--c-text-muted) !important; }
.area-card-v2__delete:hover { color: var(--c-bad) !important; border-color: var(--c-bad) !important; }

/* ── Empty state ────────────────────────────────────────────────────── */
.areas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 20px;
  gap: 10px;
  color: var(--c-text-muted);
}
.areas-empty__icon {
  font-size: 36px;
  opacity: 0.25;
  animation: scoplio-pulse 2.5s ease-out infinite;
}
.areas-empty__title { font-size: 15px; font-weight: 600; color: var(--c-text); }
.areas-empty__sub { font-size: 13px; color: var(--c-text-muted); line-height: 1.55; max-width: 240px; }

/* ── Right-side map controls ────────────────────────────────────────── */
.areas-controls {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(13, 16, 32, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(89,187,215,0.12);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: panel-slide-in 0.3s 0.1s cubic-bezier(0.22,1,0.36,1) both;
}
.areas-ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.areas-ctrl-btn:hover {
  background: rgba(89,187,215,0.12);
  color: var(--c-accent);
  border-color: rgba(89,187,215,0.2);
}
.areas-ctrl-btn.is-loading {
  animation: ctrl-spin 1s linear infinite;
  color: var(--c-accent);
}
@keyframes ctrl-spin { to { transform: rotate(360deg); } }
.areas-ctrl-btn svg { width: 16px; height: 16px; pointer-events: none; }
.areas-ctrl-sep {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 2px 0;
}

/* ── Draw hint ──────────────────────────────────────────────────────── */
.areas-draw-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  background: rgba(13, 16, 32, 0.88);
  backdrop-filter: blur(10px);
  color: var(--c-text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(89,187,215,0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  animation: hint-pop 0.2s cubic-bezier(0.22,1,0.36,1);
}
@keyframes hint-pop {
  from { opacity: 0; transform: translateX(-50%) scale(0.9); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}
.areas-draw-hint.hidden { display: none !important; }

/* ── Live dot ───────────────────────────────────────────────────────── */
.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-accent);
  flex-shrink: 0;
  animation: scoplio-pulse 1.6s ease-out infinite;
}

/* ── Create area drawer ─────────────────────────────────────────────── */
.areas-drawer {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  width: 360px;
  background: rgba(13, 16, 32, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(89,187,215,0.18);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  overflow-y: auto;
  padding: 0;
  transform: translateX(calc(100% + 20px));
  transition: transform 230ms cubic-bezier(0.4,0,0.2,1), opacity 230ms ease;
  opacity: 0;
}
.areas-drawer.hidden { display: none !important; }
.areas-drawer.is-open { transform: translateX(0); opacity: 1; }

.areas-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: sticky;
  top: 0;
  background: rgba(13, 16, 32, 0.98);
  z-index: 2;
}
.areas-drawer__title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-accent);
}
.areas-drawer__close {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.areas-drawer__close:hover { background: rgba(196,69,69,0.15); color: var(--c-bad); }
.areas-drawer__close svg { width: 12px; height: 12px; }

#areas-drawer .form { max-width: none; padding: 20px; gap: 18px; }

/* Advanced BAE details section */
.drawer-details {
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.drawer-details summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255,255,255,0.03);
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--t-fast), color var(--t-fast);
}
.drawer-details summary::-webkit-details-marker { display: none; }
.drawer-details summary::before {
  content: '›';
  font-size: 16px;
  transition: transform 0.2s;
  display: inline-block;
}
.drawer-details[open] summary::before { transform: rotate(90deg); }
.drawer-details summary:hover { background: rgba(89,187,215,0.06); color: var(--c-text); }
.drawer-details__body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

/* Polygon area visual in map */
.area-poly { cursor: pointer; }

/* Leaflet popup dark theme */
.leaflet-popup-content-wrapper {
  background: var(--c-surface) !important;
  color: var(--c-text) !important;
  border: 1px solid var(--c-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-2) !important;
  font-family: var(--font-body) !important;
}
.leaflet-popup-tip { background: var(--c-surface) !important; }
.leaflet-popup-close-button { color: var(--c-text-muted) !important; }
.leaflet-popup-close-button:hover { color: var(--c-text) !important; }
.leaflet-popup-content { font-size: 13px !important; line-height: 1.5 !important; }
.leaflet-popup-content a { color: var(--c-accent) !important; }

/* Responsive: on narrow viewports collapse panel by default */
@media (max-width: 900px) {
  .areas-panel { width: 300px; }
  .areas-drawer { width: 300px; }
}
@media (max-width: 640px) {
  .areas-panel { width: calc(100vw - 32px); top: auto; bottom: 0; left: 0; right: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; height: 45vh; }
  .areas-controls { top: auto; bottom: 90px; transform: none; }
  .areas-topbar { top: 12px; right: 12px; }
}

/* ── Modal overlay (sc-modal) ────────────────────────────────────────── */
/* Visibility is controlled exclusively by the .is-open class so the
   hidden HTML attribute and display:flex can never conflict.           */
.sc-modal {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  align-items: center; justify-content: center;
  padding: 16px;
}
.sc-modal.is-open { display: flex; }
.sc-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 7, 18, 0.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: cmd-fade-in 0.15s ease;
}
.sc-modal__box {
  position: relative; z-index: 1;
  background: var(--c-surface);
  border: 1px solid rgba(89, 187, 215, 0.15);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(89, 187, 215, 0.06);
  animation: cmd-slide-in 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.sc-modal__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--c-border);
}
.sc-modal__body { padding: 20px 24px; }
.sc-modal__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 16px; margin-top: 4px;
  border-top: 1px solid var(--c-border);
}
.sc-modal__close {
  background: none; border: none; color: var(--c-text-muted); cursor: pointer;
  padding: 4px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: color var(--t-fast), background var(--t-fast);
}
.sc-modal__close:hover { color: var(--c-text); background: rgba(255, 255, 255, 0.07); }

/* ── Contact avatar ──────────────────────────────────────────────────── */
.contact-av {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-primary) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.03em;
  -webkit-user-select: none;
  user-select: none;
}
.contact-av--sm { width: 32px; height: 32px; font-size: 12px; }
.contact-av--lg { width: 56px; height: 56px; font-size: 20px; }
.contact-av--xl { width: 72px; height: 72px; font-size: 26px; box-shadow: 0 0 0 3px rgba(89,187,215,0.2), 0 4px 16px rgba(0,0,0,0.35); }

/* ── Form label utility ──────────────────────────────────────────────── */
.form__label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 5px;
}

/* ── Contact detail layout ───────────────────────────────────────────── */
.contact-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }

/* ── Contact hero header ─────────────────────────────────────────────── */
.contact-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 24px; margin-bottom: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
}
.contact-hero__info { flex: 1; min-width: 0; }
.contact-hero__name { font-size: 22px; font-weight: 700; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-hero__sub { font-size: 13px; color: var(--c-text-muted); margin-top: 3px; }
.contact-hero__actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Section label ───────────────────────────────────────────────────── */
.section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--c-text-muted);
  margin-bottom: 12px;
}

/* ── Alias row ───────────────────────────────────────────────────────── */
.alias-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.alias-row:last-of-type { border-bottom: none; }

/* ── Info rows (contact detail left panel) ───────────────────────────── */
.info-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.info-row:last-of-type { border-bottom: none; padding-bottom: 0; }
.info-row:first-of-type { padding-top: 0; }
.info-row__icon {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: rgba(89, 187, 215, 0.07);
  border: 1px solid rgba(89, 187, 215, 0.12);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.info-row__icon svg { width: 13px; height: 13px; stroke: var(--c-accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.info-row__body { flex: 1; min-width: 0; }
.info-row__label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--c-text-muted); margin-bottom: 2px;
}
.info-row__value { font-size: 13px; color: var(--c-text); word-break: break-word; line-height: 1.4; }

/* ── Landing Page AI Studio ──────────────────────────────────────────────────── */
.lp-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px;
  padding: 80px 24px; text-align: center;
}
.lp-empty__icon { font-size: 52px; opacity: 0.18; line-height: 1; }
.lp-empty__text { color: var(--c-text-muted); font-size: 14px; line-height: 1.6; max-width: 400px; margin: 0; }

.lp-studio {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: 740px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--c-surface);
}

.lp-studio__preview {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--c-border);
  min-width: 0;
}

.lp-studio__preview-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; flex-shrink: 0;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}
.lp-studio__preview-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--c-text-muted);
}
.lp-studio__preview-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.lp-studio__iframe {
  flex: 1; width: 100%; border: none; background: #fff; display: block;
}

/* Chat panel */
.lp-studio__chat {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--c-surface);
}
.lp-chat__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; flex-shrink: 0;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.lp-chat__title {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--c-text-muted);
}
.lp-chat__status-dot {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--c-text-muted);
  background: var(--c-surface); padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--c-border);
}
.lp-chat__status-dot--approved {
  color: #5fd9a5;
  background: rgba(47,163,122,0.12);
  border-color: rgba(47,163,122,0.30);
}

.lp-chat__feed {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: thin;
}

/* Chat messages */
.lp-chat__msg {
  display: flex; flex-direction: column; gap: 3px;
  animation: lpMsgIn 0.18s ease;
}
@keyframes lpMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lp-chat__msg--user      { align-items: flex-end; }
.lp-chat__msg--assistant { align-items: flex-start; }

.lp-chat__bubble {
  max-width: 90%; padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px; line-height: 1.5;
  word-break: break-word;
}
.lp-chat__msg--user .lp-chat__bubble {
  background: rgba(29,91,148,0.22);
  color: var(--c-text);
  border-bottom-right-radius: 3px;
}
.lp-chat__msg--assistant .lp-chat__bubble {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
  border-bottom-left-radius: 3px;
  font-size: 12px;
}
.lp-chat__msg-time {
  font-size: 10px; color: var(--c-text-muted); padding: 0 4px;
}

/* Generation event marker */
.lp-chat__event {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; font-size: 11px; color: var(--c-text-muted);
  background: rgba(89,187,215,0.06);
  border: 1px solid rgba(89,187,215,0.12);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.lp-chat__event-icon { color: #59BBD7; font-size: 14px; }

/* Composer area */
.lp-chat__composer {
  border-top: 2px solid var(--c-border);
  padding: 10px 12px; flex-shrink: 0;
  background: var(--c-surface-2);
}
.lp-chat__input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: var(--c-bg); color: var(--c-text);
  font-size: 13px; font-family: inherit;
  padding: 8px 10px; resize: none; outline: none; line-height: 1.5;
  transition: border var(--t-fast);
}
.lp-chat__input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(29,91,148,0.15);
}
.lp-chat__input::placeholder { color: var(--c-text-muted); }

.lp-chat__composer-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.lp-chat__char-count { font-size: 11px; color: var(--c-text-muted); }

/* Thinking dots */
.lp-chat__thinking {
  display: flex; gap: 4px; align-items: center; padding: 6px 2px;
}
.lp-chat__thinking-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #59BBD7; opacity: 0.5;
  animation: lpDotBounce 1.2s ease-in-out infinite;
}
.lp-chat__thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.lp-chat__thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes lpDotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

/* Mobile: stack vertically */
@media (max-width: 900px) {
  .lp-studio {
    grid-template-columns: 1fr;
    grid-template-rows: 420px 1fr;
    height: auto; min-height: 720px;
  }
  .lp-studio__preview { border-right: none; border-bottom: 1px solid var(--c-border); }
}

/* ── Compose attachment bar ───────────────────────────────────────────────────── */
.compose-attach-bar {
  border-top: 1px solid var(--c-border);
  padding: 6px 16px 4px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--c-surface);
}
.compose-attach-bar__left {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}

.compose-attach-list { display: flex; flex-wrap: wrap; gap: 5px; }

/* Attachment chip in compose */
.compose-attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 3px 8px; font-size: 11px; color: var(--c-text-muted);
  max-width: 260px;
  animation: chipPop 0.14s ease;
}
.compose-attach-chip__name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.compose-attach-chip__size { flex-shrink: 0; opacity: 0.65; }
.compose-attach-chip__remove {
  background: none; border: none; color: var(--c-text-muted);
  cursor: pointer; font-size: 14px; line-height: 1;
  padding: 0; opacity: 0.6; flex-shrink: 0;
  transition: opacity 0.1s, color 0.1s;
}
.compose-attach-chip__remove:hover { opacity: 1; color: var(--c-bad); }

/* Landing page quick-attach active state */
.compose-attach-lp-active {
  background: rgba(89,187,215,0.10) !important;
  border-color: rgba(89,187,215,0.30) !important;
  color: #59BBD7 !important;
}

/* Drag-over highlight */
.compose-box.is-dragover {
  border-top-color: #59BBD7;
  background: rgba(89,187,215,0.03);
}

/* ── Attachment chips on sent messages ───────────────────────────────────────── */
.msg-card__attachments {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--c-border);
}
.msg-attach-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--c-text-muted);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: 3px 10px; text-decoration: none;
  transition: border-color 120ms, color 120ms;
}
.msg-attach-chip:hover { border-color: #59BBD7; color: #59BBD7; }
.msg-attach-chip__size { opacity: 0.6; }
