/* ===========================================================================
   DataDiligence — Applied Digital theme
   A clean black-and-white corporate aesthetic: white canvas, near-black ink and
   accents, light-gray surfaces and hairline borders, no color — monochrome
   throughout (data visualizations use a grayscale ramp). Type stays Bricolage
   Grotesque (display) / IBM Plex Sans (body) / IBM Plex Mono (data).
   =========================================================================== */
:root {
  --bg: #ffffff;
  --bg-2: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --surface-3: #ededee;
  --border: #e6e6e8;
  --border-strong: #d4d4d6;

  --text: #0a0a0a;
  --text-2: #5a5a5e;
  --text-3: #9a9a9e;

  /* Applied Digital is monochrome: the accent is black, never neon. */
  --primary: #0a0a0a;
  --primary-hover: #2a2a2a;
  --primary-soft: rgba(10, 10, 10, .06);
  --primary-line: rgba(10, 10, 10, .16);
  --primary-ink: #ffffff;

  /* Status is conveyed by icon + label, not hue (kept monochrome). */
  --info: #404043;    --info-soft: rgba(10,10,10,.05);    --info-border: #e2e2e4;
  --success: #161616; --success-soft: rgba(10,10,10,.05); --success-border: #e2e2e4;
  --danger: #161616;  --danger-soft: rgba(10,10,10,.05);  --danger-border: #dadadc;
  --warning: #404043; --warning-soft: rgba(10,10,10,.05); --warning-border: #e2e2e4;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(10,10,10,.05);
  --shadow: 0 12px 32px rgba(10,10,10,.10);
  --glow: 0 4px 16px rgba(10,10,10,.14);

  --sidebar-w: 252px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
/* Atmosphere: a barely-there engineering grid in light gray, fading out. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(10,10,10,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10,10,10,.028) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(120% 120% at 50% 0%, #000 45%, transparent 100%);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; }
code {
  font-family: var(--mono); font-size: 0.86em; color: var(--primary);
  background: var(--primary-soft); padding: 1px 5px; border-radius: 5px;
}
.muted { color: var(--text-2); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------------------------------------------------------------- motion */
@keyframes reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.content > *, .auth-card { animation: reveal .55s cubic-bezier(.2,.7,.2,1) both; }
.content > *:nth-child(1){animation-delay:.03s}
.content > *:nth-child(2){animation-delay:.09s}
.content > *:nth-child(3){animation-delay:.15s}
.content > *:nth-child(4){animation-delay:.21s}
.content > *:nth-child(5){animation-delay:.27s}
.content > *:nth-child(6){animation-delay:.33s}
.content > *:nth-child(7){animation-delay:.39s}
.content > *:nth-child(n+8){animation-delay:.45s}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===================================================================== app shell */
body.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); position: fixed; top: 0; left: 0; z-index: 20;
  height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 20px 14px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px;
  font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
}
.sidebar .brand .logo {
  width: 30px; height: 30px; flex: none; color: var(--text);
  display: grid; place-items: center;
}
.sidebar .brand .logo svg { width: 100%; height: 100%; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav .navlink {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500;
  text-decoration: none; transition: background .14s, color .14s, transform .14s;
}
.nav .navlink svg { width: 18px; height: 18px; flex: none; }
.nav .navlink:hover { background: var(--surface-2); color: var(--text); text-decoration: none; transform: translateX(2px); }
.nav .navlink.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav .navlink.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.sidebar .spacer { flex: 1; }
.sidebar .account { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.sidebar .account .who { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; }
.sidebar .account .avatar {
  width: 30px; height: 30px; border-radius: 8px; flex: none; font-family: var(--mono);
  background: var(--surface-3); color: var(--primary); font-weight: 600;
  display: grid; place-items: center; font-size: 13px; text-transform: uppercase;
  border: 1px solid var(--border-strong);
}
.sidebar .account .email { font-family: var(--mono); font-size: 11.5px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px;
  border: none; background: none; color: var(--text-2); font: inherit; font-weight: 500;
  border-radius: var(--radius-sm); cursor: pointer; text-align: left; transition: background .14s, color .14s;
}
.logout-btn svg { width: 18px; height: 18px; }
.logout-btn:hover { background: var(--danger-soft); color: var(--danger); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column;
  margin-left: var(--sidebar-w); }
.topbar {
  height: 66px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 34px; background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.topbar .page-title { font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.topbar .topbar-actions { display: flex; gap: 10px; }
.content { padding: 30px 34px 72px; max-width: 1220px; width: 100%; }

/* ===================================================================== auth shell */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-wrap { width: 100%; max-width: 410px; }
.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-family: var(--display); font-size: 22px; font-weight: 700; margin-bottom: 24px; letter-spacing: -0.02em;
}
.auth-brand .logo {
  width: 34px; height: 34px; color: var(--text);
  display: grid; place-items: center;
}
.auth-brand .logo svg { width: 100%; height: 100%; }
.auth-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 30px 28px;
}
.auth-card h1 { font-size: 22px; margin-bottom: 5px; }
.auth-card .sub { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }
.auth-foot { text-align: center; color: var(--text-2); font-size: 13px; margin-top: 20px; }

/* ===================================================================== cards */
.card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px 24px; }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.card .card-sub { color: var(--text-2); font-size: 13px; margin-bottom: 18px; }
.section-title {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .14em; margin: 32px 0 14px;
  display: flex; align-items: center; gap: 9px;
}
.section-title::before { content: ""; width: 7px; height: 7px; border-radius: 2px;
  background: var(--primary); }

/* ===================================================================== stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 6px; }
.stat {
  position: relative; overflow: hidden; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 18px 20px; transition: border-color .16s, transform .16s;
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.stat .stat-head { display: flex; align-items: center; gap: 10px; color: var(--text-2);
  font-family: var(--mono); font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: 12px; }
.stat .stat-head .ic { width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
  border: 1px solid var(--primary-line); }
.stat .stat-head .ic svg { width: 16px; height: 16px; }
.stat .num { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.05;
  letter-spacing: -0.02em; }
.stat .sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat.green .ic { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.stat.amber .ic { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }

/* ===================================================================== buttons */
.btn, button.btn, a.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .1s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 0 0 1px var(--primary-line); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--glow); text-decoration: none; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn-danger-ghost { background: transparent; color: var(--danger); padding: 6px 0; font-weight: 600; }
.btn-danger-ghost:hover { text-decoration: underline; }
.btn-block { width: 100%; }
.btn-lg { padding: 11px 18px; font-size: 14px; }

