/* =====================================================================
 * Portal-specific overrides — layered on top of style.css.
 * Only client-facing /portal pages link this file.
 *
 * Sections
 *   1. Page backdrop (subtle gradient glow)
 *   2. Site cards grid
 *   3. Device monitoring table tweaks
 *   4. Controls bar (filter toggles)
 * ===================================================================== */

body.portal {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(90,162,255,.07), transparent 60%),
    var(--bg);
}

/* Portal logo sized to fit the 56px topbar with 8px gap top + bottom.
 * Customer brand is the prominent identity on this view (the operator
 * dashboard stays at the firmware default — see style.css .brand
 * .logo), so this override sits in the portal-only stylesheet. */
.brand .logo {
  width: 40px; height: 40px;
  object-fit: contain;
}

/* ── 2. Site cards (portal landing) ─────────────────────────────────── */
.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.site-card {
  display: block;
  padding: 18px;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.site-card:hover {
  transform: translateY(-2px);
  border-color: #33405a;
  text-decoration: none;
}
.site-card .name { font-size: 17px; font-weight: 700; }
.site-card .loc  { color: var(--mut); font-size: 12px; margin-top: 2px; }
.site-card .stat {
  display: flex; align-items: baseline; gap: 8px;
  margin: 16px 0 10px;
}
.site-card .stat .big { font-size: 30px; font-weight: 800; line-height: 1; }
.site-card .stat .of  { color: var(--mut); font-size: 14px; }

.progress {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress > i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--ok);
  transition: width .3s ease;
}
.progress.warn > i { background: var(--warn); }
.progress.bad  > i { background: var(--bad); }

/* ── 3. Device monitoring table ─────────────────────────────────────── */
.dev-table { width: 100%; border-collapse: collapse; }
.dev-table th {
  text-align: left; padding: 10px 12px;
  font-size: 11px; color: var(--mut);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  white-space: nowrap;
  position: sticky; top: 0;
}
.dev-table td {
  padding: 9px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.dev-table tr:last-child td { border-bottom: 0; }
.dev-table tr.off td { opacity: .55; }
.dev-table tbody tr:hover td { background: rgba(255,255,255,.025); }

.dev-table th.num, .dev-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dev-table th .u {
  color: var(--mut); font-weight: 500;
  font-size: 11px; text-transform: none; letter-spacing: 0;
}
.dev-table th.sortable { cursor: pointer; user-select: none; }
.dev-table th.sortable:hover { color: var(--fg); }
.dev-table th .arr { color: var(--acc); margin-left: 5px; font-size: 10px; }

/* ── 4. Controls bar (filter toggles above the table) ───────────────── */
.controls {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
}
.controls .liveness-help {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--mut);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: border-color .12s, color .12s;
}
.controls .liveness-help:hover {
  color: var(--fg);
  border-color: #33405a;
}
.controls .liveness-help-icon {
  font-size: 13px;
  color: var(--acc);
}

/* Liveness rule modal — 3-state table */
.liveness-rule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.liveness-rule-table th,
.liveness-rule-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.liveness-rule-table th {
  color: var(--mut);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.liveness-rule-table tr:last-child td { border-bottom: 0; }
.liveness-rule-table td:first-child { width: 110px; }
.liveness-rule-table td:nth-child(2) {
  width: 130px; color: var(--mut); font-variant-numeric: tabular-nums;
}
.controls .chk {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--mut); cursor: pointer;
}
.controls .chk input { cursor: pointer; }
.controls .muted { font-size: 12px; }
