/* ══════════════════════════════════════════════════════════════════════════
   style.css — Gnoke Suite Design System
   SignalTower Edition
   Copyright © 2026 Edmund Sparrow — GNU GPL v3
   ══════════════════════════════════════════════════════════════════════════ */


/* ── 1. TOKENS ──────────────────────────────────────────────────────────── */
:root {
  --bg:           #f7f2ec;
  --bg2:          #ede5d8;
  --surface:      #ffffff;
  --surface2:     #faf7f4;
  --surface3:     #f3ede5;
  --text:         #1c140e;
  --text2:        #4a3728;
  --muted:        #9c8070;
  --border:       #e0d2c2;
  --border2:      #ccbbaa;

  /* SignalTower accent — electric sky blue */
  --accent:       #0ea5e9;
  --accent-dk:    #0284c7;
  --accent-lt:    #e0f2fe;
  --accent-txt:   #0c4a6e;
  --accent-dim:   color-mix(in srgb, #0ea5e9 10%, transparent);

  --green:        #2d6e4e;
  --green-lt:     #dff2ea;
  --red:          #b83030;
  --red-lt:       #fde8e8;
  --danger:       #dc2626;

  --topbar-bg:    #ffffff;
  --topbar-bdr:   #e0d2c2;
  --topbar-txt:   #1c140e;
  --topbar-muted: #9c8070;
  --topbar-h:     52px;

  --font-sans:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', monospace;
  --font-display: 'Playfair Display', serif;

  --radius:       10px;
  --radius-lg:    14px;
  --shadow:       0 1px 4px rgba(28,20,14,.08), 0 2px 12px rgba(28,20,14,.05);
  --shadow-lg:    0 4px 24px rgba(28,20,14,.14);
  --transition:   0.18s ease;
}

[data-theme="dark"] {
  --bg:       #18120c;
  --bg2:      #201710;
  --surface:  #241a12;
  --surface2: #2e2018;
  --surface3: #38271a;
  --text:     #f0e8de;
  --text2:    #c8b09a;
  --muted:    #7a6a5a;
  --border:   #2e2218;
  --border2:  #3e3020;

  --topbar-bg:    #241a12;
  --topbar-bdr:   #2e2218;
  --topbar-txt:   #f0e8de;
  --topbar-muted: #7a6a5a;

  --accent-lt:    #082f49;
  --accent-txt:   #bae6fd;
}


/* ── 2. RESET ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--bg); color: var(--text);
  line-height: 1.55; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; display: flex; flex-direction: column;
  transition: background var(--transition), color var(--transition);
}
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: var(--font-sans); font-size: inherit; }


/* ── 3. LOADING OVERLAY ─────────────────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  z-index: 999;
}
.loader-dots { display: flex; gap: 6px; }
.loader-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  animation: blink 1.2s infinite;
}
.loader-dot:nth-child(2) { animation-delay: .2s; }
.loader-dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: .2; transform: scale(.8); }
  40%           { opacity: 1;  transform: scale(1);  }
}
.loader-text {
  font-family: var(--font-mono);
  font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}


/* ── 4. TOPBAR ──────────────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-bdr);
  display: flex; align-items: center;
  gap: 10px; padding: 0 16px;
  flex-shrink: 0; z-index: 100;
}

#hamburger {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--topbar-txt);
  font-size: 16px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  transition: border-color var(--transition);
}
#hamburger:hover { border-color: var(--accent); }

#brand {
  display: flex; align-items: baseline; gap: 6px;
  text-decoration: none; flex-shrink: 0; cursor: pointer;
}
#brand-gnoke {
  font-family: var(--font-mono);
  font-size: .62rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--accent);
}
#brand-app {
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 700;
  color: var(--topbar-txt); letter-spacing: -.01em;
}

#context-info {
  font-family: var(--font-mono);
  font-size: .68rem; letter-spacing: .04em;
  color: var(--topbar-muted); margin-left: 4px;
}

.topbar-spacer { flex: 1; }

.menu-group { display: flex; gap: 2px; }
.menu { position: relative; }
.menu-btn {
  background: transparent; border: none;
  color: var(--topbar-txt); font-family: var(--font-sans);
  font-size: .82rem; padding: 6px 10px;
  cursor: pointer; border-radius: 5px;
  transition: background var(--transition), color var(--transition);
}
.menu-btn:hover { background: var(--accent-dim); color: var(--accent); }
.menu-btn.active { color: var(--accent); font-weight: 600; }
.menu-content {
  display: none; position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 4px; z-index: 200;
}
.menu:hover .menu-content,
.menu:focus-within .menu-content { display: flex; flex-direction: column; }
.menu-content button, .menu-content a {
  background: none; border: none; text-align: left;
  padding: 8px 12px; font-family: var(--font-sans);
  font-size: .82rem; color: var(--text);
  cursor: pointer; border-radius: 5px;
  text-decoration: none; display: block;
  transition: background var(--transition);
}
.menu-content button:hover, .menu-content a:hover { background: var(--accent-dim); }
.menu-content hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.menu-content .danger-item { color: var(--danger); }

#topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

#status-chip {
  font-family: var(--font-mono);
  font-size: .6rem; letter-spacing: .1em; text-transform: uppercase;
  background: var(--surface2); color: var(--topbar-muted);
  border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 20px;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
#status-chip.show { opacity: 1; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--topbar-txt); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition), background var(--transition);
}
.icon-btn:hover { border-color: var(--accent); background: var(--accent-dim); }


/* ── 5. PAGES ────────────────────────────────────────────────────────────── */
.pages { flex: 1; overflow: hidden; position: relative; }
.page  { position: absolute; inset: 0; overflow-y: auto; display: none; }
.page.active { display: block; animation: fadeUp .22s ease forwards; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-content {
  max-width: 680px; margin: 0 auto;
  padding: 24px 20px 60px;
}

.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.7rem; font-weight: 700;
  color: var(--text); letter-spacing: -.02em;
}
.page-header .sub {
  font-family: var(--font-mono);
  font-size: .68rem; letter-spacing: .06em;
  color: var(--muted); margin-top: 4px;
}


/* ── 6. CARDS ────────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow);
}
.card-title {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 600; color: var(--text);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.hint { font-size: .82rem; font-weight: 300; color: var(--muted); line-height: 1.65; }
.hint strong { color: var(--text); font-weight: 600; }


/* ── 7. BUTTONS ──────────────────────────────────────────────────────────── */
.btn {
  padding: 9px 16px; border-radius: 8px; border: none;
  font-family: var(--font-sans); font-size: .82rem; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: opacity var(--transition), transform var(--transition), background var(--transition);
  white-space: nowrap;
}
.btn:active { opacity: .85; transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); }
.btn-ghost   { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-lt); }
.btn-sm { padding: 6px 12px; font-size: .76rem; }


