/* Backend portal theme.
   Brand palette: #263476 (navy, identity), #f41130 (accent), #2e17ff (electric blue),
   with white + greys as neutrals. Navy carries the chrome (nav, headings); blue is
   the active/interactive tone; red is reserved for highlights and danger. */

:root {
  --navy: #263476;
  --navy-dark: #1a2556;
  --navy-deep: #121a3d;
  --navy-soft: #eceffa;

  --primary: #2e17ff;
  --primary-dark: #2411cc;
  --primary-soft: #e8e6ff;
  --accent: #f41130;
  --accent-dark: #c00d24;
  --accent-soft: #ffe4e8;

  --bg: #f5f6fb;
  --panel: #ffffff;
  --nav: var(--navy);
  --nav-dark: var(--navy-dark);

  --text: #1a1f2e;
  --text-on-dark: #ffffff;
  --muted: #6b7280;

  --border: #d9dce6;
  --border-strong: #bac0d1;

  --success: #166534;
  --success-bg: #dcfce7;
  --warning: #92400e;
  --warning-bg: #fef3c7;
  --danger: var(--accent-dark);
  --danger-bg: var(--accent-soft);
  --info: var(--navy);
  --info-bg: var(--navy-soft);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

header.portal-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: var(--text-on-dark);
  padding: 14px 24px;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 4px 14px rgba(18, 26, 61, 0.18);
  /* Pin the navbar so it stays visible while scrolling long pages
     (case lists, import job logs, audit trail). `top: 0` keeps it
     flush with the viewport edge; the high z-index sits above the
     workspace content + Bootstrap modal backdrops at z 1040+ but
     still below open dialogs themselves. */
  position: sticky;
  top: 0;
  z-index: 1030;
}
header.portal-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--primary) 100%);
}

header.portal-header .header-row {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

nav.portal-nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
nav.portal-nav a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
nav.portal-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-on-dark);
  text-decoration: none;
}
nav.portal-nav a.active,
nav.portal-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-on-dark);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
}
.user-chip::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5cf291;
  box-shadow: 0 0 0 3px rgba(92, 242, 145, 0.18);
}

.portal-header .actions .btn-light {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-on-dark);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.portal-header .actions .btn-light:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-on-dark);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-on-dark);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 15px;
  margin-right: 12px;
}
.portal-brand:hover { color: var(--text-on-dark); text-decoration: none; }
.portal-brand-mark {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* No backdrop — the AngioInsight logo already ships its own red→navy
     gradient and reads cleanly on dark nav surfaces. */
}
.portal-brand-mark .brand-mark-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
/* Legacy SVG fallback (kept in case the partial ever renders SVG again) */
.portal-brand-mark .brand-mark-svg,
.portal-brand-mark svg { width: 100%; height: 100%; }

.container {
  max-width: 1280px;
  margin: 24px auto;
  padding: 0 16px 32px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.page-header p { margin: 6px 0 0; color: var(--muted); }
.page-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.page-header .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--navy-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.page-header .eyebrow svg { width: 13px; height: 13px; }

/* Launcher hero and application cards */
.launcher-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: var(--text-on-dark);
  border-radius: 18px;
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.launcher-hero::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(244, 17, 48, 0.35), rgba(244, 17, 48, 0) 70%);
  pointer-events: none;
}
.launcher-hero::after {
  content: "";
  position: absolute;
  bottom: -70px;
  left: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(46, 23, 255, 0.35), rgba(46, 23, 255, 0) 70%);
  pointer-events: none;
}
.launcher-hero-text { position: relative; z-index: 1; max-width: 640px; }
.launcher-hero h1 {
  margin: 6px 0 8px;
  font-size: 28px;
  letter-spacing: -0.01em;
}
.launcher-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
  font-size: 15px;
}
.launcher-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}
.launcher-hero-stats {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.launcher-stat {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 130px;
}
.launcher-stat .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}
.launcher-stat .value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-on-dark);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 14px;
}
.section-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.section-heading .count {
  color: var(--muted);
  font-size: 13px;
}

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.app-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 6px 18px rgba(26, 26, 26, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
}
.app-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--primary) 60%, var(--accent) 100%);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(38, 52, 118, 0.1);
  border-color: var(--border-strong);
}
.app-card:hover::before { opacity: 1; }

