/* ==========================================================================
   Visor de Alertas · versión web
   ========================================================================== */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #16203a;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff4ff;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-dark: #047857;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px -12px rgba(15, 23, 42, 0.28);
  --shadow-lg: 0 30px 70px -20px rgba(15, 23, 42, 0.45);
  --radius: 14px;
  --radius-sm: 9px;
  --topbar-h: 68px;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body { font-size: 14px; }

h1, h2, h3, h4, p, ul, dl, dd { margin: 0; }
ul { padding-left: 1.1rem; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Botones y campos
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-secondary { background: var(--surface); color: var(--ink-soft); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-soft); border-color: var(--muted-2); }

.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: var(--success-dark); border-color: var(--success-dark); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-dark); border-color: var(--danger-dark); }

.btn-link {
  background: none;
  border: none;
  color: var(--brand);
  padding: 6px 0;
  font-size: 12.5px;
  text-decoration: underline;
  cursor: pointer;
}
.btn-link:hover { color: var(--brand-dark); }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

.icon { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label,
.field > span:first-child {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="date"],
input[type="search"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

input::placeholder, textarea::placeholder { color: var(--muted-2); }

.hint {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.hint-danger { color: var(--danger); }

.field-full { grid-column: 1 / -1; }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(1100px 600px at 8% 2%, rgba(56, 189, 248, 0.16), transparent 60%),
    radial-gradient(900px 500px at 96% 96%, rgba(37, 99, 235, 0.24), transparent 62%),
    linear-gradient(135deg, #0b1226 0%, #111c3d 48%, #16264f 100%);
}

.login-layout {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: rise 0.45s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  position: relative;
  padding: 52px 48px;
  color: #eaf1ff;
  background:
    radial-gradient(700px 400px at 110% -10%, rgba(56, 189, 248, 0.35), transparent 60%),
    linear-gradient(160deg, #12306b 0%, #1d4ed8 55%, #2563eb 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 30% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  margin-bottom: 26px;
}
.brand-mark svg { width: 30px; height: 30px; }
.brand-mark-sm {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  margin: 0;
  background: var(--brand);
  border-color: transparent;
  color: #fff;
}
.brand-mark-sm svg { width: 23px; height: 23px; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11.5px;
  font-weight: 700;
  color: #a9c6ff;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.login-brand h1 {
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.brand-copy {
  max-width: 40ch;
  color: #c7d8ff;
  line-height: 1.65;
  font-size: 14.5px;
  position: relative;
  z-index: 1;
}

.brand-points {
  margin-top: 28px;
  display: grid;
  gap: 10px;
  list-style: none;
  padding: 0;
  position: relative;
  z-index: 1;
}
.brand-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dbe7ff;
  font-size: 13.5px;
}
.brand-points li::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3'><path d='M5 12.5l4.5 4.5L19 7.5' stroke-linecap='round' stroke-linejoin='round'/></svg>")
    center / 11px no-repeat,
    rgba(255, 255, 255, 0.18);
}

.login-card {
  padding: 52px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--surface);
}

.login-card-header h2 {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.login-card-header p { color: var(--muted); margin-bottom: 24px; }

.login-form { display: grid; gap: 16px; }
.login-form .btn-primary { margin-top: 6px; padding: 11px 16px; font-size: 14.5px; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
}
.password-toggle:hover { background: var(--surface-soft); color: var(--ink); }
.password-toggle svg { width: 19px; height: 19px; }
.password-toggle.is-active { color: var(--brand); }

.login-card-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13.5px;
  line-height: 1.5;
}
.alert svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.alert-error {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* --------------------------------------------------------------------------
   Shell de la aplicación
   -------------------------------------------------------------------------- */
.app-body { min-height: 100vh; }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  background: #0f1a33;
  color: #eef4ff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.topbar-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8fb2ff;
  font-weight: 700;
}
.topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.topbar-actions { display: flex; align-items: center; gap: 14px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 0;
}
.avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-chip-text strong {
  font-size: 13px;
  font-weight: 600;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip-text small {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: #9db7e8;
  text-transform: uppercase;
}
.topbar .btn-ghost { color: #dbe7ff; border-color: rgba(255, 255, 255, 0.22); }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  align-items: start;
  min-height: 0;
}

/* --------------------------------------------------------------------------
   Sidebar de filtros
   -------------------------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  max-height: calc(100vh - var(--topbar-h) - 36px);
  overflow-y: auto;
  padding-right: 2px;
}

.filter-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.filter-header h2 { font-size: 16px; letter-spacing: -0.01em; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-soft { background: var(--brand-soft); color: var(--brand-dark); }

.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filter-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* --------------------------------------------------------------------------
   Tabla
   -------------------------------------------------------------------------- */
.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-heading h2 { font-size: 22px; letter-spacing: -0.02em; }
.result-summary { color: var(--muted); font-size: 13px; margin-top: 3px; }

.heading-actions { display: flex; align-items: center; gap: 12px; }

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}
.inline-field select { width: auto; padding: 7px 9px; }

.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 420px;
  overflow: hidden;
}

.table-scroll {
  flex: 1 1 auto;
  overflow: auto;
  max-height: calc(100vh - var(--topbar-h) - 190px);
}

.alerts-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.alerts-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 0;
  white-space: nowrap;
}

