/* ============================================================
   VacPulse Cloud - "Clean Sky" theme
   Palette sampled from the VacPulse logo:
     pulse blue #0f6fd0 · deep navy #0d2242 · sky #0090d8
   Light UI: ice background, white cards, navy sidebar.
   ============================================================ */

:root {
  --bg: #eef4fb;
  --panel: #ffffff;
  --line: #d9e5f2;
  --ink: #132a4a;
  --muted: #5b7392;
  --navy: #0d2242;
  --navy-2: #13315e;
  --blue: #0f6fd0;
  --blue-soft: #e3effc;
  --sky: #0090d8;
  --ok: #189a62;
  --ok-soft: #e2f5ea;
  --bad: #d84a38;
  --bad-soft: #fde8e4;
  --warn: #b57b12;
  --warn-soft: #fdf2da;
  --shadow: 0 2px 10px rgba(15, 60, 120, .09);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.5 'Segoe UI', system-ui, Arial, sans-serif;
}
a { color: var(--blue); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 205px; flex: 0 0 205px;
  background: var(--navy); color: #dbe7f5;
  padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
}
.side a { color: #c3d5ec; display: block; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.side a:hover { background: var(--navy-2); text-decoration: none; }
.side a.on { background: var(--blue); color: #fff; font-weight: 600; }
.brand { font-weight: 800; font-size: 16.5px; color: var(--navy); padding: 2px 6px 12px; letter-spacing: .2px; }
.side .brand { color: #fff; }
.brand .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--sky); margin-inline-end: 7px; }
.spacer { flex: 1; }
.who { border-top: 1px solid rgba(255,255,255,.14); padding: 12px 8px 0; font-size: 13.5px; color: #dbe7f5; }
.who .role { display: block; color: #8fa9cc; font-size: 12px; margin-top: 2px; }
.who a { padding: 6px 0 0; }
.main { flex: 1; padding: 24px 28px; min-width: 0; }

/* ---------- headings ---------- */
h1 { font-size: 22px; margin: 0; font-weight: 800; }
h2 { font-size: 16.5px; margin: 0 0 10px; font-weight: 700; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: 'Consolas', 'Menlo', monospace; font-size: .95em; }
.right { text-align: end; }
.click, .rowlink { cursor: pointer; }
.rowlink:hover td { background: var(--blue-soft); }
.linkish { color: var(--blue); cursor: pointer; }
.backlink, .back { color: var(--muted); font-size: 13.5px; display: inline-block; margin-bottom: 10px; }

/* ---------- cards & panels ---------- */
.card { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); }
.panel { padding: 16px 18px; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats .card { padding: 14px 16px; }
.stats .k { color: var(--muted); font-size: 12.5px; }
.stats .n { font-size: 24px; font-weight: 800; color: var(--blue); margin-top: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; font-size: 14px; }
.kv .k { color: var(--muted); }
.empty { color: var(--muted); padding: 18px; text-align: center; font-size: 14px; }

/* ---------- tables ---------- */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: start; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 8px 10px; border-bottom: 2px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* ---------- buttons ---------- */
.btn {
  background: var(--blue); color: #fff; border: none; border-radius: 9px;
  padding: 9px 18px; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: filter .12s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.small, .btn.sm { padding: 6px 13px; font-size: 13px; border-radius: 8px; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--blue); border: 1px solid #b9cde6; }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.danger { background: var(--bad); }
.btn.block { display: block; width: 100%; margin-top: 16px; }

input, select, textarea {
  background: #fff; border: 1px solid #c3d3e6; border-radius: 8px;
  padding: 8px 11px; font: inherit; color: var(--ink); outline: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15,111,208,.14); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.claim-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fld { display: block; margin-bottom: 12px; font-size: 13.5px; color: var(--muted); }
.fld input { display: block; width: 100%; margin-top: 5px; }

/* ---------- pills & badges ---------- */
.pill {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  padding: 2.5px 10px; border-radius: 20px; white-space: nowrap;
}
.pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--blue-soft); color: var(--blue); }
.pill.idle { background: #eaf0f7; color: var(--muted); }
.dot-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-inline-end: 5px; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- gauges & charts ---------- */
.gauges { display: flex; gap: 12px; flex-wrap: wrap; }
.gauge { background: var(--blue-soft); border-radius: 11px; padding: 12px 16px; min-width: 118px; }
.g-l { color: var(--muted); font-size: 12px; }
.g-v { font-size: 22px; font-weight: 800; color: var(--blue); }
.g-u { font-size: 12px; color: var(--muted); margin-inline-start: 3px; }
.spark { background: #fff; border-radius: 8px; }
.bar { background: #e2ebf5; border-radius: 20px; height: 10px; overflow: hidden; }
.bar > div { background: linear-gradient(90deg, var(--sky), var(--blue)); height: 100%; border-radius: 20px; }

/* ---------- alerts / events ---------- */
.ev-list { display: flex; flex-direction: column; gap: 6px; }
.ev-row { display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; border-radius: 8px; background: #f6f9fd; font-size: 13.5px; }
.err { color: var(--bad); font-size: 13px; margin-top: 6px; }
.danger-zone { border: 1px solid #f3c1b8; background: #fff7f5; border-radius: 12px; padding: 14px 16px; }
.danger-zone h2 { color: var(--bad); }

/* ---------- global search ---------- */
.gsearch { position: relative; width: 100%; margin: 4px 0 10px; }
.gsearch input { width: 100%; background: #13315e; border-color: #24457e; color: #e7eef9; }
.gsearch input::placeholder { color: #8fa9cc; }
.gsearch input:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(0,144,216,.22); }
.gs-drop {
  position: absolute; top: 44px; inset-inline-start: 0; z-index: 30; width: 300px; max-width: 82vw;
  background: #fff; border: 1px solid var(--line); border-radius: 11px; color: var(--ink);
  box-shadow: 0 10px 30px rgba(13,34,66,.3); padding: 6px; max-height: 380px; overflow: auto;
}
.gs-drop .rowlink { padding: 8px 10px; border-radius: 8px; display: block; }
.gs-drop .rowlink:hover { background: var(--blue-soft); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eaf3fc 0%, #dcebfa 55%, #cfe3f7 100%);
  padding: 20px;
}
.login, .login-card {
  width: 100%; max-width: 400px; padding: 30px 30px 26px;
  background: #fff; border-radius: 18px; box-shadow: 0 14px 44px rgba(13,34,66,.16);
}
.login h1, .login-card h1 { font-size: 20px; margin: 6px 0 4px; }
.login-card .sub { margin: 0 0 16px; }
.login-card label { display: block; margin: 12px 0 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-card input { width: 100%; }

/* ---------- misc ---------- */
.toast {
  position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; border-radius: 10px; padding: 11px 20px;
  font-size: 14px; box-shadow: 0 8px 26px rgba(13,34,66,.35); z-index: 60; max-width: 90vw;
}
.creds { background: var(--ok-soft); border: 1px solid #9adbb8; border-radius: 11px; padding: 12px 16px; margin-bottom: 14px; }
.cred-row { font-size: 14.5px; margin-bottom: 4px; }
.seg { display: inline-flex; background: #e2ebf5; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: transparent; padding: 6px 13px; border-radius: 8px; font: 600 13px 'Segoe UI', sans-serif; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--blue); box-shadow: 0 1px 4px rgba(13,34,66,.14); }
.new-devices { border: 1px dashed #a9c6e8; background: #f2f8ff; }
.role { color: var(--muted); }

/* ---------- mobile ---------- */
.hamb { display: none; }
.panel { overflow-x: auto; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side {
    width: 100%; flex: none; position: sticky; top: 0; z-index: 40;
    padding: 10px 14px; box-shadow: 0 3px 12px rgba(13,34,66,.25);
  }
  .side-logo { max-width: 120px !important; width: auto !important; margin: 0 !important; border-radius: 9px !important; }
  .hamb {
    display: flex; position: absolute; top: 12px; inset-inline-end: 12px;
    background: var(--navy-2); color: #fff; border: 1px solid #24457e; border-radius: 9px;
    font-size: 20px; padding: 5px 13px; cursor: pointer;
  }
  /* collapsed: only the logo bar; open: full menu slides in */
  .side .gsearch, .side nav, .side .spacer, .side .who, .side .va-box { display: none; }
  .side.open .gsearch { display: block; margin-top: 12px; }
  .side.open nav, .side.open .who, .side.open .va-box { display: block; }
  .side.open { max-height: 92vh; overflow-y: auto; }
  .main { padding: 14px; }
  h1 { font-size: 19px; }
  .head { gap: 10px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 9px; }
  .kv { grid-template-columns: 100px 1fr; }
  .grid { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }   /* stops iOS auto-zoom on focus */
  .btn { padding: 9px 14px; }
  .gs-drop { position: fixed; top: auto; inset-inline: 10px; width: auto; max-width: none; }
  .toast { width: calc(100vw - 30px); text-align: center; }
  .login, .login-card { padding: 22px 18px; }

  /* ---- no ugly wrapping: a row stays a row, swipe sideways when it's wider ---- */
  table th, table td { white-space: nowrap; }
  .pill { white-space: nowrap; }
  .btn { white-space: nowrap; }
  .card.panel { padding: 12px 12px; }
  h2 { font-size: 15.5px; }
  .ev-row { flex-wrap: nowrap; overflow: hidden; }
  .ev-row > span { white-space: nowrap; }
  .ev-row span[title] { max-width: 34vw !important; }     /* detail text: ellipsis, tap-and-hold to read */
  .kv { grid-template-columns: 96px minmax(0, 1fr); }
  .kv > div { min-width: 0; overflow-wrap: anywhere; }
  .head { row-gap: 6px; }
  .head h1 { white-space: nowrap; }
  .sub { font-size: 12.5px; }
  .who { font-size: 12.5px; }
}