.app-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.app-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--navy-soft) 0%, var(--primary-soft) 100%);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.app-card-icon svg { width: 26px; height: 26px; }
.app-card h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.app-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  flex-grow: 1;
}
.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.app-card-footer .btn {
  padding: 9px 14px;
  font-size: 14px;
}
.app-card-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.app-card-status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.launcher-empty {
  padding: 48px 24px;
  border-radius: 16px;
  border: 1px dashed var(--border-strong);
  background: var(--panel);
  text-align: center;
  color: var(--muted);
}
.launcher-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--navy-soft);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.launcher-empty-icon svg { width: 28px; height: 28px; }
.launcher-empty h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.launcher-empty p { margin: 0; font-size: 14px; }

.card {
  background: var(--panel);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(26, 26, 26, 0.04);
}

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

.metric { font-size: 32px; font-weight: 700; margin-top: 8px; color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Page hero used across dashboards (admin/annotator/qc) */
.page-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: var(--text-on-dark);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.page-hero::before {
  content: "";
  position: absolute;
  top: -50px; right: -50px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(244, 17, 48, 0.28), rgba(244, 17, 48, 0) 70%);
  pointer-events: none;
}
.page-hero::after {
  content: "";
  position: absolute;
  bottom: -60px; left: -40px;
  width: 170px; height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(46, 23, 255, 0.3), rgba(46, 23, 255, 0) 70%);
  pointer-events: none;
}
.page-hero-text { position: relative; z-index: 1; max-width: 680px; }
.page-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}
.page-hero h1 {
  margin: 8px 0 6px;
  font-size: 24px;
  letter-spacing: -0.01em;
}
.page-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
  font-size: 14.5px;
}
.page-hero .actions {
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}
.page-hero .actions .btn {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-on-dark);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.page-hero .actions .btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.page-hero .actions .btn-primary,
.page-hero .actions .btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--text-on-dark);
  box-shadow: 0 6px 16px rgba(244, 17, 48, 0.32);
}
.page-hero .actions .btn-primary:hover,
.page-hero .actions .btn.primary:hover {
  background: var(--accent-dark);
}

/* Stat cards: icon + label + value, used on dashboards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(38, 52, 118, 0.07);
  border-color: var(--border-strong);
}
.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-soft);
  color: var(--navy);
}
.stat-card-icon svg { width: 22px; height: 22px; }
.stat-card-icon.tone-accent { background: var(--accent-soft); color: var(--accent-dark); }
.stat-card-icon.tone-primary { background: var(--primary-soft); color: var(--primary-dark); }
.stat-card-icon.tone-success { background: var(--success-bg); color: var(--success); }
.stat-card-icon.tone-warning { background: var(--warning-bg); color: var(--warning); }

.stat-card-body { display: flex; flex-direction: column; min-width: 0; }
.stat-card-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
  line-height: 1.2;
}
.stat-card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Workflow chips row */
.workflow-snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.workflow-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7f8fc;
  border: 1px solid var(--border);
}
.workflow-chip .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.workflow-chip .count {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

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

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
thead th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
tr:hover td { background: rgba(38, 52, 118, 0.04); }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  line-height: 1.4;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin-top: 0;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--primary);
}
input[type="file"] {
  padding: 8px 12px;
  background: #fafbff;
  cursor: pointer;
}

/* Strip the OS-native select chrome so our border/padding/radius rules apply
   consistently across Safari/Chrome/Firefox, then paint a custom chevron. */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  padding-right: 36px;
  cursor: pointer;
}
select::-ms-expand { display: none; }
select[multiple],
select[size] {
  background-image: none;
  padding-right: 12px;
  cursor: auto;
}
select[multiple] option,
select[size] option { padding: 6px 8px; }

