/* Solar Monitor app, app.solarmonitor.ge. Colours and type follow solarmonitor.ge. */

@font-face { font-family: "FiraGO"; src: url("/fonts/firago-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "FiraGO"; src: url("/fonts/firago-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "FiraGO"; src: url("/fonts/firago-semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "FiraGO"; src: url("/fonts/firago-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --cell: #10244A;
  --cell-deep: #0A1833;
  --sun: #F5B324;
  --sun-soft: #FFE7AE;
  --leaf: #2E9B6A;
  --amber: #E0892B;
  --danger: #C2412D;
  --sky: #F1F4F8;
  --paper: #FFFFFF;
  --ink: #0F1B2E;
  --muted: #4F5E76;
  --rule: #D6DEE9;
  --on-cell: #E9EEF7;
  --on-cell-muted: #A9B7CF;
  --radius: 10px;
  --gutter: clamp(14px, 3vw, 32px);
  --font: "FiraGO", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--sky); color: var(--ink);
  font-family: var(--font); font-size: 1rem; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 600; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 4px; }
.noscript { padding: 40px; text-align: center; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 40px; padding: .45em 1.1em;
  border-radius: 999px; border: 2px solid transparent;
  font-weight: 600; font-size: .95rem; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  background: var(--paper); border-color: var(--rule); color: var(--ink);
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn-sun { background: var(--sun); border-color: transparent; }
.btn-sun:hover { background: var(--sun-soft); border-color: transparent; }
.btn-ink { background: var(--ink); color: var(--paper); border-color: transparent; }
.btn-ink:hover { background: var(--cell); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-small { min-height: 32px; padding: .25em .8em; font-size: .85rem; }
.btn[disabled] { opacity: .6; cursor: default; }

/* ---------- Header ---------- */

.top { background: var(--cell); color: var(--on-cell); }
.top-in {
  display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap;
  padding: 10px var(--gutter); max-width: 1400px; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.1rem; text-decoration: none; color: var(--paper); }
.brand svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-right: auto; }
.nav a {
  padding: 6px 12px; border-radius: 999px; text-decoration: none;
  color: var(--on-cell-muted); font-weight: 500; font-size: .95rem;
}
.nav a:hover { color: var(--paper); }
.nav a.on { background: rgba(233, 238, 247, .12); color: var(--paper); }
.top-user { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--on-cell-muted); }
.user { position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 3px 10px 3px 3px;
  background: none; border: 1px solid rgba(233, 238, 247, .3); color: var(--on-cell);
  border-radius: 999px; cursor: pointer; font: inherit; font-size: .88rem; font-weight: 500;
}
.user-btn:hover, .user-btn[aria-expanded="true"], .user-btn.on { border-color: var(--on-cell); background: rgba(233, 238, 247, .08); }
.avatar {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--sun); color: var(--ink); font-weight: 600; font-size: .85rem; flex: none;
}
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .7; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(10, 24, 51, .18); padding: 6px; display: grid;
}
.user-menu-who { display: grid; gap: 2px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--rule); font-size: .85rem; }
.user-menu-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-who span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu a, .user-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 7px;
  background: none; color: var(--ink); font: inherit; font-size: .92rem; text-decoration: none; cursor: pointer;
}
.user-menu a:hover, .user-menu button:hover { background: var(--sky); }

.langs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(233, 238, 247, 0.07); }
.top-user .lang-opt, .lang-opt {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 34px; padding: 4px 10px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font-size: 0.88rem; font-weight: 500; line-height: 1;
  color: var(--on-cell-muted);
}
.top-user .lang-opt:hover, .lang-opt:hover { color: var(--on-cell); background: rgba(233, 238, 247, 0.08); }
.top-user .lang-opt.is-current, .lang-opt.is-current { color: var(--on-cell); background: rgba(233, 238, 247, 0.16); }
.flag { display: inline-flex; width: 21px; height: 14px; border-radius: 3px; overflow: hidden; flex: none; box-shadow: 0 0 0 1px rgba(233, 238, 247, 0.25); }
.flag svg { width: 100%; height: 100%; }
.login .langs { background: var(--cell); }
@media (max-width: 760px) {
  .lang-code { display: none; }
  .lang-opt { padding: 4px 7px; }
}

main { max-width: 1400px; margin: 0 auto; padding: 22px var(--gutter) 60px; }

/* ---------- Login ---------- */

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--cell); }
.login {
  width: min(100%, 400px); background: var(--paper); border-radius: 16px; padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(4, 12, 30, .4);
}
.login .brand { color: var(--ink); margin-bottom: 22px; font-size: 1.25rem; }
.login .brand svg { width: 36px; height: 36px; }
.login h1 { font-size: 1.15rem; margin-bottom: 16px; }
.login .btn { width: 100%; margin-top: 6px; }
.login-foot { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--muted); }
.login-foot button { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; }

