/* Ups Remote Watch — dark NOC / control-room theme */
:root {
  --bg:        #0a0e14;
  --bg-grad:   radial-gradient(1200px 600px at 80% -10%, #12202b 0%, #0a0e14 55%);
  --panel:     #111823;
  --panel-2:   #161f2c;
  --border:    #22303f;
  --border-2:  #2c3d50;
  --text:      #e6edf3;
  --muted:     #8497aa;
  --faint:     #5a6b7d;

  --green:     #35d07f;
  --amber:     #f5b83d;
  --red:       #ff5d54;
  --offline:   #6b7d90;
  --accent:    #1fc6d8;   /* Ups-ish electric cyan */

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-grad), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Brand ─────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 18px; height: 18px; border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), #1479b8);
  box-shadow: 0 0 14px rgba(31,198,216,.55);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 4px 4px auto 4px; height: 3px;
  border-radius: 2px; background: rgba(255,255,255,.85);
}
.brand-name { font-size: 15px; letter-spacing: .3px; }
.brand-name b { color: var(--accent); font-weight: 700; }

/* ── Login ─────────────────────────────────────────────── */
.login-screen {
  min-height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 24px;
}
.login-card {
  width: 340px; max-width: 92vw; background: var(--panel);
  border: 1px solid var(--border); border-radius: 14px; padding: 28px 26px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
}
.brand--login { justify-content: center; margin-bottom: 2px; }
.login-sub { text-align: center; color: var(--muted); margin: -6px 0 8px; font-size: 12.5px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.login-card input {
  background: #0c121b; border: 1px solid var(--border-2); color: var(--text);
  border-radius: 9px; padding: 10px 12px; font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,198,216,.15); }
.btn-primary {
  margin-top: 4px; background: linear-gradient(135deg, var(--accent), #1479b8);
  color: #04121a; font-weight: 700; border: 0; border-radius: 9px; padding: 11px;
  font-size: 14px;
}
.btn-primary:hover { filter: brightness(1.08); }
.login-err { color: var(--red); font-size: 12.5px; min-height: 16px; text-align: center; }
.login-foot { color: var(--faint); font-size: 11.5px; }

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 12px 20px;
  background: rgba(12,18,26,.86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px;
  letter-spacing: 1.5px; color: var(--green); font-weight: 700; margin-left: 4px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px var(--green); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.25} }

.summary { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  font-size: 12px; color: var(--muted);
}
.chip b { color: var(--text); font-family: var(--mono); font-size: 13px; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.total b { color: var(--text); }
.dot.green{background:var(--green);box-shadow:0 0 7px var(--green)}
.dot.amber{background:var(--amber);box-shadow:0 0 7px var(--amber)}
.dot.red{background:var(--red);box-shadow:0 0 7px var(--red)}
.dot.offline{background:var(--offline)}

.topbar-right { display: flex; align-items: center; gap: 14px; }
.clock { font-family: var(--mono); color: var(--muted); font-size: 13px; }
.whoami { color: var(--muted); font-size: 12.5px; }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-2); }

/* ── Layout ────────────────────────────────────────────── */
main { padding: 18px 20px 40px; max-width: 1500px; margin: 0 auto; }
.fleet-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 1080px) { .fleet-layout { grid-template-columns: 1fr; } }

.section-title { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--faint); margin: 2px 0 12px; font-weight: 600; }