/* ===================================================================== forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-family: var(--mono); font-weight: 500; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); margin-bottom: 7px; }
.field .hint { text-transform: none; letter-spacing: 0; color: var(--text-3); }
.input {
  width: 100%; padding: 10px 13px; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .14s, box-shadow .14s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type="file"].input { padding: 8px 12px; }
input[type="file"].input::file-selector-button {
  font: inherit; font-weight: 600; margin-right: 12px; padding: 5px 11px; cursor: pointer;
  color: var(--primary); background: var(--primary-soft); border: 1px solid var(--primary-line);
  border-radius: 6px; }

/* ===================================================================== tabs */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 22px; }
.tab { padding: 7px 16px; border: none; background: none; font-family: var(--mono); font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2);
  border-radius: var(--radius-sm); cursor: pointer; transition: color .14s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary-line); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: reveal .4s cubic-bezier(.2,.7,.2,1) both; }

/* ===================================================================== table */
.table-card { overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 12px 18px; font-size: 13px;
  border-bottom: 1px solid var(--border); }
table.data th { background: var(--bg-2); color: var(--text-2); font-family: var(--mono); font-weight: 500;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.actions a { margin-right: 14px; font-weight: 600; font-size: 12.5px; }
table.data td.actions .inline-act { display: inline; margin-right: 14px; }
.tbl-action { background: none; border: none; padding: 0; font: inherit; font-weight: 600;
  font-size: 12.5px; color: var(--primary); cursor: pointer; }
.tbl-action:hover { text-decoration: underline; }
.tbl-action.danger { color: var(--danger); }

/* ===================================================================== badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 10px; border-radius: 6px; border: 1px solid transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.done { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge.running { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.badge.error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge.iso { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }

/* ===================================================================== alerts */
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 12px 15px;
  border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px; font-size: 13.5px;
  background: var(--surface); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.alert.ok { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.alert.warn { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ===================================================================== empty state */
.empty { text-align: center; padding: 60px 24px; }
.empty .ic { width: 56px; height: 56px; border-radius: 15px; margin: 0 auto 18px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
  border: 1px solid var(--primary-line); }
.empty .ic svg { width: 27px; height: 27px; }
.empty h3 { font-size: 18px; margin-bottom: 7px; }
.empty p { color: var(--text-2); margin: 0 auto 18px; max-width: 380px; }

/* ===================================================================== progress */
.progress-card { max-width: 580px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--primary-soft);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite;
  display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar-track { height: 10px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 999px; overflow: hidden; margin: 20px 0 10px; }
.bar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--primary);
  transition: width .4s ease; }

/* ===================================================================== site detail */
.detail-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.detail-head h1 { font-size: 26px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 16px 0 28px;
  color: var(--text-2); font-size: 13px; }
.detail-meta b { color: var(--text); font-weight: 600; font-family: var(--mono); }
/* Attribute ledger: a clean label -> value row per attribute; provenance is
   always visible, and the plain-language "why it matters" tucks into an
   on-demand expander so the page reads as an orderly report, not a wall of
   prose. */
.attr-card { margin-bottom: 18px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 16px; }
.card-head .count { font-family: var(--mono); font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.attr { padding: 13px 0; border-top: 1px solid var(--border); }
.attr:first-child { border-top: none; }
.attr-line { display: flex; align-items: baseline; gap: 20px; }
.attr-name { color: var(--text); font-weight: 500; }
.attr-line .attr-value { margin-left: auto; font-family: var(--mono); font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text); text-align: right; white-space: nowrap; }
.attr-line .attr-value.empty { color: var(--text-3); font-weight: 400; }
.attr-missing .attr-name { color: var(--text-2); }
.attr-text { margin-top: 6px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  color: var(--text); word-break: break-word; }

.attr-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 13px; margin-top: 10px;
  font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.attr-src { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 8px; color: var(--text-2);
  text-decoration: none; white-space: nowrap;
  transition: border-color .14s, color .14s, background .14s; }
a.attr-src:hover { color: var(--primary); border-color: var(--border-strong);
  background: var(--surface-3); text-decoration: none; }
.attr-res { color: var(--text-3); }
.attr-note { font-family: var(--font); font-size: 12px; color: var(--text-2); }

/* Attribute search — sticky live filter over the report's attribute rows. */
.attr-search { position: sticky; top: 66px; z-index: 4;
  display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 9px 14px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: border-color .14s, box-shadow .14s; }
.attr-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.attr-search-ico { width: 17px; height: 17px; flex: none; color: var(--text-3); }
.attr-search-input { flex: 1; min-width: 0; border: 0; background: none; padding: 3px 0;
  font: inherit; font-size: 14px; color: var(--text); }
.attr-search-input::placeholder { color: var(--text-3); }
.attr-search-input:focus { outline: none; }
.attr-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.attr-search-count { flex: none; font-family: var(--mono); font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.attr-search-clear { flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: 11px; line-height: 1;
  transition: border-color .14s, color .14s; }
.attr-search-clear:hover { color: var(--text); border-color: var(--border-strong); }

.attr-card.is-hidden, .attr.is-hidden,
.attr-item.is-hidden, .attr-list.is-hidden, .section-title.is-hidden { display: none; }
.attr-name mark, .attr-label mark { background: var(--surface-3); color: var(--text); padding: 0 1px; border-radius: 2px; }

.attr-search-empty { margin: 0 0 18px; padding: 18px; text-align: center; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--primary);
  text-decoration: underline; cursor: pointer; }

.why { margin-left: auto; }
.why[open] { flex-basis: 100%; margin-left: 0; }
.why > summary { list-style: none; cursor: pointer; user-select: none; color: var(--text-2);
  font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.why > summary::-webkit-details-marker { display: none; }
.why > summary::before { content: ""; flex: none; width: 0; height: 0; border-left: 5px solid currentColor;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s ease; }
.why[open] > summary::before { transform: rotate(90deg); }
.why > summary:hover { color: var(--primary); }
.why p { margin: 9px 0 1px; font-family: var(--font); font-size: 12.5px; line-height: 1.6;
  color: #3f3f46; max-width: 80ch; }
.dictval { margin-top: 7px; display: grid; grid-template-columns: 1fr auto; gap: 3px 18px;
  font-family: var(--mono); padding-left: 2px; }
.dictval .dk { color: var(--text-2); }
.dictval .dv { text-align: right; color: var(--text); }

/* Stacked "fuel mix" / capacity-by-fuel bar + legend. */
.mixbar { display: flex; height: 18px; border-radius: 5px; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-2); margin: 9px 0; }
.mixbar span { height: 100%; transition: filter .14s; }
.mixbar span:hover { filter: brightness(1.18); }
.mixleg { display: flex; flex-wrap: wrap; gap: 5px 16px; font-family: var(--mono);
  font-size: 11px; color: var(--text-2); margin-bottom: 2px; }
.mixleg-item { display: inline-flex; align-items: center; gap: 6px; }
.mixleg .sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.mixleg b { color: var(--text); font-weight: 600; }

/* Project-stage breakdown that rides under an attribute (queue phase / planned
   development stage): a small heading + a reused mix bar/legend. */
.phasewrap { margin: 10px 0 2px; padding-top: 9px; border-top: 1px dashed var(--border); }
.phaselabel { font-size: 11.5px; color: var(--text-2); margin-bottom: 2px; }
.phaselabel b { color: var(--text); font-family: var(--mono); }
.phaselabel .phase-dl { color: var(--text); font-weight: 600; text-decoration: underline;
  text-underline-offset: 2px; }
.phaselabel .phase-dl:hover { color: var(--primary); }

/* Single-value reference bar (renewable share, rate/carbon/LMP cues). */
.scalebar { height: 7px; max-width: 340px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 999px; overflow: hidden; margin: 9px 0 5px; }
.scalebar .fill { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }
.scalecap { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); margin-bottom: 2px; }

/* Generation-sources map: click-to-reveal Leaflet map of nearby power plants. */
.genmap-block { margin: 10px 0 4px; }
.map-toggle { display: inline-flex; align-items: center; gap: 8px; font: inherit;
  font-size: 12.5px; font-weight: 500; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 13px; cursor: pointer; transition: border-color .14s, color .14s, background .14s; }
.map-toggle::before { content: ""; flex: none; width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--primary) 0 33%, transparent 38%);
  border: 1.5px dashed var(--primary-line); box-sizing: border-box; }