/* ---------- Forms ---------- */

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number],
.field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper);
}
.field textarea { min-height: 84px; resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; }
.field input.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; }
.field small { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; }
.checks { display: grid; gap: 6px; max-height: 190px; overflow: auto; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.check input { width: 17px; height: 17px; accent-color: var(--cell); }
.error { color: var(--danger); font-size: .9rem; margin: 4px 0 12px; }
.note { color: var(--muted); font-size: .9rem; }

dialog {
  border: 0; border-radius: 14px; padding: 0; width: min(94vw, 520px); max-height: 92vh;
  box-shadow: 0 20px 60px rgba(4, 12, 30, .35); color: var(--ink);
}
dialog::backdrop { background: rgba(10, 24, 51, .55); }
dialog form { padding: 24px; }
dialog h2 { font-size: 1.15rem; margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.preview { margin: -4px 0 14px; padding: 10px 12px; background: var(--sky); border-radius: 8px; font-size: .85rem; max-height: 150px; overflow: auto; }
.preview code { display: block; }

/* ---------- Dashboard ---------- */

.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.bar h1 { font-size: 1.35rem; margin-right: auto; }
.bar select { padding: 8px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); font-weight: 500; }
.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: .9rem; color: var(--muted); }
.seg button.on { background: var(--cell); color: var(--paper); }
.updated { font-size: .8rem; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card h3 { font-size: .9rem; font-weight: 500; color: var(--muted); }
.stat-value { font-size: 2rem; font-weight: 600; line-height: 1.2; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stats .card h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat-range { padding: 1px 8px; border-radius: 999px; background: var(--rule); font-size: .75rem; font-weight: 500; white-space: nowrap; }
.stat-value small { font-size: .5em; font-weight: 500; color: var(--muted); margin-left: .3em; }
.stats .card:first-child { background: var(--cell); border-color: var(--cell); color: var(--paper); }
.stats .card:first-child h3 { color: var(--on-cell-muted); }
.stats .card:first-child .stat-value { color: var(--sun); }
.stats .card:first-child .stat-value small { color: var(--on-cell-muted); }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 14px; }
.chart-card h3 { margin-bottom: 10px; }
.chart { min-height: 280px; position: relative; }
.chart-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; text-align: center; padding: 20px; }
.u-legend { font-size: .8rem; text-align: left; font-family: var(--font); }
.u-legend .u-series > * { padding: 2px 4px; }
.u-legend.u-inline { display: block; width: 100%; margin: 8px 0 0; }
.u-legend.u-inline tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 16px; }
.u-legend.u-inline .u-series { display: flex; align-items: center; min-width: 0; margin: 0; }
.u-legend.u-inline .u-series:first-child { grid-column: 1 / -1; }
.u-legend.u-inline .u-series th, .u-legend.u-inline .u-series td { border: 0; }
.u-legend.u-inline .u-series th { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; white-space: nowrap; }
.u-legend.u-inline .u-series .u-label { overflow: hidden; text-overflow: ellipsis; }
.u-legend.u-inline .u-series .u-value { flex: 1 0 auto; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.u-legend.u-inline .u-series:first-child .u-value { flex: 0 0 auto; text-align: left; }

.empty { background: var(--paper); border: 1px dashed var(--rule); border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 1.1rem; margin-bottom: 6px; }

/* ---------- Admin ---------- */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--rule); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-color: var(--sun); }
.table-wrap { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: .8rem; font-weight: 600; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td code, .code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .82rem; display: inline-block; max-width: 100%; min-width: 10ch; overflow-wrap: anywhere; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--sky); color: var(--muted); white-space: nowrap; }
.tag-admin { background: var(--sun-soft); color: #6b4a00; }
.tag-manager { background: #DCEBFF; color: #1E4D9A; }
.tag-up { background: #DDF3E8; color: #1c6a47; }
.tag-down { background: #FBE3DE; color: var(--danger); }
.tag-off { background: #E9ECF1; color: var(--muted); }
.tag-comm { background: #DCEBFF; color: #1E4D9A; }
.help { margin-top: 16px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); font-size: .9rem; color: var(--muted); }
.help pre { margin: 10px 0 0; padding: 12px; background: var(--cell-deep); color: var(--on-cell); border-radius: 8px; overflow-x: auto; font-size: .8rem; }
.narrow { max-width: 480px; }
.narrow .card { margin-bottom: 14px; }
.narrow h2 { font-size: 1.05rem; margin-bottom: 14px; }
.ok { color: var(--leaf); font-size: .9rem; margin: 4px 0 12px; }

@media (max-width: 600px) {
  .stat-value { font-size: 1.6rem; }
  .user-name { display: none; }
  .user-btn { padding-right: 8px; }
  .user-menu { left: 0; right: auto; }
  .seg { max-width: 100%; overflow-x: auto; }
  .seg button { padding: 5px 10px; white-space: nowrap; }
}
.login-foot .lang-opt { padding: 4px 10px; color: var(--on-cell-muted); text-decoration: none; }
.login-foot .lang-opt.is-current { color: var(--on-cell); }

/* ---------- Device log ---------- */

.filters { margin-top: -6px; }
.filters label { font-size: .85rem; color: var(--muted); }
.bar input[type=date], .bar input[type=search] {
  padding: 7px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper);
  font: inherit; font-size: .9rem; color: var(--ink);
}
.bar a.btn { text-decoration: none; }
.logs td { font-size: .9rem; }
.logs td.when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.logs .muted, td .muted { color: var(--muted); font-size: .82rem; }
.more { display: flex; justify-content: center; margin-top: 14px; }

/* ---------- Kiosk ---------- */

body.kiosk { --cell-deep: #1B1D21; --cell: #272A30; --on-cell: #E8EAED; --on-cell-muted: #9BA1AA; --k-line: rgba(255, 255, 255, .12); --k-sun: var(--sun); background: var(--cell-deep); color: var(--on-cell); }
body.kiosk.k-light { --cell-deep: #F2F4F7; --cell: #FFFFFF; --on-cell: #1B2430; --on-cell-muted: #5B6675; --k-line: rgba(20, 32, 54, .16); --k-sun: #B97D00; }
body.kiosk .brand { color: var(--on-cell); }
.k-page { --g: 180px; min-height: 100vh; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.k-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.k-top select {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--k-line);
  background: var(--k-line); color: var(--on-cell); font: inherit; font-size: .9rem;
}
.k-top select option { color: var(--ink); }
.k-clock { margin-left: auto; color: var(--on-cell-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.k-btn {
  padding: 5px 14px; border-radius: 999px; border: 1px solid var(--k-line); background: none;
  color: var(--on-cell); font: inherit; font-size: .85rem; cursor: pointer; text-decoration: none;
}
.k-btn:hover { border-color: var(--on-cell); }
.k-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.k-kpi, .k-station { background: var(--cell); border: 1px solid var(--k-line); border-radius: var(--radius); min-width: 0; }
.k-kpi { padding: 12px 16px; }
.k-kpi h3 { font-size: .8rem; font-weight: 500; color: var(--on-cell-muted); }
.k-kpi b { display: block; font-size: clamp(1.4rem, 2.5vw, 2.4rem); font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-kpi b small { font-size: .45em; font-weight: 500; color: var(--on-cell-muted); margin-left: .35em; }
.k-kpi.sun b { color: var(--k-sun); }
.k-kpi.warn b { color: #E08A2E; }
.k-kpi.bad b { color: #E5533A; }
.k-grid { display: flex; flex-wrap: wrap; gap: 12px; flex: 1; align-content: flex-start; }
.k-station { padding: 10px 12px 12px; }
.k-station header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 4px; }
.k-station h2 { flex: 1 1 auto; max-width: 100%; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-station header span { color: var(--on-cell-muted); font-size: .82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.k-sensor { flex: 1 1 100%; }
/* serial numbers differ at the end, so long names are cut at the start */
.k-sensor .k-name { direction: rtl; }
.k-name span { direction: ltr; unicode-bidi: embed; }
.k-sensor .k-name, .k-sensor .k-sub { overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.k-gauges { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: space-around; }
.k-gauge { width: var(--g); position: relative; text-align: center; }
.k-gauge svg.g { display: block; width: 100%; }
.g-track, .g-value { fill: none; stroke-width: 8; stroke-linecap: round; }
.g-track { stroke: var(--k-line); }
.k-val { position: absolute; left: 0; right: 0; top: calc(var(--g) * .36); font-size: calc(var(--g) * .17); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.k-val small { display: block; margin-top: .3em; font-size: .45em; font-weight: 500; color: var(--on-cell-muted); }
.k-name { margin-top: calc(var(--g) * -.05); font-size: clamp(.68rem, calc(var(--g) * .075), .9rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-sub { font-size: clamp(.62rem, calc(var(--g) * .065), .78rem); color: var(--on-cell-muted); white-space: nowrap; }
.k-spark { display: block; width: 86%; height: calc(var(--g) * .13); margin: 3px auto 0; }
.k-gauge.off { opacity: .5; }
.k-msg { margin: auto; color: var(--on-cell-muted); }
@media (max-width: 800px) { .k-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* kiosk pages: tiles and small charts */
.k-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--k-line); }
.k-tabs button { padding: 4px 12px; border: 0; border-radius: 999px; background: none; color: var(--on-cell-muted); font: inherit; font-size: .85rem; cursor: pointer; }
.k-tabs button.on { background: var(--k-line); color: var(--on-cell); }
.k-btn.on { border-color: var(--k-sun); color: var(--k-sun); }
.k-tiles { display: grid; grid-template-columns: repeat(var(--cols, 8), minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .k-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.k-tile, .k-status { min-width: 0; border: 1px solid var(--k-line); border-radius: 10px; padding: 5px 8px 6px; }
.k-tile.off { opacity: .5; }
.k-tile-head { display: flex; flex-direction: row; align-items: baseline; gap: 6px; min-width: 0; line-height: 1.25; }
.k-tile-head b { flex: 0 1 auto; max-width: 64%; }
.k-tile-head small { flex: 1 1 0; min-width: 0; }
.k-tile-head b { font-size: clamp(.66rem, calc(var(--g) * .075), .85rem); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
.k-tile-head b span { direction: ltr; unicode-bidi: embed; }
.k-tile-head small { font-size: clamp(.6rem, calc(var(--g) * .062), .74rem); color: var(--on-cell-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-phases { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: 2px; line-height: 1.2; }
.k-phases small { display: block; font-size: .68rem; color: var(--on-cell-muted); }
.k-phases b { font-size: clamp(.8rem, calc(var(--g) * .11), 1.3rem); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.k-phases i, .k-big i { font-style: normal; font-size: .62em; margin-left: .15em; }
.k-status p { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; padding: 3px; border-radius: 7px; font-weight: 600; font-size: clamp(.7rem, calc(var(--g) * .08), .95rem); color: #fff; }
.k-status p i { width: .7em; height: .7em; border-radius: 50%; background: #fff; }
.k-status.on p { background: #1E8E4A; }
.k-status.down p { background: #C2412D; }
.k-dc { position: relative; overflow: hidden; }
.k-dcspark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 55%; pointer-events: none; }
.k-big { position: relative; text-align: center; font-size: clamp(1rem, calc(var(--g) * .16), 1.8rem); font-weight: 600; color: #2BB5A0; font-variant-numeric: tabular-nums; }
.k-share { position: relative; display: block; text-align: center; font-size: .68rem; color: var(--on-cell-muted); }
.k-plot { position: relative; margin-top: 4px; height: calc(var(--g) * .62); }
.k-plot > div, .k-chart-svg { width: 100%; height: 100%; display: block; }
.k-grid-line { stroke: var(--k-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.k-ymax { position: absolute; left: 2px; top: -2px; font-size: .62rem; color: var(--on-cell-muted); font-variant-numeric: tabular-nums; }
.k-ticks { display: flex; justify-content: space-between; font-size: .58rem; color: var(--on-cell-muted); font-variant-numeric: tabular-nums; }
.k-legend { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 4px; font-size: .6rem; color: var(--on-cell-muted); white-space: nowrap; overflow: hidden; }
.k-legend i { display: inline-block; width: 8px; height: 3px; margin-right: 3px; vertical-align: middle; }
.k-legend b { color: var(--on-cell); font-weight: 500; font-variant-numeric: tabular-nums; }

/* watermark on every chart */
.wm { position: absolute; right: 4px; bottom: 2px; font-size: .62rem; font-weight: 600; letter-spacing: .02em; opacity: .38; pointer-events: none; color: var(--on-cell-muted); }
.chart-card { position: relative; }
.chart-card > .wm { right: 16px; bottom: 10px; font-size: .75rem; color: var(--muted); }
.k-status .k-tile-head { flex-direction: column; gap: 0; }
.k-status .k-tile-head b { max-width: 100%; }

.k-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 30px; padding: 0; }
.k-icon svg { width: 16px; height: 16px; }
.k-top { flex-wrap: nowrap; }
.k-top .brand span { white-space: nowrap; }
.k-top .k-btn, .k-tabs button { white-space: nowrap; }
.k-top .langs { flex: none; }
body.kiosk.k-light .langs { background: var(--k-line); }
body.kiosk.k-light .lang-opt { color: var(--on-cell-muted); }
body.kiosk.k-light .lang-opt.is-current { color: var(--on-cell); background: rgba(20, 32, 54, .1); }
.k-kpis[hidden] { display: none; }
@media (max-width: 1100px) { .k-top { flex-wrap: wrap; } }

/* ---------- Manage inverter ---------- */

.warn-box { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius); background: #FFF4DC; border: 1px solid #F2D58C; color: #6b4a00; font-size: .9rem; }
dialog .warn-box { margin: 4px 0 14px; }
h2.sub { font-size: 1.1rem; margin: 28px 0 12px; }
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
.empty-row { padding: 18px; color: var(--muted); }

/* ---------- Admin layout: sidebar with sections ---------- */

.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.admin-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.company-pick-wrap { display: block; }
.company-pick-wrap > span { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin: 0 0 4px 2px; text-transform: uppercase; letter-spacing: .04em; }
.company-pick { width: 100%; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); font-weight: 600; }
.admin-nav { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 6px; }
.admin-nav a { padding: 9px 12px; border-radius: 7px; text-decoration: none; color: var(--muted); font-weight: 500; }
.admin-nav a:hover { color: var(--ink); background: var(--sky); }
.admin-nav a.on { color: var(--ink); background: var(--sun-soft); }
.admin-main { min-width: 0; }
.bot-card { margin-bottom: 16px; }
.bot-card h3 { margin-bottom: 6px; }
@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side { position: static; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .admin-nav a { padding: 7px 11px; font-size: .92rem; }
}
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chat-list { margin-top: 12px; }
.chat-list .table-wrap { border-radius: 8px; }
.phrase-search { max-width: 320px; }
.compare-card { margin-top: 14px; padding: 18px 20px; }
.compare-card h3 { margin-bottom: 4px; }
.compare-note { font-size: .85rem; margin-bottom: 12px; }
.table-wrap.plain { border: 0; border-radius: 0; background: none; }
.row-low td { background: #FFF1EE; }
.row-low td:first-child { font-weight: 600; color: var(--danger); }

/* ---------- Plants ---------- */
.plant-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.plant-summary > div { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 16px; }
.plant-summary span, .plant-numbers span { display: block; font-size: .8rem; color: var(--muted); }
.plant-summary b { font-size: 1.35rem; font-weight: 600; }
.plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.plant-card { display: grid; gap: 8px; border-left: 4px solid var(--leaf); }
.plant-card.plant-offline { border-left-color: var(--danger); }
.plant-card.plant-alarm, .plant-card.plant-behind { border-left-color: var(--amber); }
.plant-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.plant-card h3 { font-size: 1.05rem; font-weight: 600; margin: 0; color: var(--ink); }
.plant-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.plant-place, .plant-seen { font-size: .82rem; margin: 0; }
.plant-numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.plant-numbers b { font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.plant-expect { margin: 0; font-size: .9rem; }
.plant-expect .good { color: var(--leaf); }
.plant-expect .warn { color: var(--amber); }
.plant-expect .bad { color: var(--danger); }
.tag-warn { background: #FFE9D6; color: #8A4A0B; text-decoration: none; }
.company-cell { display: flex; align-items: center; gap: 8px; }
.company-logo { height: 28px; max-width: 90px; object-fit: contain; }
.partner-logo { height: 30px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px 6px; }

/* ---------- Report and printing ---------- */
.report-period { margin: -8px 0 14px; }
.report h2.sub { margin: 22px 0 10px; }
@media print {
  .top, .no-print, .admin-side { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .card, .table-wrap, .plant-summary > div { break-inside: avoid; box-shadow: none; }
  .table-wrap { overflow: visible; }
  a.btn, button { display: none !important; }
}

/* ---------- Map ---------- */
.map-box { height: min(72vh, 680px); border-radius: var(--radius); border: 1px solid var(--rule); overflow: hidden; background: #D5E6F3; }
.map-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: .85rem; color: var(--muted); }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.map-missing { margin-top: 6px; }
.map-pin { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.map-pin img, .map-pin .map-dot { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--leaf); background: #fff; object-fit: contain; box-shadow: 0 2px 6px rgba(10, 24, 51, .25); }
.map-pin .map-dot { background: var(--sun); }
.map-pin.map-alarm img, .map-pin.map-alarm .map-dot { border-color: var(--amber); }
.map-pin.map-offline img, .map-pin.map-offline .map-dot { border-color: var(--danger); }
.map-pin-text { font-size: .72rem; font-weight: 600; color: var(--ink); background: rgba(255, 255, 255, .85); border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.map-popup { display: grid; gap: 3px; font-size: .85rem; font-family: var(--font); }
.map-popup b { font-size: .95rem; }
.map-status { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
