:root {
  --bg: #0e1016;
  --bg2: #16181f;
  --bg3: #1c1e26;
  --bg4: #262830;
  --bg-elevated: #1a1c24;
  --border: rgba(142, 213, 255, 0.08);
  --border-strong: rgba(142, 213, 255, 0.16);
  --text: #e8eaf2;
  --dim: #8f9aa8;
  --muted: #6b7582;
  --accent: #8ed5ff;
  --accent-2: #38bdf8;
  --accent-ink: #032433;
  --green: #4ae176;
  --green-dim: rgba(74, 225, 118, 0.12);
  --red: #ffb4ab;
  --red-dim: rgba(255, 180, 171, 0.12);
  --amber: #f5c542;
  --amber-dim: rgba(245, 197, 66, 0.12);
  --sidebar-w: 248px;
  --header-h: 64px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.55);
  --font-headline: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #b6e5ff; }

img { max-width: 100%; display: block; }

h1, h2, h3, .display {
  font-family: var(--font-headline);
  letter-spacing: -0.03em;
  font-weight: 600;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  vertical-align: middle;
  font-size: 18px;
}

/* ── Login ─────────────────────────────────────────────────────────── */

body.page-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(142, 213, 255, 0.12), transparent 55%),
    radial-gradient(700px 380px at 110% 110%, rgba(245, 197, 66, 0.08), transparent 50%),
    var(--bg);
}

.login-wrap {
  width: min(920px, 100%);
}

.login-brand {
  text-align: center;
  margin-bottom: 36px;
}

.login-brand img {
  height: 56px;
  width: auto;
  margin: 0 auto 18px;
  border-radius: 8px;
}

.login-brand h1 {
  font-size: 28px;
  color: var(--text);
  margin-bottom: 8px;
}

.login-brand p {
  color: var(--dim);
  font-size: 15px;
}

.login-portals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.portal-card {
  background: linear-gradient(180deg, rgba(142, 213, 255, 0.05), transparent 40%), var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 28px 26px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.portal-card .eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}

.portal-card.site .eyebrow { color: #9be7c4; }

.portal-card h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.portal-card p {
  color: var(--dim);
  font-size: 13.5px;
  margin-bottom: 20px;
  flex: 1;
}

.portal-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
}

.login-note {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.login-card {
  width: min(420px, 100%);
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(142, 213, 255, 0.05), transparent 40%), var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 28px 26px 24px;
  box-shadow: var(--shadow);
}

.login-card .fg { margin-bottom: 14px; }

.login-card .btn { width: 100%; padding: 11px 16px; margin-top: 4px; }

.login-error {
  margin-top: 12px;
  color: var(--red);
  font-size: 13px;
}

.preview-badge {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 80;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(245, 197, 66, 0.28);
  border-radius: 999px;
  padding: 5px 10px;
  pointer-events: none;
}

.view-as-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 32px;
  background: var(--amber-dim);
  border-bottom: 1px solid rgba(245, 197, 66, 0.28);
  color: var(--amber);
  font-size: 13px;
}

table.data .empty-cell {
  text-align: center;
  color: var(--dim);
  font-weight: 400;
  padding: 28px 16px;
}

/* ── Manager shell ─────────────────────────────────────────────────── */

body.shell-manager { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}

.sidebar-brand img {
  height: 36px;
  width: auto;
  border-radius: 6px;
}

.sidebar-brand-text { line-height: 1.2; }

.sidebar-brand-text strong {
  display: block;
  font-family: var(--font-headline);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.sidebar-brand-text span {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.nav-group {
  margin-bottom: 18px;
}

.nav-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--dim);
  font-size: 13.5px;
  font-weight: 500;
}

.nav-link:hover {
  background: var(--bg4);
  color: var(--text);
}

.nav-link.active {
  background: rgba(142, 213, 255, 0.1);
  color: var(--accent);
}

.nav-link .material-symbols-outlined { font-size: 18px; }

.sidebar-foot {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
}

