/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --green:        #86C62E;
  --green-dim:    rgba(134,198,46,0.12);
  --green-border: rgba(134,198,46,0.30);
  --green-hover:  rgba(134,198,46,0.20);
  --dark:         #0a0a0a;
  --surface:      #111111;
  --surface2:     #191919;
  --surface3:     #212121;
  --border:       rgba(255,255,255,0.08);
  --border2:      rgba(255,255,255,0.12);
  --text:         #f0f0f0;
  /* --text-dim and --text-muted bumped for WCAG AA: 888→9c (4.6:1), 555→6e (3.0:1 on dark for non-text UI) */
  --text-dim:     #9c9c9c;
  --text-muted:   #6e6e6e;
  --danger:       #ef4444;
  --danger-dim:   rgba(239,68,68,0.12);
  --warn:         #f59e0b;
  --warn-dim:     rgba(245,158,11,0.12);
  --info:         #3b82f6;
  --info-dim:     rgba(59,130,246,0.12);
  --sidebar-w:    240px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  /* Neutral overlay tokens (inverted per theme) */
  --overlay-02:   rgba(255,255,255,0.02);
  --overlay-03:   rgba(255,255,255,0.03);
  --overlay-04:   rgba(255,255,255,0.04);
  --overlay-06:   rgba(255,255,255,0.06);
  --overlay-12:   rgba(255,255,255,0.12);
  --overlay-22:   rgba(255,255,255,0.22);
}

:root[data-theme="light"] {
  --green:        #5e9a17;
  --green-dim:    rgba(134,198,46,0.18);
  --green-border: rgba(94,154,23,0.40);
  --green-hover:  rgba(134,198,46,0.25);
  --dark:         #f5f5f7;
  --surface:      #ffffff;
  --surface2:     #f0f0f3;
  --surface3:     #e4e4e9;
  --border:       rgba(0,0,0,0.08);
  --border2:      rgba(0,0,0,0.14);
  --text:         #1a1a1a;
  /* 5a5a5a was already close; 4e4e4e lifts dim text to solid AA (5.7:1 on white) */
  --text-dim:     #4e4e4e;
  --text-muted:   #707070;
  --danger-dim:   rgba(239,68,68,0.10);
  --warn-dim:     rgba(245,158,11,0.14);
  --info-dim:     rgba(59,130,246,0.10);
  --shadow:       0 4px 24px rgba(0,0,0,0.08);
  --overlay-02:   rgba(0,0,0,0.02);
  --overlay-03:   rgba(0,0,0,0.03);
  --overlay-04:   rgba(0,0,0,0.04);
  --overlay-06:   rgba(0,0,0,0.05);
  --overlay-12:   rgba(0,0,0,0.14);
  --overlay-22:   rgba(0,0,0,0.26);
}

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

html, body {
  height: 100%;
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--dark);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Visible focus ring for keyboard users — intentionally only on :focus-visible
   so mouse interaction stays clean. WCAG 2.4.7 Focus Visible. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Buttons already have a background; a solid ring looks cleaner than outline. */
.btn:focus-visible,
.chip-btn:focus-visible,
.tab-btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
/* Text inputs: keep the existing border highlight as the focus indicator. */
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible,
.search-input:focus-visible,
.range-input:focus-visible,
.filter-select:focus-visible { outline: none; }

/* Keyboard shortcut chips (used in the availability legend). */
kbd {
  display: inline-block;
  padding: 1px 5px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.72em;
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-bottom-width: 2px;
  border-radius: 4px;
  line-height: 1.2;
}

/* Respect the user's reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Skip-to-content link — invisible until focused, lets keyboard users
   bypass the sidebar nav. */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  z-index: 1000;
  padding: 8px 12px;
  background: var(--green);
  color: #0a0a0a;
  font-weight: 600;
  font-size: 0.82rem;
  border-radius: 4px;
  transition: top 0.12s;
}
.skip-link:focus { top: 8px; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .18s ease;
}

:root[data-sidebar="collapsed"] { --sidebar-w: 56px; }
:root[data-sidebar="collapsed"] .sidebar-app-name,
:root[data-sidebar="collapsed"] .nav-item span,
:root[data-sidebar="collapsed"] .theme-toggle-label,
:root[data-sidebar="collapsed"] .sidebar-back { display: none; }
:root[data-sidebar="collapsed"] .sidebar-header { padding: 1rem .5rem .75rem; justify-content: center; }
:root[data-sidebar="collapsed"] .sidebar-logo { height: 16px; }
:root[data-sidebar="collapsed"] .nav-item { justify-content: center; padding: .55rem .5rem; }
:root[data-sidebar="collapsed"] .sidebar-footer { padding: .5rem .4rem; text-align: center; }
:root[data-sidebar="collapsed"] .theme-toggle { justify-content: center; padding: .5rem .3rem; }
:root[data-sidebar="collapsed"] .sidebar-fold svg { transform: rotate(180deg); }

.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  transition: margin-left .18s ease, margin-right .18s ease;
}

.sidebar-fold {
  margin-left: auto;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
  transition: color .12s, background .12s, border-color .12s;
}
.sidebar-fold:hover { color: var(--text); background: var(--overlay-04); border-color: var(--border2); }
.sidebar-fold svg { width: 12px; height: 12px; transition: transform .18s ease; }

