/* ═══════════════════════════════════════════════════════════
   NRI // NIGHT RIDGE INTEL — CINEMATIC STYLESHEET
   Matte black · charcoal · red biometric accent
   ═══════════════════════════════════════════════════════════ */
:root {
  --bg-base: #0A0A0B;
  --bg-raised: #0D0D0F;
  --bg-card: #111114;
  --bg-overlay: #16161A;
  --border-subtle: #1F1F22;
  --border-default: #2A2A2F;
  --border-strong: #3A3A40;
  --text-primary: #F5F5F7;
  --text-secondary: #A8A8B0;
  --text-tertiary: #6B6B72;
  --text-mono: #D4D4D8;
  --text-dim: #3A3A40;
  --red: #E10A1F;
  --red-glow: rgba(225,10,31,0.35);
  --red-deep: #7A0512;
  --amber: #F59E0B;
  --green: #10B981;
  --blue: #3B82F6;
  --purple: #A855F7;
  --pink: #EC4899;
  --teal: #14B8A6;
  --sans: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.grain {
  display: none; /* v31: Removed grain noise to let Matrix rain breathe */
}
.ambient-glow {
  position: fixed; top: -200px; right: -200px; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(225,10,31,0.08) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

.app { display: flex; min-height: 100vh; position: relative; z-index: 5; }
.rail {
  width: 64px; background: var(--bg-raised); border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; align-items: center; padding: 20px 0; gap: 4px;
  position: sticky; top: 0; height: 100vh; z-index: 10;
}
.rail-logo {
  width: 36px; height: 36px; border: 1px solid var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--red);
  margin-bottom: 20px; font-family: var(--mono); letter-spacing: .05em;
  text-decoration: none;
}
.rail-btn {
  width: 40px; height: 40px; background: transparent; border: 1px solid transparent;
  color: var(--text-tertiary); font-size: 18px; display: flex; align-items: center;
  justify-content: center; transition: all .18s var(--ease); border-radius: 6px;
  text-decoration: none;
}
.rail-btn:hover { background: rgba(255,255,255,.04); color: var(--text-primary); }
.rail-btn.active { background: rgba(225,10,31,.12); border-color: rgba(225,10,31,.4); color: var(--red); }
.rail-footer { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rail-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.rail-vlabel { font-size: 8px; color: var(--text-dim); writing-mode: vertical-rl; letter-spacing: .3em; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 52px; border-bottom: 1px solid var(--border-subtle);
  background: rgba(13,13,15,.7); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  display: flex; align-items: center; padding: 0 24px; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-route { font-size: 11px; font-family: var(--mono); color: var(--text-tertiary); letter-spacing: .2em; }
.topbar-divider { width: 1px; height: 14px; background: var(--border-subtle); }
.topbar-clearance { font-size: 10px; color: var(--text-dim); font-family: var(--mono); }
.session { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-secondary); font-family: var(--mono); }
.session-dot { color: var(--red); }
.clock { font-size: 12px; color: var(--text-primary); font-family: var(--mono); letter-spacing: .05em; }
.logout-btn {
  background: transparent; border: 1px solid var(--border-subtle); color: var(--text-tertiary);
  padding: 4px 10px; font-size: 10px; font-family: var(--mono); letter-spacing: .15em; cursor: pointer;
  transition: all .18s; text-decoration: none;
}
.logout-btn:hover { border-color: var(--red); color: var(--red); }

.content { flex: 1; overflow: auto; }
.view { padding: 32px; animation: viewIn .32s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }

.header-row { margin-bottom: 32px; display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.h-eyebrow { font-size: 10px; color: var(--text-tertiary); letter-spacing: .3em; margin-bottom: 8px; font-family: var(--mono); }
.h-title { font-size: 32px; font-weight: 500; letter-spacing: -.02em; line-height: 1; }
.actions { display: flex; gap: 8px; }

.btn { padding: 10px 16px; font-size: 10px; font-family: var(--mono); letter-spacing: .25em; transition: all .18s var(--ease); border-radius: 0; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn-ghost { background: transparent; border: 1px solid var(--border-default); color: var(--text-secondary); }
.btn-ghost:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.btn-primary { background: var(--red); border: 1px solid var(--red); color: #fff; font-weight: 600; box-shadow: 0 0 16px rgba(225,10,31,.3); }
.btn-primary:hover { box-shadow: 0 0 24px rgba(225,10,31,.5); }
.btn-danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(225,10,31,.1); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 32px; }
.kpi { background: var(--bg-raised); border: 1px solid var(--border-subtle); padding: 20px; position: relative; overflow: hidden; animation: cardIn .4s var(--ease) backwards; }
.kpi:nth-child(1) { animation-delay: .06s; }
.kpi:nth-child(2) { animation-delay: .12s; }
.kpi:nth-child(3) { animation-delay: .18s; }
.kpi:nth-child(4) { animation-delay: .24s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } }
.kpi-accent { position: absolute; top: 0; left: 0; right: 0; height: 1px; opacity: .3; }
.kpi-label { font-size: 10px; color: var(--text-tertiary); letter-spacing: .2em; margin-bottom: 12px; font-family: var(--mono); }
.kpi-row { display: flex; align-items: baseline; justify-content: space-between; }
.kpi-value { font-size: 40px; font-weight: 300; letter-spacing: -.03em; line-height: 1; }
.kpi-delta { font-size: 11px; color: var(--text-tertiary); font-family: var(--mono); }

.panel { background: var(--bg-raised); border: 1px solid var(--border-subtle); position: relative; }
.panel-head { padding: 14px 20px; border-bottom: 1px solid var(--bg-overlay); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-title { font-size: 10px; color: var(--text-primary); letter-spacing: .3em; font-family: var(--mono); font-weight: 600; }
.panel-sub { font-size: 9px; color: var(--text-tertiary); letter-spacing: .2em; font-family: var(--mono); }
.panel-body { padding: 20px; }

.grid-2-1 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.feed-row { display: flex; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--bg-overlay); gap: 16px; cursor: pointer; transition: background .18s; text-decoration: none; color: inherit; }
.feed-row:last-child { border-bottom: none; }
.feed-row:hover { background: rgba(255,255,255,.02); }
.feed-time { font-size: 11px; color: var(--text-tertiary); font-family: var(--mono); width: 64px; flex-shrink: 0; }
.feed-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.feed-dot.alert { background: var(--red); box-shadow: 0 0 8px var(--red); }
.feed-dot.note { background: var(--purple); }
.feed-dot.info { background: var(--blue); }
.feed-dot.success { background: var(--green); }
.feed-codename { font-size: 11px; font-family: var(--mono); color: var(--red); min-width: 140px; flex-shrink: 0; }
.feed-action { font-size: 12px; color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-arrow { font-size: 14px; color: var(--text-dim); }

.tile-grid { padding: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { aspect-ratio: 1; background: var(--bg-raised); border: 1px solid var(--border-subtle); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; transition: all .18s var(--ease); text-decoration: none; }
.tile:hover { transform: translateY(-2px); }
.tile-dot { position: absolute; top: 6px; left: 6px; width: 6px; height: 6px; border-radius: 50%; }
.tile-avatar { font-size: 32px; opacity: .6; margin-bottom: 4px; }
.tile-code { font-size: 9px; color: var(--text-secondary); font-family: var(--mono); letter-spacing: .05em; }

.plate { padding: 4px 10px; background: var(--bg-base); border: 1px solid var(--border-default); font-size: 12px; font-family: var(--mono); color: var(--text-primary); letter-spacing: .1em; border-radius: 3px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 10px; color: var(--text-tertiary); letter-spacing: .2em; font-family: var(--mono); }
.field-input { background: var(--bg-base); border: 1px solid var(--border-default); color: var(--text-primary); padding: 10px 12px; font-size: 13px; transition: border-color .18s; }
.field-input:focus { outline: none; border-color: var(--red); }

.login-shell { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; position: relative; z-index: 5; }
.login-box { width: 100%; max-width: 380px; background: var(--bg-raised); border: 1px solid var(--border-subtle); padding: 40px 32px; }
.login-logo { width: 56px; height: 56px; border: 1px solid var(--red); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: var(--red); margin: 0 auto 24px; font-family: var(--mono); letter-spacing: .05em; }
.login-title { text-align: center; font-size: 16px; font-weight: 500; letter-spacing: .25em; margin-bottom: 4px; font-family: var(--mono); }
.login-sub { text-align: center; font-size: 10px; color: var(--text-tertiary); letter-spacing: .3em; margin-bottom: 32px; font-family: var(--mono); }
.login-error { background: rgba(225,10,31,.08); border: 1px solid rgba(225,10,31,.3); padding: 10px 12px; color: var(--red); font-size: 11px; margin-bottom: 16px; font-family: var(--mono); letter-spacing: .1em; }

.placeholder { padding: 60px; text-align: center; color: var(--text-dim); font-size: 11px; letter-spacing: .3em; font-family: var(--mono); }

/* ═══════════════════════════════════════════════════════ */
/* TABLET — 900px and below                                */
/* ═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1, .grid-1-1 { grid-template-columns: 1fr; }
  .h-title { font-size: 24px; }
  .header-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .view { padding: 20px; }
}

/* ═══════════════════════════════════════════════════════ */
/* PHONE — 768px and below                                 */
/* ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Prevent horizontal overflow at root */
  html, body { overflow-x: hidden !important; max-width: 100vw !important; width: 100% !important; position: relative; }
  .app, .main, .content, .view { max-width: 100vw !important; overflow-x: hidden !important; width: 100%; }
  .panel { max-width: 100%; }

  /* Layout: collapse sidebar to horizontal top nav */
  .app { display: block; }
  .rail {
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: 8px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border-default);
    justify-content: space-around;
    overflow-x: auto;
    gap: 4px;
  }
  .rail-logo { display: none; }
  .rail-vlabel, .rail-dot { display: none; }
  .rail-footer { flex-direction: row; margin-top: 0; }
  .rail-btn {
    width: 40px; height: 40px;
    min-width: 40px;
    font-size: 14px;
  }
  .main { width: 100%; }

  /* Topbar — wrap inner divs */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 18px;
    gap: 6px;
    height: auto;
  }
  .topbar-left, .topbar-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar-route { font-size: 10px; }
  .topbar-clearance { font-size: 9px; }
  .topbar-divider { display: none; }
  .session { font-size: 9px; }
  .clock { font-size: 11px; }
  .logout-btn { padding: 6px 14px; font-size: 10px; min-height: 36px; }

  /* Dossier header — collapse vertical */
  .dossier-header-row { flex-direction: column !important; gap: 16px !important; }
  .dossier-header-row > div:first-child {
    width: 100% !important;
    max-width: 280px;
    height: 280px !important;
    margin: 0 auto;
  }
  .dossier-header-row > div:nth-child(2) {
    text-align: center;
  }
  .dossier-header-row > div:nth-child(2) > div:nth-child(2) {
    font-size: 24px !important;
    word-break: break-word;
  }
  .dossier-header-row > div:nth-child(2) > div[style*="flex"] {
    justify-content: center;
  }
  .dossier-header-row > div:last-child {
    flex-direction: row !important;
    width: 100%;
    flex-wrap: wrap;
  }
  .dossier-header-row > div:last-child > * {
    flex: 1 1 calc(33% - 6px);
    min-width: 80px;
  }
  .dossier-header-row > div:last-child form {
    flex: 1 1 calc(33% - 6px);
    min-width: 80px;
  }

  /* Search bar — stack on mobile */
  .search-input-row { flex-direction: column !important; }
  .search-q-input { width: 100% !important; }
  .search-scope-select { width: 100% !important; }
  .search-submit-btn { width: 100% !important; }

  /* Capture station — stack camera + slots vertically */
  .capture-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
  .capture-grid > * { min-width: 0; max-width: 100%; overflow: hidden; }
  .mobile-slot-picker { max-width: 100%; overflow: hidden; }
  .mobile-slot-picker > div { max-width: 100%; }
  .mobile-slot-tab { min-width: 0 !important; overflow: hidden; }

  /* View padding tighter */
  .view { padding: 20px 18px; }

  /* Typography */
  .h-title { font-size: 22px; line-height: 1.2; }
  .h-eyebrow { font-size: 10px; }

  /* Panel padding */
  .panel-head { padding: 10px 14px; }
  .panel-body { padding: 14px; }
  .panel-title { font-size: 11px; }
  .panel-sub { font-size: 9px; }

  /* Grids that need to collapse */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .grid-2-1, .grid-1-1, .grid-1-1-1 { grid-template-columns: 1fr !important; gap: 12px; }

  /* Feed rows — stack content */
  .feed-row {
    flex-wrap: wrap;
    padding: 12px 14px;
    gap: 8px;
  }
  .feed-row > * { flex-shrink: 1; }
  .feed-codename { min-width: 0 !important; max-width: 100%; }
  .feed-action { font-size: 10px; }
  .feed-arrow { margin-left: auto; }

  /* Buttons — bigger touch targets */
  .btn { min-height: 44px; padding: 12px 16px; font-size: 11px; }
  .btn-ghost { min-height: 44px; }

  /* Form fields */
  .field-input {
    font-size: 16px;
    padding: 12px 14px;
  }
  .field-label { font-size: 10px; }

  /* Tags & chips */
  .tag { padding: 4px 8px; font-size: 9px; }

  /* Plate cards */
  .plate { font-size: 13px; padding: 8px 12px; }
}

/* ═══════════════════════════════════════════════════════ */
/* SMALL PHONE — 480px and below                           */
/* ═══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .view { padding: 16px 14px; }
  .h-title { font-size: 20px; }
  .panel-body { padding: 12px; }

  /* Hide non-essential topbar elements */
  .topbar-route { display: none; }
  .topbar-clearance { font-size: 8px; }

  /* Feed rows — tighter */
  .feed-row { padding: 10px 12px; gap: 6px; }

  /* Tags smaller */
  .tag { padding: 3px 6px; font-size: 8px; letter-spacing: .1em; }

  /* Make all grids single column */
  .kpi-grid { grid-template-columns: 1fr; }
  div[style*="grid-template-columns:repeat(5,1fr)"],
  div[style*="grid-template-columns:repeat(4,1fr)"],
  div[style*="grid-template-columns:1fr 1fr 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Form column collapse */
  div[style*="grid-template-columns:1fr auto 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ═══════════════════════════════════════════════════════ */
/* CAPTURE STATION mobile overrides                        */
/* ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .capture-grid { grid-template-columns: 1fr !important; }
  .mobile-slot-picker { display: block !important; }
}
@media (min-width: 769px) {
  .mobile-slot-picker { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   POLISH LAYER — typography, hover states, animations
   ═══════════════════════════════════════════════════════════ */

/* Text selection: red highlight matching brand */
::selection { background: var(--red); color: #fff; }
::-moz-selection { background: var(--red); color: #fff; }

/* Smoother focus ring on all interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--red);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(225,10,31,0.15);
}

/* Field inputs — subtle red glow on focus */
.field-input {
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.field-input:focus {
  border-color: var(--red);
  background: rgba(225,10,31,0.02);
  box-shadow: 0 0 0 3px rgba(225,10,31,0.08);
}

/* Buttons — subtle press feedback */
.btn { will-change: transform; }
.btn:active { transform: translateY(1px); }
.btn-primary { transition: box-shadow .18s var(--ease), transform .12s var(--ease); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { transition: all .18s var(--ease); }
.btn-ghost:hover { background: rgba(255,255,255,.03); }

/* Panels — subtle elevation on hover */
.panel { transition: border-color .25s var(--ease); }
.panel:hover { border-color: var(--border-default); }

/* Feed rows — animated indicator on hover */
.feed-row {
  position: relative;
  transition: background .18s var(--ease), padding-left .18s var(--ease);
}
.feed-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--red);
  transition: width .18s var(--ease);
}
.feed-row:hover::before { width: 2px; }
.feed-row:hover { padding-left: 24px; }

/* Tags — subtle micro-interaction */
.tag {
  transition: transform .12s var(--ease), box-shadow .18s var(--ease);
  display: inline-flex;
  align-items: center;
}
a.tag:hover, button.tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Plate cards — subtle glow on hover */
.plate {
  transition: box-shadow .18s var(--ease), transform .12s var(--ease);
}
a:hover .plate, .plate:hover {
  box-shadow: 0 0 12px rgba(225,10,31,0.2);
}

/* Rail buttons — smoother transitions */
.rail-btn {
  transition: background .2s var(--ease), color .2s var(--ease), transform .12s var(--ease);
}
.rail-btn:active { transform: scale(0.94); }

/* Logout/EXIT button — red glow on hover */
.logout-btn { transition: all .2s var(--ease); }
.logout-btn:hover {
  box-shadow: 0 0 12px rgba(225,10,31,0.4);
}

/* Typography rhythm — tighten headings */
.h-title {
  letter-spacing: -0.018em;
  font-weight: 500;
  line-height: 1.15;
}
.h-eyebrow {
  letter-spacing: 0.32em;
  font-weight: 500;
}

/* Better mono rendering */
.field-input,
[class*='mono'],
.btn,
.tag,
.feed-codename {
  font-feature-settings: 'tnum' 1, 'zero' 1;
}

/* KPI cards — subtle pulse on the number */
.kpi-value {
  transition: color .25s var(--ease);
}

/* Placeholders — subtle breathing animation */
.placeholder {
  animation: placeholderBreath 4s ease-in-out infinite;
}
@keyframes placeholderBreath {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.85; }
}

/* Smooth page transition (enhanced) */
.view {
  animation: viewIn 0.42s var(--ease);
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* Card stagger in (for panel grids) */
.panel {
  animation: panelIn 0.5s var(--ease) both;
}
@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.panel:nth-of-type(2) { animation-delay: 0.05s; }
.panel:nth-of-type(3) { animation-delay: 0.10s; }
.panel:nth-of-type(4) { animation-delay: 0.15s; }
.panel:nth-of-type(5) { animation-delay: 0.20s; }

/* Status dot pulse — refined */
.session-dot {
  animation: sessionPulse 2.4s ease-in-out infinite;
}
@keyframes sessionPulse {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 4px var(--red)); }
  50% { opacity: 0.5; filter: drop-shadow(0 0 8px var(--red)); }
}

/* Clock — subtle blink effect on colon */
.clock { font-variant-numeric: tabular-nums; }

/* Smooth image hover in dossiers */
img {
  transition: opacity .25s var(--ease);
}

/* Force smooth scroll page-wide */
html { scroll-behavior: smooth; }

/* Disable animations for users with motion sensitivity */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01s !important;
    transition-duration: 0.01s !important;
  }
  .feed-row:hover { padding-left: 20px; }
}

/* Mobile: lighter hover effects (no hover on touch) */
@media (hover: none) {
  .feed-row:hover { padding-left: 20px; }
  .feed-row:hover::before { width: 0; }
  .btn-primary:hover { transform: none; }
  a.tag:hover, button.tag:hover { transform: none; }
}

/* Better mobile tap highlight */
button, a, .feed-row, .tag, .slot, .mobile-slot-tab {
  -webkit-tap-highlight-color: rgba(225,10,31,0.15);
  -webkit-touch-callout: none;
}

/* ═══════════════════════════════════════════════════════════
   CINEMATIC LAYER — heavy red glows, dramatic animations
   ═══════════════════════════════════════════════════════════ */

/* Panels — dramatic hover with red edge glow */
.panel {
  transition: border-color .25s var(--ease), box-shadow .35s var(--ease), transform .2s var(--ease);
}
.panel:hover {
  border-color: rgba(225,10,31,0.4);
  box-shadow:
    0 0 0 1px rgba(225,10,31,0.2),
    0 8px 32px rgba(225,10,31,0.12),
    0 0 64px rgba(225,10,31,0.08);
  transform: translateY(-2px);
}

/* Panel head — animated scan line on hover */
.panel-head {
  position: relative;
  overflow: hidden;
}
.panel-head::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  transition: left .8s var(--ease);
}
.panel:hover .panel-head::after {
  left: 100%;
}

/* Feed rows — dramatic slide + glow */
.feed-row {
  transition: background .25s var(--ease), padding-left .25s var(--ease), box-shadow .25s var(--ease);
}
.feed-row::before {
  width: 0;
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
}
.feed-row:hover {
  background: rgba(225,10,31,0.05);
  padding-left: 32px;
  box-shadow: inset 0 0 32px rgba(225,10,31,0.05);
}
.feed-row:hover::before {
  width: 3px;
}

/* Buttons primary — heavy glow halo */
.btn-primary {
  position: relative;
  box-shadow:
    0 0 24px rgba(225,10,31,0.4),
    inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: -4px;
  background: var(--red);
  filter: blur(20px);
  opacity: 0.3;
  z-index: -1;
  transition: opacity .25s var(--ease);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 40px rgba(225,10,31,0.6),
    0 8px 24px rgba(225,10,31,0.4),
    inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover::after { opacity: 0.6; }
.btn-primary:active {
  transform: translateY(0);
  box-shadow:
    0 0 16px rgba(225,10,31,0.5),
    inset 0 2px 8px rgba(0,0,0,0.3);
}

/* Btn ghost — subtle red ambience on hover */
.btn-ghost:hover {
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 0 16px rgba(225,10,31,0.2);
  background: rgba(225,10,31,0.04);
}

/* EXIT button — pulse halo on hover */
.logout-btn:hover {
  box-shadow:
    0 0 24px rgba(225,10,31,0.6),
    0 0 48px rgba(225,10,31,0.3);
  animation: exitPulse 1.6s ease-in-out infinite;
}
@keyframes exitPulse {
  0%, 100% { box-shadow: 0 0 24px rgba(225,10,31,0.6), 0 0 48px rgba(225,10,31,0.3); }
  50% { box-shadow: 0 0 32px rgba(225,10,31,0.8), 0 0 64px rgba(225,10,31,0.5); }
}

/* Input focus — heavy red halo */
.field-input:focus {
  border-color: var(--red);
  background: rgba(225,10,31,0.04);
  box-shadow:
    0 0 0 4px rgba(225,10,31,0.15),
    0 0 24px rgba(225,10,31,0.2),
    inset 0 0 16px rgba(225,10,31,0.04);
}

/* Tags — glow with heavier lift */
a.tag:hover, button.tag:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.5),
    0 0 16px rgba(225,10,31,0.25);
}

