:root {
  --onyx-1: #050507;
  --onyx-2: #09090E;
  --onyx-3: #020204;
  --marble-vein: radial-gradient(1200px 500px at 15% -10%, rgba(223, 183, 67, 0.08), transparent 55%),
                  radial-gradient(900px 420px at 90% 110%, rgba(223, 183, 67, 0.05), transparent 55%),
                  repeating-linear-gradient(115deg, rgba(255,255,255,0.012) 0px, rgba(255,255,255,0.012) 1px, transparent 2px, transparent 9px);
  --gold-1: #FCEAB2;
  --gold-2: #DFB743;
  --gold-3: #8C6A1A;
  --gold-glow: rgba(223, 183, 67, 0.25);
  --ink: #F7F5EE;
  --ink-soft: #C5BEAC;
  --ink-faint: #756E5C;
  --danger: #B8473D;
  --danger-glow: rgba(184, 71, 61, 0.25);
  --success: #2E8A5E;
  --success-glow: rgba(46, 138, 94, 0.25);
  --warn: #C9972E;
  --font-display: 'Cinzel', serif;
  --font-serif: 'Newsreader', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --radius: 6px;
  --card-border: rgba(223, 183, 67, 0.16);
  --glass-bg: rgba(12, 12, 16, 0.72);
}

body[data-theme="forest"] {
  --onyx-1: #020B08;
  --onyx-2: #051510;
  --onyx-3: #010604;
  --marble-vein: radial-gradient(1200px 500px at 15% -10%, rgba(52, 211, 153, 0.1), transparent 55%),
                  radial-gradient(900px 420px at 90% 110%, rgba(52, 211, 153, 0.05), transparent 55%);
  --gold-1: #D1FAE5;
  --gold-2: #34D399;
  --gold-3: #0D7A55;
  --gold-glow: rgba(52, 211, 153, 0.25);
  --ink: #EAFBF4;
  --ink-soft: #A3CFBD;
  --ink-faint: #578572;
  --card-border: rgba(52, 211, 153, 0.2);
}

body[data-theme="ocean"] {
  --onyx-1: #030A12;
  --onyx-2: #06121E;
  --onyx-3: #01050A;
  --marble-vein: radial-gradient(1200px 500px at 15% -10%, rgba(56, 189, 248, 0.1), transparent 55%),
                  radial-gradient(900px 420px at 90% 110%, rgba(56, 189, 248, 0.05), transparent 55%);
  --gold-1: #E0F2FE;
  --gold-2: #38BDF8;
  --gold-3: #0369A1;
  --gold-glow: rgba(56, 189, 248, 0.25);
  --ink: #EEF8FF;
  --ink-soft: #ADC9DF;
  --ink-faint: #5B7F98;
  --card-border: rgba(56, 189, 248, 0.2);
}

body[data-theme="terracotta"] {
  --onyx-1: #120704;
  --onyx-2: #1B0B07;
  --onyx-3: #090302;
  --marble-vein: radial-gradient(1200px 500px at 15% -10%, rgba(251, 146, 60, 0.1), transparent 55%),
                  radial-gradient(900px 420px at 90% 110%, rgba(251, 146, 60, 0.05), transparent 55%);
  --gold-1: #FFEDD5;
  --gold-2: #FB923C;
  --gold-3: #9A3412;
  --gold-glow: rgba(251, 146, 60, 0.25);
  --ink: #FFF5EC;
  --ink-soft: #DFC2B3;
  --ink-faint: #916E5E;
  --card-border: rgba(251, 146, 60, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--onyx-1);
  background-image: var(--marble-vein), linear-gradient(170deg, var(--onyx-1) 0%, var(--onyx-2) 40%, var(--onyx-3) 100%);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient cursor glow */
.ambient-spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0.35;
  z-index: 1;
  transition: opacity 0.3s ease;
}

/* Top Luxury Status Strip */
.luxury-top-strip {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 40px;
  background: rgba(5, 5, 7, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(223, 183, 67, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.luxury-strip-left {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.08em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 10px var(--gold-2);
}

.live-dot.pulse {
  animation: dotGlow 2s infinite ease-in-out;
}

@keyframes dotGlow {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.strip-label {
  color: var(--gold-1);
  font-weight: 600;
}

.strip-sep {
  color: var(--ink-faint);
}

.strip-mono {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.luxury-strip-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quantum-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: rgba(223, 183, 67, 0.08);
  border: 1px solid rgba(223, 183, 67, 0.25);
  border-radius: 4px;
  color: var(--gold-1);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
}

.mobile-nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--gold-1);
  transition: transform 0.2s;
}

/* Layout */
#appView {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 40px);
  position: relative;
  z-index: 2;
}

/* Sidebar */
.sidebar {
  background: rgba(8, 8, 12, 0.88);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--card-border);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 10px 0 35px rgba(0,0,0,0.45);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-logo {
  width: 86px;
  height: auto;
  display: block;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
  opacity: 0.96;
}

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.sidebar-brand .brand-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
  line-height: 1.15;
}

