:root {
  font-family: "Segoe UI", Arial, sans-serif;
  color: #17202a;
  background: #eef2f6;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button {
  border: 0;
  border-radius: 7px;
  background: #145ea8;
  color: white;
  padding: 10px 13px;
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: #0f4f8d; }
button:disabled { opacity: .55; cursor: wait; }
button.ghost { background: #e6ebf1; color: #203040; }
button.danger { background: #b42318; }
button.danger:hover { background: #912018; }
input {
  min-width: 0;
  border: 1px solid #c8d2dc;
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
}

.boot, .login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(440px, 100%);
  background: white;
  border: 1px solid #d8e0e8;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 20px 55px rgba(31, 48, 66, .12);
}
.brand {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #145ea8;
  color: #fff;
  font-weight: 800;
  letter-spacing: .5px;
}
.login-card h1, .nav h1, .topbar h2 { margin: 12px 0 6px; }
.login-card p, .nav p, .topbar p, .panel p { margin: 0; color: #687789; }
.login-card label { display: block; margin: 22px 0 8px; color: #44576a; }
.login-card input, .login-card button { width: 100%; }
.login-card button { margin-top: 14px; }
.error { color: #b42318 !important; margin-top: 12px !important; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.nav {
  background: #102a43;
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.nav p, .nav small { color: #bed0df; }
.device-list { display: grid; gap: 8px; }
.device-tab {
  width: 100%;
  background: rgba(255,255,255,.08);
  color: white;
  text-align: left;
  display: grid;
  gap: 4px;
}
.device-tab.active { background: #1d70b8; }
.device-tab small.ok { color: #95f0c8; }
.device-tab small.warn { color: #ffd099; }
.page-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,.14);
  border-bottom: 1px solid rgba(255,255,255,.14);
  padding: 14px 0;
}
.page-nav button.active {
  background: #1d70b8;
  color: #fff;
}
.nav-actions { margin-top: auto; display: grid; gap: 10px; }
.workspace { padding: 24px; overflow: auto; }
.topbar {
  background: #fff;
  border: 1px solid #d8e0e8;
  border-radius: 10px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.eyebrow {
  color: #145ea8 !important;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.status-pill {
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
}
.status-pill.online { background: #dff8ec; color: #057a55; }
.status-pill.stale { background: #fff0d9; color: #9a5b00; }
.notice {
  margin: 14px 0 0;
  background: #e8f3ff;
  border: 1px solid #bfdcff;
  border-radius: 8px;
  padding: 11px 13px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.metric, .panel {
  background: #fff;
  border: 1px solid #d8e0e8;
  border-radius: 10px;
}
.metric {
  min-height: 112px;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 7px;
}
.metric span { color: #65788b; font-size: 13px; }
.metric strong { font-size: 20px; line-height: 1.12; overflow-wrap: anywhere; }
.metric small { color: #697a8c; overflow-wrap: anywhere; }
.grid-two {
  display: grid;
  grid-template-columns: minmax(420px, 1.35fr) minmax(340px, .9fr);
  gap: 14px;
  margin-bottom: 14px;
}
.grid-two.lower { grid-template-columns: 1fr 1fr; }
.panel { padding: 16px; }
.panel h3 { margin: 0 0 8px; }
.filter-panel {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
  margin: 14px 0;
}
.filter-panel label {
  display: block;
  margin-bottom: 6px;
  color: #65788b;
  font-size: 13px;
  font-weight: 700;
}
.filter-panel input { width: 100%; }
.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 9px;
}
.ssid-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 9px;
  margin-top: 12px;
}
.signin-block {
  margin-top: 14px;
  border-top: 1px solid #e2e8ef;
  padding-top: 14px;
}
.signin-block h4 {
  margin: 0 0 10px;
  font-size: 15px;
}
.signin-block p {
  margin-top: 9px;
  font-size: 13px;
}
.signin-grid {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  gap: 9px;
}
.map-panel { margin-bottom: 14px; }
.map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 7px;
  padding: 8px 12px;
  background: #e6ebf1;
  color: #203040;
  text-decoration: none;
  font-weight: 800;
}
.map-frame {
  width: 100%;
  height: 360px;
  border: 0;
  border-radius: 8px;
  background: #dfe7ef;
}
.map-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #c8d2dc;
  border-radius: 8px;
  color: #65788b;
  background: #f8fafc;
}
.info-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 9px 12px;
  margin: 12px 0 0;
}
.info-list dt { color: #65788b; }
.info-list dd { margin: 0; overflow-wrap: anywhere; }
.sessions, .actions { display: grid; gap: 8px; margin-top: 12px; }
.session {
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid #e2e8ef;
  border-radius: 8px;
  padding: 10px;
}
.session strong { text-align: center; color: #145ea8; }
.action-row {
  display: grid;
  grid-template-columns: 170px 150px 100px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid #e2e8ef;
  border-radius: 8px;
  padding: 10px;
}
.badge {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  background: #edf2f7;
}
.badge.completed { background: #dff8ec; color: #057a55; }
.badge.failed { background: #fde3df; color: #b42318; }
.badge.queued { background: #fff0d9; color: #9a5b00; }
.muted { color: #75879a !important; }
.table-wrap { overflow: auto; max-height: 520px; border: 1px solid #e2e8ef; border-radius: 8px; }
.audit-table { max-height: 680px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px; border-bottom: 1px solid #e7edf3; text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #f6f8fb; color: #52677c; z-index: 1; }
td { overflow-wrap: anywhere; }

@media (max-width: 1200px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .grid-two, .grid-two.lower { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .nav { min-height: auto; }
  .metrics { grid-template-columns: 1fr; }
  .control-grid, .ssid-row, .signin-grid, .filter-panel, .session, .action-row { grid-template-columns: 1fr; }
  .topbar { align-items: start; flex-direction: column; }
}
