:root {
  color-scheme: dark;
  --bg: #09101c;
  --panel: #111c2d;
  --panel-2: #152338;
  --line: #24354e;
  --text: #f4f8ff;
  --muted: #91a4bd;
  --cyan: #53d9d1;
  --cyan-deep: #1a9f9a;
  --amber: #ffc857;
  --red: #ff5d6c;
  --green: #57df9a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 20% 0%, #14233a 0, var(--bg) 42rem); color: var(--text); min-height: 100vh; }
button, select, input { font: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 28px; }
.topbar, .card-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.topbar { margin-bottom: 24px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin-bottom: 0; letter-spacing: -0.05em; }
h2 { font-size: 1.25rem; margin-bottom: 0; }
.eyebrow { color: var(--cyan); font-size: .72rem; letter-spacing: .16em; font-weight: 800; margin-bottom: 6px; }
.muted { color: var(--muted); line-height: 1.5; }
.card { background: linear-gradient(145deg, rgba(21, 35, 56, .97), rgba(14, 24, 40, .97)); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: 0 18px 50px rgba(0, 0, 0, .17); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, .75fr); gap: 18px; }
.side-stack { display: grid; gap: 18px; }
.stream-card { min-height: 470px; }
.stream-placeholder, #streamFrame { width: 100%; height: 390px; margin-top: 20px; border: 0; border-radius: 15px; background: #060b12; }
.stream-placeholder { display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; color: var(--muted); }
.listen-symbol { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 15px; border-radius: 50%; color: var(--cyan); background: rgba(83, 217, 209, .1); border: 1px solid rgba(83, 217, 209, .35); font-size: 2rem; }
.button { border: 1px solid var(--line); color: var(--text); background: #1a2a42; padding: 11px 15px; border-radius: 12px; cursor: pointer; font-weight: 750; transition: transform .12s ease, filter .12s ease; }
.button:hover { filter: brightness(1.12); }
.button:active { transform: translateY(1px); }
.button-primary { background: linear-gradient(135deg, var(--cyan-deep), #247b9b); border-color: transparent; }
.button-alert { width: 100%; background: linear-gradient(135deg, #e04658, #9c324f); border: 0; }
.button-alert.armed { background: rgba(87, 223, 154, .12); color: var(--green); border: 1px solid rgba(87, 223, 154, .45); }
.button-light { background: white; color: #761525; border: 0; }
.button-small { padding: 8px 11px; font-size: .85rem; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 999px; font-size: .76rem; font-weight: 800; white-space: nowrap; }
.badge span { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-offline { color: #f7a5ad; background: rgba(255, 93, 108, .11); }
.badge-online { color: var(--green); background: rgba(87, 223, 154, .1); }
.badge-neutral { color: #b6c5d7; background: rgba(145, 164, 189, .1); }
.sound-card.noise { border-color: var(--red); box-shadow: 0 0 0 2px rgba(255, 93, 108, .16), 0 18px 50px rgba(0,0,0,.17); }
#dbValue { font-size: 1.1rem; }
.meter { position: relative; height: 16px; overflow: hidden; margin: 28px 0 14px; border-radius: 99px; background: #08101c; }
#meterFill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--amber), var(--red)); transition: width .12s linear; }
#thresholdMarker { position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 4px; background: white; box-shadow: 0 0 8px white; }
.lower-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; margin-top: 18px; }
.setting-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 15px; align-items: center; margin-top: 24px; }
.setting-row span { display: grid; }
.setting-row small { color: var(--muted); margin-top: 4px; }
.setting-row input { grid-column: 1 / -1; width: 100%; accent-color: var(--cyan); }
.setting-row output { color: var(--cyan); font-weight: 850; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.two-columns label { display: grid; gap: 8px; color: var(--muted); font-size: .86rem; }
select { width: 100%; background: #0c1727; color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: 10px; }
.form-result { min-height: 1.3rem; margin: 14px 0 0; color: var(--green); font-size: .86rem; }
dl { margin: 18px 0 0; }
dl div { display: flex; justify-content: space-between; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); }
dl div:last-child { border: 0; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-weight: 700; }
.recordings-card { margin-top: 18px; }
.recordings-list { display: grid; gap: 12px; margin-top: 20px; }
.recording { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 14px; align-items: center; background: rgba(5, 12, 21, .5); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; }
.recording p { margin: 0; font-weight: 750; }
.recording small { color: var(--muted); }
.recording-actions { display: flex; gap: 8px; }
.recording a { text-decoration: none; }
.alarm-overlay { position: fixed; inset: 0; z-index: 100; place-items: center; text-align: center; padding: 30px; background: rgba(160, 12, 35, .92); backdrop-filter: blur(9px); }
.alarm-overlay:not([hidden]) { display: grid; }
.alarm-overlay h2 { font-size: clamp(2rem, 7vw, 4.5rem); }
.alarm-icon { display: grid; place-items: center; width: 86px; height: 86px; margin: 0 auto 22px; border-radius: 50%; background: white; color: #a00c23; font-size: 3.3rem; font-weight: 950; }
footer { padding: 22px 6px 0; color: #667b95; font-size: .78rem; text-align: center; }
.login-body { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.login-shell { width: min(430px, 100%); }
.login-card { padding: 34px; }
.login-card h1 { margin-bottom: 14px; }
.login-symbol { display: grid; place-items: center; width: 68px; height: 68px; margin-bottom: 24px; border-radius: 50%; color: var(--cyan); background: rgba(83, 217, 209, .1); border: 1px solid rgba(83, 217, 209, .35); font-size: 2rem; }
.login-form { display: grid; gap: 16px; margin-top: 26px; }
.login-form label { display: grid; gap: 7px; color: var(--muted); font-size: .86rem; }
.login-form input { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: #0c1727; color: var(--text); }
.login-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(83, 217, 209, .12); }
.login-error { min-height: 1.2rem; margin: -4px 0 0; color: #ff8a96; font-size: .86rem; }
.login-note { margin: 20px 0 0; color: #667b95; text-align: center; font-size: .76rem; }

@media (max-width: 820px) {
  .hero-grid, .lower-grid { grid-template-columns: 1fr; }
  .stream-card { min-height: auto; }
  .stream-placeholder, #streamFrame { height: 320px; }
}

@media (max-width: 540px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 20px; }
  .card { padding: 17px; border-radius: 18px; }
  .topbar { align-items: flex-end; }
  .two-columns { grid-template-columns: 1fr; }
  .stream-placeholder, #streamFrame { height: 250px; }
  .recording { grid-template-columns: 1fr; }
  .recording-actions { width: 100%; }
  .recording-actions .button { flex: 1; text-align: center; }
}