.map-toggle:hover { border-color: var(--primary-line); color: var(--primary); background: var(--primary-soft); }
.genmap { height: 340px; width: 100%; margin-top: 10px; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border); background: var(--bg-2); z-index: 0; }
.genmap-cap { font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  margin-top: 7px; line-height: 1.5; }
.genmap .leaflet-popup-content-wrapper, .genmap .leaflet-popup-tip {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.genmap .leaflet-popup-content { font-family: var(--font); font-size: 12px; }

/* Satellite infrastructure map + stats sidebar (substations / transmission /
   pipelines / plants / data centers within the radius). */
.infra-layout { display: flex; gap: 14px; align-items: stretch; margin-top: 10px; }
.infra-map { height: 520px; flex: 1 1 auto; min-width: 0; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border-strong); background: #0b0f17; z-index: 0; }
.infra-side { width: 306px; flex: none; height: 520px; overflow-y: auto;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.infra-status { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); padding: 12px; }
.infra-sec { border-bottom: 1px solid var(--border); }
.infra-sec:last-child { border-bottom: none; }
.infra-sec-head { display: flex; align-items: center; gap: 8px; padding: 9px 11px; cursor: pointer;
  user-select: none; position: sticky; top: 0; z-index: 1; background: var(--surface-2);
  border-bottom: 1px solid var(--border); }
.infra-sec-head input { accent-color: var(--primary); width: 13px; height: 13px; flex: none; cursor: pointer; }
.infra-sec-head .infra-sw { width: 11px; height: 11px; border-radius: 3px; flex: none;
  border: 1px solid rgba(10,10,10,.25); }
.infra-sec-head .infra-sw.line { height: 4px; border: none; }
.infra-sec-head .nm { font-weight: 600; font-size: 12.5px; color: var(--text); }
.infra-sec-head .ct { font-family: var(--mono); font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums; }
.infra-sec-head .sum { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-2);
  text-align: right; }