.sidebar-brand .brand-subtitle {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--gold-2);
  margin-top: 4px;
}

.gold-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-2) 20%, var(--gold-1) 50%, var(--gold-2) 80%, transparent);
  opacity: 0.45;
  margin-bottom: 20px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(223, 183, 67, 0.12);
  transform: translateX(2px);
}

.nav-item.active {
  color: var(--gold-1);
  background: linear-gradient(90deg, rgba(223, 183, 67, 0.14) 0%, rgba(223, 183, 67, 0.03) 100%);
  border-color: rgba(223, 183, 67, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.nav-item.active .nav-glow {
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--gold-2);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px var(--gold-2);
}

.nav-ic {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--gold-2);
  opacity: 0.9;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(223, 183, 67, 0.15);
}

.staff-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(223, 183, 67, 0.1);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.staff-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-3));
  color: #100C02;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.staff-chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
  font-weight: 600;
}

.level-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(223, 183, 67, 0.15);
  border: 1px solid var(--gold-2);
  color: var(--gold-1);
  font-size: 9.5px;
  margin-left: 6px;
}

.staff-status-text {
  display: block;
  font-size: 10px;
  color: var(--ink-faint);
  margin-top: 2px;
}

/* Main Area */
.main {
  padding: 40px 48px;
  overflow-y: auto;
  max-width: 1480px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  gap: 16px;
}

.page-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.page-desc {
  color: var(--ink-faint);
  font-size: 13.5px;
  margin-top: 6px;
  max-width: 720px;
  line-height: 1.6;
}

/* Luxury Panels */
.panel {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.panel:hover {
  border-color: rgba(223, 183, 67, 0.3);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-2) 30%, var(--gold-1) 50%, var(--gold-2) 70%, transparent);
  opacity: 0.7;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 19px;
  color: var(--ink);
  font-weight: 600;
}

.panel-sub {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 3px;
}

.panel-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.panel-badge.gold {
  color: var(--gold-1);
}

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 16px;
}

/* Luxury Form Fields */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
  font-weight: 500;
}

.field-shell {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  position: relative;
}

.field-shell:focus-within {
  border-color: var(--gold-2);
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 16px var(--gold-glow), inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.field-shell input,
.field-shell select {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.field-shell select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23C5BEAC' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.field-shell select option {
  background: #111116;
  color: #F7F5EE;
}

/* Search shell */
.search-shell {
  display: flex;
  align-items: center;
  padding: 0 12px;
}

.search-shell input {
  padding: 0 10px;
}

.search-ic {
  color: var(--gold-2);
  opacity: 0.8;
}

.search-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gold-2);
  padding: 2px 6px;
  border: 1px solid rgba(223, 183, 67, 0.3);
  border-radius: 3px;
  background: rgba(223, 183, 67, 0.08);
}

/* Luxury Buttons */
.btn {
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13.5px;
  padding: 12px 20px;
  letter-spacing: 0.03em;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  border: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 60%, var(--gold-3) 100%);
  color: #120D04;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 24px var(--gold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 700;
}

.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px var(--gold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  filter: brightness(1.04);
}

.btn-ghost {
  border: 1px solid rgba(223, 183, 67, 0.25);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.02);
}

.btn-ghost:hover {
  border-color: var(--gold-2);
  color: var(--gold-1);
  background: rgba(223, 183, 67, 0.06);
  transform: translateY(-1px);
}

.btn-danger-ghost {
  border: 1px solid rgba(184, 71, 61, 0.35);
  color: #F87171;
  background: rgba(184, 71, 61, 0.06);
}

.btn-danger-ghost:hover {
  border-color: #F87171;
  background: rgba(184, 71, 61, 0.15);
  color: #FFF;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
}

/* Banners */
.err-banner {
  background: rgba(184, 71, 61, 0.12);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #FCA5A5;
  font-size: 13px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* Views */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeInPanel 0.25s ease-out;
}

@keyframes fadeInPanel {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Queue Cards */
.queue-card {
  background: var(--glass-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 14px;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.queue-card:hover {
  border-color: rgba(223, 183, 67, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

.queue-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-2) 40%, transparent);
  opacity: 0.5;
}

.queue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.queue-main {
  flex: 1;
  min-width: 240px;
}

.queue-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
}

.queue-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
  line-height: 1.7;
}

.queue-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 6px;
  font-weight: 500;
}

.tag-warn {
  border: 1px solid var(--warn);
  color: #FDE047;
  background: rgba(201, 151, 46, 0.1);
}