/* Plate cards — dramatic red glow */
a:hover .plate, .plate:hover {
  box-shadow:
    0 0 24px rgba(225,10,31,0.4),
    0 4px 16px rgba(225,10,31,0.2);
  transform: scale(1.02);
}

/* Page transitions — more dramatic entry */
.view {
  animation: viewInDramatic 0.6s var(--ease);
}
@keyframes viewInDramatic {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    filter: blur(8px);
  }
  60% {
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Panel stagger — more pronounced */
.panel {
  animation: panelInDramatic 0.7s var(--ease) both;
}
@keyframes panelInDramatic {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    box-shadow: 0 0 0 transparent;
  }
  60% {
    box-shadow: 0 0 32px rgba(225,10,31,0.15);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 transparent;
  }
}

/* Session dot — bigger pulse */
.session-dot {
  animation: sessionPulseDramatic 1.8s ease-in-out infinite;
}
@keyframes sessionPulseDramatic {
  0%, 100% {
    opacity: 1;
    filter: drop-shadow(0 0 6px var(--red)) drop-shadow(0 0 12px var(--red));
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    filter: drop-shadow(0 0 12px var(--red)) drop-shadow(0 0 24px var(--red));
    transform: scale(1.2);
  }
}

/* Rail buttons — red glow on hover */
.rail-btn:hover {
  background: rgba(225,10,31,0.08);
  color: var(--red);
  box-shadow: 0 0 16px rgba(225,10,31,0.3);
  transform: scale(1.05);
}
.rail-btn.active {
  box-shadow:
    0 0 16px rgba(225,10,31,0.4),
    inset 0 0 12px rgba(225,10,31,0.15);
}

