/* ══════════════════════════════════════════════════════════════════
   SunTrack — Industrial Solar Monitoring
   Hand-authored CSS. No build step: this file ships as-is.
   ══════════════════════════════════════════════════════════════════ */

/* ── Design tokens ────────────────────────────────────────────────
   Light is the default; dark overrides only the colour tokens so no
   component ever needs a theme-specific rule of its own.            */
:root {
  /* Surfaces - white cards on a soft grey ground, as in the reference. */
  --bg-body:        #f5f6f8;
  --bg-header:      #ffffff;
  --bg-card:        #ffffff;
  --bg-card-2:      #f8fafc;
  --bg-input:       #ffffff;
  --bg-thead:       #f8fafc;
  --bg-row:         #ffffff;
  --bg-row-alt:     #fbfcfd;
  --bg-hover:       #f1f5f9;
  --border:         #e5e7eb;
  --border-2:       #d1d5db;
  --text:           #111827;
  --text-2:         #374151;
  --text-muted:     #6b7280;
  --text-faint:     #9ca3af;
  --shadow:         0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-md:      0 4px 8px -2px rgba(16,24,40,.08), 0 2px 4px -2px rgba(16,24,40,.05);
  --shadow-lg:      0 12px 20px -6px rgba(16,24,40,.1), 0 4px 8px -4px rgba(16,24,40,.06);

  /* Status palette - saturated enough to read on white. */
  --ok:      #16a34a;
  --ok-bg:   #ecfdf5;
  --warn:    #d97706;
  --warn-bg: #fffbeb;
  --major:   #ea580c;
  --major-bg:#fff7ed;
  --crit:    #dc2626;
  --crit-bg: #fef2f2;
  --info:    #0284c7;
  --info-bg: #f0f9ff;
  --idle:    #64748b;
  --idle-bg: #f1f5f9;

  /* Solar Energy palette. On a light ground the yellow needs a darker
     partner for text and strokes - raw #ffe205 on white is unreadable. */
  --solar:    #f0b429;   /* legible amber for text/borders on white */
  --solar-2:  #ffe205;   /* the brand yellow, for fills and bars    */
  --solar-3:  #fffe33;
  --solar-dim:#fef9e7;
  --grid:     #1092cf;
  --grid-dim: #eff8fd;
  --deep:     #045097;
  --accent:   #1092cf;
  --accent-2: #045097;
  --battery:  #7c3aed;
  --load:     #ea580c;

  --sidebar-w: 232px;
  --rail-w:    64px;
  --header-h:  58px;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  background: var(--bg-body);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background .15s, color .15s;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; }
[x-cloak] { display: none !important; }

/* Tabular numerals everywhere a value can change — stops KPI digits
   from jittering horizontally as they tick. */
.num, .kpi-value, td.num, .metric-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

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

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR
   Design intent: navigation is chrome, not content. It should recede
   until needed, then answer "where am I?" instantly. That means one
   accent colour (never a rainbow of per-item colours), a strong
   unambiguous active state, and generous grouping whitespace.
   ══════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #0d1726;
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: width .18s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--rail-w); }

/* ── Brand ────────────────────────────────────────────────────────
   Shares the header's exact height so the two rules line up across
   the fold. A misaligned seam here is the first thing a designer
   notices and the hardest to unsee.                                */
