/* ===========================================================================
   Trainer Matrix Tool — app.css
   Faithful to BRANDING.md (Asset College house style — same as scans.asset.college).
   Token names match the spec verbatim so future cross-app shares stay clean.
   =========================================================================== */

:root {
  /* Brand */
  --blue-bright: #20c4f4;   /* accent — focus rings, active borders, hover edges */
  --blue-mid:    #008dd2;   /* primary — buttons, links, branded UI chrome */
  --blue-pale:   #e6f6fd;   /* tinted backgrounds for callouts / blue surfaces */

  /* Ink */
  --ink:         #1a1a1a;
  --ink-soft:    #4a5568;
  --ink-muted:   #8a9bb0;

  /* Surfaces */
  --surface:     #ffffff;
  --surface-2:   #f0f8fd;   /* page background */
  --border:      #c8e8f8;   /* default border / divider, also disabled bg */

  /* Sizing */
  --sidebar-w:   220px;
  --radius:      8px;

  /* Sidebar (chrome) */
  --sidebar-bg:  #0d1117;

  /* Status — semantic */
  --green:       #166534;
  --green-bg:    #dcfce7;
  --green-border:#bbf7d0;
  --green-soft:  #f0fdf4;
  --amber:       #92400e;
  --amber-bg:    #fef3c7;
  --amber-border:#fde68a;
  --amber-soft:  #fffbeb;
  --red:         #991b1b;
  --red-strong:  #dc2626;
  --red-bg:      #fee2e2;
  --red-border:  #fecaca;
  --red-soft:    #fef2f2;

  /* Type tag palette (project-specific, kept brand-adjacent) */
  --type-employee:   #1f6feb;
  --type-contractor: #8b5cf6;
  --type-volunteer:  #16a34a;
  --type-partner:    #d97706;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--surface-2);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; height: 100vh; overflow: hidden; }

a { color: var(--blue-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Custom scrollbars (WebKit) — per spec */
::-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(--blue-bright); }

/* ============================================================================
   Sidebar — 220px fixed, dark navy, logo + nav (scrollable) + user pill
   ============================================================================ */

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  height: 100vh;
}

.sidebar-logo {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo img { width: 160px; height: auto; display: block; }

/* Sky-blue gradient hairline beneath the logo */
.sidebar-divider {
  height: 1px; margin: 0 14px;
  background: linear-gradient(90deg, rgba(32,196,244,.2), transparent);
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 8px 14px; }

/* Section headings (used to label different tools — for trainer-matrix we have
   one section but keep the structure for parity with scans). */
.nav-section {
  padding: 14px 14px 4px;
  display: flex; align-items: center;
}
.nav-item + .nav-section {
  margin-top: 14px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.nav-section-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.4);
}

.sidebar-status {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 14px 6px;
  font-size: 10.5px;
  color: rgba(255,255,255,.4);
}
.sidebar-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #6b7280;
}
.sidebar-status.connected .sidebar-status-dot { background: #22c55e; }
.sidebar-status.error     .sidebar-status-dot { background: #ef4444; }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border-radius: 6px;
  color: rgba(255,255,255,.45);
  font-size: 13px; font-weight: 400;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-left: 2px solid transparent;
}
.nav-item:hover {
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.75);
  text-decoration: none;
}
.nav-item.active {
  background: rgba(0,141,210,.25);
  color: #fff;
  font-weight: 500;
  border-left: 2px solid var(--blue-bright);
  padding-left: 10px;
}
.nav-item--disabled { opacity: .65; cursor: default; pointer-events: none; }

.nav-icon { width: 15px; height: 15px; opacity: .6; flex: 0 0 15px; }
.nav-item.active .nav-icon { opacity: 1; }

/* Count pill in nav (e.g. matrix run badge) */
.nav-item .count-pill { margin-left: auto; }