#view-root {
  flex: 1;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar-header {
  padding: 1.25rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.sidebar-logo {
  height: 18px;
}

.sidebar-app-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border2);
}

.nav-list {
  list-style: none;
  padding: 0.5rem 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 1rem;
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: color 0.12s, background 0.12s;
  margin: 1px 6px;
  border-radius: 6px;
  position: relative;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.12s;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  color: var(--green);
  background: var(--green-dim);
}

.nav-item.active svg {
  opacity: 1;
  stroke: var(--green);
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-back {
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: color 0.12s;
}

.sidebar-back:hover { color: var(--text-dim); }

/* ── Theme toggle (sidebar footer) ──────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.55rem;
  margin-bottom: 0.5rem;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  transition: color .12s, background .12s, border-color .12s;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--overlay-04);
  border-color: var(--border2);
}

.theme-toggle .theme-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

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

.theme-toggle-label { flex: 1; text-align: left; }

/* ── Page header ────────────────────────────────────────────────────────────── */
.page-header {
  padding: 1.5rem 1.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  background: var(--dark);
}

.page-header-left { display: flex; align-items: center; gap: 0.75rem; }

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-subtitle {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 1px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.12s;
  white-space: nowrap;
  line-height: 1;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--green);
  color: #0a0a0a;
  border-color: var(--green);
}
.btn-primary:hover { background: #97d63a; border-color: #97d63a; }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}
.btn-secondary:hover { background: var(--surface3); border-color: var(--overlay-22); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Page body scroll container ─────────────────────────────────────────────── */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
}

/* ── Dashboard ─────────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-card.accent .stat-value { color: var(--green); }

.category-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.cat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
  color: inherit;
}

.cat-chip:hover {
  border-color: var(--green-border);
  background: var(--green-dim);
}

.cat-chip-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

.cat-chip-count {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
}

.recent-uploads-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  font-size: 0.83rem;
}

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

.recent-item-title {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item-meta { color: var(--text-dim); font-size: 0.78rem; flex-shrink: 0; }

/* ── Section headers ─────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.data-table th {
  padding: 0.6rem 0.875rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover { background: var(--surface2); }

.data-table tbody tr.clickable { cursor: pointer; }

/* ── Filters bar ─────────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--dark);
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 320px;
}

.search-wrap svg {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.45rem 0.75rem 0.45rem 2.1rem;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s;
}

.search-input:focus { border-color: var(--green-border); }

.filter-select {
  padding: 0.45rem 2rem 0.45rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 14px;
  cursor: pointer;
  transition: border-color 0.12s;
  max-width: 180px;
}

.filter-select:focus { border-color: var(--green-border); }

.range-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.range-wrap span { font-size: 0.78rem; color: var(--text-dim); }

.range-input {
  width: 80px;
  padding: 0.45rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s;
}

.range-input:focus { border-color: var(--green-border); }

/* ── Chips / badges ─────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.chip-green {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.chip-blue {
  background: var(--info-dim);
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,0.25);
}

.chip-amber {
  background: var(--warn-dim);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.25);
}

.chip-red {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.25);
}

.chip-gray {
  background: var(--overlay-06);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* ── Filter chip-group (quick tab-style filters) ───────────────────────────── */
.chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 999px;
}

.chip-btn {
  padding: 4px 11px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: color .12s, background .12s;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.chip-btn:hover { color: var(--text); }

.chip-btn.is-active {
  background: var(--green-dim);
  color: var(--green);
  box-shadow: 0 0 0 1px var(--green-border) inset;
}

/* Inline "Active only" toggle — label wraps a native checkbox */
.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: color .12s, border-color .12s;
}

.toggle-inline:hover { color: var(--text); border-color: var(--border); }

.toggle-inline input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.toggle-inline:has(input:checked) {
  color: var(--green);
  border-color: var(--green-border);
  background: var(--green-dim);
}

.filter-count {
  margin-left: auto;
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Availability matrix ─────────────────────────────────────────────────────── */
.av-table-wrap {
  padding: 0 1.75rem 1rem;
}

.av-table {
  min-width: 900px;
}

.av-table th,
.av-table td {
  padding: 6px 8px;
  font-size: 0.8rem;
}

.av-sticky-col {
  position: sticky;
  left: 0;
  background: var(--dark);
  z-index: 2;
  min-width: 220px;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.av-table thead th.av-sticky-col { z-index: 3; }

.av-cell {
  padding: 2px 4px;
  background: var(--surface);
  transition: background .12s;
  text-align: right;
}

.av-cell.av-dirty {
  background: var(--warn-dim);
  box-shadow: inset 0 0 0 1px rgba(245,158,11,0.4);
}

.av-cell.av-shared {
  background: linear-gradient(135deg, var(--green-dim) 50%, var(--info-dim) 50%);
}

.av-cell.av-dirty.av-shared {
  background: linear-gradient(135deg, var(--warn-dim) 50%, var(--info-dim) 50%);
  box-shadow: inset 0 0 0 1px rgba(245,158,11,0.4);
}

.av-input {
  width: 64px;
  padding: 3px 6px;
  font-size: 0.8rem;
  text-align: right;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 3px;
  outline: none;
  transition: border-color .12s, background .12s;
}

.av-input:focus {
  background: var(--dark);
  border-color: var(--green-border);
}

.av-input.av-invalid {
  border-color: var(--danger);
  color: var(--danger);
}

.av-shared-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--info-dim);
  border: 1px solid rgba(59,130,246,0.35);
  border-radius: 2px;
  vertical-align: middle;
}

