/* ══════════════════════════════════════════
   LIGHT MODE TOKENS (default)
══════════════════════════════════════════ */
:root {
  --bg:           #f2ede5;
  --surface:      #faf7f1;
  --surface-2:    #edeae1;
  --surface-3:    #e4e0d6;
  --border:       #a8a298;
  --border-dim:   #c0bbb2;
  --text:         #1c1a14;
  --text-muted:   #4a4540;
  --text-dim:     #8a847c;
  --accent:       #9e6e08;
  --accent-hover: #bc8010;
  --accent-dim:   rgba(158,110,8,0.10);
  --accent-glow:  rgba(158,110,8,0.16);
  --dot-color:    rgba(80,65,40,0.055);
  --overlay-bg:   rgba(18,16,10,0.58);
  --green:        #286640;
  --green-dim:    rgba(40,102,64,0.12);
  --red:          #882020;
  --red-dim:      rgba(136,32,32,0.12);
  --blue:         #1c4898;
  --blue-dim:     rgba(28,72,152,0.12);
  --orange:       #984010;
  --orange-dim:   rgba(152,64,16,0.12);
  --purple:       #502898;
  --purple-dim:   rgba(80,40,152,0.12);
  --sidebar-w:    220px;
  --radius:       5px;
  --radius-sm:    3px;
  --radius-lg:    8px;
}

/* ══════════════════════════════════════════
   DARK MODE TOKENS
══════════════════════════════════════════ */
[data-theme="dark"] {
  --bg:           #0c0d0b;
  --surface:      #131412;
  --surface-2:    #1b1c19;
  --surface-3:    #232420;
  --border:       #48493f;
  --border-dim:   #343530;
  --text:         #e8e4da;
  --text-muted:   #a09c94;
  --text-dim:     #636058;
  --accent:       #c98d0a;
  --accent-hover: #e0a01a;
  --accent-dim:   rgba(201,141,10,0.12);
  --accent-glow:  rgba(201,141,10,0.18);
  --dot-color:    rgba(255,255,255,0.022);
  --overlay-bg:   rgba(6,7,5,0.80);
  --green:        #3d8a58;
  --green-dim:    rgba(61,138,88,0.13);
  --red:          #a63030;
  --red-dim:      rgba(166,48,48,0.13);
  --blue:         #3060a0;
  --blue-dim:     rgba(48,96,160,0.13);
  --orange:       #b05820;
  --orange-dim:   rgba(176,88,32,0.13);
  --purple:       #6040a0;
  --purple-dim:   rgba(96,64,160,0.13);
}

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

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-dim);
}

.sidebar-logo svg { stroke: var(--accent); flex-shrink: 0; }

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-left: 2px solid transparent;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  user-select: none;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
  border-left-color: var(--border);
}

.nav-item.active {
  color: var(--accent-hover);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.nav-item .badge {
  margin-left: auto;
  background: var(--accent);
  color: #0c0d0b;
  font-size: 10px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0;
}

/* ── Sidebar footer (theme toggle) ── */
.sidebar-footer {
  padding: 8px 12px 4px;
  border-top: 1px solid var(--border-dim);
}

.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 4px;
  margin-bottom: 6px;
  color: var(--text-dim);
}

.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  padding: 3px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}

.btn-logout:hover {
  color: var(--red);
  background: var(--red-dim);
}

.btn-theme-toggle {
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10.5px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s;
  margin-bottom: 8px;
}

.btn-theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface-2);
}

/* Show moon in light mode, sun in dark mode */
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Theme label: show "Dark mode" in light, "Light mode" in dark */
.label-dark  { display: inline; }
.label-light { display: none; }
[data-theme="dark"] .label-dark  { display: none; }
[data-theme="dark"] .label-light { display: inline; }

/* Language toggle: show "Українська" in EN, "English" in UK */
.lang-label-uk { display: inline; }
.lang-label-en { display: none; }
[data-lang="uk"] .lang-label-uk { display: none; }
[data-lang="uk"] .lang-label-en { display: inline; }