.sort-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.sort-btn:hover { color: var(--brand); background: #eef4ff; }
.sort-ind { color: var(--muted-2); font-size: 11px; }
.sort-btn.is-active { color: var(--brand); }
.sort-btn.is-active .sort-ind { color: var(--brand); }

.alerts-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink-soft);
}
.alerts-table tbody tr { cursor: pointer; transition: background 0.12s; }
.alerts-table tbody tr:hover { background: #f6f9ff; }
.alerts-table tbody tr:focus { outline: 2px solid var(--brand); outline-offset: -2px; background: #f6f9ff; }

.alerts-table .td-strong { color: var(--ink); font-weight: 600; }
.alerts-table .td-mono {
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 11.5px;
  color: var(--muted);
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alerts-table .td-num { text-align: right; font-variant-numeric: tabular-nums; }
.th-num .sort-btn { justify-content: flex-end; }
.alerts-table .td-muted { color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-neutral { background: #f1f5f9; color: var(--ink-soft); }

.state-row td { cursor: default; }
.state-row:hover { background: transparent; }

.loading-block,
.empty-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 13.5px;
}

.empty-block { flex-direction: column; }
.empty-block strong { color: var(--ink); font-size: 15px; }
.empty-icon { font-size: 34px; line-height: 1; }

.spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}
.page-info { color: var(--muted); font-size: 12.5px; }
.pagination { display: flex; align-items: center; gap: 8px; }
.page-numbers { display: flex; align-items: center; gap: 4px; }
.page-number {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.page-number:hover { background: #e8efff; }
.page-number.is-current {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.page-ellipsis { color: var(--muted-2); padding: 0 2px; }

/* --------------------------------------------------------------------------
   Modal de detalle
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10, 17, 35, 0.62);
  backdrop-filter: blur(3px);
  animation: fade 0.16s ease both;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(1280px, 100%);
  max-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.18s ease both;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.modal-header h2 { font-size: 18px; letter-spacing: -0.01em; }
.modal-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  font-family: "Cascadia Mono", "Consolas", monospace;
}

.icon-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-soft); color: var(--ink); }

.modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  min-height: 0;
  flex: 1 1 auto;
}

.evidence-pane {
  padding: 18px;
  border-right: 1px solid var(--line);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.image-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background 0.15s;
  flex: 0 0 auto;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
  transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(17px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }

.image-stage {
  position: relative;
  min-height: 300px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2f7 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
}

.image-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
}
.image-frame[hidden] { display: none; }
.image-frame img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 360px);
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 6px 24px -8px rgba(15, 23, 42, 0.4);
}

.bbox {
  position: absolute;
  border: 2px solid #ef4444;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75), 0 0 22px rgba(239, 68, 68, 0.35);
  border-radius: 2px;
  pointer-events: none;
}
.bbox[hidden] { display: none; }
.bbox-label {
  position: absolute;
  left: -2px;
  bottom: 100%;
  margin-bottom: 2px;
  padding: 2px 7px;
  border-radius: 4px 4px 4px 0;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.45;
}

.image-loading,
.image-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 30px 16px;
  line-height: 1.6;
}
.image-error { color: var(--danger); max-width: 52ch; }
.image-loading[hidden], .image-error[hidden] { display: none; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 0;
}
.meta-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--surface-soft);
  min-width: 0;
}
.meta-item dt {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.meta-item dd {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta-item dd.mono { font-family: "Cascadia Mono", "Consolas", monospace; font-size: 11.5px; }

/* Feedback */
.feedback-pane {
  padding: 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
}
.feedback-pane h3 { font-size: 15px; letter-spacing: -0.01em; }

.feedback-existing {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feedback-existing[hidden] { display: none; }
.feedback-existing p { font-size: 12px; color: var(--muted); line-height: 1.5; }
.feedback-existing #feedback-existing-notes {
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 130px;
  overflow: auto;
}

.feedback-status-pill {
  align-self: flex-start;
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #f1f5f9;
  color: var(--ink-soft);
}
.feedback-status-pill.status-PENDING { background: #fff7ed; color: #b45309; }
.feedback-status-pill.status-VALID { background: var(--success-soft); color: var(--success-dark); }
.feedback-status-pill.status-INVALID { background: var(--danger-soft); color: #b91c1c; }
.feedback-status-pill.status-UNCERTAIN { background: #eff6ff; color: var(--brand-dark); }

.feedback-form { display: flex; flex-direction: column; gap: 12px; }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(420px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #0f1a33;
  color: #eef4ff;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  line-height: 1.45;
  animation: toast-in 0.2s ease both;
  word-break: break-word;
}
.toast::before {
  content: "";
  width: 4px;
  align-self: stretch;
  border-radius: 4px;
  background: var(--brand);
  flex: 0 0 auto;
}
.toast-success::before { background: #34d399; }
.toast-error::before { background: #f87171; }
.toast-info::before { background: #60a5fa; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: 0.2s; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { padding: 38px 34px; }
  .brand-points { display: none; }
  .login-card { padding: 38px 34px; }

  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .filter-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .table-scroll { max-height: 62vh; }

  .modal-body { grid-template-columns: 1fr; }
  .evidence-pane { border-right: none; border-bottom: 1px solid var(--line); }
  .image-frame img { max-height: 48vh; }
}

@media (max-width: 700px) {
  :root { --topbar-h: 60px; }
  .topbar { padding: 0 14px; }
  .topbar-title { font-size: 15.5px; }
  .topbar-eyebrow { display: none; }
  .user-chip-text { display: none; }
  .user-chip { padding: 4px; }
  .layout { padding: 12px; gap: 12px; }
  .page-heading { align-items: flex-start; }
  .heading-actions { width: 100%; justify-content: space-between; }
  .filter-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; }
  .modal { max-height: 100vh; height: 100vh; border-radius: 0; }
  .modal-body { grid-template-columns: 1fr; }
  .image-frame img { max-height: 40vh; }
  .toast-stack { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}