.who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.who strong { font-size: 13px; }
.who span {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 16, 22, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  font-size: 18px;
  font-weight: 600;
}

.topbar .crumb {
  color: var(--dim);
  font-size: 12px;
}

.topbar-spacer { flex: 1; }

.page {
  padding: 28px;
  max-width: 1280px;
  width: 100%;
}

.page-lead {
  color: var(--dim);
  font-size: 14px;
  max-width: 62ch;
  margin: -8px 0 22px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-head h1 { font-size: 26px; }
.page-head p { color: var(--dim); margin-top: 6px; max-width: 56ch; }

/* ── Site shell ────────────────────────────────────────────────────── */

body.shell-site { min-height: 100vh; }

.site-header {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-header .brand img {
  height: 36px;
  border-radius: 6px;
}

.site-header .brand strong {
  font-family: var(--font-headline);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.site-nav a {
  color: var(--dim);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
}

.site-nav a:hover { color: var(--text); background: var(--bg4); }
.site-nav a.active { color: var(--accent); background: rgba(142, 213, 255, 0.1); }

.site-who {
  text-align: right;
  line-height: 1.25;
}

.site-who strong { display: block; font-size: 13px; }
.site-who span { font-size: 11px; color: var(--dim); }

body.shell-site .page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 32px 64px;
}

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
}

.btn-primary:hover { filter: brightness(1.06); color: var(--accent-ink); }

.btn-ghost {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover { background: #2e313a; color: var(--text); }

.btn-danger {
  background: #7f1d1d;
  color: #fff;
  border-color: #991b1b;
}

.btn-danger:hover { background: #991b1b; color: #fff; }

.btn-amber {
  background: var(--amber);
  color: #1a1400;
}

.btn-amber:hover { filter: brightness(1.05); color: #1a1400; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Cards / KPIs ──────────────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card, .card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.kpi-card .label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}

.kpi-card .value {
  font-family: var(--font-headline);
  font-size: 28px;
  margin: 8px 0 4px;
  letter-spacing: -0.04em;
}

.kpi-card .value span {
  font-size: 14px;
  color: var(--dim);
  font-weight: 500;
  margin-left: 4px;
}

.kpi-card .hint { font-size: 12px; color: var(--dim); }

.kpi-card[data-filter] {
  appearance: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card[data-filter]:hover {
  border-color: var(--border-strong);
}

.kpi-card[data-filter]:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(142, 213, 255, 0.12);
}

.kpi-card[data-filter].active {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.22);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg4);
  color: var(--dim);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
}

.filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.filter-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(142, 213, 255, 0.12);
  border-color: var(--accent);
}

.filter-chip.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.32);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.recent-item .name-cell { flex: 1; min-width: 0; }
.recent-item .btn-row { flex-shrink: 0; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.grid-2.equal { grid-template-columns: 1fr 1fr; }

.card h3 {
  font-size: 15px;
  margin-bottom: 14px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card-head h3 { margin: 0; }

.split { display: flex; flex-direction: column; gap: 14px; }

/* ── Tables ────────────────────────────────────────────────────────── */

.tbl-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  background: var(--bg2);
}

table.data {
  width: 100%;
  border-collapse: collapse;
}

table.data th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 12px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}

table.data td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: rgba(142, 213, 255, 0.03); }