.btn-new-claim {
  margin: 0 12px 18px;
  padding: 10px 14px;
  background: var(--accent);
  color: #0c0d0b;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  font-family: 'IBM Plex Sans', sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.12s;
}

.btn-new-claim:hover { background: var(--accent-hover); }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 30px 34px;
  min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; }

.page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 22px;
  letter-spacing: 0.02em;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title-row .page-title { margin-bottom: 0; }

/* ── Plus / New Manual Claim button ── */
.btn-plus-claim {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #0c0d0b;
  border: none;
  cursor: pointer;
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, transform 0.1s, box-shadow 0.12s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.btn-plus-claim:hover {
  background: var(--accent-hover);
  transform: scale(1.10);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 28px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 70%);
}

.stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 34px;
  font-weight: 600;
  color: var(--accent-hover);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Page Header / Filters ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.filters input,
.filters select {
  padding: 7px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s;
}

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.filters input::placeholder { color: var(--text-dim); }

/* ── Search wrapper with icon ── */
.search-wrapper {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 11px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.search-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-icon {
  color: var(--text-dim);
  pointer-events: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.search-wrapper input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 7px 0 !important;
  outline: none !important;
  min-width: 190px;
}

.search-wrapper input:focus {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* ── Prominent status filter ── */
.filter-status-select {
  border-color: var(--accent) !important;
  background: var(--accent-dim) !important;
  font-weight: 600;
  font-size: 13px !important;
  padding: 7px 13px !important;
  box-shadow: 0 0 0 2px var(--accent-glow);
  color: var(--text) !important;
}

.filter-status-select:focus {
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

.filter-status-select optgroup {
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

/* ── Table ── */
.table-wrapper {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

.claims-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.claims-table th {
  padding: 10px 14px;
  text-align: left;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  font-family: 'IBM Plex Mono', monospace;
}

.claims-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-dim);
  color: var(--text);
  vertical-align: middle;
}

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

.claims-table tbody tr:hover td {
  background: var(--surface-2);
}

.claims-table .empty-row td {
  text-align: center;
  color: var(--text-dim);
  padding: 48px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* ── Status Badges (light mode defaults) ── */
.status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'IBM Plex Mono', monospace;
  border: 1px solid transparent;
}

.status-unclaimed           { background: rgba(158,110,8,0.07); color: var(--text-dim); border-color: rgba(158,110,8,0.22); }
.status-new                 { background: var(--blue-dim);   color: #1a4898; border-color: rgba(28,72,152,0.30); }
.status-submitted           { background: var(--orange-dim); color: #8a3a08; border-color: rgba(152,64,16,0.30); }
.status-in_progress         { background: var(--accent-dim); color: var(--accent); border-color: rgba(158,110,8,0.30); }
.status-compensation_agreed { background: var(--green-dim);  color: #1a5830; border-color: rgba(40,102,64,0.30); }
.status-sent_to_finance     { background: var(--purple-dim); color: #3c1890; border-color: rgba(80,40,152,0.30); }
.status-closed              { background: var(--surface-3);  color: var(--text-muted); border-color: var(--border); }
.status-rejected            { background: var(--red-dim);    color: #882020; border-color: rgba(136,32,32,0.30); }
.status-cancelled           { background: var(--surface-3);  color: var(--text-muted); border-color: var(--border); }

/* Status badge dark mode overrides */
[data-theme="dark"] .status-unclaimed           { color: var(--text-dim); border-color: rgba(158,110,8,0.18); }
[data-theme="dark"] .status-new                 { color: #6090d0; border-color: rgba(48,96,160,0.28); }
[data-theme="dark"] .status-submitted           { color: #c87a30; border-color: rgba(176,88,32,0.28); }
[data-theme="dark"] .status-in_progress         { color: var(--accent-hover); border-color: rgba(201,141,10,0.28); }
[data-theme="dark"] .status-compensation_agreed { color: #50a870; border-color: rgba(61,138,88,0.28); }
[data-theme="dark"] .status-sent_to_finance     { color: #8870c8; border-color: rgba(96,64,160,0.28); }
[data-theme="dark"] .status-rejected            { color: #c05050; border-color: rgba(166,48,48,0.28); }

/* ── Carrier Labels ── */
.carrier-label {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 9.5px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Action Buttons ── */
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--text-muted);
  transition: all 0.1s;
  white-space: nowrap;
}

.btn-icon:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-actions { display: flex; gap: 5px; flex-wrap: wrap; }

.btn-icon-danger { color: #882020; border-color: rgba(136,32,32,0.30); }
.btn-icon-danger:hover { background: var(--red-dim); border-color: rgba(136,32,32,0.50); color: #882020; }
[data-theme="dark"] .btn-icon-danger { color: #c05050; border-color: rgba(166,48,48,0.28); }
[data-theme="dark"] .btn-icon-danger:hover { color: #d06060; border-color: rgba(166,48,48,0.50); }

.btn-primary {
  background: var(--accent);
  color: #0c0d0b;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  font-family: 'IBM Plex Sans', sans-serif;
  letter-spacing: 0.03em;
  transition: background 0.12s;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'IBM Plex Sans', sans-serif;
  transition: all 0.12s;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--surface-2);
}

.btn-danger {
  background: var(--red);
  color: #f0d4d4;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  font-family: 'IBM Plex Sans', sans-serif;
  transition: background 0.12s;
}

.btn-danger:hover { background: #a02828; }

.btn-success {
  background: var(--green);
  color: #d0f0e0;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  font-family: 'IBM Plex Sans', sans-serif;
  transition: background 0.12s;
}

.btn-success:hover { background: #348050; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

[data-theme="dark"] .modal {
  box-shadow: 0 40px 100px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.03);
}

.modal-large { max-width: 860px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1.5px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-header h2 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: 'IBM Plex Mono', monospace;
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  transition: all 0.1s;
}

.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-dim);
}

.modal-body { padding: 22px; }

/* ── Steps ── */
.step { display: none; }
.step.active { display: block; }

.step-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-dim);
  font-family: 'IBM Plex Mono', monospace;
}

.step-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-dim);
}

/* ── Form ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'IBM Plex Mono', monospace;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-dim); }

.form-group textarea {
  resize: vertical;
  font-family: 'IBM Plex Sans', sans-serif;
}

.form-group label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  padding: 6px 0;
  font-family: 'IBM Plex Sans', sans-serif;
}

.form-group input[type="checkbox"] {
  width: 14px;
  height: 14px;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.required { color: var(--accent); }

/* ── Carrier form area ── */
.carrier-info-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
  font-family: 'IBM Plex Mono', monospace;
}

.carrier-info-box strong { color: var(--accent-hover); font-weight: 600; }

.sub-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.sub-type-btn {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface-2);
  text-align: left;
  transition: all 0.12s;
}

.sub-type-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.sub-type-btn.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.sub-type-btn .sub-label {
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--accent-hover);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sub-type-btn .sub-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Detail modal ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-section { margin-bottom: 20px; }

.detail-section h4 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-dim);
  font-family: 'IBM Plex Mono', monospace;
}

.detail-row {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  font-size: 12.5px;
}

.detail-row .key {
  color: var(--text-muted);
  min-width: 130px;
  font-weight: 500;
  font-size: 12px;
}

.detail-row .val {
  color: var(--text);
  font-weight: 400;
}

.history-list {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 3px;
}

.history-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border-dim);
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
}

.history-list li:last-child { border-bottom: none; }

.history-list li .h-time {
  color: var(--text-dim);
  font-size: 10.5px;
}

.history-list li .h-action {
  font-weight: 600;
  color: var(--text);
}

/* ── View Email button in history ── */
.btn-email-preview {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-dim);
  border: 1px solid rgba(158,110,8,0.35);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  transition: all 0.12s;
}

.btn-email-preview:hover {
  background: var(--accent);
  color: #0c0d0b;
  border-color: var(--accent);
}

[data-theme="dark"] .btn-email-preview {
  border-color: rgba(201,141,10,0.30);
  color: var(--accent-hover);
}

[data-theme="dark"] .btn-email-preview:hover {
  color: #0c0d0b;
}

/* ── Email preview popup ── */
/* NOTE: No backdrop-filter here — it conflicts with the detail modal's own
   backdrop-filter and causes Chrome to render the overlay behind the modal. */
.email-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.email-preview-popup {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 68vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.04);
  overflow: hidden;
  animation: emailPopupIn 0.15s ease;
}

@keyframes emailPopupIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

[data-theme="dark"] .email-preview-popup {
  box-shadow: 0 40px 100px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.06);
}

.email-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px 14px;
  border-bottom: 1.5px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  gap: 12px;
}