/* KPI value — color pulse on hover */
.kpi-card { transition: all .3s var(--ease); }
.kpi-card:hover {
  border-color: rgba(225,10,31,0.5);
  box-shadow:
    0 0 32px rgba(225,10,31,0.2),
    0 12px 32px rgba(0,0,0,0.5);
  transform: translateY(-4px);
}
.kpi-value {
  transition: color .25s var(--ease), text-shadow .25s var(--ease);
}
.kpi-card:hover .kpi-value {
  text-shadow: 0 0 24px rgba(225,10,31,0.4);
}

/* Topbar — subtle red sweep on session indicator */
.topbar {
  position: relative;
  overflow: hidden;
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(225,10,31,0.3), transparent);
  animation: topbarSweep 6s ease-in-out infinite;
}
@keyframes topbarSweep {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

/* Clock — subtle red glow */
.clock {
  text-shadow: 0 0 8px rgba(225,10,31,0.3);
}

/* h-title — subtle red glow underline appears on view */
.h-title {
  position: relative;
  display: inline-block;
}
.h-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--red), transparent);
  box-shadow: 0 0 8px var(--red);
  animation: titleUnderline 1.2s var(--ease) 0.3s forwards;
}
@keyframes titleUnderline {
  to { width: 60%; }
}

/* Placeholder — bigger breathing + subtle red glow */
.placeholder {
  animation: placeholderBreathDramatic 3s ease-in-out infinite;
  text-shadow: 0 0 12px rgba(225,10,31,0.1);
}
@keyframes placeholderBreathDramatic {
  0%, 100% {
    opacity: 0.5;
    text-shadow: 0 0 8px rgba(225,10,31,0.05);
  }
  50% {
    opacity: 0.9;
    text-shadow: 0 0 16px rgba(225,10,31,0.2);
  }
}