.mono { font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
.name-cell { font-weight: 600; }
.sub { display: block; font-size: 12px; color: var(--dim); font-weight: 400; margin-top: 2px; }

/* ── Pills ─────────────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.pill-green { background: var(--green-dim); color: var(--green); border-color: rgba(74, 225, 118, 0.22); }
.pill-red { background: var(--red-dim); color: var(--red); border-color: rgba(255, 180, 171, 0.22); }
.pill-amber { background: var(--amber-dim); color: var(--amber); border-color: rgba(245, 197, 66, 0.28); }
.pill-blue { background: rgba(56, 189, 248, 0.12); color: var(--accent); border-color: rgba(56, 189, 248, 0.22); }
.pill-dim { background: var(--bg4); color: var(--dim); border-color: var(--border); }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.pill-green .dot { animation: pulse 2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── Forms ─────────────────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.fg { display: flex; flex-direction: column; gap: 6px; }
.fg.span-2 { grid-column: span 2; }
.fg.span-3 { grid-column: span 3; }
.fg[hidden] { display: none !important; }

.fg label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  outline: none;
  color-scheme: dark;
}

textarea { min-height: 84px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(142, 213, 255, 0.12);
}

.search {
  max-width: 360px;
  margin-bottom: 14px;
}

/* ── Picker ────────────────────────────────────────────────────────── */

.picker {
  position: relative;
  z-index: 1;
}

.picker:focus-within {
  z-index: 3;
}

/* Elevate whole field group while combobox is open (e.g. filter chips steal focus). */
.fg.picker-list-open {
  position: relative;
  z-index: 10;
}

.picker-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 464px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg2);
  box-shadow: var(--shadow);
}

.picker-results[hidden] { display: none !important; }

.picker-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--dim);
}

.picker-row {
  appearance: none;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name pills"
    "meta pills";
  gap: 2px 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.picker-row:last-child { border-bottom: none; }

.picker-row .name-cell { grid-area: name; }
.picker-row-pills {
  grid-area: pills;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-self: center;
}
.picker-row-meta {
  grid-area: meta;
  font-size: 12px;
  color: var(--dim);
}

.picker-row:hover,
.picker-row.active {
  background: rgba(142, 213, 255, 0.08);
}

.picker-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.picker-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.picker-card-head .name-cell {
  min-width: 0;
  word-break: break-all;
}

.picker-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--dim);
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.check-item input { width: auto; margin-top: 3px; }
.check-item strong { display: block; font-size: 13px; }
.check-item span { font-size: 12px; color: var(--dim); }

/* ── Lists / activity ──────────────────────────────────────────────── */

.feed { display: flex; flex-direction: column; gap: 0; }

.feed-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.feed-item:last-child { border-bottom: none; }

.feed-item .mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--accent);
}

.feed-item .mark.warn { background: var(--amber); }
.feed-item .mark.ok { background: var(--green); }
.feed-item .when { color: var(--muted); font-size: 11px; font-family: var(--font-mono); }

/* ── Sparks ────────────────────────────────────────────────────────── */

.spark {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 72px;
}

.spark i {
  display: block;
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent), rgba(56, 189, 248, 0.25));
  min-height: 6px;
}