/* User pill at the bottom */
.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue-mid);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  flex: 0 0 28px;
}
.sidebar-user-info { min-width: 0; line-height: 1.25; }
.sidebar-user-name {
  color: rgba(255,255,255,.85);
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-email {
  color: rgba(255,255,255,.35);
  font-size: 10.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================================================
   Main pane — page-header (sticky) + scrollable content + footer
   ============================================================================ */

.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow-y: auto;
  background: var(--surface-2);
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 28px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 20;
  gap: 16px;
}
.page-header h1 {
  font-size: 18px; font-weight: 600;
  color: var(--ink); letter-spacing: -.01em;
  margin: 0;
}
.page-subtitle {
  font-size: 12.5px; color: var(--ink-muted);
  margin: 2px 0 0;
}

.page-header-actions {
  display: flex; align-items: center; gap: 10px;
}

.app-footer {
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 11.5px;
  color: var(--ink-muted);
  text-align: center;
  flex-shrink: 0;
}

/* ============================================================================
   Panels — the standard content container
   ============================================================================ */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 20px 28px 0;
  flex-shrink: 0;
}
.panel:last-of-type { margin-bottom: 20px; }

.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--blue-pale) 0%, var(--surface) 70%);
}
.panel-head-icon {
  width: 30px; height: 30px;
  background: var(--blue-mid);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.panel-head-icon svg { width: 15px; height: 15px; }
.panel-head-text { flex: 1; min-width: 0; }
.panel-head h2 {
  font-size: 13.5px; font-weight: 600; color: var(--ink); margin: 0;
}
.panel-head p {
  font-size: 12px; color: var(--ink-muted); margin: 1px 0 0;
}
.panel-head-actions { display: flex; gap: 8px; align-items: center; }

.panel-body { padding: 18px; }
.panel-body--flush { padding: 0; } /* For tables that should bleed to the panel edges */

.section-divider {
  border: 0; height: 1px; background: var(--border);
  margin: 36px 28px;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn-primary, .btn-ghost, .btn-generate, .btn-discard {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border: 0; outline: none;
  transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .1s;
}

.btn-primary {
  height: 38px; padding: 0 20px;
  background: var(--blue-mid); color: #fff;
  border-radius: 6px;
  font-size: 13.5px;
}
.btn-primary:hover  { background: #006fab; }
.btn-primary:disabled,
.btn-primary[disabled] { background: var(--border); color: var(--ink-muted); cursor: not-allowed; }

.btn-ghost {
  height: 30px; padding: 0 14px;
  background: transparent; color: var(--ink-soft);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
}
.btn-ghost:hover { background: var(--blue-pale); color: var(--blue-mid); border-color: var(--blue-bright); }

.btn-sm { height: 27px; padding: 0 12px; font-size: 12px; }

.btn-generate {
  height: 42px; padding: 0 24px;
  background: linear-gradient(135deg, var(--blue-bright) 0%, var(--blue-mid) 100%);
  color: #fff; border-radius: 7px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,141,210,.35);
}
.btn-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,141,210,.45);
}
.btn-generate:disabled,
.btn-generate[disabled] {
  background: var(--border); color: var(--ink-muted);
  box-shadow: none; cursor: not-allowed; transform: none;
}

.btn-discard {
  height: 36px; padding: 0 16px;
  background: transparent; color: var(--red-strong);
  border: 1.5px solid var(--red-border);
  border-radius: 6px;
  font-size: 13px;
}
.btn-discard:hover { background: var(--red-soft); }

/* Backwards-compat for older callsites that still use .btn-secondary */
.btn-secondary { /* alias of .btn-ghost */
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 14px;
  background: transparent; color: var(--ink-soft);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-secondary:hover { background: var(--blue-pale); color: var(--blue-mid); border-color: var(--blue-bright); }

/* ============================================================================
   Forms
   ============================================================================ */

.field-row    { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field        { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 160px; margin-bottom: 14px; }
.field-grow   { flex: 2; }
.field-label  {
  font-size: 11px; font-weight: 600; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .06em;
}
.field-label .optional { font-weight: 400; color: var(--ink-muted); text-transform: none; letter-spacing: 0; font-size: 10.5px; }
.field-label .required { color: var(--red-strong); }

.field-input {
  height: 38px; padding: 0 11px;
  border: 1.5px solid var(--border); border-radius: 6px;
  font-family: 'DM Sans', sans-serif; font-size: 13.5px;
  color: var(--ink); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.field-input { height: auto; padding: 10px 11px; line-height: 1.5; }
.field-input:focus {
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 3px rgba(32,196,244,.15);
}
.field-input::placeholder { color: var(--ink-muted); }

select.field-input { padding-right: 28px; cursor: pointer; }

.field-fieldset {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px;
}
.field-fieldset legend { padding: 0 6px; font-size: 11px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.field-fieldset label { margin-right: 14px; font-size: 13px; color: var(--ink-soft); }

.radio-group { display: flex; gap: 16px; }
.radio-option { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; color: var(--ink-soft); user-select: none; }
.radio-option input[type="radio"] { accent-color: var(--blue-mid); width: 15px; height: 15px; cursor: pointer; }
.radio-option:has(input:checked) { color: var(--ink); font-weight: 500; }

input[type="checkbox"] { accent-color: var(--blue-mid); width: 15px; height: 15px; }

/* Drop zone (file upload) */
.dropzone {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 32px 18px; text-align: center;
  transition: border-color .15s, background .15s; cursor: pointer;
  background: var(--surface);
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--blue-bright); background: var(--blue-pale); }
.dropzone p { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 4px; }
.dropzone p strong { color: var(--ink); font-weight: 600; }
.dropzone small { font-size: 11px; color: var(--ink-muted); }

/* ============================================================================
   Tables
   ============================================================================ */

.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  padding: 9px 14px; text-align: left;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-muted);
  background: #f7fbfe;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr {
  border-bottom: 1px solid #eef5fb;
  transition: background .1s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f0f9ff; }
.data-table tbody tr.row-selected { background: var(--blue-pale); }
.data-table td {
  padding: 9px 14px;
  color: var(--ink-soft);
  vertical-align: middle;
}
.td-name { font-weight: 500; color: var(--ink) !important; }
.td-id   { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--ink-muted) !important; }
.mono    { font-family: 'DM Mono', monospace; }

/* ============================================================================
   Badges & chips
   ============================================================================ */

.result-chip {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--blue-mid); color: #fff;
  padding: 3px 8px; border-radius: 4px;
}

