/* Portal-only rules on top of sems-app.css (the SEMS board stylesheet, copied unchanged by
   scripts/sync_sems_style.py). Nothing here may redefine a selector sems-app.css already defines. */
:root {
  --bg-tooltip: rgba(15, 23, 42, 0.96);
  --series-pv: #10b981;
  --series-load: #b8c7d6;
  --series-import: #e63946;
  --series-export: #00a8e8;
  --series-battery: #f59e0b;
  --series-soc: #a855f7;
  --forecast-region: rgba(168, 85, 247, 0.05);
  --forecast-edge: rgba(168, 85, 247, 0.35);
  --forecast-label: #c4a4f6;
  --chart-axis: #7a95aa;
  --chart-grid: rgba(148, 163, 184, 0.08);
  --chart-tick: rgba(148, 163, 184, 0.25);
  --chart-zero: rgba(148, 163, 184, 0.3);
  --chart-cursor: rgba(184, 199, 214, 0.45);
}
.hidden { display: none !important; }
.skip-link { position: absolute; left: var(--space-4); top: -100px; z-index: 1000; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); background: var(--primary-action); color: var(--text-on-primary); font-weight: 600; }
/* Focus moved by script onto a heading (tabindex=-1) after a page change shows no ring for pointer users. */
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
.skip-link:focus { top: var(--space-4); color: var(--text-on-primary); }
.nav-section-label { padding: 0 0.8rem; color: var(--text-muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
/* The sidebar's middle scrolls on its own, so the foot (organization, language, logout) stays in view. */
.sidebar-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; scrollbar-width: thin; }
.compact-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2) var(--space-4); margin-top: var(--space-3); }
.compact-values div { min-width: 0; }
.compact-values dt { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-values dd { color: var(--text-secondary); font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.series-pv { --c: var(--series-pv); }
.series-load { --c: var(--series-load); }
.series-import { --c: var(--series-import); }
.series-export { --c: var(--series-export); }
.series-battery { --c: var(--series-battery); }
.series-soc { --c: var(--series-soc); }
.chart-host { min-height: 440px; display: grid; min-width: 0; border-radius: var(--radius-md); }
.chart-host:focus-visible { outline-offset: 4px; }
.chart-svg { display: block; width: 100%; height: auto; font-family: var(--font-sans); touch-action: pan-y; }
.chart-svg .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart-svg .zero-line { stroke: var(--chart-zero); stroke-width: 1; }
.chart-svg .tick { stroke: var(--chart-tick); stroke-width: 1; }
.chart-svg .axis-label { fill: var(--chart-axis); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-svg .soc-axis { fill: var(--series-soc); }
.chart-svg .line { fill: none; stroke: var(--c); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line.series-pv { stroke-width: 1.7; }
.chart-svg .line.series-soc { stroke-width: 2; }
.chart-svg .line.forecast { stroke-dasharray: 6 4; stroke-linecap: butt; }
.chart-svg .forecast-region { fill: var(--forecast-region); }
.chart-svg .forecast-now { stroke: var(--forecast-edge); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-svg .forecast-label { fill: var(--forecast-label); font-size: 12px; font-weight: 600; }
.chart-svg .point { fill: var(--c); }
.chart-svg .cursor { stroke: var(--chart-cursor); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-svg .cursor-dot { fill: var(--c); stroke: var(--bg-card); stroke-width: 1.5; }
.chart-svg .hit { fill: transparent; cursor: crosshair; }
.chart-tooltip.at-left { top: var(--space-2); left: 64px; }
.chart-tooltip.at-right { top: var(--space-2); right: 56px; }
.chart-hint { min-height: 1.4em; margin-top: var(--space-2); color: var(--text-muted); font-size: 0.78rem; }
.chart-hint:empty { display: none; }
.chart-status { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.chart-status:empty { display: none; }
.login-copy p { margin-top: var(--space-2); color: var(--text-secondary); font-size: 0.92rem; line-height: 1.55; }
.login-copy p + p { margin-top: var(--space-3); }
.login-note { color: var(--text-secondary); font-size: 0.86rem; line-height: 1.55; }
.field-hint { color: var(--text-muted); font-size: 0.78rem; line-height: 1.45; }
.schedule-actions { margin-top: var(--space-3); }
.schedule-table :is(th, td) { text-align: left; }
.schedule-table tr.past td { opacity: 0.55; }
.cookie-notice { position: fixed; z-index: 10000; right: max(1.25rem, env(safe-area-inset-right)); bottom: max(1.25rem, env(safe-area-inset-bottom)); width: min(430px, calc(100vw - 2.5rem)); padding: var(--space-5); border: 1px solid var(--primary-border); border-radius: var(--radius-lg); background: var(--bg-card); box-shadow: var(--shadow-xl); color: var(--text-primary); font-size: 0.86rem; line-height: 1.55; }
.cookie-notice h2 { margin-bottom: var(--space-2); font-size: 1rem; font-weight: 700; }
.cookie-notice p { margin-bottom: var(--space-4); color: var(--text-secondary); }
.cookie-notice__actions { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
@media (max-width: 768px) {
  /* Phones: the notice sits in the page flow after the content, so it never covers text (login, forms). */
  .cookie-notice { position: static; width: auto; margin: var(--space-4); }
  .nav-section-label { display: none; }
  .sidebar.mobile-open .nav-section-label { display: block; padding: 0.75rem 1.55rem 0.25rem; border-top: 1px solid var(--border); }
  .chart-tooltip.at-left { left: 8px; min-width: 0; }
  .chart-tooltip.at-right { right: 8px; min-width: 0; }
}
.note-body { margin: 0 0 0.25rem; color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; }
#noteForm { margin-bottom: var(--space-4); }
/* Notification choices governed by the master switch: dimmed and inert while it is off, so nothing looks chosen. */
fieldset.notify-details, fieldset.notify-details fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.notify-details legend { padding: 0; }
fieldset.notify-details:disabled { opacity: 0.55; cursor: not-allowed; }

/* Sidebar foot: EMS column (sidebar-foot, full-width logout-btn); the organization and language pickers use the
   EMS nav-system-select control. */
.sidebar-identity { display: grid; gap: var(--space-1); min-width: 0; padding: 0 0.8rem; }
.sidebar-identity > a { color: var(--text-secondary); font-size: 0.84rem; font-weight: 600; overflow-wrap: anywhere; text-decoration: none; }
.sidebar-identity > a:hover { color: var(--text-primary); text-decoration: underline; }
.language-control { display: block; }
.language-control--floating { position: fixed; z-index: 30; top: var(--space-4); right: var(--space-4); }


/* Menu: the other open alerts, neutral, after the EMS badge of unacknowledged critical ones. */
.nav-open-count { margin-left: auto; min-width: 1.35rem; height: 1.35rem; padding: 0 0.38rem; display: inline-flex;
  align-items: center; justify-content: center; border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  color: var(--text-muted); font: 700 0.75rem/1 var(--font-mono); }
.nav-event-badge:not([hidden]) + .nav-open-count { margin-left: var(--space-2); }
.sidebar.collapsed .nav-open-count { display: none; }

/* Location filter for push settings (pages.js sitePicker): searchable compact toggles, scrolls past a few rows. */
.site-picker { display: grid; gap: var(--space-2); min-width: 0; margin: 0; padding: 0; border: 0; }
.site-picker__list { display: flex; flex-wrap: wrap; gap: var(--space-2); max-height: 15rem; overflow-y: auto; padding: var(--space-1); }

/* Static pages hold Slovenian source text; in another language it stays hidden until i18n.js has translated it,
   so the page never flashes Slovenian (the server sets <html lang> before any script runs). */
html:not([lang="sl"]):not([data-i18n-ready]) [data-i18n] { visibility: hidden; }

/* Empty-list message inside a wide scrolling table: on phones it stays in the visible part instead of the middle of the table. */
.list-empty { display: block; }
@media (max-width: 768px) {
  .list-empty { position: sticky; left: 0; width: min(100%, calc(100vw - 4.75rem)); }
}

/* Search field in a list's filter bar: two grid columns on wide screens, so its placeholder is not cut off (the EMS
   bar has six fields and gives search the wide last one; portal bars have three to five). */
@media (min-width: 769px) {
  .filters-search { grid-column: span 2; }
}