.email-preview-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.email-preview-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-family: 'IBM Plex Mono', monospace;
}

.email-preview-recipient {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-preview-subject-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}

.email-preview-subj-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.email-preview-subj-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  line-height: 1.4;
}

.email-preview-body-text {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  font-size: 12.5px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.8;
  background: var(--surface-2);
}

.status-select-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.status-select-row select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.12s;
}

.status-select-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.note-input-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.note-input-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.12s;
}

.note-input-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.note-input-row input::placeholder { color: var(--text-dim); }

/* ── Toast (light mode defaults) ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 18px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  font-family: 'IBM Plex Sans', sans-serif;
}

[data-theme="dark"] .toast {
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.toast.success {
  background: var(--green-dim);
  border-color: rgba(40,102,64,0.35);
  color: #1a5830;
}

.toast.error {
  background: var(--red-dim);
  border-color: rgba(136,32,32,0.35);
  color: #7a1a1a;
}

[data-theme="dark"] .toast.success { border-color: rgba(61,138,88,0.35);  color: #60c880; }
[data-theme="dark"] .toast.error   { border-color: rgba(166,48,48,0.35); color: #d06868; }

/* ── select option (dark mode only) ── */
[data-theme="dark"] select option { background: #1b1c19; color: #dedad1; }

/* ── Carriers page ── */
.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
  margin-top: -16px;
  margin-bottom: 22px;
}