.scenario-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; padding: 2px 6px; border-radius: 3px;
}
.scenario-badge.auto   { background: var(--green-bg); color: var(--green); }
.scenario-badge.manual { background: var(--amber-bg); color: var(--amber); }

.status-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 4px;
}
.status-badge.pushed { background: var(--green-bg); color: var(--green); }
.status-badge.failed { background: var(--red-bg);   color: var(--red); }

.confidence-badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px;
}
.confidence-badge.high   { background: var(--green-bg); color: var(--green); }
.confidence-badge.medium { background: var(--amber-bg); color: var(--amber); }
.confidence-badge.low    { background: var(--red-bg);   color: var(--red); }
.confidence-badge.none   { background: var(--surface-2); color: var(--ink-muted); }

.count-pill {
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 500;
  color: var(--blue-mid); background: #cceeff;
  padding: 3px 9px; border-radius: 10px;
}

/* Traffic-light pills (project-specific — share styling with status-badge but
   keep the legacy class names so existing JS keeps rendering correctly). */
.badge-green, .badge-amber, .badge-red {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 4px;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red   { background: var(--red-bg);   color: var(--red); }

.type-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.type-tag {
  display: inline-block;
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #fff;
  padding: 2px 7px; border-radius: 3px;
}
.type-tag.type-employee   { background: var(--type-employee); }
.type-tag.type-contractor { background: var(--type-contractor); }
.type-tag.type-volunteer  { background: var(--type-volunteer); }
.type-tag.type-partner    { background: var(--type-partner); }

.completeness-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 500;
  color: var(--blue-mid); background: #cceeff;
  padding: 3px 9px; border-radius: 10px;
}