.tag-danger {
  border: 1px solid var(--danger);
  color: #FCA5A5;
  background: rgba(184, 71, 61, 0.12);
}

.tag-success {
  border: 1px solid var(--success);
  color: #86EFAC;
  background: rgba(46, 138, 94, 0.12);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 14px 12px;
  border-bottom: 1px solid rgba(223, 183, 67, 0.18);
  font-weight: 500;
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

tr:hover td {
  background: rgba(223, 183, 67, 0.02);
  color: var(--ink);
}

/* Tasks */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.task-item:hover {
  border-color: rgba(223, 183, 67, 0.25);
  background: rgba(255, 255, 255, 0.03);
}

.task-item.completed {
  opacity: 0.55;
}

.task-check {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-3);
  background: transparent;
  color: var(--gold-1);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.task-check:hover:not(.done) {
  border-color: var(--gold-2);
  background: rgba(223, 183, 67, 0.1);
}

.task-check.done {
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  color: #100C02;
  border-color: var(--gold-1);
  cursor: default;
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
}

.task-title.completed {
  text-decoration: line-through;
  color: var(--ink-faint);
}

.task-desc {
  font-size: 13px;
  color: var(--ink-faint);
  margin-top: 4px;
  line-height: 1.55;
}

.task-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 8px;
}

/* Customer card */
.customer-card {
  background: var(--glass-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.customer-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13.5px;
}

.customer-row span:first-child {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.customer-row span:last-child {
  color: var(--ink);
  font-weight: 500;
  text-align: right;
}

.level-gate-note {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  padding: 12px 0;
  border-top: 1px dashed rgba(223, 183, 67, 0.2);
  margin-top: 16px;
}

/* Immutable Train (ML-DSA-87) */
.chain-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.chain-summary .stat {
  flex: 1;
  min-width: 160px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
}

.chain-summary .stat b {
  display: block;
  font-family: var(--font-mono);
  font-size: 26px;
  color: var(--ink);
  font-weight: 700;
}

.chain-summary .stat.ok b {
  color: #86EFAC;
}

.chain-summary .stat.bad b {
  color: #F87171;
}

.chain-summary .stat span {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
  display: block;
}

.train {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
}

.wagon {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.wagon:hover {
  border-color: var(--gold-2);
  transform: translateX(2px);
}

.wagon.broken {
  border-color: var(--danger);
  background: rgba(184, 71, 61, 0.1);
}

.coupling {
  width: 2px;
  height: 20px;
  background: rgba(223, 183, 67, 0.35);
  margin-left: 36px;
}

.coupling.broken {
  background: repeating-linear-gradient(180deg, var(--danger) 0 4px, transparent 4px 8px);
  width: 3px;
}

.wagon .seqmark {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #100C02;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--gold-glow);
}

.wagon.broken .seqmark {
  background: var(--danger);
  color: #FFF;
}

.wagon .wbody {
  flex: 1;
  min-width: 0;
}

.wagon .wtop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.wagon .wevent {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
}

.wagon .wsrc {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(223, 183, 67, 0.2);
  color: var(--gold-1);
  margin-left: 8px;
  text-transform: uppercase;
}

.wagon .wtime {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}

.wagon .wmeta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 6px;
  word-break: break-all;
}

.wagon .wproblems {
  margin-top: 10px;
  font-size: 12.5px;
  color: #F87171;
  font-weight: 600;
}

/* Settings */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.8fr);
  gap: 20px;
  max-width: 1040px;
}

.settings-card {
  background: var(--glass-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 26px;
  position: relative;
}

.settings-card h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 6px;
}

.settings-card p {
  font-size: 13.5px;
  color: var(--ink-faint);
  line-height: 1.55;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
  cursor: pointer;
}

.theme-option:hover {
  transform: translateY(-1px);
  border-color: var(--gold-2);
  background: rgba(223, 183, 67, 0.04);
}

.theme-option.active {
  border-color: var(--gold-2);
  background: rgba(223, 183, 67, 0.08);
  color: var(--ink);
  box-shadow: 0 0 16px var(--gold-glow);
}

.theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.theme-swatch.gold { background: linear-gradient(135deg, #FCEAB2, #DFB743 60%, #8C6A1A); }
.theme-swatch.forest { background: linear-gradient(135deg, #D1FAE5, #34D399 60%, #0D7A55); }
.theme-swatch.ocean { background: linear-gradient(135deg, #E0F2FE, #38BDF8 60%, #0369A1); }
.theme-swatch.terracotta { background: linear-gradient(135deg, #FFEDD5, #FB923C 60%, #9A3412); }

.theme-name {
  font-size: 13.5px;
  font-weight: 600;
  display: block;
}

.theme-detail {
  display: block;
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 3px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-label {
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 600;
}

.settings-help {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 3px;
}

.select-control {
  min-width: 160px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(223, 183, 67, 0.25);
  border-radius: var(--radius);
  background: #0E0E14;
  color: var(--ink);
  outline: none;
}

.settings-preview {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(140deg, rgba(223, 183, 67, 0.15), var(--onyx-2) 70%);
  overflow: hidden;
}

.preview-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-1);
}

.preview-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 24px;
  color: var(--ink);
  line-height: 1.2;
}

.preview-line {
  height: 1px;
  background: linear-gradient(90deg, var(--gold-1), transparent);
  opacity: 0.6;
}

/* Threat Banner */
#threatBanner {
  display: none;
  position: sticky;
  top: 40px;
  z-index: 50;
  padding: 12px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  backdrop-filter: blur(12px);
}

#threatBanner.level-amarillo {
  display: block;
  background: rgba(201, 151, 46, 0.16);
  border-bottom: 1px solid var(--warn);
  color: #FDE047;
}

#threatBanner.level-rojo {
  display: block;
  background: rgba(184, 71, 61, 0.22);
  border-bottom: 1px solid #F87171;
  color: #FCA5A5;
  animation: threatPulse 1.4s infinite;
}

@keyframes threatPulse {
  0%, 100% { background: rgba(184, 71, 61, 0.15); }
  50% { background: rgba(184, 71, 61, 0.32); }
}

/* CiberDefenders Panel */
:root {
  --cyber-cyan: #33FFDD;
  --cyber-line: rgba(51, 255, 221, 0.18);
}

.cyber-panel {
  background: radial-gradient(900px 300px at 10% -10%, rgba(51, 255, 221, 0.08), transparent 60%), linear-gradient(160deg, #02120E, #010806 70%);
  border: 1px solid var(--cyber-line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.cyber-title {
  font-family: var(--font-mono);
  color: var(--cyber-cyan);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cyber-title .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyber-cyan);
  box-shadow: 0 0 10px var(--cyber-cyan);
}

.threat-gauge {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.threat-chip {
  flex: 1;
  padding: 16px;
  border-radius: var(--radius);
  text-align: center;
  font-family: var(--font-mono);
  border: 1px solid var(--cyber-line);
  background: rgba(0, 0, 0, 0.35);
}

.threat-chip .n {
  font-size: 26px;
  font-weight: 700;
  color: var(--cyber-cyan);
}

.threat-chip .l {
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 4px;
}

.threat-level-box {
  padding: 18px;
  border-radius: var(--radius);
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 20px;
  border: 1px solid;
}

.threat-level-box.verde {
  color: #86EFAC;
  border-color: rgba(134, 239, 172, 0.3);
  background: rgba(134, 239, 172, 0.06);
}

.threat-level-box.amarillo {
  color: #FDE047;
  border-color: rgba(253, 224, 71, 0.35);
  background: rgba(253, 224, 71, 0.08);
}

.threat-level-box.rojo {
  color: #FCA5A5;
  border-color: rgba(252, 165, 165, 0.4);
  background: rgba(184, 71, 61, 0.16);
}

.cyber-input {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--cyber-line);
  color: var(--cyber-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px 14px;
  border-radius: var(--radius);
  width: 100%;
  outline: none;
}

.cyber-input:focus {
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 12px rgba(51, 255, 221, 0.2);
}

.btn-cyber {
  background: transparent;
  border: 1px solid var(--cyber-line);
  color: var(--cyber-cyan);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cyber:hover {
  background: rgba(51, 255, 221, 0.08);
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 12px rgba(51, 255, 221, 0.2);
}

.btn-cyber-danger {
  border-color: rgba(248, 113, 113, 0.4);
  color: #F87171;
}

.btn-cyber-danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: #F87171;
}

.cyber-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--cyber-line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(223, 183, 67, 0.2);
  border-top-color: var(--gold-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-note {
  color: var(--ink-faint);
  font-size: 13px;
  padding: 24px 0;
  text-align: center;
}

.empty-note {
  color: var(--ink-faint);
  font-size: 13.5px;
  padding: 28px;
  text-align: center;
}

/* Compact mode */
body.compact .panel { padding: 18px 20px; margin-bottom: 16px; }
body.compact .queue-card { padding: 14px 18px; margin-bottom: 10px; }
body.compact .main { padding: 24px 32px; }
body.compact .nav-item { padding: 8px 12px; }
body.compact td, body.compact th { padding: 10px 8px; }

/* Responsive */
@media (max-width: 900px) {
  #appView { grid-template-columns: 1fr; }
  .mobile-nav-toggle { display: flex; }
  .sidebar {
    position: fixed;
    inset: 40px auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 90;
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 24px 20px; }
  .settings-layout { grid-template-columns: 1fr; }
}