.av-legend {
  margin-top: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  padding-bottom: 0.5rem;
}
.av-legend kbd { font-size: 0.68rem; padding: 1px 4px; }

/* Container so the input + indicator dots can coexist inside one cell. */
.av-cell-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Small dots in the cell's top-right corner: green = shared, amber = note.
   These give a visible affordance for states that were previously invisible. */
.av-dot {
  position: absolute;
  top: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
}
.av-dot-shared { right: 3px;  background: #60a5fa; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); }
.av-dot-note   { right: 11px; background: #fbbf24; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); }
.av-cell.av-has-note { cursor: help; }

/* Column-totals footer */
.av-table tfoot .av-footer td {
  position: sticky;
  bottom: 0;
  background: var(--surface2, #0f1320);
  border-top: 1px solid var(--border);
  font-size: .82rem;
}
.av-table tfoot .av-footer .av-sticky-col {
  background: var(--surface2, #0f1320);
  z-index: 2;
}

/* ── Availability timeline panel ─────────────────────────────────────────── */
.timeline-panel {
  margin: 0.25rem 1.75rem 0.9rem;
  padding: 0.75rem 1rem 0.6rem;
  background: var(--surface, #141824);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.timeline-readout {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .5rem;
}
.timeline-value {
  font-size: 1.02rem;
  margin-top: 2px;
}
.timeline-value b { font-weight: 600; }
.timeline-value #tl-total { color: var(--green); }
.timeline-sub { font-size: .78rem; margin-top: 2px; }
.timeline-sep { margin: 0 .4rem; color: var(--text-muted); }
.timeline-hint { font-size: .72rem; }

.timeline-bars {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 46px;
  padding: 2px 0;
}
.tl-bar {
  flex: 1 1 0;
  min-width: 2px;
  background: var(--green-dim, rgba(74,222,128,0.22));
  border-radius: 1px 1px 0 0;
  cursor: pointer;
  transition: background .08s;
}
.tl-bar:hover { background: var(--green, #4ade80); }
.tl-bar.is-active {
  background: var(--green, #4ade80);
  box-shadow: 0 0 0 1px rgba(74,222,128,0.55);
}

.timeline-range {
  width: 100%;
  margin: 4px 0 2px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.timeline-range::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
}
.timeline-range::-moz-range-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
}
.timeline-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green, #4ade80);
  border: 2px solid var(--surface, #141824);
  margin-top: -6px;
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.timeline-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green, #4ade80);
  border: 2px solid var(--surface, #141824);
  cursor: grab;
}
.timeline-range:focus { outline: none; }
.timeline-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--green-dim), 0 1px 4px rgba(0,0,0,0.5);
}
.timeline-range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--green-dim), 0 1px 4px rgba(0,0,0,0.5);
}

.timeline-ticks {
  display: grid;
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.tl-year { text-align: center; }

.av-diff-table {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.av-diff-table th, .av-diff-table td { padding: 6px 8px; }

/* ── Modals ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  backdrop-filter: blur(3px);
}

.modal-overlay.hidden { display: none; }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  z-index: 210;
  width: 90vw;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: modal-in 0.14s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-lg { max-width: 720px; }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}

.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-close svg { width: 16px; height: 16px; }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid.single { grid-template-columns: 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  padding: 0.5rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s;
  width: 100%;
}

.form-input:focus { border-color: var(--green-border); }

.form-input-with-unit {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface2);
  transition: border-color 0.12s;
}

.form-input-with-unit:focus-within { border-color: var(--green-border); }

.form-input-with-unit input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--text);
  outline: none;
  min-width: 0;
}

.unit-chip {
  display: flex;
  align-items: center;
  padding: 0 0.65rem;
  background: var(--surface3);
  border-left: 1px solid var(--border2);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.form-select {
  padding: 0.5rem 2.2rem 0.5rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 14px;
  cursor: pointer;
  transition: border-color 0.12s;
  width: 100%;
}

.form-select:focus { border-color: var(--green-border); }

.form-textarea {
  padding: 0.5rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 80px;
  width: 100%;
  transition: border-color 0.12s;
}

.form-textarea:focus { border-color: var(--green-border); }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--dark);
  overflow-x: auto;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  margin-bottom: -1px;
}

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

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

.tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
}

.tab-pane.active { display: block; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.card-body { padding: 1.25rem; }

.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

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

.field-key {
  font-size: 0.78rem;
  color: var(--text-dim);
  flex-shrink: 0;
  min-width: 140px;
}

.field-val {
  font-size: 0.83rem;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

/* ── Availability grid ─────────────────────────────────────────────────────── */
.avail-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: fixed;
}

.avail-grid th {
  padding: 0.5rem 0.25rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.avail-grid th:first-child { text-align: left; width: 60px; }

.avail-grid td {
  padding: 0.3rem 0.2rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.avail-grid td:first-child { text-align: left; font-weight: 600; padding-left: 0.5rem; }

.avail-cell {
  width: 100%;
  padding: 0.3rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  text-align: center;
  font-size: 0.78rem;
  outline: none;
  transition: border-color 0.1s;
  min-width: 0;
}

.avail-cell:focus { border-color: var(--green-border); }

.avail-cell.has-value { background: var(--green-dim); border-color: var(--green-border); color: var(--green); }

/* ── ROD scoring ─────────────────────────────────────────────────────────────── */
.rod-criterion {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}

.rod-criterion:last-child { border-bottom: none; }

.rod-name {
  font-size: 0.83rem;
  font-weight: 500;
  flex: 1;
}

.rod-score-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rod-slider {
  width: 120px;
  accent-color: var(--green);
}

.rod-score-val {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--green);
  min-width: 32px;
  text-align: right;
}

.rod-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 0;
  font-weight: 700;
}

/* ── Toast notifications ─────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.83rem;
  font-weight: 500;
  max-width: 360px;
  pointer-events: all;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast-success { background: #1a2e1a; color: #6ee36e; border-color: rgba(110,227,110,0.25); }
.toast-error   { background: #2e1a1a; color: #fca5a5; border-color: rgba(252,165,165,0.25); }
.toast-info    { background: #1a1f2e; color: #93c5fd; border-color: rgba(147,197,253,0.25); }

/* ── Loading states ─────────────────────────────────────────────────────────── */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--dark);
  opacity: 0.4;
  border-radius: inherit;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

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

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 0.75rem;
  color: var(--text-dim);
  font-size: 0.83rem;
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-dim);
  text-align: center;
  gap: 0.5rem;
}

.empty-state svg { opacity: 0.3; margin-bottom: 0.5rem; }
.empty-state strong { font-size: 0.9rem; color: var(--text); }
.empty-state p { font-size: 0.82rem; }

/* ── Detail two-column layout ─────────────────────────────────────────────── */
.detail-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100%;
  overflow: hidden;
}

.detail-sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.photo-placeholder {
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.photo-placeholder svg { width: 32px; height: 32px; }

.quick-facts { display: flex; flex-direction: column; }

.quick-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}

.quick-fact:last-child { border-bottom: none; }

.qf-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.qf-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Inline editing ─────────────────────────────────────────────────────────── */
.editable-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.editable-field .edit-pencil {
  opacity: 0;
  transition: opacity 0.1s;
  color: var(--text-muted);
  flex-shrink: 0;
}

.editable-field:hover .edit-pencil { opacity: 1; }

.inline-edit-wrap {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.inline-edit-wrap input,
.inline-edit-wrap select,
.inline-edit-wrap textarea {
  padding: 0.3rem 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--green-border);
  border-radius: 5px;
  color: var(--text);
  outline: none;
  font-size: inherit;
}

/* ── Maintenance task list ────────────────────────────────────────────────── */
.task-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}

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