/* Header-area connection chip — used in page-header right side */
.header-badge {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 500;
  color: var(--blue-mid); background: var(--blue-pale);
  border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 20px;
}
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #aaa;
  transition: background .3s;
}
.header-badge.connected .badge-dot { background: #22c55e; }
.header-badge.error     .badge-dot { background: #ef4444; }

/* Tier selector pill — sits in page-header right side */
.tier-selector {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--ink-muted);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 4px 4px 4px 12px;
  height: 38px;
}
.tier-label { font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.tier-selector select {
  appearance: none;
  background: transparent;
  border: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; color: var(--ink);
  font-weight: 500;
  height: 28px; padding: 0 10px 0 6px;
  cursor: pointer; outline: none;
}
.tier-selector:focus-within { border-color: var(--blue-bright); box-shadow: 0 0 0 3px rgba(32,196,244,.15); }

/* ============================================================================
   Stat tiles (dashboard)
   ============================================================================ */

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin: 20px 28px 0;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-muted);
}
.stat-value { font-size: 28px; font-weight: 600; color: var(--ink); margin-top: 4px; line-height: 1.1; }

/* Backwards-compat for legacy .stat-card calls */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }

/* ============================================================================
   Profile view — section tabs + evidence list
   ============================================================================ */

.profile-meta { display: flex; gap: 12px; align-items: center; margin-top: 6px; flex-wrap: wrap; }

.section-tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.section-tab {
  background: transparent; border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif; font-size: 12.5px;
  color: var(--ink-muted); font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.section-tab:hover { color: var(--ink); }
.section-tab.active { color: var(--blue-mid); border-bottom-color: var(--blue-bright); font-weight: 600; }

.evidence-item {
  display: grid; grid-template-columns: 90px 1fr auto; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid #eef5fb;
}
.evidence-item:last-child { border-bottom: 0; }
.evidence-ref { font-family: 'DM Mono', monospace; color: var(--blue-mid); font-weight: 500; font-size: 13px; }
.evidence-title { font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.evidence-fields { font-size: 12px; color: var(--ink-soft); display: flex; gap: 12px; flex-wrap: wrap; }
.evidence-fields span { background: var(--surface-2); padding: 2px 8px; border-radius: 4px; }
.evidence-comment { font-size: 12px; color: var(--ink-muted); margin-top: 4px; font-style: italic; }
.evidence-actions { display: flex; gap: 4px; align-items: center; }

/* ============================================================================
   Matrix accordion
   ============================================================================ */

.matrix-accordion { display: flex; flex-direction: column; gap: 14px; margin: 20px 28px; }
.matrix-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.matrix-card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue-pale) 0%, var(--surface) 70%);
  border-bottom: 1px solid var(--border);
}
.matrix-card-head .matrix-code { font-family: 'DM Mono', monospace; font-weight: 500; color: var(--blue-mid); font-size: 13px; }
.matrix-card-head .matrix-name { font-weight: 600; color: var(--ink); flex: 1; font-size: 13.5px; }
.matrix-card-body { padding: 18px; display: none; }
.matrix-card.open .matrix-card-body { display: block; }

.matrix-row {
  display: grid; grid-template-columns: 110px 80px 1fr 220px; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid #eef5fb;
  align-items: start;
}
.matrix-row:last-child { border-bottom: 0; }
.matrix-row .unit-code { font-family: 'DM Mono', monospace; color: var(--blue-mid); font-size: 12.5px; }
.matrix-row .refs { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--ink-muted); }
.matrix-row .refs a { color: var(--blue-mid); }