.spark.export i {
  background: linear-gradient(180deg, #9be7c4, rgba(74, 225, 118, 0.2));
}

.meter-live {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.meter-live .empty { grid-column: 1 / -1; }

.meter-live:has(.live-card:only-of-type) {
  grid-template-columns: 1fr;
}

.live-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.live-card.offline {
  opacity: 0.72;
}

.live-card.exporting .kw { color: #9be7c4; }

.live-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.live-card-name {
  font-family: var(--font-headline);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.live-card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.live-phase-tag {
  font-size: 11px;
  color: var(--dim);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.live-card .kw {
  font-family: var(--font-headline);
  font-size: 36px;
  letter-spacing: -0.04em;
  margin: 8px 0 2px;
}

.live-card .kw span {
  font-size: 16px;
  color: var(--dim);
  font-weight: 500;
}

.live-trust {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}

.live-remark {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(245, 197, 66, 0.28);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.stat-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

.stat-row > div {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px;
}

.stat-row .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.stat-row .v { font-family: var(--font-mono); font-size: 13px; margin-top: 4px; }
.stat-row .v.warn { color: var(--amber); }

.live-phase {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 12px;
}

.live-phase th,
.live-phase td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.live-phase th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.live-phase td,
.live-phase tbody th {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 500;
}

.live-phase tbody th {
  color: var(--dim);
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}

.live-phase tr:last-child th,
.live-phase tr:last-child td { border-bottom: none; }

/* ── Wizard ────────────────────────────────────────────────────────── */

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.step {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--dim);
}

.step b {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.step.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(142, 213, 255, 0.08);
}

.step.done {
  border-color: rgba(74, 225, 118, 0.35);
  color: var(--green);
}

.step-panel { display: none; }
.step-panel.active { display: block; }

.verify-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.verify-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
}

.banner {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.banner-amber {
  background: var(--amber-dim);
  border-color: rgba(245, 197, 66, 0.28);
  color: #f3e2a6;
}

.banner-info {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.22);
  color: #c7e9ff;
}

.callout {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 16px;
  color: var(--dim);
  font-size: 13px;
  background: rgba(142, 213, 255, 0.03);
}

/* ── Drawer ────────────────────────────────────────────────────────── */

.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.72);
  z-index: 80;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.drawer-overlay.open { display: flex; }

.drawer {
  width: min(480px, 100%);
  background: var(--bg3);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.drawer h2 { font-size: 18px; margin-bottom: 8px; }
.drawer .drawer-body,
.drawer p { color: var(--dim); margin-bottom: 16px; font-size: 13.5px; line-height: 1.45; }
.drawer .drawer-body > p { margin: 0 0 12px; }

.baseline-anchor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.baseline-anchor-option {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  align-items: start;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
  text-transform: none;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.35;
}

.baseline-anchor-option input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--blue);
}

.baseline-anchor-option strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  text-transform: none;
  letter-spacing: normal;
}

.baseline-anchor-option .sub {
  margin-top: 3px;
  line-height: 1.4;
}

.baseline-anchor-option .baseline-date-wrap {
  margin-top: 10px;
}

.baseline-anchor-option .baseline-date-wrap[hidden] {
  display: none !important;
}
.drawer .phrase {
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 12px;
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 90;
  font-size: 13px;
}

.toast.show { display: block; }

/* ── Hardware detail ───────────────────────────────────────────────── */

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.meta-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.meta-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.meta-box .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.meta-box .v { margin-top: 4px; font-weight: 600; }

.danger-zone {
  margin-top: 24px;
  border: 1px solid rgba(255, 180, 171, 0.22);
  border-radius: 12px;
  padding: 16px;
  background: rgba(127, 29, 29, 0.12);
}

.danger-zone h3 { color: var(--red); font-size: 14px; margin-bottom: 6px; }
.danger-zone p { color: var(--dim); font-size: 13px; margin-bottom: 12px; }

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg4);
  font-size: 11px;
  margin: 2px 4px 2px 0;
}

/* ── Reports ───────────────────────────────────────────────────────── */

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.report-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.report-card h3 { font-size: 16px; margin-bottom: 4px; }
.report-card .period { color: var(--dim); font-size: 12px; margin-bottom: 16px; }

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--dim);
}

/* ── Live full-data modal (match dashboard) ─────────────────────────── */

.live-card-actions {
  margin-top: 14px;
}

.rec-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.rec-modal-overlay.open {
  display: flex;
}

.rec-modal {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(920px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5);
}