.task-main { flex: 1; }
.task-meta { color: var(--text-dim); font-size: 0.78rem; }

/* ── Cost list ─────────────────────────────────────────────────────────────── */
.cost-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}

.cost-bar {
  height: 4px;
  background: var(--green-dim);
  border-radius: 2px;
  overflow: hidden;
  flex: 1;
}

.cost-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
}

.cost-val { font-weight: 600; min-width: 80px; text-align: right; }
.cost-pct { color: var(--text-dim); min-width: 40px; text-align: right; font-size: 0.78rem; }

/* ── Supplier header ─────────────────────────────────────────────────────────── */
.supplier-header {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.supplier-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.supplier-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ── Documents ─────────────────────────────────────────────────────────────── */
.doc-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 0.83rem;
}

.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: var(--surface2); }

.doc-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-icon svg { width: 16px; height: 16px; color: var(--text-dim); }

.doc-info { flex: 1; min-width: 0; }
.doc-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 0.76rem; color: var(--text-dim); }
.doc-actions { flex-shrink: 0; display: flex; gap: 0.375rem; }

/* ── PDF viewer ─────────────────────────────────────────────────────────────── */
.pdf-viewer {
  width: 100%;
  height: 600px;
  border: none;
  background: var(--surface2);
  border-radius: var(--radius);
}

/* ── Settings ─────────────────────────────────────────────────────────────── */
.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 2rem;
}

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

.setting-info { flex: 1; min-width: 0; }
.setting-label { font-size: 0.875rem; font-weight: 500; }
.setting-desc { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }

/* Toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 22px;
  cursor: pointer;
  transition: all 0.15s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all 0.15s;
}

.toggle input:checked + .toggle-slider { background: var(--green-dim); border-color: var(--green-border); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: var(--green); }

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.text-green { color: var(--green); }
.text-dim   { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.gap-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--overlay-12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--overlay-22); }

/* ── Back breadcrumb ─────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.375rem;
}

.breadcrumb a { color: var(--text-dim); transition: color 0.1s; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { color: var(--text-muted); }

/* ── View picker (saved supplier-grid configurations) ───────────────────────── */
.view-picker {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.view-picker .form-select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .4rem .55rem;
  font-size: .82rem;
  height: 32px;
}