.matrix-run-status {
  margin-top: 16px; background: var(--surface-2);
  padding: 12px; border-radius: var(--radius); font-size: 13px;
}
.matrix-run-status .course-line { padding: 4px 0; }

/* ============================================================================
   Modals
   ============================================================================ */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(13, 17, 23, .5);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(13, 17, 23, .25);
  width: 100%; max-width: 520px; max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-wide { max-width: 800px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.modal-close { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--ink-muted); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ============================================================================
   Callouts
   ============================================================================ */

.submission-note {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--blue-pale);
  border: 1px solid #b3e0f0;
  border-left: 3px solid var(--blue-mid);
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 13px; color: var(--ink); line-height: 1.55;
  margin: 0 28px 22px;
}
.submission-note strong { color: var(--ink); font-weight: 600; }
.submission-note a { color: var(--blue-mid); text-decoration: underline; }

/* Vision-fallback warning re-uses match-status / not-found tone */
.vision-warning {
  font-size: 12px; color: var(--amber);
  margin: 4px 0 8px;
}

/* ============================================================================
   Upload / draft review
   ============================================================================ */

.upload-progress { margin-top: 16px; }
.upload-progress .upload-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 13px;
  border-bottom: 1px solid #eef5fb;
}

.draft-panel { margin-top: 16px; }
.draft-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; background: var(--surface);
}
.draft-card.vision { border-left: 4px solid var(--amber); }
.draft-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.draft-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 8px; }
.confidence-high   { border-left: 3px solid var(--green); padding-left: 8px; }
.confidence-medium { border-left: 3px solid var(--amber); padding-left: 8px; }
.confidence-low    { border-left: 3px solid var(--red);   padding-left: 8px; }

/* ============================================================================
   Checklists
   ============================================================================ */

.course-checklist, .trainer-checklist {
  border: 1px solid var(--border); border-radius: var(--radius);
  max-height: 280px; overflow-y: auto; background: var(--surface);
}
.course-checklist label, .trainer-checklist label {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid #eef5fb; font-size: 13px; cursor: pointer;
}
.course-checklist label:last-child, .trainer-checklist label:last-child { border-bottom: 0; }
.course-checklist label:hover, .trainer-checklist label:hover { background: var(--blue-pale); }

.units-builder { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.units-builder .unit-row, .units-builder .lic-row {
  display: grid; grid-template-columns: 130px 1fr 30px; gap: 8px; align-items: center;
}

/* ============================================================================
   Empty / loading
   ============================================================================ */

.empty-state {
  text-align: center; padding: 48px 24px; color: var(--ink-muted);
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(0,141,210,.3);
  border-top-color: var(--blue-mid);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   View shell helpers
   ============================================================================ */

.view { display: block; }
.view-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 14px; flex-wrap: wrap;
}
.view-actions { display: flex; gap: 8px; align-items: center; }
.back-link { font-size: 11.5px; color: var(--ink-muted); display: inline-block; margin-bottom: 4px; }
.back-link:hover { color: var(--blue-mid); }
.muted { color: var(--ink-muted); }

/* Per-view content lives directly in .main, but most chunks go inside .panel.
   Shorthand for legacy code paths that still use .table-wrap as a panel. */
.table-wrap.legacy {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  margin: 20px 28px 0;
}

/* Admin "big card" links */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px; margin: 20px 28px 0;
}
.big-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-align: left; cursor: pointer; font-family: inherit;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.big-card:hover { border-color: var(--blue-bright); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0, 141, 210, .08); }
.big-card h3 { color: var(--blue-mid); margin: 0 0 6px; font-size: 14px; }
.big-card p  { color: var(--ink-soft); margin: 0; font-size: 13px; }

/* ============================================================================
   Toast container (matches spec — bottom-right stack)
   ============================================================================ */

.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 200;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 7px;
  font-size: 13px; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  animation: toastIn .2s ease; max-width: 320px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.info    { background: var(--blue-mid); }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