/* Status dots dalam audit feed — pulse */
.feed-row [style*="background:#10B981"],
.feed-row [style*="background:var(--green)"] {
  animation: dotPulseGreen 2s ease-in-out infinite;
}
@keyframes dotPulseGreen {
  0%, 100% { box-shadow: 0 0 4px var(--green); }
  50% { box-shadow: 0 0 12px var(--green); }
}

/* Mobile — keep cinematic but tone down for touch */
@media (max-width: 768px) {
  .panel:hover { transform: none; box-shadow: none; border-color: var(--border-subtle); }
  .panel-head::after { display: none; }
  .feed-row:hover { padding-left: 14px; background: transparent; }
  .feed-row:hover::before { width: 0; }
  .btn-primary:hover { transform: none; }
  .kpi-card:hover { transform: none; box-shadow: none; }
  .logout-btn:hover { animation: none; box-shadow: none; }
}


/* ═══════════════════════════════════════════════════════════
   TIER 1 POLISH — Status badge continuous pulse
   Only RISKY, VIP, HIGH_VALUE pulse (active attention states)
   ═══════════════════════════════════════════════════════════ */

/* Target tag elements containing matching status keywords */
.tag[style*="225,10,31"], .tag[style*="#E10A1F"],
.tag[data-status="RISKY"] {
  animation: tagPulseRisky 2s ease-in-out infinite;
}
@keyframes tagPulseRisky {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(225,10,31,0);
  }
  50% {
    box-shadow: 0 0 12px rgba(225,10,31,0.3), 0 0 24px rgba(225,10,31,0.15);
  }
}