/* Compact selects inside filter rows keep the chevron proportional */
.filter-field select { background-position: right 10px center; padding-right: 30px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46, 23, 255, 0.15);
}
input:disabled, select:disabled, textarea:disabled {
  background: #f2f3f9;
  color: var(--muted);
  cursor: not-allowed;
}
input::placeholder, textarea::placeholder { color: #9aa0ae; }
label { font-weight: 600; display: block; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: var(--text-on-dark);
  border: 0;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  font: inherit;
  font-weight: 600;
}
button:hover, .btn:hover { background: var(--primary-dark); color: var(--text-on-dark); }

.btn-secondary { background: var(--navy); }
.btn-secondary:hover { background: var(--navy-dark); }

.btn-light, .btn.secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-light:hover, .btn.secondary:hover { background: #f5f5f5; color: var(--text); }

.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #7a360a; }

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

.messages { list-style: none; padding: 0; }
.messages li, .message, .alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.messages .success, .message.success, .alert-success { background: var(--success-bg); color: var(--success); }
.messages .warning, .message.warning, .alert-warning { background: var(--warning-bg); color: var(--warning); }
.messages .error, .message.error, .alert-error { background: var(--danger-bg); color: var(--danger); }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}
.badge-draft { background: var(--warning-bg); color: var(--warning); }
.badge-progress { background: var(--info-bg); color: var(--info); }
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-archived { background: #ececec; color: #4a4a4a; }
.badge-info-soft { background: var(--info-bg); color: var(--info); }
.badge-warning-soft { background: var(--warning-bg); color: var(--warning); }
.badge-danger-soft { background: var(--danger-bg); color: var(--danger); }
.badge.active { background: var(--success-bg); color: var(--success); }
.badge.inactive { background: var(--danger-bg); color: var(--danger); }
.badge.assignment { background: var(--info-bg); color: var(--info); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--info);
  font-size: 12px;
  font-weight: 600;
}

.chip {
  background: #f1f1f1;
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.filter-card { padding: 18px 20px; }
.filter-form { display: flex; flex-direction: column; gap: 12px; }

.filter-row {
  display: grid;
  gap: 12px;
  align-items: end;
}
.filter-row-primary {
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(160px, 1fr));
}
.filter-row-secondary {
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
}

.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
}
.filter-field input,
.filter-field select {
  margin-top: 0;
  padding: 8px 10px;
  font-size: 13px;
}
.filter-field-wide { grid-column: span 1; }

.filter-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: stretch;
}
.filter-actions button,
.filter-actions .btn { padding: 8px 14px; font-size: 13px; }

@media (max-width: 900px) {
  .filter-row-primary,
  .filter-row-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { justify-content: flex-start; grid-column: span 2; }
}

@media (max-width: 560px) {
  .filter-row-primary,
  .filter-row-secondary { grid-template-columns: 1fr; }
  .filter-actions { grid-column: auto; }
}

.empty-state, .empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

/* Vessel form: color field, toggle cards, preview chip */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.field label { margin-bottom: 0; }
.field .help {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  margin-top: 6px;
}
.field .errors {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 8px 10px;
  border-radius: 6px;
  margin-top: 6px;
  font-size: 12.5px;
  list-style: none;
}
.field .errors li { margin: 0; padding: 0; }