.rec-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.rec-modal-title {
  font-family: var(--font-headline);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.rec-modal-close {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
}

.rec-modal-close:hover {
  color: var(--text);
  background: var(--bg4);
}

.rec-modal-body {
  padding: 16px 20px 20px;
  overflow: auto;
}

.rec-detail-label {
  display: block;
  color: var(--dim);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.mc-hero {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.mc-hero-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin-bottom: 4px;
}

.mc-hero-val {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.mc-hero-val.warn {
  color: var(--amber);
}

.mc-hero-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--dim);
  margin-left: 6px;
}

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-online {
  background: rgba(74, 225, 118, 0.1);
  color: var(--green);
  border: 1px solid rgba(74, 225, 118, 0.2);
}

.status-offline {
  background: rgba(255, 180, 171, 0.1);
  color: var(--red);
  border: 1px solid rgba(255, 180, 171, 0.2);
}

.raw-json {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.45;
  overflow: auto;
  max-height: 240px;
  white-space: pre-wrap;
  word-break: break-word;
}

.live-detail-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.live-detail-head .live-head-status {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}

.md-section-title {
  font-family: var(--font-headline);
  font-size: 14px;
  font-weight: 600;
  margin: 20px 0 12px;
  color: var(--text);
}

.md-section-title:first-child {
  margin-top: 0;
}

.md-group {
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}

details.md-group {
  background: var(--bg4);
}

details.md-group summary {
  list-style: none;
  cursor: pointer;
}

details.md-group summary::-webkit-details-marker {
  display: none;
}

details.md-group summary .md-group-head {
  display: flex;
}

details.md-group summary .md-group-head::after {
  content: 'expand_more';
  font-family: 'Material Symbols Outlined';
  font-size: 20px;
  color: var(--dim);
  margin-left: auto;
  flex-shrink: 0;
}

details.md-group[open] summary .md-group-head::after {
  content: 'expand_less';
}

.md-group-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.md-group-head .material-symbols-outlined {
  font-size: 22px;
  color: var(--accent);
  margin-top: 2px;
}

.md-group-title {
  font-family: var(--font-headline);
  font-weight: 600;
  font-size: 14px;
}

.md-group-desc {
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
}

.md-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1px;
  background: var(--border);
}

.md-field {
  background: var(--bg3);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100%;
}

.md-field-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.md-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.md-field-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.md-field-value .md-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
  margin-left: 4px;
}

.md-field-value.warn {
  color: var(--amber);
}

.md-field-value.dim {
  color: var(--dim);
  font-weight: 500;
}

.md-field-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--dim);
}

.md-field-tech {
  font-size: 10px;
  color: var(--dim);
  opacity: 0.75;
}

details.md-tech-details {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg4);
}

details.md-tech-details summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  list-style: none;
}

details.md-tech-details summary::-webkit-details-marker {
  display: none;
}

details.md-tech-details[open] summary {
  border-bottom: 1px solid var(--border);
}

.md-tech-body {
  padding: 12px 14px 14px;
}

.md-tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.md-tech-table th,
.md-tech-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.md-tech-table th {
  color: var(--dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Site overview ─────────────────────────────────────────────────── */

body.shell-site.page-overview .page {
  max-width: 1200px;
}

body.page-overview {
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(142, 213, 255, 0.10), transparent 55%),
    radial-gradient(700px 380px at 110% 8%, rgba(74, 225, 118, 0.06), transparent 50%),
    var(--bg);
}

.ov-eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.ov-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.ov-hero {
  margin-bottom: 18px;
  background: linear-gradient(180deg, rgba(142, 213, 255, 0.06), transparent 42%), var(--bg2);
  border-color: var(--border-strong);
}

.ov-hero-body {
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) 1fr;
  gap: 20px;
  align-items: end;
}

.ov-hero-val {
  font-family: var(--font-headline);
  font-size: 48px;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 4px 0 8px;
  font-variant-numeric: tabular-nums;
}

.ov-hero-val span {
  font-size: 18px;
  color: var(--dim);
  font-weight: 500;
  margin-left: 6px;
}

.ov-hero.exporting .ov-hero-val { color: #9be7c4; }

.ov-hero .hint { font-size: 12px; color: var(--dim); }

.rt-chart-wrap.ov-spark-wrap { height: 96px; }

.ov-spark-empty {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.ov-spark-empty[hidden] { display: none; }

.rt-chart-wrap.ov-spark-wrap[hidden] { display: none; }

.ov-kpis .kpi-card {
  background: linear-gradient(180deg, rgba(142, 213, 255, 0.04), transparent 50%), var(--bg2);
  border-top: 2px solid var(--border-strong);
}

.ov-kpi-import { border-top-color: var(--accent-2); }
.ov-kpi-export { border-top-color: var(--green); }
.ov-kpi-net { border-top-color: var(--amber); }
.ov-kpi-peak { border-top-color: var(--accent); }

.ov-kpi-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ov-kpi-label .material-symbols-outlined {
  font-size: 18px;
  color: var(--dim);
}

.ov-kpi-import .ov-kpi-label .material-symbols-outlined { color: var(--accent); }
.ov-kpi-export .ov-kpi-label .material-symbols-outlined { color: var(--green); }
.ov-kpi-net .ov-kpi-label .material-symbols-outlined { color: var(--amber); }
.ov-kpi-peak .ov-kpi-label .material-symbols-outlined { color: var(--accent); }

.ov-mix {
  margin: -8px 0 22px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ov-mix[hidden] { display: none; }

.ov-mix-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 8px;
}

.ov-mix-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg4);
}