.tag[style*="168,85,247"], .tag[style*="#A855F7"],
.tag[data-status="VIP"] {
  animation: tagPulseVip 2.4s ease-in-out infinite;
}
@keyframes tagPulseVip {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(168,85,247,0);
  }
  50% {
    box-shadow: 0 0 12px rgba(168,85,247,0.3), 0 0 24px rgba(168,85,247,0.15);
  }
}

.tag[style*="245,158,11"], .tag[style*="#F59E0B"],
.tag[data-status="HIGH_VALUE"] {
  animation: tagPulseHighValue 2.8s ease-in-out infinite;
}
@keyframes tagPulseHighValue {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245,158,11,0);
  }
  50% {
    box-shadow: 0 0 12px rgba(245,158,11,0.3), 0 0 24px rgba(245,158,11,0.15);
  }
}

/* Reduce pulse intensity on mobile to save battery */
@media (max-width: 768px) {
  .tag[style*="225,10,31"], .tag[style*="168,85,247"], .tag[style*="245,158,11"] {
    animation-duration: 4s;
  }
}

/* Disable for reduced-motion users */
@media (prefers-reduced-motion: reduce) {
  .tag[style*="225,10,31"], .tag[style*="168,85,247"], .tag[style*="245,158,11"] {
    animation: none !important;
  }
}