/* ── Fleet grid & cards ────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--border);
  border-radius: 13px; padding: 15px 16px 16px; cursor: pointer; overflow: hidden;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--border-2);
  box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--st); }
.card.st-offline { opacity: .82; }
.card.crit { animation: critglow 1.8s infinite; }
@keyframes critglow {
  0%,100% { box-shadow: 0 0 0 rgba(255,93,84,0); border-color: var(--border); }
  50% { box-shadow: 0 0 22px rgba(255,93,84,.32); border-color: var(--red); }
}

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-name { font-weight: 650; font-size: 14.5px; line-height: 1.2; }
.card-sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.card.real .card-name::after {
  content: "REALE"; font-family: var(--mono); font-size: 9px; letter-spacing: 1px;
  color: var(--accent); border: 1px solid rgba(31,198,216,.4); border-radius: 4px;
  padding: 1px 5px; margin-left: 8px; vertical-align: middle;
}

.pill { font-size: 10px; font-weight: 700; letter-spacing: .6px; padding: 4px 9px;
  border-radius: 20px; white-space: nowrap; text-transform: uppercase; }
.pill.online   { color: var(--green);   background: rgba(53,208,127,.12); border:1px solid rgba(53,208,127,.35); }
.pill.on_battery { color: var(--amber); background: rgba(245,184,61,.12); border:1px solid rgba(245,184,61,.35); }
.pill.low_battery{ color: var(--red);   background: rgba(255,93,84,.14);  border:1px solid rgba(255,93,84,.4); }
.pill.offline  { color: var(--offline); background: rgba(107,125,144,.12); border:1px solid rgba(107,125,144,.35); }
.pill.unknown  { color: var(--faint);   background: rgba(90,107,125,.1);  border:1px solid var(--border); }

.batt { margin: 14px 0 10px; }
.batt-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.batt-label { color: var(--muted); font-size: 11px; }
.batt-val { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.batt-bar { height: 8px; border-radius: 5px; background: #0b1119; overflow: hidden; border: 1px solid var(--border); }
.batt-fill { height: 100%; border-radius: 5px; transition: width .5s ease, background .3s; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.metric { background: var(--panel-2); border-radius: 8px; padding: 7px 8px; }
.metric .m-lab { color: var(--faint); font-size: 9.5px; letter-spacing: .4px; text-transform: uppercase; }
.metric .m-val { font-family: var(--mono); font-size: 13.5px; margin-top: 2px; }

/* ── Alerts / events side ──────────────────────────────── */
.aside { display: flex; flex-direction: column; gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 13px; padding: 14px; }
.alert-item {
  display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px;
  background: var(--panel-2); margin-bottom: 8px; border-left: 3px solid var(--st);
}
.alert-item:last-child { margin-bottom: 0; }
.alert-item .a-name { font-weight: 600; font-size: 13px; }
.alert-item .a-meta { color: var(--muted); font-size: 11px; margin-top: 1px; }
.alert-item .a-right { margin-left: auto; text-align: right; font-family: var(--mono); font-size: 12px; }
.empty { color: var(--faint); font-size: 12.5px; text-align: center; padding: 16px 4px; }

.evt { display: flex; gap: 9px; padding: 7px 2px; border-bottom: 1px solid var(--border); font-size: 12px; }
.evt:last-child { border-bottom: 0; }
.evt-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex: none; }
.evt-time { color: var(--faint); font-family: var(--mono); font-size: 10.5px; margin-top: 1px; }
.sev-info .evt-dot{background:var(--accent)} .sev-warning .evt-dot{background:var(--amber)} .sev-critical .evt-dot{background:var(--red)}

/* ── Detail view ───────────────────────────────────────── */
.back { color: var(--muted); font-size: 13px; display: inline-flex; gap: 6px; margin-bottom: 14px; }
.back:hover { color: var(--text); }
.detail-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.detail-head h1 { font-size: 22px; margin: 0; }
.detail-head .sub { color: var(--muted); font-size: 13px; }
.updated { color: var(--faint); font-size: 12px; font-family: var(--mono); margin-left: auto; }

.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 14px; margin-bottom: 18px; }
.gauge-card { background: var(--panel); border: 1px solid var(--border); border-radius: 13px;
  padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gauge {
  --val: 0; --col: var(--green);
  width: 116px; height: 116px; border-radius: 50%;
  background: conic-gradient(var(--col) calc(var(--val) * 1%), #0d141d 0);
  display: grid; place-items: center; position: relative;
  box-shadow: inset 0 0 0 1px var(--border);
}
.gauge::before { content: ""; position: absolute; inset: 12px; border-radius: 50%;
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--border); }
.gauge-inner { position: relative; text-align: center; }
.gauge-num { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.gauge-unit { color: var(--muted); font-size: 11px; }
.gauge-lab { color: var(--muted); font-size: 12px; letter-spacing: .3px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 11px; padding: 13px 15px; }
.tile .t-lab { color: var(--faint); font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase; }
.tile .t-val { font-family: var(--mono); font-size: 20px; margin-top: 4px; }
.tile .t-val small { font-size: 12px; color: var(--muted); }

.chart-card { background: var(--panel); border: 1px solid var(--border); border-radius: 13px; padding: 16px; margin-bottom: 18px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.chart-head h3 { margin: 0; font-size: 14px; }
.ranges { display: flex; gap: 6px; }
.range-btn { background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 7px; padding: 5px 11px; font-size: 12px; }
.range-btn.active { color: #04121a; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.chart-wrap { position: relative; height: 300px; }

.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 1080px) { .detail-grid { grid-template-columns: 1fr; } }