.ov-mix-imp {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.ov-mix-exp {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #9be7c4, var(--green));
}

.ov-chart-card .empty { padding: 36px 16px; }

.ov-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ov-links .btn { flex: 1; min-width: 120px; }

/* ── Site realtime ─────────────────────────────────────────────────── */

body.shell-site.page-realtime .page {
  max-width: 1200px;
}

body.page-realtime .kpi-grid {
  grid-template-columns: repeat(3, 1fr);
}

.rt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: -6px 0 18px;
}

.rt-toolbar .filter-row,
.rt-hero-card .filter-row { margin: 0; }

.rt-hero-card { margin-bottom: 14px; }

.rt-chart-wrap {
  position: relative;
  height: 220px;
}

.rt-chart-wrap.tall { height: 280px; }

.rt-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.rt-share {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rt-share-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rt-share-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rt-share-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.rt-share-kw {
  font-family: var(--font-mono);
  font-size: 13px;
  min-width: 7ch;
  text-align: right;
}

.rt-share-kw.export { color: #9be7c4; }

.rt-share-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg4);
  overflow: hidden;
}

.rt-share-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.rt-share-bar.export > span {
  background: linear-gradient(90deg, #9be7c4, var(--green));
}

/* ── Site history ──────────────────────────────────────────────────── */

body.shell-site.page-history .page {
  max-width: 1200px;
}

body.page-history .kpi-grid {
  grid-template-columns: repeat(5, 1fr);
}

.hist-toolbar-left {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.hist-meter {
  min-width: 220px;
}

.hist-custom {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin: -6px 0 18px;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.hist-custom[hidden] { display: none; }

.hist-custom-action { align-self: end; }

.hist-progress {
  margin: -4px 0 18px;
}

.hist-progress[hidden] { display: none; }

.hist-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--dim);
  font-family: var(--font-mono);
}

.hist-progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--bg4);
  overflow: hidden;
}

.hist-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

.hist-progress.indeterminate .hist-progress-fill {
  width: 36%;
  animation: hist-progress-slide 1.2s ease-in-out infinite;
}

@keyframes hist-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.hist-hero-head {
  align-items: flex-start;
  flex-wrap: wrap;
}

.hist-hero-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.hist-hint {
  font-size: 12px;
  color: var(--dim);
  margin-top: 10px;
}

.hist-averages {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.hist-averages summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  list-style: none;
}

.hist-averages summary::-webkit-details-marker { display: none; }

.hist-averages summary::after {
  content: "Show";
  margin-left: 8px;
  color: var(--accent);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.hist-averages[open] summary::after { content: "Hide"; }

.hist-avg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.hist-avg-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.hist-avg-card .label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}

.hist-avg-card .value {
  font-family: var(--font-mono);
  font-size: 14px;
  margin-top: 6px;
  color: var(--text);
}

.hist-secondary { margin: 14px 0; }

.hist-heatmap-card,
.hist-ledger-card { margin-top: 14px; }

.hist-chart-clickable { cursor: crosshair; }

.load-heatmap-wrap {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.load-heatmap-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  width: 40px;
  font-size: 10px;
  color: var(--dim);
  font-family: var(--font-mono);
  padding: 1px 0;
}

.load-heatmap-main {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.load-heatmap-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  min-height: 320px;
}

.load-heatmap-cell {
  appearance: none;
  border: none;
  padding: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 14px;
  min-height: 13px;
  cursor: pointer;
  background: rgba(38, 40, 48, 0.55);
}