.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.color-field input[type="color"] {
  width: 48px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  margin-top: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.color-field input[type="text"] {
  flex: 1;
  min-width: 140px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.color-presets button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 2px solid var(--panel);
  outline: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.1s ease, outline-color 0.15s ease;
  box-shadow: 0 2px 6px rgba(26, 26, 26, 0.08);
}
.color-presets button:hover {
  transform: scale(1.1);
  outline-color: var(--navy);
}
.color-presets button.is-active {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}

.toggle-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  margin-bottom: 10px;
}
.toggle-card:hover { border-color: var(--border-strong); }
.toggle-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.toggle-card input[type="checkbox"] {
  margin-top: 2px;
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-card .toggle-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.toggle-card .toggle-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14.5px;
  letter-spacing: 0;
  text-transform: none;
}
.toggle-card .toggle-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.vessel-preview-card {
  position: sticky;
  top: 16px;
  background: linear-gradient(135deg, var(--navy-soft) 0%, #fff 70%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.vessel-preview-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 12px;
}
.vessel-preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 4px 10px rgba(26, 26, 26, 0.06);
  max-width: 100%;
}
.vessel-preview-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #cccccc;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--border);
  flex-shrink: 0;
}
.vessel-preview-code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}
.vessel-preview-meta {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vessel-preview-meta strong { color: var(--text); }

.hierarchy-path {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.hierarchy-path .chip { background: var(--navy-soft); color: var(--navy); font-weight: 600; }
.hierarchy-path .sep { color: var(--border-strong); }

/* Form sections + dropzone used by case/vessel forms */
.form-section {
  padding: 20px 0;
  border-top: 1px solid var(--border);
}
.form-section:first-of-type { padding-top: 0; border-top: none; }
.form-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.form-section-head .step-badge {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--navy-soft);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.form-section-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.form-section-head p.sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  padding: 28px;
  background: #fafbff;
  text-align: center;
  margin-bottom: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.is-active { border-color: var(--primary); background: var(--primary-soft); }
.dropzone-icon {
  width: 48px; height: 48px;
  margin: 0 auto 10px;
  border-radius: 12px;
  background: var(--navy-soft);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dropzone-icon svg { width: 24px; height: 24px; }
.dropzone strong { display: block; font-size: 15px; color: var(--text); }
.dropzone .muted { display: block; margin-top: 4px; font-size: 13px; }

/* Key / value description list used on detail pages */
.data-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 18px;
  margin: 0;
}
.data-list dt {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: center;
}
.data-list dd {
  margin: 0;
  color: var(--text);
  align-self: center;
  word-break: break-word;
}

/* Timeline used for history/activity feeds */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}
.timeline > li {
  position: relative;
  padding: 8px 0 14px 34px;
}
.timeline > li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--panel);
  border: 2.5px solid var(--navy);
  box-shadow: 0 0 0 3px var(--navy-soft);
}
.timeline > li + li { border-top: none; }
.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.timeline-head strong { font-size: 14px; }
.timeline-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.timeline-body { margin-top: 8px; white-space: pre-wrap; font-size: 14px; line-height: 1.5; }

/* Comment block */
.comment-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  margin-bottom: 12px;
}
.comment-item + .comment-item { margin-top: 0; }
.comment-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.comment-author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.comment-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy) 0%, var(--primary) 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}
.comment-body {
  margin-top: 10px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 14px;
}

/* Case activity log feed — semantic <table> so the browser handles
   column widths automatically, accessibility tools announce rows/cells,
   and the layout degrades gracefully under horizontal scroll on narrow
   viewports. Payload reveals as an expandable <tr> that spans all cells. */
.log-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  background: var(--panel);
}
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.log-table thead th {
  background: #f5f6fb;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.log-table tbody td {
  padding: 10px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  transition: background 0.1s ease;
}
.log-table tbody tr:last-child td { border-bottom: none; }
.log-table tbody tr.log-row-main:hover td { background: #f8f9fd; }

.log-cell-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.log-cell-time .log-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--navy);
  margin-right: 8px;
  vertical-align: middle;
}
.log-cell-time .log-dot.tone-accent { background: var(--accent); }
.log-cell-time .log-dot.tone-primary { background: var(--primary); }
.log-cell-time .log-dot.tone-success { background: #22c55e; }
.log-cell-time .log-dot.tone-warning { background: #f59e0b; }
.log-cell-time .log-dot.tone-muted { background: #9aa0b4; }

.log-cell-type .badge { font-size: 11px; padding: 3px 9px; white-space: nowrap; }

.log-cell-case { max-width: 320px; }
.log-cell-case strong { color: var(--text); font-weight: 600; }
.log-cell-case .muted { color: var(--muted); font-size: 12px; margin-left: 4px; }

.log-cell-actor { white-space: nowrap; }
.log-cell-actor .log-ip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); margin-left: 8px; }

.log-cell-actions {
  text-align: right;
  white-space: nowrap;
}
.log-cell-actions .btn,
.log-cell-actions .log-payload-toggle {
  padding: 4px 10px;
  font-size: 12px;
}
.log-cell-actions .log-payload-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  margin-right: 4px;
}
.log-cell-actions .log-payload-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: #f5f6fb;
}

/* Payload row visibility is controlled inline (style="display: none;") and
   flipped via JS — that way the toggle works even if this CSS file is
   serving stale from a browser cache. Leave CSS here purely visual. */
.log-row-main.is-expanded td { background: #fafbff; }
.log-row-payload td {
  padding: 0 !important;
  background: #101425 !important;
  border-bottom: 1px solid var(--border);
}
.log-payload-toggle.is-active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}
.log-row-payload pre {
  margin: 0;
  padding: 14px 20px;
  background: transparent;
  color: #cfd3e4;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  border-radius: 0;
}