.carriers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.carrier-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.14s;
}

.carrier-card:hover {
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}

[data-theme="dark"] .carrier-card:hover {
  box-shadow: 0 2px 16px rgba(0,0,0,0.4);
}

.carrier-card.method-email       { border-left-color: var(--blue); }
.carrier-card.method-automation  { border-left-color: var(--accent); }
.carrier-card.method-email-form  { border-left-color: var(--green); }
.carrier-card.method-email-web   { border-left-color: var(--purple); }

.carrier-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.carrier-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.carrier-card-method {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 3px;
}

.method-badge-email       { color: #1a4898; background: var(--blue-dim);   border-color: rgba(28,72,152,0.25); }
.method-badge-automation  { color: var(--accent); background: var(--accent-dim); border-color: rgba(158,110,8,0.25); }
.method-badge-form        { color: #1a5830; background: var(--green-dim);  border-color: rgba(40,102,64,0.25); }
.method-badge-web         { color: #3c1890; background: var(--purple-dim); border-color: rgba(80,40,152,0.25); }

[data-theme="dark"] .method-badge-email      { color: #6090d0; border-color: rgba(48,96,160,0.28); }
[data-theme="dark"] .method-badge-automation { color: var(--accent-hover); border-color: rgba(201,141,10,0.28); }
[data-theme="dark"] .method-badge-form       { color: #50a870; border-color: rgba(61,138,88,0.28); }
[data-theme="dark"] .method-badge-web        { color: #8870c8; border-color: rgba(96,64,160,0.28); }

.carrier-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
  margin-bottom: 8px;
}

.carrier-card-desc strong { color: var(--red); font-weight: 600; }
[data-theme="dark"] .carrier-card-desc strong { color: #c05050; }

.carrier-card-contact {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.carrier-card-footer {
  padding-top: 11px;
  border-top: 1px solid var(--border-dim);
}

.btn-carrier-claim {
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.12s;
  letter-spacing: 0.02em;
}

.btn-carrier-claim:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-hover);
}

/* ── Carrier claim modal ── */
.form-section-header {
  font-size: 10px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border-dim);
}

.carrier-section .form-section-header {
  margin-top: 20px;
}

/* Carrier info box stacking */
.carrier-info-box + .carrier-info-box {
  margin-top: 8px;
}

/* Carrier info box warning/notice variants */
.carrier-info-box.warning {
  border-left-color: var(--red);
  background: var(--red-dim);
  color: #882020;
}

[data-theme="dark"] .carrier-info-box.warning { color: #c05050; }

.carrier-info-box.notice {
  border-left-color: var(--orange);
  background: var(--orange-dim);
  color: #7a3808;
}

[data-theme="dark"] .carrier-info-box.notice { color: #c87a30; }

/* ── Manual claim description ── */
.manual-claim-desc {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  line-height: 1.6;
  padding: 10px 14px;
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 18px;
}

/* ── Carrier picker inside detail modal ── */
.carrier-picker-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.carrier-picker-select {
  flex: 1;
  min-width: 160px;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.12s;
}

.carrier-picker-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Email Claim Modal — two-column redesign ── */
.ecm-modal {
  max-width: 1060px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ecm-main-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ecm-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Left panel — claim details */
.ecm-left {
  width: 300px;
  min-width: 270px;
  border-right: 1px solid var(--border);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  background: var(--surface-2);
}

/* Right panel — email composition */
.ecm-right {
  flex: 1;
  min-width: 0;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Panel section titles */
.ecm-panel-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: 'IBM Plex Mono', monospace;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-dim);
  margin-bottom: 2px;
  flex-shrink: 0;
}

/* Value + Currency side-by-side */
.ecm-value-row {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px;
}

/* Insurance checkbox */
.ecm-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
}

.ecm-checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* Email compose panel (flex column filling right side) */
.ecm-compose-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 10px;
  overflow: hidden;
}

/* To / From / Subject fields grid */
.ecm-meta-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex-shrink: 0;
}

.ecm-subject-group {
  grid-column: 1 / -1;
}

.ecm-subject-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}

/* Recipient hint */
.ecm-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  font-style: italic;
  padding: 5px 10px;
  background: var(--surface-2);
  border-left: 2px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  flex-shrink: 0;
  margin: -4px 0 0;
}

.ecm-hint:empty { display: none; }

/* Body textarea — grows to fill remaining height */
.ecm-body-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ecm-body-area {
  flex: 1;
  resize: none;
  width: 100%;
  min-height: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  line-height: 1.75;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.ecm-body-area:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* EasyPost panel */
.ecm-easypost-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 14px;
}

/* Alternative redirects row */
.ecm-alt-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.ecm-alt-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
  margin-right: 4px;
}

/* Sticky footer */
.ecm-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  background: var(--surface);
  flex-shrink: 0;
}

.ecm-footer-actions {
  display: flex;
  gap: 10px;
}

/* Success pane */
.ecm-success-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
  gap: 12px;
  min-height: 300px;
}

.ecm-success-check {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1.5px solid rgba(40, 102, 64, 0.3);
  color: var(--green);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

[data-theme="dark"] .ecm-success-check {
  border-color: rgba(61, 138, 88, 0.35);
  color: #4aaa6e;
}

.ecm-success-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.ecm-success-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  max-width: 340px;
}

.ecm-success-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.ecm-from-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ecm-from-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.ecm-from-hint a {
  color: var(--accent);
  text-decoration: none;
}

.ecm-from-hint a:hover {
  text-decoration: underline;
}

.ecm-gmail-warn {
  color: var(--accent);
  font-weight: 500;
}