.load-heatmap-cell:hover {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
  z-index: 1;
  position: relative;
}

.load-heatmap-x-axis {
  display: flex;
  margin-top: 6px;
  font-size: 10px;
  color: var(--dim);
  font-family: var(--font-mono);
}

.load-heatmap-x-tick {
  flex: 1;
  min-width: 14px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.load-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--dim);
  flex-wrap: wrap;
}

.load-heatmap-legend-bar {
  height: 10px;
  width: 160px;
  border-radius: 4px;
  background: linear-gradient(to right, #1c1e26 0%, #38bdf8 55%, #f5c542 100%);
  border: 1px solid var(--border);
}

.hist-ledger-head {
  align-items: flex-end;
}

.hist-ledger-search {
  min-width: 200px;
}

.hist-ledger-card .hist-hint { margin-top: 4px; }

.hist-export-modal {
  width: min(440px, 100%);
}

.hist-export-choice .btn { flex: 1; }

table.data tbody tr.hist-row {
  cursor: pointer;
}

/* ── Site monthly reports ──────────────────────────────────────────── */

body.shell-site.page-reports .page {
  max-width: 1200px;
}

body.page-reports .kpi-grid {
  grid-template-columns: repeat(5, 1fr);
}

.rpt-month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

#reports-months {
  margin: 0;
  max-width: min(760px, 100%);
}

.rpt-cal-card { margin-bottom: 14px; }

.rpt-cal-weekdays,
.rpt-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.rpt-cal-weekdays {
  margin-bottom: 8px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

.rpt-cal-pad {
  min-height: 72px;
}

.rpt-cal-cell {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 72px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg4);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.rpt-cal-cell:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.rpt-cal-cell:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(142, 213, 255, 0.12);
  border-color: var(--accent);
}

.rpt-cal-cell.today {
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.45);
}

.rpt-cal-cell.peak {
  border-color: rgba(245, 197, 66, 0.45);
}

.rpt-cal-cell.empty {
  opacity: 0.72;
}

.rpt-cal-cell.future {
  background: transparent;
  border-color: transparent;
  cursor: default;
  opacity: 0.4;
}

.rpt-cal-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
}

.rpt-cal-net {
  font-family: var(--font-headline);
  font-size: 16px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.rpt-cal-unit {
  font-size: 10px;
  color: var(--dim);
}

table.data tbody tr.rpt-row.future td,
table.data tbody tr.rpt-row.empty td {
  opacity: 0.65;
}

.rec-modal-back { margin-bottom: 12px; }

.rec-modal-hint {
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 10px;
}

.rec-detail-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

/* ── Mobile chrome (hidden on desktop) ─────────────────────────────── */

.nav-toggle,
.site-tabbar,
.site-more,
.nav-backdrop {
  display: none;
}

.nav-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg4);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
}

.nav-toggle .material-symbols-outlined { font-size: 22px; }

.nav-toggle:hover { color: var(--accent); border-color: var(--border-strong); }

.nav-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(142, 213, 255, 0.12);
  border-color: var(--accent);
}

.site-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  gap: 4px;
}

.site-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 4px;
  border-radius: 8px;
}

.site-tab .material-symbols-outlined { font-size: 22px; }

.site-tab:hover { color: var(--text); background: var(--bg4); }
.site-tab.active { color: var(--accent); background: rgba(142, 213, 255, 0.1); }

.site-more {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(4, 6, 10, 0.72);
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}

.site-more-sheet {
  width: min(480px, 100%);
  background: var(--bg3);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px 16px 16px;
}

.site-more-who {
  padding: 4px 10px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.site-more-who strong { display: block; font-size: 14px; }
.site-more-who span { font-size: 11px; color: var(--dim); }

.site-more-sheet a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  border-radius: 8px;
  color: var(--text);
  min-height: 44px;
  font-weight: 500;
}

.site-more-sheet a .material-symbols-outlined { font-size: 20px; color: var(--dim); }