.chip-actor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 2px;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  vertical-align: middle;
}
.chip-actor .avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy) 0%, var(--primary) 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}
.chip-actor .chip-actor-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Angle / attachment list */
.angle-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--panel);
}
.angle-item:last-child { margin-bottom: 0; }
.angle-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--navy-soft);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.angle-icon svg { width: 18px; height: 18px; }
.angle-body { flex: 1; min-width: 0; }
.angle-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.angle-meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.angle-meta span { display: block; word-break: break-all; }

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--navy-deep);
  color: var(--text-on-dark);
  padding: 16px;
  border-radius: 10px;
  overflow: auto;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.section-title { margin: 0 0 12px; }
.button-inline { display: inline; }
.checkbox-cell { width: 42px; }

/* Login screens: split-hero layout shared by platform and coronary shortcut. */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}

.auth-hero {
  position: relative;
  overflow: hidden;
  padding: 56px 56px 48px;
  color: var(--text-on-dark);
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(244, 17, 48, 0.45) 0%, rgba(244, 17, 48, 0) 55%),
    radial-gradient(110% 90% at 0% 100%, rgba(46, 23, 255, 0.55) 0%, rgba(46, 23, 255, 0) 60%),
    linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 55%, #364492 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}

.auth-hero::before,
.auth-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}
.auth-hero::before {
  width: 320px;
  height: 320px;
  right: -110px;
  top: -110px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 70%);
}
.auth-hero::after {
  width: 260px;
  height: 260px;
  left: -90px;
  bottom: -90px;
  background: radial-gradient(circle at 50% 50%, rgba(244, 17, 48, 0.45), rgba(244, 17, 48, 0) 70%);
}

.auth-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 520px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.95);
}
.auth-brand-mark {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 10px 24px rgba(244, 17, 48, 0.3));
}
.auth-brand-mark .brand-mark-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.auth-brand-mark .brand-mark-svg,
.auth-brand-mark svg { width: 100%; height: 100%; }

.auth-hero h2 {
  font-size: 40px;
  line-height: 1.12;
  margin: 0;
  letter-spacing: -0.02em;
}
.auth-hero p.lead {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
  max-width: 460px;
}

.auth-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}
.auth-feature-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14.5px;
  line-height: 1.5;
}
.auth-feature-list .tick {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.auth-feature-list .tick svg { width: 12px; height: 12px; }

.auth-hero-footer {
  position: relative;
  z-index: 1;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.02em;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}

.auth-panel {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  padding: 40px 36px;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 48px rgba(26, 26, 26, 0.08);
}
.auth-panel-header { margin-bottom: 28px; }
.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--navy-soft);
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.auth-panel h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.auth-panel p.auth-sub {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14.5px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form p { margin: 0; }
.auth-form label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth-form input {
  margin-top: 8px;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 10px;
  background: #fafafb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.auth-form input:hover { border-color: var(--border-strong); }
.auth-form input:focus {
  background: var(--panel);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(46, 23, 255, 0.12);
}

.auth-panel button[type="submit"] {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--primary) 100%);
  box-shadow: 0 10px 22px rgba(38, 52, 118, 0.28);
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.auth-panel button[type="submit"]:hover {
  filter: brightness(1.08);
  box-shadow: 0 14px 28px rgba(38, 52, 118, 0.35);
}
.auth-panel button[type="submit"]:active { transform: translateY(1px); }

.auth-panel .errorlist {
  list-style: none;
  padding: 10px 12px;
  margin: 0 0 8px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}
.auth-panel .errorlist li { margin: 0; }

.auth-footer-note {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.auth-footer-note strong { color: var(--text); }

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero {
    padding: 40px 32px;
    min-height: 320px;
  }
  .auth-hero h2 { font-size: 30px; }
  .auth-main { padding: 32px 20px 48px; }
  .auth-panel { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .auth-hero { padding: 32px 22px; }
  .auth-hero h2 { font-size: 26px; }
  .auth-panel { padding: 28px 20px; border-radius: 14px; }
}

.logout {
  color: var(--text-on-dark);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.stat {
  background: var(--navy-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.stat .label {
  color: var(--navy);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; color: var(--text); }