/* ── Column chooser modal ───────────────────────────────────────────────────── */
.col-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem .85rem;
  max-height: 360px;
  overflow: auto;
  padding: .15rem;
}
.col-picker-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .4rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: .82rem;
  color: var(--text-dim);
  transition: background .08s, color .08s;
}
.col-picker-row:hover { background: var(--overlay-04); color: var(--text); }
.col-picker-row input[type="checkbox"] { cursor: pointer; }

/* ── Comments drawer (supplier modal) ───────────────────────────────────────── */
.comment-item {
  padding: .55rem .2rem;
  border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .2rem;
  font-size: .8rem;
}
.comment-body {
  color: var(--text);
  font-size: .82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.comm-del { opacity: .55; }
.comm-del:hover { opacity: 1; color: var(--danger, #ef4444); }

/* ── Side drawer (right-side folding panel, e.g. comments log) ──────────────── */
.side-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border2);
  box-shadow: -12px 0 32px rgba(0,0,0,0.28);
  z-index: 180;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 16px));
  transition: transform .22s cubic-bezier(.4,.0,.2,1);
}
:root[data-theme="light"] .side-drawer { box-shadow: -12px 0 32px rgba(0,0,0,0.08); }
.side-drawer.is-open { transform: translateX(0); }
.side-drawer.is-collapsed { transform: translateX(calc(100% - 36px)); }

.drawer-head {
  padding: .9rem 1rem .85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.drawer-fold {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
}
.drawer-fold:hover { color: var(--text); background: var(--overlay-04); border-color: var(--border2); }
.drawer-fold svg { width: 12px; height: 12px; transition: transform .18s ease; }
.side-drawer.is-collapsed .drawer-fold svg { transform: rotate(180deg); }
.drawer-title {
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-title small {
  display: block;
  font-size: .72rem;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0;
  margin-top: 1px;
}
.drawer-close {
  background: none;
  border: none;
  color: var(--text-dim);
  width: 26px; height: 26px;
  border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.drawer-close:hover { background: var(--surface2); color: var(--text); }
.drawer-close svg { width: 14px; height: 14px; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: .85rem 1rem 1.25rem;
}
.side-drawer.is-collapsed .drawer-body,
.side-drawer.is-collapsed .drawer-foot,
.side-drawer.is-collapsed .drawer-title { visibility: hidden; }

.drawer-foot {
  border-top: 1px solid var(--border);
  padding: .75rem 1rem .85rem;
  background: var(--surface);
  flex-shrink: 0;
}
.drawer-foot .form-textarea { min-height: 64px; }
.drawer-foot-row {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: .45rem;
}

.log-group { margin-bottom: 1rem; }
.log-day {
  position: sticky;
  top: -0.85rem;
  background: var(--surface);
  padding: .35rem 0 .25rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.log-day::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.log-entry {
  position: relative;
  padding: .45rem 0 .5rem .95rem;
  border-left: 1px solid var(--border2);
  margin-left: .25rem;
}
.log-entry::before {
  content: '';
  position: absolute;
  left: -4px; top: .7rem;
  width: 7px; height: 7px;
  background: var(--green);
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-sizing: content-box;
}
.log-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .76rem;
  color: var(--text-dim);
  margin-bottom: .15rem;
}
.log-head .log-author { color: var(--text); font-weight: 600; font-size: .8rem; }
.log-head .log-time  { margin-left: auto; font-size: .7rem; color: var(--text-muted); }
.log-body {
  color: var(--text);
  font-size: .82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.log-entry .log-del {
  opacity: 0;
  transition: opacity .1s, color .1s;
  padding: 2px 4px;
}
.log-entry:hover .log-del { opacity: .6; }
.log-entry .log-del:hover { opacity: 1; color: var(--danger); }

.drawer-empty {
  color: var(--text-dim);
  font-size: .82rem;
  padding: 1.5rem .5rem;
  text-align: center;
}

@media (max-width: 600px) {
  .side-drawer { width: 92vw; }
}

/* ── Detail page bottom nav (prev / next) ──────────────────────────────────── */
.detail-navbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .5rem .75rem;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}
.detail-navbar .btn {
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  gap: .35rem;
}
.detail-navbar .btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
}

/* ── Tabulator overrides (keep grid consistent with app theme) ──────────────── */
#supp-grid .tabulator,
#eq-grid   .tabulator { background: transparent; border: 1px solid var(--border); border-radius: 8px; }
#supp-grid .tabulator .tabulator-header,
#eq-grid   .tabulator .tabulator-header { background: var(--surface2); border-bottom: 1px solid var(--border); }
#supp-grid .tabulator-row.tabulator-selectable:hover,
#eq-grid   .tabulator-row.tabulator-selectable:hover { background: var(--overlay-03); }
#supp-grid .tabulator-row .tabulator-cell,
#eq-grid   .tabulator-row .tabulator-cell { border-right: 1px solid var(--overlay-03); }
#supp-grid .supp-active-chk,
#eq-grid   .eq-active-chk { accent-color: var(--green); width: 14px; height: 14px; cursor: pointer; }
#supp-grid .tabulator-group,
#eq-grid   .tabulator-group { background: var(--surface2); color: var(--text); font-size: .82rem; }
#supp-grid .tabulator-header-filter input,
#supp-grid .tabulator-header-filter select,
#eq-grid   .tabulator-header-filter input,
#eq-grid   .tabulator-header-filter select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: .75rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .detail-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .col-picker { grid-template-columns: 1fr; }
}

/* ── AI Assistant drawer ────────────────────────────────────────────────── */
.ai-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(900px, 85vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(0,0,0,0.35);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}
.ai-drawer.is-open { transform: translateX(0); }
.ai-drawer.maximized { width: 100vw; transition: transform 220ms ease-out, width 220ms ease-out; }

.ai-drawer-actions { display: flex; gap: 4px; align-items: center; }

.ai-preview-actions { display: inline-flex; gap: 4px; align-items: center; }

/* Fullscreen preview overlay — content is moved in from the drawer and back. */
.ai-fs-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15, 17, 22, 0.92);
  display: flex; flex-direction: column;
  opacity: 0; transition: opacity 180ms ease-out;
}
.ai-fs-overlay.is-open { opacity: 1; }
.ai-fs-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: #fff; font-size: 14px;
  background: rgba(0,0,0,0.4);
}
.ai-fs-body {
  flex: 1; overflow: hidden; display: flex; flex-direction: column;
  background: #1f2228; margin: 0 16px 16px;
  border-radius: 6px;
}
.ai-fs-body > * { flex: 1; }