.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(140deg, #ffe863, #f0b429);
  display: grid; place-items: center;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.brand-text { color: #f1f5f9; font-weight: 640; font-size: 14.5px; letter-spacing: -.015em; white-space: nowrap; line-height: 1.15; }
.brand-sub  { color: #64748b; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; margin-top: 1px; }
.sidebar.collapsed .sidebar-brand { padding: 0; justify-content: center; }
.sidebar.collapsed .brand-text, .sidebar.collapsed .brand-sub { display: none; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0 20px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(148,163,184,.18); border-radius: 2px; }
.sidebar-nav:hover::-webkit-scrollbar-thumb { background: rgba(148,163,184,.3); }

/* ── Section label ────────────────────────────────────────────────
   Deliberately dim and small. Its job is to group, not to compete
   with the items underneath it.                                    */
.nav-section {
  padding: 18px 18px 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #7c8ba3;          /* 5.21:1 on #0d1726 - passes WCAG AA */
  white-space: nowrap;
}
.nav-section:first-child { padding-top: 12px; }

.sidebar.collapsed .nav-section {
  padding: 14px 0 6px;
  font-size: 0;
}
/* A hairline stands in for the label when collapsed, so grouping
   survives without text. */
.sidebar.collapsed .nav-section::after {
  content: '';
  display: block;
  width: 20px; height: 1px;
  margin: 0 auto;
  background: rgba(148,163,184,.16);
}

/* ── Item ─────────────────────────────────────────────────────────
   Inset pill rather than a full-bleed row: it reads as a discrete
   control and keeps a consistent left margin down the whole list.  */
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 1px 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 450;
  white-space: nowrap;
  position: relative;
  transition: background .13s ease, color .13s ease;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }

/* Active: filled, high-contrast, with a marker at the rail edge.
   Two redundant signals (fill + marker) mean the state survives on a
   poor monitor or for a colour-blind operator. */
.nav-item.active {
  background: rgba(16,146,207,.16);
  color: #ffffff;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--solar-2);
}

/* ── Icons ────────────────────────────────────────────────────────
   ONE accent, not one colour per item. A rainbow sidebar makes every
   item shout equally, which is the same as none of them standing
   out - and it fights the data colours in the content area, where
   colour actually carries meaning.                                 */
.nav-item svg {
  width: 17px; height: 17px;
  flex-shrink: 0;
  stroke-width: 1.7;
  color: #75849a;          /* 4.73:1 - passes WCAG AA */
  transition: color .13s ease;
}
.nav-item:hover svg  { color: #cbd5e1; }
.nav-item.active svg { color: var(--solar-2); }

.sidebar.collapsed .nav-item { justify-content: center; margin: 1px 8px; padding: 9px 0; }
.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .nav-item.active::before { left: -8px; }

/* Alarm count. Red is reserved for genuine alerts - it is the only
   place in this sidebar where a second colour is justified. */
.nav-badge {
  margin-left: auto;
  min-width: 19px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--crit);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
}
.sidebar.collapsed .nav-badge { display: none; }

/* ── Main column ──────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left .18s ease;
}
.main.expanded { margin-left: var(--rail-w); }

.header {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.header-title { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.header-sub   { font-size: 12px; color: var(--text-muted); }

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--text-muted);
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; stroke-width: 1.8; }

/* Seven-segment clock — reads as instrumentation, not decoration. */
.clock {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
}
.clock-date { font-size: 10px; color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 550;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-ok    { background: var(--ok-bg);   color: var(--ok);   border-color: rgba(16,185,129,.25); }
.pill-warn  { background: var(--warn-bg); color: var(--warn); border-color: rgba(245,158,11,.25); }
.pill-crit  { background: var(--crit-bg); color: var(--crit); border-color: rgba(239,68,68,.25); }
.pill-info  { background: var(--info-bg); color: var(--info); border-color: rgba(14,165,233,.25); }
.pill-idle  { background: var(--idle-bg); color: var(--idle); border-color: rgba(100,116,139,.25); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.dot-pulse { animation: pulse 2s cubic-bezier(.4,0,.6,1) infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* Respect users who have asked the OS for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .dot-pulse { animation: none; }
  * { transition-duration: .01ms !important; }
}

.content { flex: 1; padding: 16px; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 12.5px; font-weight: 600; letter-spacing: -.005em; }
.card-body { padding: 14px; }

/* ── KPI tiles ────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
/* A thin accent rail carries the tile's status without spending a
   whole colour field on it. */
.kpi::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: .85;
}
.kpi.solar::before { background: var(--solar); }
.kpi.ok::before    { background: var(--ok); }
.kpi.warn::before  { background: var(--warn); }
.kpi.crit::before  { background: var(--crit); }

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.kpi-value {
  font-size: 21px;
  font-weight: 640;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--text);
}
.kpi-unit { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-left: 3px; }
.kpi-meta { margin-top: 4px; font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }

.trend-up   { color: var(--ok); }
.trend-down { color: var(--crit); }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data thead th {
  background: var(--bg-thead);
  padding: 8px 11px;
  text-align: left;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data tbody td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
}
table.data tbody tr:hover { background: var(--bg-hover); }
table.data tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.cell-strong { color: var(--text); font-weight: 600; }

/* Sortable headers */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable::after { content: '⇅'; opacity: .3; margin-left: 5px; font-size: 9px; }
th.sortable.asc::after  { content: '↑'; opacity: .9; }
th.sortable.desc::after { content: '↓'; opacity: .9; }

/* ── Status chips ─────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip-ok    { background: var(--ok-bg);    color: var(--ok); }
.chip-warn  { background: var(--warn-bg);  color: var(--warn); }
.chip-major { background: var(--major-bg); color: var(--major); }
.chip-crit  { background: var(--crit-bg);  color: var(--crit); }
.chip-info  { background: var(--info-bg);  color: var(--info); }
.chip-idle  { background: var(--idle-bg);  color: var(--idle); }

/* ── Forms ────────────────────────────────────────────────────── */
.input, .select {
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 12.5px;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16,146,207,.20);
}
.input::placeholder { color: var(--text-faint); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 550;
  border: 1px solid var(--border-2);
  background: var(--bg-card);
  color: var(--text-2);
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #045097; border-color: #045097; }
.btn svg { width: 15px; height: 15px; stroke-width: 1.9; }

/* ── Utilities ────────────────────────────────────────────────── */
.grid  { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.tiny  { font-size: 11px; }
.small { font-size: 12px; }
.bold  { font-weight: 600; }
.mono  { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.text-ok { color: var(--ok); } .text-warn { color: var(--warn); }
.text-crit { color: var(--crit); } .text-solar { color: var(--solar); }
.w-full { width: 100%; }
.hidden { display: none; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0 !important; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
  .content { padding: 12px; }
}

/* ── Print (reports) ──────────────────────────────────────────── */
@media print {
  .sidebar, .header, .no-print { display: none !important; }
  .main { margin-left: 0 !important; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  body { background: #fff; font-size: 11px; }
}


/* ══════════════════════════════════════════════════════════════════
   SHELL EXTRAS
   ══════════════════════════════════════════════════════════════════ */



/* ── Placeholder for pages not yet built ─────────────────────────
   An explicit empty state beats a blank screen: it says the route is
   wired and the feature is pending, rather than looking broken.     */
.placeholder {
  display: grid;
  place-items: center;
  min-height: 58vh;
  text-align: center;
}
.placeholder-icon {
  width: 54px; height: 54px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  margin: 0 auto 14px;
}
.placeholder-icon svg { width: 24px; height: 24px; stroke-width: 1.6; color: var(--text-faint); }
.placeholder h2 { font-size: 16px; font-weight: 620; letter-spacing: -.01em; }
.placeholder p  { font-size: 13px; color: var(--text-muted); margin-top: 6px; max-width: 42ch; }

/* ── Live badge (kept: shell-level, reused across modules) ───────── */
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 5px;
  font-size: 10.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  background: var(--solar-dim); color: var(--solar);
  border: 1px solid rgba(255,226,5,.3);
}
.live-badge .dot { position: relative; }
.live-badge .dot::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; border: 1px solid currentColor;
  animation: ring 1.8s ease-out infinite;
}
@keyframes ring {
  0%   { transform: scale(.6); opacity: .9; }
  100% { transform: scale(2.2); opacity: 0; }
}
.live-badge.stale   { background: var(--warn-bg); color: var(--warn); border-color: rgba(245,158,11,.3); }
.live-badge.offline { background: var(--crit-bg); color: var(--crit); border-color: rgba(239,68,68,.3); }
.live-badge.stale .dot::after, .live-badge.offline .dot::after { animation: none; }

/* ── Bar meter (kept: reused for load, SOC, progress) ────────────── */
.meter { height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.meter > i {
  display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--solar), var(--solar-2));
  transition: width .8s cubic-bezier(.22,1,.36,1);
}
.meter.grid > i { background: linear-gradient(90deg, var(--deep), var(--grid)); }
.meter.warn > i { background: linear-gradient(90deg, #b45309, var(--warn)); }
.meter.crit > i { background: linear-gradient(90deg, #b91c1c, var(--crit)); }

/* Motion is an enhancement, never the only signal. */
@media (prefers-reduced-motion: reduce) {
  .live-badge .dot::after { animation: none !important; }
}


/* ══════════════════════════════════════════════════════════════════
   LIGHT-THEME COMPONENTS
   Card surfaces are white; colour is spent on data, not chrome.
   ══════════════════════════════════════════════════════════════════ */

/* KPI tile: thick coloured rail, value in the accent colour. The rail
   is what lets a row of tiles be scanned by colour before reading. */
.kpi {
  padding: 15px 17px;
  border-radius: 10px;
}
.kpi::before { width: 4px; opacity: 1; }
.kpi-value  { font-size: 27px; font-weight: 680; letter-spacing: -.03em; }
.kpi-label  { font-size: 10.5px; letter-spacing: .06em; margin-bottom: 0; margin-top: 4px; order: 2; }
.kpi > .kpi-value { order: 1; }
.kpi { display: flex; flex-direction: column; }

.kpi.solar { --tone: var(--solar); }
.kpi.ok    { --tone: var(--ok); }
.kpi.warn  { --tone: var(--warn); }
.kpi.crit  { --tone: var(--crit); }
.kpi.info  { --tone: var(--grid); }
.kpi.deep  { --tone: var(--deep); }
.kpi[class*="kpi "]::before, .kpi.solar::before, .kpi.ok::before,
.kpi.warn::before, .kpi.crit::before, .kpi.info::before, .kpi.deep::before {
  background: var(--tone, var(--accent));
}
.kpi.solar .kpi-value { color: var(--solar); }
.kpi.ok    .kpi-value { color: var(--ok); }
.kpi.warn  .kpi-value { color: var(--warn); }
.kpi.crit  .kpi-value { color: var(--crit); }
.kpi.info  .kpi-value { color: var(--grid); }
.kpi.deep  .kpi-value { color: var(--deep); }

/* Tabs, as on the reference's Pending/Completed row. */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 2px;
  font-size: 13.5px; font-weight: 550;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--grid); border-bottom-color: var(--grid); }
.tab-count {
  margin-left: 7px; padding: 1px 7px; border-radius: 9px;
  background: var(--bg-hover); color: var(--text-muted);
  font-size: 11px; font-weight: 650;
}
.tab.active .tab-count { background: var(--grid-dim); color: var(--grid); }

/* Solid action buttons for table rows. */
.btn-solid { color: #fff; border: 0; font-weight: 550; }
.btn-solid.blue  { background: var(--grid); }
.btn-solid.blue:hover  { background: var(--deep); }
.btn-solid.green { background: var(--ok); }
.btn-solid.green:hover { background: #15803d; }



/* ══════════════════════════════════════════════════════════════════
   HEADER — farm selector, status pills, account menu
   ══════════════════════════════════════════════════════════════════ */
.header { gap: 12px; }

.farm-picker { display: flex; align-items: center; gap: 8px; }

.farm-select-wrap { position: relative; display: flex; align-items: center; }
.farm-select-wrap > svg {
  position: absolute; left: 10px;
  width: 15px; height: 15px;
  color: var(--solar);
  stroke-width: 1.9;
  pointer-events: none;
}
.farm-select {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 7px 30px 7px 31px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  min-width: 250px;
  cursor: pointer;
  /* Chevron as a background image so the control keeps one box and the
     native arrow does not double up. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
}
.farm-select:hover { border-color: var(--solar); }
.farm-select:focus { outline: none; border-color: var(--solar); box-shadow: 0 0 0 3px rgba(255,226,5,.18); }

.btn-add-farm {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--solar);
  background: var(--solar-dim);
  color: #92700f;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .13s, box-shadow .13s;
}
.btn-add-farm:hover { background: #fdf2c8; box-shadow: 0 1px 4px rgba(240,180,41,.22); }
.btn-add-farm .plus { font-size: 15px; line-height: 1; font-weight: 500; }

/* Status pills */
.hdr-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
}
.hdr-pill.live { background: var(--ok-bg); color: var(--ok); border: 1px solid rgba(22,163,74,.22); }
/* Clock: read from across a control room, so it gets size and a stable
   tabular figure width rather than being squeezed into a pill. */
.hdr-clock { text-align: right; line-height: 1.15; }
.hdr-clock .time {
  font-size: 19px; font-weight: 650;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.hdr-clock .meta {
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); margin-top: 1px;
}

/* Live pip: one calm 2.4s pulse. */
.pip { width: 7px; height: 7px; border-radius: 50%; background: currentColor; position: relative; flex-shrink: 0; }
.pip::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; border: 1px solid currentColor;
  animation: pipRing 2.4s ease-out infinite;
}
@keyframes pipRing {
  0%   { transform: scale(.65); opacity: .8; }
  100% { transform: scale(2.1); opacity: 0; }
}

.btn-ghost { background: var(--bg-card); border-color: var(--border-2); color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-hover); }

.icon-btn.notif { position: relative; }
.notif-dot {
  position: absolute; top: 2px; right: 1px;
  min-width: 15px; height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--crit);
  color: #fff;
  font-size: 9.5px; font-weight: 700;
  display: grid; place-items: center;
  border: 1.5px solid var(--bg-header);
}

.avatar-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ffe863, #f0b429);
  color: #6b4d05;
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  flex-shrink: 0;
}

.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 232px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 60;
}
.user-pop-head { display: flex; align-items: center; gap: 10px; padding: 13px; border-bottom: 1px solid var(--border); }
.avatar-lg {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(140deg, #ffe863, #f0b429);
  color: #6b4d05; font-size: 13px; font-weight: 700;
  display: grid; place-items: center; flex-shrink: 0;
}
.user-name { font-size: 13.5px; font-weight: 600; }
.user-mail { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.user-pop-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 11px 13px;
  font-size: 13px; font-weight: 500;
  text-align: left;
}
.user-pop-item:hover { background: var(--bg-hover); }
.user-pop-item.danger { color: var(--crit); }
.user-pop-item svg { width: 15px; height: 15px; stroke-width: 1.9; }

/* ══════════════════════════════════════════════════════════════════
   MODAL — Register New Solar Farm
   ══════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 24px;
  overflow-y: auto;
}
.modal-panel {
  width: 100%; max-width: 720px;
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: 0 24px 48px -12px rgba(16,24,40,.28);
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  animation: modalIn .18s cubic-bezier(.22,1,.36,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.modal-head {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--solar-dim);
  border: 1px solid rgba(240,180,41,.3);
}
.modal-head-icon svg { width: 20px; height: 20px; color: var(--solar); stroke-width: 1.9; }
.modal-title { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.modal-sub   { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  margin-left: auto; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 7px;
  font-size: 21px; line-height: 1;
  color: var(--text-muted);
  display: grid; place-items: center;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }

.modal-body { padding: 4px 22px 20px; overflow-y: auto; flex: 1; }

/* Numbered section headers, mirroring the reference. */
.form-section {
  display: flex; align-items: center; gap: 9px;
  margin: 22px 0 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}
.form-section:first-child { margin-top: 16px; }
.section-num {
  width: 21px; height: 21px; flex-shrink: 0;
  border-radius: 6px;
  background: var(--solar-dim);
  color: #92700f;
  font-size: 11.5px; font-weight: 700;
  display: grid; place-items: center;
}
.form-section h3 { font-size: 13.5px; font-weight: 620; letter-spacing: -.01em; }

.form-grid { display: grid; gap: 13px; margin-bottom: 13px; }
.form-grid.two   { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }

.fld { display: flex; flex-direction: column; min-width: 0; }
.lbl { font-size: 12px; font-weight: 550; color: var(--text-2); margin-bottom: 5px; }
.req { color: var(--crit); }

.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > svg {
  position: absolute; left: 10px;
  width: 15px; height: 15px;
  color: var(--text-faint); stroke-width: 1.8;
  pointer-events: none;
}
.input-icon .input { padding-left: 32px; }

.input-suffix { position: relative; display: flex; align-items: center; }
.input-suffix .suffix {
  position: absolute; right: 10px;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  padding-left: 6px;
  pointer-events: none;
}

.hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.hint-ok   { color: var(--ok); }
.hint-warn { color: var(--warn); }

.form-alert {
  background: var(--crit-bg);
  border: 1px solid rgba(220,38,38,.24);
  border-radius: 9px;
  padding: 11px 13px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: #991b1b;
}
.form-alert ul { margin: 6px 0 0; padding-left: 17px; }
.form-alert li { margin-top: 2px; }

.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 17px;
  border-top: 1px solid var(--border);
}
.foot-note {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-muted);
}
.foot-note svg { width: 14px; height: 14px; color: var(--ok); stroke-width: 1.9; }

.btn-create {
  background: linear-gradient(135deg, #ffe205, #f0b429);
  border: 0;
  color: #5c3f04;
  font-weight: 650;
  padding: 9px 18px;
}
.btn.btn-create:hover {
  background: linear-gradient(135deg, #ffe205, #f0b429);
  filter: brightness(1.05);
  box-shadow: 0 3px 10px rgba(240,180,41,.3);
}

/* Toast for the post-create confirmation. */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: flex; align-items: center; gap: 9px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(22,163,74,.28);
  border-left: 3px solid var(--ok);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  animation: toastIn .22s cubic-bezier(.22,1,.36,1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.toast svg { width: 16px; height: 16px; color: var(--ok); stroke-width: 2.1; }

@media (max-width: 860px) {
  .farm-select { min-width: 168px; }
  .hdr-pill.clock-pill, .btn-ghost { display: none; }
}
@media (max-width: 640px) {
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .pip::after, .modal-panel, .toast { animation: none; }
}

/* Selector placeholder shown before any farm is registered. Saying so
   plainly beats an empty dropdown, which reads as a broken control. */
.farm-empty {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px dashed var(--border-2);
  background: var(--bg-card-2);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.farm-empty svg { width: 14px; height: 14px; stroke-width: 1.8; color: var(--text-faint); }

/* "All Farms" carries a fleet glyph rather than the site pin, so the
   aggregate view is distinguishable from a single site at a glance. */
.farm-select-wrap.is-all > svg { color: var(--grid); }

/* ══════════════════════════════════════════════════════════════════
   SITE DASHBOARD
   ══════════════════════════════════════════════════════════════════ */

/* An inline SVG with no explicit size expands to fill its parent. Size the
   inline *icons* only - the flow diagram and chart are deliberately
   full-width and are sized by their own rules below. */
.plant-title svg, p.small svg, .tiny svg, .metric-box svg, .foot-note svg {
  width: 14px; height: 14px; flex-shrink: 0;
}
.plant-title { font-size: 20px; font-weight: 660; letter-spacing: -.025em; }
.cap-badge {
  display: inline-block; vertical-align: middle;
  margin-left: 7px; padding: 2px 8px;
  border-radius: 5px;
  background: var(--grid-dim); color: var(--grid);
  font-size: 11px; font-weight: 650; letter-spacing: .02em;
}

/* KPI tiles carry a label row, the value, then a footer of context.
   The footer is what turns a number into a judgement: "44,841 kW" alone
   says nothing, "92% of rated" says the plant is running hard. */
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-head svg { width: 15px; height: 15px; stroke-width: 1.9; color: var(--tone, var(--accent)); }
.kpi-foot {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-top: 7px; padding-top: 7px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
}
.kpi .kpi-label { order: 0; margin: 0; }
.kpi .kpi-value { order: 0; margin-top: 7px; }
.kpi { display: block; }

.head-ico {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 7px;
  display: grid; place-items: center;
}
.head-ico svg { width: 14px; height: 14px; stroke-width: 2; }
.head-ico.solar { background: var(--solar-dim); color: var(--solar); }
.head-ico.warn  { background: var(--warn-bg);   color: var(--warn); }

/* ── Flow diagram ─────────────────────────────────────────────── */
.flow-wrap { width: 100%; }
.flow-svg  { width: 100%; height: auto; min-height: 300px; display: block; overflow: visible; }

.fl-rail { fill: none; stroke: var(--border-2); stroke-width: 1.6; }
.fl-rail.on   { stroke: var(--solar); }
.fl-rail.batt { stroke: var(--ok); }
.fl-rail.grid { stroke: var(--grid); }
.fl-rail.load { stroke: var(--battery); }

/* Dashes travel along the conductor: direction shows import vs export,
   speed is bound to magnitude, so flow reads before any number does. */
.fl-dash {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 1 11;
  animation: flDash linear infinite;
}
@keyframes flDash { to { stroke-dashoffset: -120; } }
.fl-dash.rev  { animation-direction: reverse; }
.fl-dash.pv   { stroke: var(--solar-2); }
.fl-dash.batt { stroke: #34d399; }
.fl-dash.grid { stroke: #38bdf8; }
.fl-dash.load { stroke: #c4b5fd; }

.fl-node {
  height: 100%;
  padding: 7px 9px;
  border-radius: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color .3s, box-shadow .3s;
}
.fl-node.live.solar { border-color: var(--solar); box-shadow: 0 0 0 3px rgba(240,180,41,.1); }
.fl-node.live.batt  { border-color: var(--ok);    box-shadow: 0 0 0 3px rgba(22,163,74,.1); }
.fl-node.live.grid  { border-color: var(--grid);  box-shadow: 0 0 0 3px rgba(16,146,207,.1); }
.fl-node.live.load  { border-color: var(--battery); box-shadow: 0 0 0 3px rgba(124,58,237,.1); }

.fl-node-head {
  display: flex; align-items: center; gap: 5px;
  font-size: 9.5px; font-weight: 650;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted);
}
.fl-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.fl-dot.solar { background: var(--solar); }
.fl-dot.batt  { background: var(--ok); }
.fl-dot.grid  { background: var(--grid); }
.fl-dot.load  { background: var(--battery); }

.fl-val {
  font-size: 15px; font-weight: 700;
  letter-spacing: -.02em; margin-top: 2px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.fl-val small { font-size: 9.5px; font-weight: 550; color: var(--text-muted); margin-left: 2px; }
.fl-val.solar { color: var(--solar); }
.fl-val.batt  { color: var(--ok); }
.fl-val.grid  { color: var(--grid); }
.fl-val.load  { color: var(--battery); }
.fl-sub { font-size: 9px; color: var(--text-faint); margin-top: 1px; }

.fl-bar { height: 4px; border-radius: 2px; background: var(--border); margin-top: 3px; overflow: hidden; }
.fl-bar > i { display: block; height: 100%; background: var(--ok); border-radius: 2px; }

.fl-tag {
  display: inline-block; margin-top: 3px;
  padding: 1px 6px; border-radius: 4px;
  font-size: 8.5px; font-weight: 700; letter-spacing: .06em;
}
.fl-tag.export { background: var(--grid-dim); color: var(--grid); }
.fl-tag.import { background: var(--warn-bg);  color: var(--warn); }

/* Inline conductor labels */
.fl-tagbox rect { fill: var(--bg-card); stroke: var(--border-2); stroke-width: 1; }
.fl-tagbox text {
  fill: var(--text-2); font-size: 9.5px; font-weight: 650;
  text-anchor: middle; font-variant-numeric: tabular-nums;
}
.fl-tagbox.batt rect { stroke: var(--ok); }
.fl-tagbox.grid rect { stroke: var(--grid); }
.fl-tagbox.load rect { stroke: var(--battery); }

.flow-legend {
  display: flex; align-items: center; gap: 15px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 11px;
  border-top: 1px solid var(--border);
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.legend-item i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Alarms ───────────────────────────────────────────────────── */
.alarm-list { max-height: 340px; overflow-y: auto; padding: 11px; display: grid; gap: 9px; }
.alarm {
  padding: 10px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-2);
  background: var(--bg-card-2);
}
.alarm-crit { border-left-color: var(--crit); background: var(--crit-bg); }
.alarm-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.alarm-info { border-left-color: var(--grid); background: var(--grid-dim); }
.alarm-msg { font-size: 12.5px; font-weight: 550; color: var(--text); line-height: 1.4; }

.btn-ack {
  padding: 3px 10px; border-radius: 5px;
  background: var(--solar); color: #5c3f04;
  font-size: 10.5px; font-weight: 650;
  white-space: nowrap;
}
.btn-ack:hover { filter: brightness(1.06); }

.alarm-more {
  display: block; padding: 11px;
  text-align: center;
  font-size: 12px; font-weight: 600;
  color: var(--solar);
  border-top: 1px solid var(--border);
}
.alarm-more:hover { background: var(--bg-hover); }

/* ── Production chart ─────────────────────────────────────────── */
.chart-wrap { width: 100%; }
.prod-chart { width: 100%; height: auto; min-height: 210px; display: block; }
.ch-grid { stroke: var(--border); stroke-width: .8; }
.ch-lbl  { fill: var(--text-faint); font-size: 8.5px; font-variant-numeric: tabular-nums; }
.ch-pv   { fill: none; stroke: var(--solar); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
/* Forecast is dashed so the two lines stay distinguishable where they
   overlap, not only where they diverge. */
.ch-forecast {
  fill: none; stroke: var(--battery); stroke-width: 1.4;
  stroke-dasharray: 4 3; opacity: .75;
}
.chart-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 9px; padding-top: 9px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
}

/* ── Metrics panel ────────────────────────────────────────────── */
.metric-box {
  padding: 11px 13px;
  border-radius: 9px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
}
.metric-box.green { background: var(--ok-bg); border-color: rgba(22,163,74,.2); }
.metric-box svg { width: 15px; height: 15px; stroke-width: 1.9; color: var(--ok); }
.metric-label {
  font-size: 10.5px; font-weight: 650;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted);
}
.metric-big { font-size: 16px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cond-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.text-grid { color: var(--grid); }

@media (max-width: 1180px) {
  .grid[style*="1.55fr"] { grid-template-columns: 1fr !important; }
}
@media (prefers-reduced-motion: reduce) {
  .fl-dash { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════
   MONITORING SCREENS
   ══════════════════════════════════════════════════════════════════ */

/* ── 24-hour replay ───────────────────────────────────────────── */
.replay-slider {
  width: 100%;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--border) 0%, var(--solar) 50%, var(--border) 100%);
  outline: none;
}
.replay-slider::-webkit-slider-thumb {
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--solar);
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer;
}
.replay-slider::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--solar);
  border: 2px solid var(--bg-card);
  cursor: pointer;
}
.replay-axis {
  display: flex; justify-content: space-between;
  margin-top: 7px;
  font-size: 10.5px; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.replay-stat {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
}
.replay-val {
  font-size: 19px; font-weight: 680; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; margin-top: 3px;
}
.replay-val small { font-size: 11px; font-weight: 550; color: var(--text-muted); margin-left: 2px; }

/* ── Telemetry bus log ────────────────────────────────────────── */
.bus-log {
  max-height: 220px; overflow-y: auto;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 11.5px;
}
.bus-line {
  display: flex; gap: 10px;
  padding: 5px 14px;
  border-bottom: 1px solid var(--border);
}
.bus-line:nth-child(even) { background: var(--bg-card-2); }
.bus-ts { color: var(--grid); flex-shrink: 0; }
.bus-payload { color: var(--text-2); word-break: break-all; }

/* ── Inverter cards ───────────────────────────────────────────── */
.inv-card { border-left: 3px solid var(--border-2); transition: box-shadow .15s; }
.inv-card:hover { box-shadow: var(--shadow-md); }
.inv-ok   { border-left-color: var(--ok); }
.inv-warn { border-left-color: var(--warn); }
.inv-crit { border-left-color: var(--crit); }
.inv-idle { border-left-color: var(--idle); }
.inv-info { border-left-color: var(--grid); }
.inv-card .tiny svg { width: 12px; height: 12px; vertical-align: -1px; }

/* ── String heatmap ───────────────────────────────────────────── */
.hm-row {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.hm-row:last-child { border-bottom: 0; }
.hm-label { width: 118px; flex-shrink: 0; }
.hm-cells { display: flex; gap: 5px; flex: 1; overflow-x: auto; padding-bottom: 2px; }

.hm-cell {
  flex: 1; min-width: 58px;
  padding: 7px 5px;
  border-radius: 5px;
  text-align: center;
  color: #fff;
  cursor: default;
  transition: transform .1s;
}
.hm-cell:hover { transform: translateY(-2px); }
.hm-pos { font-size: 9.5px; opacity: .85; font-weight: 600; }
.hm-w   { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Colour encodes deviation from sibling modules, not absolute watts -
   so a passing cloud dims the whole array without turning it red. */
.hm-ok     { background: var(--solar); color: #4a3500; }
.hm-low    { background: #fb923c; }
.hm-soiled { background: #ea580c; }
.hm-shaded { background: #c2410c; }
.hm-fault  { background: #f9a8d4; color: #831843; }

/* ── BMS cell grid ────────────────────────────────────────────── */
.cell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 9px;
}
.cell-box {
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  text-align: center;
}
/* The out-of-balance cell is the point of the screen, so it is marked
   rather than left for the reader to spot among sixteen. */
.cell-box.weak {
  background: var(--warn-bg);
  border-color: rgba(217,119,6,.35);
}
.cell-v {
  font-size: 14px; font-weight: 680;
  font-variant-numeric: tabular-nums;
  color: var(--ok); margin-top: 2px;
}
.cell-box.weak .cell-v { color: var(--warn); }
.cell-v small { font-size: 10px; font-weight: 550; color: var(--text-muted); margin-left: 1px; }

@media (max-width: 900px) {
  .hm-label { width: 90px; }
  .hm-cell  { min-width: 50px; }
}

/* ══════════════════════════════════════════════════════════════════
   WORK ORDERS & SIMULATOR
   ══════════════════════════════════════════════════════════════════ */

/* ── Kanban board ─────────────────────────────────────────────── */
.wo-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.wo-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.wo-col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-2);
  font-size: 13px;
}
.wo-count {
  min-width: 20px; padding: 1px 7px;
  border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 11px; font-weight: 700; text-align: center;
}
.wo-cards { padding: 10px; display: grid; gap: 9px; min-height: 90px; }

.wo-card {
  padding: 11px;
  border-radius: 8px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-2);
}
.wo-crit { border-left-color: var(--crit); }
.wo-warn { border-left-color: var(--warn); }
.wo-info { border-left-color: var(--grid); }
.wo-idle { border-left-color: var(--idle); }
.wo-card svg { width: 12px; height: 12px; vertical-align: -2px; }

.wo-empty {
  padding: 22px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

/* ── Simulator console ────────────────────────────────────────── */
.payload-json {
  margin: 0;
  padding: 13px;
  border-radius: 8px;
  background: #0d1726;
  color: #cbd5e1;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  max-height: 380px;
  overflow: auto;
  white-space: pre;
}

@media (max-width: 1100px) {
  .wo-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .wo-board { grid-template-columns: 1fr; }
}

/* Zero grid flow: neither import nor export, so it reads as neutral
   rather than claiming an active state that is not happening. */
.fl-tag.idle { background: var(--idle-bg); color: var(--idle); }

/* ══════════════════════════════════════════════════════════════════
   REFERENCE-MATCHED ANIMATION
   Motion timing and easing are matched to the reference design rather
   than approximated by eye.
   ══════════════════════════════════════════════════════════════════ */

/* Expanding ring on a live indicator (reference: `ping`). */
@keyframes gp-ping {
  75%, 100% { opacity: 0; transform: scale(2); }
}

/* Slow breathing on live cards (reference: `pulseSlow`). Deliberately
   subtle - 2% scale - so a wall display reads as alive without the
   layout appearing to wobble. */
@keyframes gp-pulse-slow {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: .85; transform: scale(1.02); }
}

/* A dot travelling the conductor. This is the motion visible moving
   between the reference's frames, and it reads as discrete packets
   rather than a continuous smear. */
@keyframes gp-travel {
  from { offset-distance: 0%; }
  to   { offset-distance: 100%; }
}

/* Live badge ring */
.live-badge .dot::after,
.pip::after {
  animation: gp-ping 1s cubic-bezier(0, 0, .2, 1) infinite;
}

/* Card that is actively carrying power breathes gently. */
.fl-node.live { animation: gp-pulse-slow 3s ease-in-out infinite; }

/* Travelling packet dots along each conductor. */
.fl-travel {
  offset-rotate: 0deg;
  animation: gp-travel linear infinite;
}
.fl-travel circle { r: 3.5; }
.fl-travel.pv   circle { fill: var(--solar); }
.fl-travel.batt circle { fill: var(--ok); }
.fl-travel.grid circle { fill: var(--grid); }
.fl-travel.load circle { fill: var(--battery); }

/* Value tick: a brief lift when a number changes, so the eye is drawn
   to what moved rather than having to scan the whole card. */
@keyframes gp-tick {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}
.gp-tick { animation: gp-tick .45s cubic-bezier(.34,1.56,.64,1); }

/* Fullscreen live flow */
.flow-fullscreen {
  position: fixed; inset: 0; z-index: 120;
  background: var(--bg-body);
  padding: 24px;
  overflow: auto;
}
.flow-fullscreen .flow-svg { max-height: calc(100vh - 160px); }

.btn-fullscreen {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 0;
  background: linear-gradient(135deg, #ffe205, #f0b429);
  color: #5c3f04; font-size: 12.5px; font-weight: 650;
  white-space: nowrap;
}
.btn-fullscreen:hover { filter: brightness(1.05); }

/* Motion is decoration on top of colour and text here, never the only
   signal, so removing it loses nothing. */
@media (prefers-reduced-motion: reduce) {
  .fl-node.live, .fl-travel, .gp-tick,
  .live-badge .dot::after, .pip::after { animation: none !important; }
}

/* ── Live Energy Flow schematic ──────────────────────────────────────
   Colour carries meaning here: solar, battery, grid and load each keep
   one hue across wire, packet, label and node accent. */

.flow-wrap { position: relative; background: #ffffff; border-radius: 12px; }
.flow-svg  { width: 100%; height: auto; min-height: 380px; display: block; }

/* De-energised rail. Visible but recessive: topology stays readable
   when a branch is idle, without competing with live flow. */
.fc-rail {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fc-live {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .95;
    transition: stroke-width .4s ease;
}

.fc-dot {
    filter: drop-shadow(0 0 3px currentColor);
    stroke: #ffffff;
    stroke-width: 1.5;
}

.fc-solar { stroke: #f59e0b; }  .fc-solar-fill { fill: #f59e0b; color: #f59e0b; }
.fc-batt  { stroke: #10b981; }  .fc-batt-fill  { fill: #10b981; color: #10b981; }
.fc-grid  { stroke: #3b82f6; }  .fc-grid-fill  { fill: #3b82f6; color: #3b82f6; }
.fc-load  { stroke: #a855f7; }  .fc-load-fill  { fill: #a855f7; color: #a855f7; }

.fc-solar-stroke { stroke: #f59e0b; }
.fc-batt-stroke  { stroke: #10b981; }
.fc-grid-stroke  { stroke: #3b82f6; }
.fc-load-stroke  { stroke: #a855f7; }

.fc-junction { fill: #3b82f6; stroke: #ffffff; stroke-width: 2.5; }

/* Inline flow labels */
.fc-pill {
    fill: #ffffff;
    stroke-width: 1.5;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
}
.fc-pill-text {
    font: 700 12.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    fill: #1e293b;
}

/* ── Nodes ───────────────────────────────────────────────────────── */
.fc-node { cursor: pointer; }
.fc-card {
    fill: #ffffff;
    stroke: #e2e8f0;
    stroke-width: 1.5;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.04));
    transition: stroke .35s ease, filter .35s ease, transform .2s ease;
}
.fc-node:hover .fc-card,
.fc-node:focus-visible .fc-card {
    filter: drop-shadow(0 6px 16px rgba(0,0,0,0.08));
    stroke-width: 2;
}

/* An energised node is outlined in its own branch colour */
.fc-card-solar { stroke: #f59e0b !important; }
.fc-card-batt  { stroke: #10b981 !important; }
.fc-card-grid  { stroke: #3b82f6 !important; }
.fc-card-load  { stroke: #a855f7 !important; }
.fc-card-crit  { stroke: #ef4444 !important; }

.fc-badge     { opacity: 1; }
.fc-solar-bg  { fill: #fef3c7; }
.fc-batt-bg   { fill: #dcfce7; }
.fc-grid-bg   { fill: #dbeafe; }
.fc-load-bg   { fill: #f3e8ff; }

.fc-ico    { width: 24px; height: 24px; display: grid; place-items: center; }
.fc-ico svg { width: 15px; height: 15px; }
.fc-ico.solar { color: #d97706; }
.fc-ico.batt  { color: #059669; }
.fc-ico.grid  { color: #2563eb; }
.fc-ico.load  { color: #9333ea; }

.fc-title    { font: 700 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; fill: #0f172a; }
.fc-title-lg { font-size: 15px; }
.fc-sub      { font: 500 11.5px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; fill: #64748b; }
.fc-value    { font: 700 22px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: #0f172a; }
.fc-value-lg { font-size: 24px; }
.fc-unit     { font-size: 12px; font-weight: 600; fill: #64748b; }
.fc-meta     { font: 500 11px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; fill: #64748b; }

.fc-track     { fill: #e2e8f0; }
.fc-fill-batt { fill: #10b981; transition: width .6s ease; }

.fc-tag           { fill: #f1f5f9; }
.fc-tag-export    { fill: #dcfce7; }
.fc-tag-import    { fill: #fef3c7; }
.fc-tag-offline   { fill: #fee2e2; }
.fc-tag-text      { font: 700 11px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; fill: #1e293b; letter-spacing: .5px; }
.fc-tag-text-dim  { fill: #64748b; }

/* ── Hover detail ────────────────────────────────────────────────── */
.fc-hover {
    position: absolute; top: 12px; left: 12px; z-index: 4;
    min-width: 190px; padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 22px rgba(0,0,0,.10);
    pointer-events: none;
}
.fc-hover-head {
    font-size: 11.5px; font-weight: 700; color: var(--text);
    padding-bottom: 6px; margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.fc-hover-row {
    display: flex; justify-content: space-between; gap: 14px;
    font-size: 11px; color: var(--text-muted); padding: 2px 0;
}
.fc-hover-row b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ── Debug panel ─────────────────────────────────────────────────── */
.fc-debug {
    position: absolute; top: 12px; right: 12px; z-index: 4;
    min-width: 230px; padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 22px rgba(0,0,0,.10);
}
.fc-debug-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11.5px; font-weight: 700;
    padding-bottom: 6px; margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.fc-debug-row {
    display: flex; justify-content: space-between; gap: 14px;
    font-size: 11px; color: var(--text-muted); padding: 2.5px 0;
}
.fc-debug-row b {
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* ── SCADA Dark Canvas Mode ──────────────────────────────────────── */
.scada-canvas-card {
    background: #0b1329 !important;
    border-color: #1e293b !important;
    color: #f8fafc !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.scada-canvas-card .card-title { color: #f8fafc !important; }
.scada-canvas-card .muted { color: #94a3b8 !important; }
.scada-canvas-card .flow-wrap {
    background: #0f172a;
    border-radius: 10px;
    padding: 12px;
    background-image: radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 18px 18px;
    border: 1px solid #1e293b;
}
.scada-canvas-card .fc-rail { stroke: #334155; opacity: 0.8; }
.scada-canvas-card .fc-card { fill: #1e293b; stroke: #334155; }
.scada-canvas-card .fc-card-solar { stroke: #f59e0b !important; stroke-width: 2px; }
.scada-canvas-card .fc-card-batt  { stroke: #10b981 !important; stroke-width: 2px; }
.scada-canvas-card .fc-card-grid  { stroke: #0284c7 !important; stroke-width: 2px; }
.scada-canvas-card .fc-card-load  { stroke: #a855f7 !important; stroke-width: 2px; }
.scada-canvas-card .fc-card-crit  { stroke: #ef4444 !important; stroke-width: 2px; }
.scada-canvas-card .fc-title { fill: #f8fafc !important; }
.scada-canvas-card .fc-sub   { fill: #94a3b8 !important; }
.scada-canvas-card .fc-value { fill: #ffffff !important; }
.scada-canvas-card .fc-unit  { fill: #cbd5e1 !important; }
.scada-canvas-card .fc-meta  { fill: #94a3b8 !important; }
.scada-canvas-card .fc-pill  { fill: #0b1329 !important; stroke-width: 2px; }
.scada-canvas-card .fc-pill-text { fill: #ffffff !important; font-weight: 700; }
.scada-canvas-card .fc-junction { fill: #38bdf8 !important; stroke: #0f172a !important; stroke-width: 3px; }
.scada-canvas-card .fc-hover,
.scada-canvas-card .fc-debug {
    background: rgba(15, 23, 42, 0.95) !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}
.scada-canvas-card .fc-hover-head,
.scada-canvas-card .fc-debug-head { border-bottom-color: #334155 !important; color: #f8fafc !important; }
.scada-canvas-card .fc-hover-row b,
.scada-canvas-card .fc-debug-row b { color: #38bdf8 !important; }


/* Respect a stated preference for reduced motion: the diagram must
   still convey state, so wires and labels stay - only travel stops. */
@media (prefers-reduced-motion: reduce) {
    .fc-dot { display: none !important; }
    .fc-live { opacity: .6 !important; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ══════════════════════════════════════════════════════════════════
   SCADA / INDUSTRIAL ANIMATIONS & STATUS INDICATORS
   ══════════════════════════════════════════════════════════════════ */

/* Live Telemetry Dot Pulse (Green) */
@keyframes pulse-live {
    0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); transform: scale(1); }
    70%  { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); transform: scale(1); }
}

/* Warning Pulse (Amber) */
@keyframes pulse-warn {
    0%   { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.6); }
    70%  { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}

/* Critical Pulse (Red) */
@keyframes pulse-crit {
    0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.8); }
    50%  { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Fault Highlight Entrance */
@keyframes fault-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Toast Slide In */
@keyframes toast-slide-in {
    from { transform: translateY(100%) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.pip-live {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background-color: var(--ok);
    animation: pulse-live 2s infinite;
}
.pip-warn {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background-color: var(--warn);
    animation: pulse-warn 2.2s infinite;
}
.pip-crit {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background-color: var(--crit);
    animation: pulse-crit 1.5s infinite;
}

.chip-live-pulse { animation: pulse-live 2.5s infinite; }
.chip-warn-pulse { animation: pulse-warn 2.2s infinite; }
.chip-crit-pulse { animation: pulse-crit 1.5s infinite; }

/* Inverter State Indicators */
.inv-card { transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease; }
.inv-card.inv-crit-pulse { animation: pulse-crit 2s infinite; border-color: var(--crit); }
.inv-card.inv-warn-pulse { animation: pulse-warn 2.5s infinite; border-color: var(--warn); }

/* Heatmap cell transitions */
.hm-cell {
    transition: background-color 0.4s ease, border-color 0.4s ease, transform 0.15s ease;
}
.hm-cell:hover { transform: scale(1.08); z-index: 2; cursor: pointer; }
.hm-fault-blink { animation: fault-blink 1s 3; }

/* Shaded cell pattern */
.hm-shaded-pattern {
    background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.06), rgba(0,0,0,0.06) 4px, transparent 4px, transparent 8px) !important;
}

/* Data Quality Badges */
.dq-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; font-weight: 650; padding: 2px 6px; border-radius: 4px;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.dq-good    { background: rgba(22, 163, 74, 0.12); color: var(--ok); }
.dq-stale   { background: rgba(217, 119, 6, 0.12); color: var(--warn); }
.dq-bad     { background: rgba(220, 38, 38, 0.12); color: var(--crit); }
.dq-missing { background: rgba(100, 116, 139, 0.12); color: var(--idle); }

/* Real-Time Alarm Toast Stack */
.toast-container {
    position: fixed; bottom: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px; max-width: 380px; width: 100%;
    pointer-events: none;
}
.toast-alarm {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 14px; background: var(--bg-card);
    border-left: 4px solid var(--crit); border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-alarm.toast-warn { border-left-color: var(--warn); }
.toast-alarm.toast-info { border-left-color: var(--info); }

/* SCADA Modals & Drawers */
.scada-modal-overlay {
    position: fixed; inset: 0; z-index: 999;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.scada-modal {
    background: var(--bg-card); border-radius: 12px;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    max-width: 800px; width: 100%; max-height: 90vh; overflow-y: auto;
}
.scada-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.scada-modal-body { padding: 20px; }

/* Report Progress Modal */
.report-step {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--border); font-size: 13px;
}
.report-step-icon {
    width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    font-size: 12px; font-weight: bold; background: var(--bg-card-2); color: var(--text-muted);
}
.report-step.active .report-step-icon { background: var(--info); color: #fff; }
.report-step.done .report-step-icon   { background: var(--ok); color: #fff; }


/* ── Telemetry strip ─────────────────────────────────────────────────
   Auto-fit rather than a fixed six columns: the tiles reflow to two or
   three across on a narrow viewport instead of overflowing the card.
   The previous markup asked for a `.g6` class that was never defined,
   so every tile stacked full-width. */
.tele-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.tele-tile {
    background: var(--bg-row);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 11px;
}

/* Irradiance is the one reading an operator scans for first, so it
   carries the solar accent rather than sitting in the neutral set. */
.tele-tile.warm {
    background: #fff7ed;
    border-color: #ffedd5;
}
.tele-tile.warm .tele-label { color: #c2410c; }
.tele-tile.warm .tele-value { color: #c2410c; }

.tele-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.tele-value {
    font: 700 15px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ── Sites map ───────────────────────────────────────────────────────
   An equirectangular plot rather than a tile map: no external host, no
   API key, and it renders offline. The graticule supplies enough frame
   of reference to read roughly where a plant sits. */
.map-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    background: linear-gradient(180deg, #f2f7fb 0%, #eef4f9 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.map-grid { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-grid line { stroke: #cfdae6; stroke-width: .4; }
.map-grid .equator,
.map-grid .meridian { stroke: #aebecd; stroke-width: .7; }

.map-pin {
    position: absolute;
    width: 16px; height: 16px;
    margin: -8px 0 0 -8px;      /* centre on the coordinate, not below it */
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.pin-dot {
    position: relative;
    width: 11px; height: 11px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.28);
    z-index: 1;
}

/* The ring pulses only to draw the eye to a live site; it carries no
   information beyond "this marker is here". */
.pin-ring {
    position: absolute;
    width: 11px; height: 11px;
    border-radius: 50%;
    opacity: .45;
    animation: pin-pulse 2.4s ease-out infinite;
}

@keyframes pin-pulse {
    0%   { transform: scale(1);   opacity: .45; }
    70%  { transform: scale(2.6); opacity: 0; }
    100% { transform: scale(2.6); opacity: 0; }
}

.pin-ok   .pin-dot, .pin-ok   .pin-ring { background: var(--ok); }
.pin-info .pin-dot, .pin-info .pin-ring { background: var(--info); }
.pin-warn .pin-dot, .pin-warn .pin-ring { background: var(--warn); }
.pin-crit .pin-dot, .pin-crit .pin-ring { background: var(--crit); }
.pin-idle .pin-dot, .pin-idle .pin-ring { background: var(--text-muted); }

.map-pin:hover .pin-dot,
.map-pin:focus-visible .pin-dot { transform: scale(1.35); }

.map-empty {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    font-size: 13px; color: var(--text-muted);
}

.map-detail {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--bg-row);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.map-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

/* ── Table row actions ───────────────────────────────────────────── */
.row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}
.row-actions form { margin: 0; }

.btn-sm {
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.btn-sm:hover { background: var(--bg-hover); }

/* Archive is destructive-adjacent, so it reads as a warning rather than
   sitting visually identical to Edit. */
.btn-sm-danger { color: var(--crit); border-color: #f3c9c9; }
.btn-sm-danger:hover { background: #fef2f2; }