/* CMD+K hint button mobile responsive */
@media (max-width: 768px) {
  #topbarPaletteHint { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   AMBIENT CINEMATIC LAYER — HUD + grid + transitions + vignette + spotlight
   Pure CSS, zero JS dependencies
   ═══════════════════════════════════════════════════════════ */

/* ─── HUD CORNER BRACKETS ─── */
/* Targeting computer style — permanent corner accents */
body::before, body::after,
.app::before, .app::after {
  content: '';
  position: fixed;
  width: 28px;
  height: 28px;
  border-color: var(--red);
  border-style: solid;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.4;
  transition: opacity .3s var(--ease);
}
body::before {
  top: 12px;
  left: 12px;
  border-width: 1px 0 0 1px;
}
body::after {
  top: 12px;
  right: 12px;
  border-width: 1px 1px 0 0;
}
.app::before {
  bottom: 12px;
  left: 12px;
  border-width: 0 0 1px 1px;
}
.app::after {
  bottom: 12px;
  right: 12px;
  border-width: 0 1px 1px 0;
}
/* Brackets brighter on hover anywhere in app */
.app:hover::before,
.app:hover::after,
body:hover::before,
body:hover::after {
  opacity: 0.7;
}

/* Hide brackets on mobile (too cluttered) */
@media (max-width: 768px) {
  body::before, body::after,
  .app::before, .app::after { display: none; }
}

/* ─── ANIMATED GRID BACKGROUND ─── */
/* Very subtle moving grid lines — ambient depth */
body {
  position: relative;
}
/* Use html element as grid canvas */
html {
  background-image:
    linear-gradient(rgba(225,10,31,0.005) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225,10,31,0.005) 1px, transparent 1px);
  background-size: 60px 60px;
  background-position: 0 0;
  animation: hudGridDrift 90s linear infinite;
}
@keyframes hudGridDrift {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 60px 60px, 60px 60px; }
}

/* ─── PAGE TRANSITION WIPE ─── */
/* Red curtain sweeps in on page load — brief flash */
@keyframes pageWipe {
  0% { transform: translateX(-100%); opacity: 0.4; }
  60% { opacity: 0.4; }
  100% { transform: translateX(100%); opacity: 0; }
}
.app {
  position: relative;
}
.app > .pageWipeElement,
.main::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(225,10,31,0.06) 40%,
    rgba(225,10,31,0.12) 50%,
    rgba(225,10,31,0.06) 60%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 8999;
  animation: pageWipe 0.6s var(--ease) forwards;
}
/* Mobile: skip wipe, too distracting */
@media (max-width: 768px) {
  .main::after { display: none; }
}

/* ─── VIGNETTE DARKENING ─── */
/* Subtle radial darkening at edges */
body {
  background:
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.25) 100%),
    var(--bg-base);
  min-height: 100vh;
}

/* ─── AMBIENT RED GLOW PULSES (ambient breathing) ─── */
/* Scan lines + grain ambient breath REMOVED in v29 hotfix — too noisy with existing .grain pattern */
/* ─── ACCESSIBILITY: reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  html { animation: none !important; }
  .main::after, .main::before { display: none !important; }
  .grain { animation: none !important; }
}