.site-more-sheet a:hover { background: var(--bg4); color: var(--text); }
.site-more-sheet a.active { color: var(--accent); background: rgba(142, 213, 255, 0.1); }
.site-more-sheet a.active .material-symbols-outlined { color: var(--accent); }

.site-more-sheet a.btn {
  margin-top: 8px;
  justify-content: center;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(4, 6, 10, 0.72);
}

/* ── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .kpi-grid,
  body.page-realtime .kpi-grid,
  body.page-history .kpi-grid,
  body.page-reports .kpi-grid,
  body.page-overview .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .meter-live, .report-grid, .meta-grid, .meta-grid.cols-4, .rt-chart-grid { grid-template-columns: 1fr; }
  .ov-hero-body { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .hist-avg-grid { grid-template-columns: 1fr 1fr; }
  .hist-custom { grid-template-columns: 1fr 1fr; }
  .rec-detail-meta { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .login-portals { grid-template-columns: 1fr; }
  body.page-login { padding: 24px 16px; }

  .nav-toggle { display: inline-flex; }

  body.nav-open { overflow: hidden; }

  .preview-badge {
    top: 72px;
    right: 12px;
    bottom: auto;
  }

  .view-as-banner {
    padding: 10px 16px;
    flex-wrap: wrap;
  }

  body.shell-manager .workspace { min-width: 0; width: 100%; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-w), 86vw);
    height: 100%;
    max-height: 100dvh;
    overflow-y: auto;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    border-right: 1px solid var(--border);
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  body.nav-open .sidebar { transform: translateX(0); }
  body.shell-manager.nav-open .nav-backdrop { display: block; }

  .topbar {
    height: auto;
    min-height: var(--header-h);
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar > div { min-width: 0; }
  .topbar h1 { font-size: 16px; }

  .site-header {
    height: 56px;
    padding: 8px 16px;
    gap: 12px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
  }

  body.shell-site .site-nav,
  body.shell-site .site-who,
  body.shell-site .site-header > a.btn { display: none; }

  .site-header .brand { flex: 1; min-width: 0; }
  .site-header .brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .site-header .nav-toggle { margin-left: auto; }

  body.shell-site .site-tabbar { display: flex; }
  body.shell-site .site-more.open { display: flex; }

  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .fg.span-2, .fg.span-3 { grid-column: span 1; }
  .page, body.shell-site .page { padding: 20px 16px; }
  body.shell-site .page {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
  .stat-row.cols-4 { grid-template-columns: 1fr 1fr; }
  .rt-share-meta { flex-wrap: wrap; }
  .rt-chart-wrap.tall { height: 220px; }
  .rt-toolbar { align-items: stretch; }
  .hist-toolbar-left,
  .hist-meter { min-width: 0; width: 100%; }
  .hist-custom { grid-template-columns: 1fr; }
  .hist-avg-grid, .rec-detail-meta { grid-template-columns: 1fr; }
  .hist-ledger-head { align-items: stretch; }
  .hist-ledger-search { min-width: 0; }
  .hist-hero-controls { justify-content: flex-start; }
  .ov-status { align-items: flex-start; }
  .ov-hero-val { font-size: 36px; }
  .rpt-cal-pad,
  .rpt-cal-cell { min-height: 58px; }
  .rpt-cal-net { font-size: 13px; }
  .rpt-cal-unit { display: none; }

  input, select, textarea { font-size: 16px; }
}

@media (max-width: 640px) {
  .page-head h1 { font-size: 22px; }
  .kpi-card { padding: 14px; }
  .kpi-card .value { font-size: 24px; }
  .ov-hero-val { font-size: 32px; }
  .live-card .kw { font-size: 28px; }
  .rt-chart-wrap { height: 180px; }
  .rt-chart-wrap.tall { height: 200px; }
  .card-head { align-items: flex-start; flex-wrap: wrap; }
  .rec-modal-overlay { padding: 8px; align-items: stretch; }
  .rec-modal {
    width: 100%;
    max-height: none;
    border-radius: 12px;
  }
  .steps { gap: 6px; }
  .step { padding: 10px 12px; }
}