.infra-sec-head.empty { opacity: .5; cursor: default; }
.infra-sec-body { padding: 4px 5px 7px; }
.infra-item { display: flex; align-items: baseline; gap: 10px; padding: 4px 7px; border-radius: 5px; cursor: pointer; }
.infra-item:hover { background: var(--surface-2); }
.infra-item .ii-name { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; min-width: 0; }
.infra-item .ii-sub { font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.infra-item .ii-stat { margin-left: auto; flex: none; font-family: var(--mono); font-size: 11.5px;
  font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.infra-bd { display: flex; align-items: baseline; gap: 10px; padding: 3px 7px; font-family: var(--mono);
  font-size: 11.5px; color: var(--text-2); }
.infra-bd > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.infra-bd b { margin-left: auto; flex: none; color: var(--text); font-variant-numeric: tabular-nums; }
.infra-cap { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); margin-top: 8px;
  line-height: 1.55; max-width: 96ch; }
.infra-cap em { font-style: normal; color: var(--text-2); }
.infra-map .leaflet-popup-content-wrapper, .infra-map .leaflet-popup-tip {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.infra-map .leaflet-popup-content { font-family: var(--font); font-size: 12px; }
.infra-fs a { display: flex; align-items: center; justify-content: center; }
.infra-fs a svg { width: 16px; height: 16px; }
/* Full-screen mode: the layout fills the viewport, map + sidebar to full height. */
.infra-layout:fullscreen { height: 100%; background: var(--bg); padding: 10px; gap: 10px; }
.infra-layout:-webkit-full-screen { height: 100%; background: var(--bg); padding: 10px; gap: 10px; }
.infra-layout:fullscreen .infra-map, .infra-layout:fullscreen .infra-side { height: 100%; }
.infra-layout:-webkit-full-screen .infra-map, .infra-layout:-webkit-full-screen .infra-side { height: 100%; }
@media (max-width: 860px) {
  .infra-layout { flex-direction: column; }
  .infra-side { width: 100%; height: 260px; }
  .infra-map { height: 400px; }
}

/* ===================================================================== misc */
/* ===================================================================== attributes glossary */
.attr-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.attr-item { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; }
.attr-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.attr-head:hover { background: var(--surface-2); }
.attr-head .caret { flex: none; width: 0; height: 0; border-left: 6px solid var(--muted, var(--text-2));
  border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform .15s ease; }
.attr-item.open .attr-head .caret { transform: rotate(90deg); }
.attr-head .attr-label { font-weight: 600; }
.attr-head .attr-unit { margin-left: auto; flex: none; font-family: var(--mono); font-size: 11px;
  color: var(--primary); background: var(--primary-soft); border: 1px solid var(--primary-line);
  padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.attr-body { display: none; padding: 0 16px 16px 40px; }
.attr-item.open .attr-body { display: block; animation: reveal .3s cubic-bezier(.2,.7,.2,1) both; }
.attr-body p { margin: 4px 0 12px; color: #3f3f46; font-size: 13.5px; line-height: 1.6; max-width: 82ch; }
.attr-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.attr-tags .tag { font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 9px; }
.attr-tags a.tag-link { text-decoration: none; cursor: pointer; transition: color .14s, border-color .14s; }
.attr-tags a.tag-link:hover { color: var(--primary); border-color: var(--border-strong); }

/* ===================================================================== report frame */
.report-frame { width: 100%; height: calc(100vh - 188px); min-height: 540px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg); display: block; }

/* ===================================================================== directory */
#dc-map { height: 400px; border-radius: var(--radius-lg); border: 1px solid var(--border);
  margin-bottom: 16px; background: var(--bg-2); }
.leaflet-container { font-family: var(--font); background: var(--bg-2); }
.dc-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.dc-toolbar .input { flex: 1; min-width: 240px; }
.dc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dc-count { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-bottom: 12px; }
.dc-listwrap { padding: 6px; }
.dc-list { max-height: 460px; overflow-y: auto; }
.dc-row { display: flex; align-items: center; gap: 11px; padding: 8px 12px;
  border-radius: var(--radius-sm); cursor: pointer; }
.dc-row:hover { background: var(--surface-2); }
.dc-row input { accent-color: var(--primary); width: 15px; height: 15px; flex: none; cursor: pointer; }
.dc-row .dc-name { font-weight: 600; }
.dc-row .dc-sub { color: var(--text-2); font-size: 12px; font-family: var(--mono); margin-left: auto;
  text-align: right; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-2); }

@media (max-width: 880px) {
  :root { --sidebar-w: 66px; }
  .sidebar .brand span, .nav .navlink span, .sidebar .account .who .email,
  .logout-btn span { display: none; }
  .sidebar { padding: 18px 8px; }
  .nav .navlink, .logout-btn { justify-content: center; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
}