.ai-drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2, var(--surface));
}
.ai-drawer-title { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.ai-sparkle { color: var(--green, #86C62E); font-size: 18px; }
.ai-dash-status {
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(127,127,127,0.15);
}
.ai-dash-status.ok  { background: rgba(134,198,46,0.15); color: var(--green, #86C62E); }
.ai-dash-status.bad { background: rgba(239,68,68,0.15); color: #ef4444; }

.ai-drawer-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
}
.ai-tab {
  background: none; border: none; color: var(--text-dim, #9aa);
  padding: 10px 14px; cursor: pointer; font-size: 13px;
  border-bottom: 2px solid transparent;
}
.ai-tab.active { color: var(--text, #fff); border-bottom-color: var(--green, #86C62E); }

.ai-drawer-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.ai-pane { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.ai-pane.active { display: flex; }

/* Search pane ─────────────────────────────────────────────────────────── */
.ai-search-top {
  display: flex; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.ai-search-input {
  flex: 1; padding: 6px 10px; font-size: 13px;
  background: var(--surface2, var(--surface)); color: var(--text, #eee);
  border: 1px solid var(--border); border-radius: 6px;
}
.ai-search-body {
  flex: 1; display: grid; grid-template-columns: 320px 1fr;
  overflow: hidden; min-height: 0;
}
.ai-search-results { border-right: 1px solid var(--border); overflow-y: auto; }
.ai-search-preview { overflow: hidden; display: flex; flex-direction: column; }

.ai-empty { padding: 24px 16px; color: var(--text-dim, #889); font-size: 13px; text-align: center; }
.ai-empty.bad { color: #ef4444; }

.ai-result {
  display: flex; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.ai-result:hover, .ai-result.active { background: var(--surface2, rgba(255,255,255,0.03)); }
.ai-result.active { box-shadow: inset 3px 0 0 var(--green, #86C62E); }
.ai-result-chk { margin-top: 2px; }
.ai-result-main { flex: 1; min-width: 0; }
.ai-result-title {
  font-size: 13px; font-weight: 600; color: var(--text, #eee);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-result-meta {
  display: flex; gap: 6px; align-items: center;
  margin-top: 3px; font-size: 11px;
}
.ai-chip {
  background: rgba(134,198,46,0.18); color: var(--green, #86C62E);
  padding: 1px 6px; border-radius: 3px; font-weight: 600;
}
.ai-chip-dim {
  background: rgba(127,127,127,0.15); color: var(--text-dim, #889);
  padding: 1px 6px; border-radius: 3px;
}
.ai-path {
  color: var(--text-dim, #889); font-family: ui-monospace, monospace; font-size: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-result-snippet {
  margin-top: 4px; font-size: 12px; color: var(--text-dim, #aab); line-height: 1.4;
}

.ai-preview-head {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px;
}
.ai-preview-body { flex: 1; overflow: hidden; background: #374151; display: flex; flex-direction: column; }
.ai-preview-iframe { width: 100%; height: 100%; border: 0; background: #fff; }

/* DOCX preview (mammoth HTML) */
.ai-preview-doc {
  flex: 1; overflow: auto; background: #fff; color: #111;
  padding: 18px 24px; font-size: 13px; line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.ai-preview-doc p  { margin: 0 0 8px; }
.ai-preview-doc h1, .ai-preview-doc h2, .ai-preview-doc h3 { margin: 14px 0 6px; font-weight: 600; }
.ai-preview-doc table { border-collapse: collapse; margin: 8px 0; }
.ai-preview-doc td, .ai-preview-doc th { border: 1px solid #d0d0d0; padding: 4px 8px; font-size: 12px; }
.ai-preview-doc img { max-width: 100%; height: auto; }

/* XLSX preview (SheetJS tables) */
.ai-xlsx-tabs {
  display: flex; gap: 2px; overflow-x: auto; padding: 4px 6px 0;
  background: #2b313a; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.ai-xlsx-tab {
  padding: 5px 10px; font-size: 11px; border: 1px solid transparent;
  background: transparent; color: var(--text-dim, #aab); cursor: pointer;
  border-radius: 4px 4px 0 0; white-space: nowrap;
}
.ai-xlsx-tab.active { background: #fff; color: #111; border-color: var(--border); border-bottom-color: #fff; }
.ai-xlsx-body { flex: 1; overflow: auto; background: #fff; }
.ai-xlsx-panel { display: none; padding: 8px; }
.ai-xlsx-panel.active { display: block; }
.ai-xlsx-panel table { border-collapse: collapse; font-size: 11px; color: #111; font-family: -apple-system, sans-serif; }
.ai-xlsx-panel td, .ai-xlsx-panel th {
  border: 1px solid #d5d9df; padding: 3px 6px; min-width: 40px;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-xlsx-panel tr:first-child td { background: #f3f4f6; font-weight: 600; }

.ai-search-footer {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px; border-top: 1px solid var(--border);
  background: var(--surface2, var(--surface));
}
.ai-footer-chk { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-dim, #aab); cursor: pointer; }
.ai-selected-count { flex: 1; color: var(--text-dim, #889); font-size: 12px; }

.ai-progress {
  max-height: 180px; overflow-y: auto;
  padding: 8px 12px; border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2); font-family: ui-monospace, monospace; font-size: 11px;
}
.ai-progress-row { padding: 2px 0; color: var(--text-dim, #aab); }
.ai-progress-row.attached, .ai-progress-row.extracted, .ai-progress-row.done { color: var(--green, #86C62E); }
.ai-progress-row.error, .ai-progress-row.extract_error { color: #ef4444; }

/* Chat pane ──────────────────────────────────────────────────────────── */
.ai-chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ai-bubble {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 10px; border-radius: 6px;
  background: var(--surface2, rgba(255,255,255,0.03));
}
.ai-bubble-user   { background: rgba(134,198,46,0.08); }
.ai-bubble-role   { font-size: 11px; color: var(--text-dim, #889); min-width: 30px; padding-top: 2px; }
.ai-bubble-text   { flex: 1; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; }
.ai-note          { font-size: 11px; color: var(--text-dim, #889); padding: 2px 8px; font-family: ui-monospace, monospace; }
.ai-note.tool     { color: #8cf; }
.ai-note.tool.ok  { color: var(--green, #86C62E); }
.ai-note.tool.bad, .ai-note.bad { color: #ef4444; }

.ai-chat-quick {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 6px 12px; border-top: 1px solid var(--border);
}
.ai-quick {
  background: var(--surface2, rgba(255,255,255,0.06));
  color: var(--text, #eee); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 999px; cursor: pointer; font-size: 11px;
}
.ai-quick:hover { background: rgba(134,198,46,0.15); border-color: var(--green, #86C62E); }

.ai-chat-input {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.ai-chat-input textarea {
  flex: 1; resize: none; padding: 6px 10px; font-size: 13px; font-family: inherit;
  background: var(--surface2, var(--surface)); color: var(--text, #eee);
  border: 1px solid var(--border); border-radius: 6px;
}

.hidden { display: none !important; }

/* ─── Vendor Data Records (VDR) ───────────────────────────────────────────── */
.vdr-layout {
  display: grid; grid-template-columns: 300px 1fr;
  gap: 1rem; padding: 1rem; height: 100%; overflow: hidden;
}
.vdr-list-wrap {
  display: flex; flex-direction: column; gap: 0.6rem;
  border-right: 1px solid var(--border); padding-right: 0.75rem;
  overflow-y: auto;
}
.vdr-list-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.25rem;
}
.vdr-h { font-size: 0.9rem; margin: 0; color: var(--text); font-weight: 600; }
.vdr-list { display: flex; flex-direction: column; gap: 0.4rem; }
.vdr-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.7rem 0.8rem; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.vdr-card:hover { border-color: var(--green-border); background: var(--surface3); }
.vdr-card.active { border-color: var(--green); background: var(--green-dim); }
.vdr-card-title {
  font-weight: 600; color: var(--text); font-size: 0.88rem;
  margin-bottom: 0.3rem;
}
.vdr-card-meta {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  font-size: 0.72rem; color: var(--text-dim); margin-bottom: 0.4rem;
}
.vdr-chip {
  background: var(--green-dim); color: var(--green);
  border: 1px solid var(--green-border); border-radius: 999px;
  padding: 1px 8px; font-size: 0.7rem; white-space: nowrap;
}
.vdr-chip-dim {
  background: var(--overlay-04); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 8px; font-size: 0.7rem; white-space: nowrap;
}
.vdr-bar {
  background: var(--overlay-06); border-radius: 4px; height: 4px;
  overflow: hidden;
}
.vdr-bar-fill { background: var(--green); height: 100%; transition: width 0.2s; }

.vdr-detail {
  display: flex; flex-direction: column; gap: 0.75rem;
  overflow-y: auto; padding-left: 0.5rem;
}
.vdr-detail-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border);
}
.vdr-detail-title { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.vdr-detail-sub {
  font-size: 0.78rem; color: var(--text-dim); margin-top: 0.3rem;
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}
.vdr-detail-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.vdr-detail-body { display: flex; flex-direction: column; gap: 1rem; }

.vdr-view-toggle {
  display: inline-flex; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.vdr-view-toggle button {
  background: transparent; color: var(--text-dim); border: none;
  padding: 4px 10px; font-size: 0.78rem; cursor: pointer;
}
.vdr-view-toggle button.active {
  background: var(--green-dim); color: var(--green);
}

.vdr-tpl {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.vdr-tpl-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.55rem 0.8rem;
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.vdr-tpl-role {
  font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em;
}
.vdr-sec { padding: 0.4rem 0.8rem; }
.vdr-sec-head {
  font-size: 0.78rem; font-weight: 600; color: var(--text);
  padding: 0.45rem 0 0.35rem; letter-spacing: 0.02em;
}

.vdr-slot {
  display: grid; grid-template-columns: 14px 1fr auto;
  gap: 0.6rem; align-items: flex-start;
  padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--overlay-04);
}
.vdr-slot:last-child { border-bottom: none; }
.vdr-slot-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-muted); margin-top: 5px;
}
.vdr-slot-pending .vdr-slot-dot { background: var(--warn); }
.vdr-slot-received .vdr-slot-dot { background: var(--green); }
.vdr-slot-na .vdr-slot-dot { background: var(--text-muted); opacity: 0.5; }
.vdr-slot-na .vdr-slot-main { opacity: 0.55; }

.vdr-slot-title { font-weight: 500; color: var(--text); font-size: 0.85rem; }
.vdr-slot-pat {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem; color: var(--text-muted); margin-top: 2px;
}
.vdr-slot-desc { font-size: 0.76rem; color: var(--text-dim); margin-top: 3px; }
.vdr-slot-files { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.vdr-slot-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }

.vdr-file-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--overlay-04); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 9px; font-size: 0.72rem;
  color: var(--text); text-decoration: none; max-width: 280px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vdr-file-chip:hover { background: var(--overlay-06); border-color: var(--border2); }
.vdr-file-src {
  font-size: 0.62rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}

.vdr-matrix {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.vdr-matrix th, .vdr-matrix td {
  padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: top;
}
.vdr-matrix th {
  background: var(--surface2); font-weight: 600;
  color: var(--text); font-size: 0.74rem;
}
.vdr-matrix-file { min-width: 220px; }

.vdr-empty {
  padding: 1.25rem; text-align: center; color: var(--text-dim);
  font-size: 0.85rem; background: var(--surface2);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.vdr-empty.bad { color: var(--danger); border-color: var(--danger); }
.vdr-loading { padding: 1.5rem; text-align: center; color: var(--text-dim); }

.vdr-tpl-pick {
  display: flex; flex-direction: column; gap: 0.4rem;
  max-height: 240px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.5rem; background: var(--surface);
}
.vdr-tpl-pick-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; color: var(--text);
  padding: 0.3rem; border-radius: 4px; cursor: pointer;
}
.vdr-tpl-pick-row:hover { background: var(--overlay-04); }

.vdr-attach-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
.vdr-atab {
  background: transparent; color: var(--text-dim); border: none;
  padding: 0.5rem 0.9rem; font-size: 0.82rem; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.vdr-atab.active { color: var(--green); border-bottom-color: var(--green); }
.vdr-apane { display: none; }
.vdr-apane.active { display: block; }

/* Find-missing (AI) modal */
.vdr-fm-slot {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.55rem 0.7rem; margin-bottom: 0.6rem; background: var(--surface);
}
.vdr-fm-slot-head {
  display: flex; gap: 0.6rem; align-items: baseline;
  font-weight: 600; color: var(--text); font-size: 0.85rem;
  margin-bottom: 0.4rem;
}
.vdr-fm-hits { display: flex; flex-direction: column; gap: 0.35rem; }
.vdr-fm-hit {
  display: flex; gap: 0.6rem; align-items: center;
  padding: 0.4rem 0.5rem; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 6px;
}
.vdr-fm-hit-main { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.vdr-fm-hit-title {
  font-size: 0.88rem; color: var(--text); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vdr-fm-hit-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem; color: var(--text-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vdr-fm-hit-snip {
  font-size: 0.75rem; color: var(--text-dim); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.vdr-fm-hit.active {
  border-color: var(--green); background: var(--green-dim);
}
.vdr-fm-hit { cursor: pointer; }

/* Split-pane find-missing modal */
.modal-xl {
  max-width: min(1400px, 98vw) !important;
  width: 96vw;
  resize: both; overflow: auto;
}
.modal-xl .modal-body { padding: 1rem; }
.vdr-fm-split {
  display: grid;
  grid-template-columns: minmax(280px, 40%) 6px 1fr;
  gap: 0;
  height: 72vh;
  min-height: 400px;
}
.vdr-fm-left {
  overflow-y: auto;
  padding-right: 0.5rem;
  min-width: 0;
}
.vdr-fm-resizer {
  cursor: col-resize;
  background: var(--border);
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  transition: background 0.15s;
}
.vdr-fm-resizer:hover,
.vdr-fm-resizer:active {
  background: var(--green);
}
.vdr-fm-right {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.vdr-fm-preview-head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border);
  background: var(--surface2); font-size: 0.85rem;
}
.vdr-fm-preview-body { flex: 1; overflow: auto; padding: 0.75rem; }
.vdr-fm-preview-body iframe.ai-preview-iframe {
  width: 100%; height: 100%; border: 0; background: #fff;
}
