/* Castbyte SafetyNet consoles. Dark control-room theme on Castbyte teal #051C28,
   with the marine alert colours: international orange for SOS, amber for watch. */
:root {
  --bg: #051C28;
  --panel: #0A2A3A;
  --panel-2: #0E3547;
  --line: #1C4A5F;
  --text: #E6EEF6;
  --muted: #9DB6C7;
  --cyan: #4FC3F7;
  --brand: #3DD6E6;
  --lime: #D7F238;
  --sos: #FF5A1F;
  --sos-ink: #0B2545;
  --red: #FF5252;
  --amber: #F5A300;
  --green: #4CD08A;
  --grey: #6F8899;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
a { color: var(--cyan); }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer; border: 1px solid var(--line); background: var(--panel-2);
  border-radius: 8px; padding: 8px 14px; min-height: 40px;
}
button:hover { border-color: var(--cyan); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--cyan); color: #04202C; border-color: var(--cyan); font-weight: 600; }
button.danger { background: var(--sos); color: var(--sos-ink); border-color: var(--sos); font-weight: 700; }
button.ghost { background: transparent; }
input, select, textarea {
  background: #06222F; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%;
}
textarea { min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 8px 16px; background: #031520; border-bottom: 1px solid var(--line);
}
.topbar .logo { height: 22px; display: block; }
.topbar .console-name { font-weight: 600; letter-spacing: .02em; padding-left: 14px; border-left: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); background: var(--panel-2); }
.clock { font-family: var(--mono); font-size: 16px; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--grey); display: inline-block; }
.conn.ok { background: var(--green); }
.conn.bad { background: var(--red); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); font-size: 12px; white-space: nowrap; }
.chip b { font-size: 14px; }
.chip.sos { background: var(--sos); color: var(--sos-ink); }
.chip.amber { background: var(--amber); color: #2A1B00; }
.chip.red { background: var(--red); color: #2A0000; }

/* panels and tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel h2, .panel h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 12px 14px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
.table-wrap { overflow: auto; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.b-new { background: var(--sos); color: var(--sos-ink); }
.b-acked { background: var(--cyan); color: #04202C; }
.b-handed_off { background: #B39DDB; color: #1B0E33; }
.b-closed { background: var(--grey); color: #0A1620; }
.b-up { background: var(--green); color: #032012; }
.b-degraded { background: var(--amber); color: #2A1B00; }
.b-down { background: var(--red); color: #2A0000; }
.b-unknown { background: var(--grey); color: #0A1620; }
.b-test { background: var(--lime); color: #1E2600; }

.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { min-height: 34px; padding: 4px 12px; background: transparent; border-color: transparent; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--text); border-color: var(--line); }

.toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 2000;
  background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; max-width: 90vw;
}
.toast.err { border-color: var(--red); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: minmax(120px, auto) minmax(0, 1fr); gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
