/* Vickery SignCloud — brand: navy #0D1953, red #E80207 */
:root {
  --navy: #0D1953;
  --navy-2: #16246e;
  --navy-ink: #0a1440;
  --red: #E80207;
  --red-dark: #b80005;
  --amber: #f2a900;
  --green: #1f9d55;
  --bg: #eef0f5;
  --panel: #ffffff;
  --line: #d9dce6;
  --ink: #141a33;
  --muted: #5f6680;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.4 "Barlow", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- top bar */
.topbar {
  height: 58px; display: flex; align-items: center; gap: 24px; padding: 0 18px;
  background: var(--navy); color: #fff; position: relative;
}
.topbar::after { /* red swoosh rule, echoing the logo */
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px;
  background: linear-gradient(90deg, transparent 0, var(--red) 12%, var(--red) 100%);
  clip-path: polygon(0 100%, 12% 0, 100% 0, 99% 100%);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 26px; display: block; }
.product {
  font-family: var(--cond); font-weight: 700; font-style: italic; font-size: 22px; letter-spacing: .5px;
  padding-left: 12px; border-left: 2px solid rgba(255,255,255,.35); text-transform: uppercase;
}
.fleet-stats { display: flex; gap: 18px; margin-left: 12px; font-family: var(--cond); font-size: 16px; }
.fleet-stats b { font-size: 20px; margin-right: 4px; }
.fleet-stats .s-alarm b { color: #ff6b6e; }
.who { margin-left: auto; opacity: .85; }

/* ---------- layout */
.layout { display: grid; grid-template-columns: 290px 1fr 470px; height: calc(100% - 58px); padding-top: 4px; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sidebar-head { padding: 12px; border-bottom: 1px solid var(--line); }
.sidebar-head input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #f7f8fb; }
.filters { display: flex; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--muted); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.sign-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.sign-list li {
  padding: 10px 12px 10px 14px; border-bottom: 1px solid #eef0f5; cursor: pointer; display: grid;
  grid-template-columns: 12px 1fr auto; gap: 4px 10px; align-items: center; border-left: 4px solid transparent;
}
.sign-list li:hover { background: #f5f6fa; }
.sign-list li.sel { background: #eef1fb; border-left-color: var(--red); }
.sign-list .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sign-list .meta { grid-column: 2 / 4; color: var(--muted); font-size: 12px; display: flex; gap: 10px; }
.sign-list .lim {
  font-family: var(--cond); font-weight: 700; font-size: 15px; border: 2px solid var(--ink); border-radius: 4px;
  padding: 0 5px; line-height: 18px; background: #fff;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: #b5bacb; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(31,157,85,.18); }
.dot.alarm { background: var(--red); box-shadow: 0 0 0 3px rgba(232,2,7,.18); }
.unmatched { border-top: 1px solid var(--line); padding: 10px 12px; font-size: 12px; color: var(--muted); }
.unmatched:empty { display: none; }
.unmatched code { font-family: var(--mono); color: var(--ink); }

.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }
.pin {
  width: 34px; height: 34px; border-radius: 6px; background: #111; color: #ffd23f; border: 3px solid #fff;
  display: grid; place-items: center; font-family: var(--cond); font-weight: 700; font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.pin.off { color: #888; background: #444; }
.pin.alarm { border-color: var(--red); }
.pin.sel { outline: 3px solid var(--red); outline-offset: 2px; }

/* ---------- detail panel */
.detail { background: var(--panel); border-left: 1px solid var(--line); overflow: auto; min-height: 0; }
.empty { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-mark { width: 120px; height: 10px; margin: 0 auto 14px; background: var(--red); clip-path: polygon(0 100%, 18% 0, 100% 0, 92% 100%); }
.d-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.d-title { display: flex; align-items: center; gap: 10px; }
.d-title h2 { margin: 0; font-family: var(--cond); font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.d-sub { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; }
.badge.on { background: #e3f5ea; color: #13703b; }
.badge.off { background: #eceef3; color: var(--muted); }
.badge.busy { background: #fff3d6; color: #8a5a00; }
.alarm-bar { margin: 10px 0 0; padding: 8px 10px; background: #fde8e8; color: var(--red-dark); border-left: 4px solid var(--red); font-weight: 600; font-size: 13px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 10px; position: sticky; top: 0; background: #fff; z-index: 5; }
.tabs button { border: 0; background: none; padding: 11px 10px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; }
.tabs button.active { color: var(--navy); border-bottom-color: var(--red); }
.tab-body { padding: 16px 18px 30px; }

/* the sign face: mimic an LED radar sign */
.sign-face { display: flex; gap: 14px; align-items: stretch; margin-bottom: 16px; }
.mutcd {
  width: 108px; background: #fff; border: 3px solid #111; border-radius: 8px; text-align: center; padding: 6px 4px;
  font-family: var(--cond); font-weight: 700; line-height: 1; color: #111;
}
.mutcd .t { font-size: 15px; }
.mutcd .v { font-size: 46px; margin-top: 4px; }
.led {
  flex: 1; background: #0b0b0b; border-radius: 8px; display: grid; place-items: center; position: relative;
  border: 3px solid #222; min-height: 110px;
}
.led .digits { font-family: var(--cond); font-weight: 700; font-size: 64px; color: #ffb000; text-shadow: 0 0 14px rgba(255,176,0,.55); letter-spacing: 4px; }
.led .digits.red { color: #ff2a2a; text-shadow: 0 0 14px rgba(255,42,42,.55); }
.led .digits.dim { color: #333; text-shadow: none; }
.led .cap { position: absolute; bottom: 6px; left: 10px; font-size: 11px; color: #9a9a9a; text-transform: uppercase; letter-spacing: .6px; }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kv div { background: #f6f7fb; border-radius: 6px; padding: 8px 10px; }
.kv span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.kv b { font-size: 16px; font-weight: 600; }
.kv b.warn { color: var(--red); }

h3 { font-family: var(--cond); font-size: 17px; text-transform: uppercase; letter-spacing: .5px; color: var(--navy); margin: 20px 0 8px; }
h3:first-child { margin-top: 0; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 7px 12px; font-weight: 600; color: var(--ink); }
.btn:hover { border-color: var(--navy); }
a.btn { text-decoration: none; display: inline-block; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.modes .btn { padding: 9px 6px; font-size: 13px; }
.modes .btn.cur { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); color: var(--red-dark); }

.form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; align-items: end; }
.form label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; display: flex; flex-direction: column; gap: 3px; }
.form input, .form select, textarea, .console input {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; background: #fff; text-transform: none; letter-spacing: 0;
}
.form .wide { grid-column: span 3; }
.form .w2 { grid-column: span 2; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.hint code, code.cmd { font-family: var(--mono); font-size: 12px; background: #f1f2f7; padding: 1px 5px; border-radius: 4px; color: var(--navy); }

textarea { width: 100%; min-height: 120px; font-family: var(--mono); font-size: 12px; }
pre.out {
  background: #0d1124; color: #d8e0ff; font-family: var(--mono); font-size: 12px; padding: 10px 12px; border-radius: 6px;
  white-space: pre-wrap; max-height: 360px; overflow: auto; margin: 8px 0 0;
}
.console { display: flex; gap: 6px; }
.console .pfx { font-family: var(--mono); padding: 7px 0 0; color: var(--muted); }
.console input { flex: 1; font-family: var(--mono); }

.chart { width: 100%; height: 170px; display: block; }
.chart .bar { fill: var(--navy); }
.chart .bar.hi { fill: var(--red); }
.chart text { font-size: 10px; fill: var(--muted); font-family: "Barlow", sans-serif; }
.chart .ax { stroke: var(--line); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 5px 4px; }
table.tbl td { border-bottom: 1px solid #f0f1f5; padding: 5px 4px; vertical-align: top; }
table.tbl td.mono { font-family: var(--mono); font-size: 11px; }
.ok { color: var(--green); } .bad { color: var(--red); }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--navy); color: #fff;
  padding: 10px 16px; border-radius: 6px; border-left: 4px solid var(--red); transition: transform .25s; z-index: 1000; max-width: 70vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red-dark); border-left-color: #fff; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- login */
.login-body { display: grid; place-items: center; background: var(--navy); position: relative; overflow: hidden; }
.login-body::before { content: ""; position: absolute; left: -10%; right: -10%; top: 62%; height: 26px; background: var(--red); transform: skewY(-3deg); }
.login-card { position: relative; background: #fff; width: 340px; padding: 30px 28px; border-radius: 10px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.login-logo { width: 220px; align-self: center; }
.login-title { font-family: var(--cond); font-weight: 700; font-style: italic; text-transform: uppercase; font-size: 26px; text-align: center; color: var(--navy); margin-top: 4px; }
.login-sub { text-align: center; color: var(--muted); margin-top: -10px; margin-bottom: 6px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.login-card input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 15px; }
.login-card .btn { padding: 10px; margin-top: 6px; }
.err { color: var(--red); margin: 0; font-weight: 600; text-align: center; }

@media (max-width: 1200px) { .layout { grid-template-columns: 250px 1fr 420px; } }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 220px 300px auto; height: auto; }
  .sidebar { order: 2; } .mapwrap { order: 1; height: 300px; } .detail { order: 3; }
  .fleet-stats { display: none; }
}