/* ── 8. FORM ELEMENTS ────────────────────────────────────────────────────── */
label {
  display: block; font-family: var(--font-mono);
  font-size: .68rem; font-weight: 500; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text2); margin-bottom: 5px;
}
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
textarea,
select {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: .88rem; font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}
input[type="number"] { text-align: right; }
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }


/* ── 9. TABLES ───────────────────────────────────────────────────────────── */
.about-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.about-table td {
  padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--muted);
}
.about-table td:first-child {
  font-family: var(--font-mono); font-size: .72rem;
  color: var(--text); width: 40%;
}
.about-table tr:last-child td { border-bottom: none; }


/* ── 10. MODALS ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.4);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 420px;
  padding: 20px; box-shadow: 0 16px 48px rgba(0,0,0,.18);
}
.modal-head {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 14px;
}
.modal-head h3 { font-size: .95rem; font-weight: 600; }
.modal-close {
  background: none; border: none; font-size: 1rem;
  cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { font-size: .84rem; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }


/* ── 11. TOAST ───────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--bg);
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em;
  padding: 10px 18px; border-radius: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap; z-index: 999;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err  { background: var(--danger); color: #fff; }
#toast.ok   { background: var(--green);  color: #fff; }


/* ── 12. MOBILE DRAWER ───────────────────────────────────────────────────── */
#drawer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.35); z-index: 150;
}
#drawer-overlay.open { display: block; }

#drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 270px; background: var(--topbar-bg); z-index: 160;
  border-right: 1px solid var(--topbar-bdr);
  transform: translateX(-100%); transition: transform .28s ease;
  display: flex; flex-direction: column; overflow-y: auto;
}
#drawer.open { transform: translateX(0); }

#drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--topbar-bdr);
}
#drawer-brand { display: flex; align-items: baseline; gap: 6px; }
#drawer-gnoke {
  font-family: var(--font-mono); font-size: .62rem;
  letter-spacing: .22em; text-transform: uppercase; color: var(--accent);
}
#drawer-app {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 700; color: var(--topbar-txt);
}
#drawer-close {
  background: none; border: none;
  color: var(--topbar-muted); font-size: 1rem; cursor: pointer; padding: 4px 8px;
  transition: color var(--transition);
}
#drawer-close:hover { color: var(--topbar-txt); }
.drawer-section {
  font-family: var(--font-mono); font-size: .58rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--topbar-muted); padding: 16px 16px 6px;
}
.drawer-btn {
  background: none; border: none; text-align: left; width: 100%;
  padding: 10px 16px; font-family: var(--font-sans); font-size: .86rem;
  color: var(--topbar-txt); cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.drawer-btn:hover { background: var(--accent-dim); color: var(--accent); }
.drawer-btn.active { color: var(--accent); font-weight: 600; background: var(--accent-dim); }
.drawer-btn.danger { color: var(--danger); }


/* ── 13. RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #hamburger    { display: flex; }
  .menu-group   { display: none; }
  #context-info { display: none; }
  .page-content { padding: 16px 14px 60px; }
  .card-grid    { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.4rem; }
}
@media (min-width: 641px) {
  #hamburger { display: none; }
  #drawer, #drawer-overlay { display: none !important; }
}
@media (display-mode: standalone) {
  #topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
}


/* ══════════════════════════════════════════════════════════════════════════
   SIGNALTOWER — Custom Component Styles
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Horizontal tower (patterns page) ── */
.tower-horizontal { padding: 18px 20px 16px; }
.tower-row {
  display: flex; flex-direction: row;
  gap: 14px; justify-content: center; align-items: center;
}
.tower-circle {
  width: 68px; height: 68px; border-radius: 50%;
  border: 2px solid var(--border);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease, box-shadow .2s ease, border-color .2s ease;
  overflow: hidden; flex-shrink: 0;
}
.tower-circle::after {
  content: attr(data-label);
  font-family: var(--font-mono);
  font-size: .5rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
  position: relative; z-index: 2;
  transition: color .2s, text-shadow .2s;
}
.tower-circle::before {
  content: '';
  position: absolute; inset: 5px; border-radius: 50%;
  background: radial-gradient(ellipse at 45% 30%, rgba(255,255,255,.5) 0%, transparent 65%);
  opacity: 0; transition: opacity .2s; z-index: 1;
}
.tower-circle.active::before { opacity: 1; }
.tower-circle.active::after  { color: rgba(255,255,255,.9); text-shadow: 0 0 6px rgba(255,255,255,.5); }

/* OFF states */
.tower-circle.red   { background: color-mix(in srgb, #dc2626 7%, var(--surface)); }
.tower-circle.amber { background: color-mix(in srgb, #f59e0b 7%, var(--surface)); }
.tower-circle.green { background: color-mix(in srgb, #10b981 7%, var(--surface)); }
[data-theme="dark"] .tower-circle.red   { background: #1a0404; }
[data-theme="dark"] .tower-circle.amber { background: #1a1100; }
[data-theme="dark"] .tower-circle.green { background: #041208; }

/* ACTIVE states */
.tower-circle.red.active {
  background: radial-gradient(circle at 45% 35%, #f87171, #b91c1c);
  border-color: #7f1d1d;
  box-shadow: 0 0 18px rgba(220,38,38,.7), 0 0 40px rgba(220,38,38,.25);
}
.tower-circle.amber.active {
  background: radial-gradient(circle at 45% 35%, #fcd34d, #d97706);
  border-color: #92400e;
  box-shadow: 0 0 18px rgba(245,158,11,.7), 0 0 40px rgba(245,158,11,.25);
}
.tower-circle.green.active {
  background: radial-gradient(circle at 45% 35%, #6ee7b7, #059669);
  border-color: #064e3b;
  box-shadow: 0 0 18px rgba(16,185,129,.7), 0 0 40px rgba(16,185,129,.25);
}

/* ── Mode display banner ── */
.mode-display {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.mode-display .mode-label {
  font-family: var(--font-mono);
  font-size: .58rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}
.mode-display .mode-value {
  font-family: var(--font-display);
  font-size: 1.25rem; font-weight: 700;
  letter-spacing: -.01em; color: var(--accent);
  transition: color .25s;
}
.mode-display .mode-value.emergency { color: #dc2626; }
.mode-display .mode-value.warning   { color: #d97706; }
.mode-display .mode-value.normal    { color: #059669; }

/* HW status badge */
.hw-badge {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: .62rem; letter-spacing: .06em;
  color: var(--muted);
}
.hw-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(45,110,78,.5);
  animation: hw-pulse 2.4s ease infinite;
}
.hw-dot.error { background: var(--danger); box-shadow: 0 0 6px rgba(220,38,38,.5); }
.hw-dot.idle  { background: var(--muted); box-shadow: none; animation: none; }
@keyframes hw-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ── Signal tower visual ── */
.tower-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center;
}
.tower-cap-label {
  font-family: var(--font-mono);
  font-size: .56rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 16px;
}
.tower-stack {
  display: flex; flex-direction: column;
  gap: 9px; width: 168px;
}

/* Mounting pole */
.tower-pole {
  width: 12px; height: 28px;
  background: var(--border2);
  border-radius: 2px; margin: 0 auto;
}

.tower-light {
  height: 54px; border-radius: 8px;
  border: 2px solid var(--border);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease, box-shadow .2s ease, border-color .2s ease;
  overflow: hidden;
}

/* Label text via ::after */
.tower-light::after {
  content: attr(data-label);
  font-family: var(--font-mono);
  font-size: .56rem; letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative; z-index: 2;
  transition: color .2s, text-shadow .2s;
}

/* Lens highlight overlay */
.tower-light::before {
  content: '';
  position: absolute; inset: 4px;
  border-radius: 5px;
  background: radial-gradient(ellipse at 50% 20%, rgba(255,255,255,.45) 0%, transparent 65%);
  opacity: 0; transition: opacity .2s; z-index: 1;
}
.tower-light.active::before { opacity: 1; }
.tower-light.active::after  { color: rgba(255,255,255,.92); text-shadow: 0 0 8px rgba(255,255,255,.6); }

/* OFF states — light theme */
.tower-light.red   { background: color-mix(in srgb, #dc2626 7%, var(--surface)); }
.tower-light.amber { background: color-mix(in srgb, #f59e0b 7%, var(--surface)); }
.tower-light.green { background: color-mix(in srgb, #10b981 7%, var(--surface)); }

/* OFF states — dark theme */
[data-theme="dark"] .tower-light.red   { background: #1a0404; }
[data-theme="dark"] .tower-light.amber { background: #1a1100; }
[data-theme="dark"] .tower-light.green { background: #041208; }

/* ACTIVE states with glow */
.tower-light.red.active {
  background: linear-gradient(145deg, #ef4444, #b91c1c);
  border-color: #7f1d1d;
  box-shadow: 0 0 20px rgba(220,38,38,.65), 0 0 44px rgba(220,38,38,.25), inset 0 1px 6px rgba(0,0,0,.25);
}
.tower-light.amber.active {
  background: linear-gradient(145deg, #fbbf24, #d97706);
  border-color: #92400e;
  box-shadow: 0 0 20px rgba(245,158,11,.65), 0 0 44px rgba(245,158,11,.25), inset 0 1px 6px rgba(0,0,0,.25);
}
.tower-light.green.active {
  background: linear-gradient(145deg, #34d399, #059669);
  border-color: #064e3b;
  box-shadow: 0 0 20px rgba(16,185,129,.65), 0 0 44px rgba(16,185,129,.25), inset 0 1px 6px rgba(0,0,0,.25);
}

/* ── Mode control buttons ── */
.mode-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 18px;
}
.mode-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 10px 14px;
  cursor: pointer; text-align: center;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}
.mode-btn:active { transform: translateY(2px); box-shadow: none; }
.mode-btn .mode-icon { font-size: 1.35rem; display: block; margin-bottom: 7px; }
.mode-btn .mode-name {
  font-family: var(--font-mono);
  font-size: .62rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text);
  display: block; margin-bottom: 3px; font-weight: 500;
}
.mode-btn .mode-desc { font-size: .7rem; color: var(--muted); display: block; }
.mode-btn.emergency { border-color: #fca5a5; }
.mode-btn.warning   { border-color: #fcd34d; }
.mode-btn.normal    { border-color: #6ee7b7; }
.mode-btn.off       { border-color: var(--border2); }
.mode-btn.is-active.emergency { background: #fff1f1; border-color: #dc2626; }
.mode-btn.is-active.warning   { background: #fffbeb; border-color: #d97706; }
.mode-btn.is-active.normal    { background: #f0fdf4; border-color: #059669; }
.mode-btn.is-active.off       { background: var(--surface2); border-color: var(--accent); }
[data-theme="dark"] .mode-btn.is-active.emergency { background: #2a0a0a; }
[data-theme="dark"] .mode-btn.is-active.warning   { background: #1f1500; }
[data-theme="dark"] .mode-btn.is-active.normal    { background: #061a0d; }

/* ── Patterns page ── */
.pattern-section { margin-bottom: 22px; }
.pattern-section-title {
  font-family: var(--font-mono);
  font-size: .6rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 9px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.pattern-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.pattern-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 6px;
  font-family: var(--font-mono);
  font-size: .62rem; letter-spacing: .03em;
  color: var(--text); cursor: pointer; text-align: center;
  transition: all .15s ease;
  box-shadow: var(--shadow); line-height: 1.45;
}
.pattern-btn:hover  { border-color: var(--accent); color: var(--accent); }
.pattern-btn:active { transform: scale(.95); background: var(--accent-lt); }
.pattern-btn.is-active { background: var(--accent-lt); border-color: var(--accent); color: var(--accent-dk); font-weight: 600; }

/* ── Config / Settings ── */
.config-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 0 20px;
  box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden;
}
.config-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  gap: 16px;
}
.config-row:last-child { border-bottom: none; }
.config-row label { margin: 0; flex: 1; }
.config-row .config-hint {
  font-size: .72rem; font-weight: 300;
  color: var(--muted); margin-top: 2px;
  font-family: var(--font-sans);
  text-transform: none; letter-spacing: 0;
}
.config-row input[type="number"] { width: 90px; text-align: center; }
.config-row input[type="checkbox"] {
  width: 20px; height: 20px;
  accent-color: var(--accent); cursor: pointer;
  flex-shrink: 0;
}
.config-row select { max-width: 200px; }
