:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #16191f;
  --muted: #5d6675;
  --border: #e3e6eb;
  --soft: #f0f2f5;
  --code-bg: #0f1623;
  --code-text: #dfe6f1;
  --code-muted: #8b98ab;
  --ac: #15803d;
  --ac-soft: #e6f4ea;
  --dc: #c2410c;
  --dc-soft: #fdeee6;
  --cloud: #0b7fa6;
  --cloud-soft: #e2f3f9;
  --accent: var(--ac);
  --accent-soft: var(--ac-soft);
  --get: #2563eb;
  --post: #15803d;
  --ok: #15803d;
  --bad: #b91c1c;
  --warn-bg: #fff7e6;
  --warn-text: #8a5a00;
  --radius: 10px;
  --nav-w: 280px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --panel: #151b24;
    --text: #e6eaf0;
    --muted: #97a1b0;
    --border: #273040;
    --soft: #1b2330;
    --code-bg: #0a0f17;
    --ac: #3fbf6a;
    --ac-soft: #13291b;
    --dc: #f08a4b;
    --dc-soft: #2f1a0f;
    --cloud: #4cc3e6;
    --cloud-soft: #0f2630;
    --get: #6aa2ff;
    --post: #3fbf6a;
    --ok: #3fbf6a;
    --bad: #ff6b6b;
    --warn-bg: #2b2210;
    --warn-text: #f0c060;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --panel: #151b24; --text: #e6eaf0; --muted: #97a1b0; --border: #273040; --soft: #1b2330;
  --code-bg: #0a0f17; --ac: #3fbf6a; --ac-soft: #13291b; --dc: #f08a4b; --dc-soft: #2f1a0f;
  --cloud: #4cc3e6; --cloud-soft: #0f2630;
  --get: #6aa2ff; --post: #3fbf6a; --ok: #3fbf6a; --bad: #ff6b6b; --warn-bg: #2b2210; --warn-text: #f0c060;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* anchors land below the sticky header. Not html scroll-padding: with it the browser scrolls the page on every
   keystroke in the header inputs, trying to move their caret out of the padded strip. */
.main [id] { scroll-margin-top: calc(var(--top-h, 112px) + 38px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: .88em; background: var(--soft); padding: .1em .35em; border-radius: 4px; }
pre code { background: none; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 8px 16px; }

.app.prod-ac { --accent: var(--ac); --accent-soft: var(--ac-soft); }
.app.prod-dc { --accent: var(--dc); --accent-soft: var(--dc-soft); }
.app.prod-cloud { --accent: var(--cloud); --accent-soft: var(--cloud-soft); }

.boot { padding: 40px; color: var(--muted); }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: var(--panel); border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-size: 17px; white-space: nowrap; }
.brand b { color: var(--accent); }
/* OnCharger mark (img/logo.svg) drawn in the text colour, so it works on light and dark themes */
.logo { display: inline-block; width: 30px; height: 30px; background: var(--text);
  -webkit-mask: url(img/logo.svg) center / contain no-repeat; mask: url(img/logo.svg) center / contain no-repeat; }
.menu-btn { display: none; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; width: 38px; height: 38px; cursor: pointer; }

.products { display: flex; gap: 8px; margin-left: 8px; }
.prod { display: flex; align-items: center; gap: 8px; border: 2px solid var(--border); background: var(--panel); border-radius: 12px; padding: 4px 14px 4px 6px; cursor: pointer; transition: border-color .15s, background .15s; }
.prod b { display: inline-grid; place-items: center; min-width: 42px; height: 32px; border-radius: 8px; font-size: 18px; letter-spacing: .5px; color: #fff; }
.prod small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.pbtn-ac b { background: var(--ac); }
.pbtn-dc b { background: var(--dc); }
.prod:not(.on) b { opacity: .45; }
.pbtn-ac.on { border-color: var(--ac); background: var(--ac-soft); }
.pbtn-dc.on { border-color: var(--dc); background: var(--dc-soft); }
.prod.on small { color: var(--text); }

.sections, .langs { display: flex; gap: 2px; background: var(--soft); border-radius: 9px; padding: 3px; }
.sections { margin-left: auto; }
.sections button, .langs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; }
.sections button, .langs button { padding: 6px 10px; }
.theme-btn { border: 0; background: transparent; color: var(--muted); width: 28px; height: 28px; padding: 0; border-radius: 7px; cursor: pointer; font-size: 15px; line-height: 1; margin-left: -6px; }
.theme-btn:hover { background: var(--soft); color: var(--text); }
.sections button.on, .langs button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- device bar ---------- */
.devbar { display: flex; align-items: center; gap: 8px; padding: 8px 20px; border-top: 1px solid var(--border); background: var(--soft); flex-wrap: wrap; }
.devbar-title { font-weight: 600; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.devbar input:not([type=checkbox]) { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 6px 10px; min-width: 0; }
.dev-host { width: calc(32ch + 22px); font-family: var(--mono); font-size: 13px; }   /* the whole placeholder (oncharger.local | 192.168.0.100) fits */
.dev-login, .dev-pass { width: 115px; }
.pass-wrap { display: inline-flex; align-items: center; gap: 2px; }
.eye { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; opacity: .55; font-size: 14px; }
.eye.on { opacity: 1; border-color: var(--accent); }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.dev-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.dev-state i { width: 9px; height: 9px; border-radius: 50%; background: #9aa3af; }
.dev-state.st-ok { color: var(--ok); } .dev-state.st-ok i { background: var(--ok); }
.dev-state.st-badcreds, .dev-state.st-unreachable { color: var(--bad); }
.dev-state.st-badcreds i, .dev-state.st-unreachable i { background: var(--bad); }
.dev-state.st-connecting i { background: #d4a017; }
.dev-switch { font-size: 13px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; padding: 6px 12px; cursor: pointer; text-decoration: none; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 4px; }

/* ---------- layout ---------- */
.body { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); }
.nav { position: sticky; top: var(--top-h, 112px); align-self: start; height: calc(100vh - var(--top-h, 112px)); overflow: auto; border-right: 1px solid var(--border); padding: 12px 0 24px; background: var(--panel); }
.search { display: block; width: calc(100% - 24px); margin: 0 12px 10px; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: var(--bg); }
.nav-group { margin-top: 8px; }
.nav-tag { display: block; padding: 6px 16px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-decoration: none; }
.nav-item { display: flex; align-items: baseline; gap: 8px; padding: 5px 16px; color: var(--text); text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.nav-item:hover { background: var(--soft); }
/* active: border and background only; bold text would get wider and wrap a long title to a second line */
.nav-item.on { border-left-color: var(--accent); background: var(--accent-soft); }
.nav-top { font-weight: 600; }
.nav-sub { padding-left: 28px; font-size: 13px; color: var(--muted); }
.nav-sub.on { color: var(--text); }
.nav-item .m { font: 600 10px var(--mono); color: var(--get); min-width: 30px; }
.nav-item .m.post { color: var(--post); }
.nav-dl { margin: 22px 16px 0; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.nav-dl small { color: var(--muted); margin-bottom: 4px; }
.nav-dl a { font-family: var(--mono); }
.nav-local { margin: 22px 16px 0; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.nav-prod { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding: 3px 8px 3px 3px; border: 1px solid var(--border); border-radius: 8px; }
.nav-prod i { font-style: normal; font-weight: 800; font-size: 12px; color: #fff; border-radius: 6px; padding: 2px 7px; }
.np-ac i { background: var(--ac); } .np-dc i { background: var(--dc); }
.np-ac:hover { border-color: var(--ac); background: var(--ac-soft); } .np-dc:hover { border-color: var(--dc); background: var(--dc-soft); }
.nav-badge { margin-left: auto; padding: 1px 6px; background: var(--soft); border-radius: 4px; color: var(--muted); font-size: 10.5px; font-weight: 500; line-height: 16px; white-space: nowrap; }

.main { padding: 24px 32px 60px; min-width: 0; max-width: 1400px; }
.load-error { background: var(--warn-bg); color: var(--warn-text); padding: 10px 14px; border-radius: var(--radius); }

.overview { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px 26px; margin-bottom: 28px; }
.ov-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ov-head h1 { margin: 0; font-size: 26px; }
.prod-chip { color: #fff; font-weight: 800; font-size: 20px; border-radius: 10px; padding: 4px 12px; letter-spacing: .5px; }
.chip-ac { background: var(--ac); } .chip-dc { background: var(--dc); } .chip-cloud { background: var(--cloud); }
.fw { margin-left: auto; color: var(--muted); font-size: 13px; font-family: var(--mono); }
.lead { font-size: 17px; color: var(--muted); margin: 8px 0 4px; }

.md h2 { font-size: 18px; margin: 22px 0 8px; }
.md h3 { font-size: 16px; margin: 18px 0 6px; }
.md table, table.fields { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0 14px; }
.md th, .md td, table.fields th, table.fields td { border-bottom: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.md th, table.fields th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--soft); }
.md p { margin: 6px 0 10px; }
.md ul { padding-left: 20px; margin: 6px 0 10px; }
.table-wrap { overflow-x: auto; }

.tag { margin-top: 36px; }
.tag-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 2px solid var(--accent); padding-bottom: 6px; }
.tag-head h2 { margin: 0; font-size: 22px; }

/* ---------- operation ---------- */
.op { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; margin: 18px 0; padding: 18px 22px; }
.op-head h3 { margin: 6px 0 4px; font-size: 19px; }
.op-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.method { font: 700 12px var(--mono); color: #fff; background: var(--get); border-radius: 6px; padding: 3px 8px; }
.method.post { background: var(--post); }
.op-path { font-size: 14px; background: var(--soft); padding: 3px 8px; }
.op-link { margin-left: auto; font-family: var(--mono); }
.badge { font-size: 12px; border-radius: 999px; padding: 2px 9px; background: var(--soft); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-req { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
a.badge-req { text-decoration: none; } a.badge-req:hover { text-decoration: underline; } /* links to oncharger.com.ua */
.badge-free { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.op-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 24px; margin-top: 10px; }
.op-doc h4 { margin: 18px 0 6px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.f-name code { white-space: nowrap; background: none; padding: 0; font-weight: 600; color: var(--text); }
/* nested names (charger.tariff.days[].prices): one segment per line, indented by depth; the parents are quiet */
table.fields td.f-name code.f-path { display: inline-block; white-space: normal; overflow-wrap: normal; }
.f-seg { display: block; white-space: nowrap; }
.f-pre { color: var(--muted); font-weight: 400; }
/* the type column takes only what it needs (width: 1%), the description gets the rest */
table.fields th.th-type { width: 1%; }
.f-type { font: 12px var(--mono); color: var(--muted); }
.f-type > span:first-child { display: inline-block; min-width: 8.5em; white-space: pre-line; }   /* enum values one per line */
.f-type .unit { display: block; color: var(--accent); white-space: nowrap; }
.f-desc .badge { margin-left: 6px; }
/* /save-timer: two small schedule pictures (x-figure) */
.sched-figs { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 4px; }
.sched-fig { flex: 1 1 240px; margin: 0; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px 10px; background: var(--soft); }
.sched-fig svg { display: block; width: 100%; height: auto; }
.sched-fig figcaption { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.sf-win { fill: var(--accent-soft); }
.sf-edge { stroke: var(--border); stroke-dasharray: 3 3; }
.sf-axis { stroke: var(--border); }
.sf-mid { stroke: var(--muted); }
.sf-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.sf-alt { stroke-dasharray: 5 4; opacity: .6; }
.sf-lbl { fill: var(--text); font: 600 10px var(--mono); }
.sf-tick { fill: var(--muted); font: 10px var(--mono); }
.f-desc .badge-req { font-size: 11px; padding: 0 7px; background: transparent; border-color: currentColor; opacity: .8; } /* field level: quieter than on endpoints */
.enum-list { margin: 4px 0 0; padding-left: 16px; font-size: 13px; color: var(--muted); }
.enum-list code { font-size: 12px; }
.code-pill { font: 600 11px var(--mono); border-radius: 6px; padding: 2px 7px; }
.code-pill.ok { background: var(--accent-soft); color: var(--ok); }
.code-pill.bad { background: #fde8e8; color: var(--bad); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .code-pill.bad { background: #3a1616; } }
:root[data-theme="dark"] .code-pill.bad { background: #3a1616; }

/* ---------- try it ---------- */
.op-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
/* PC, two columns: the right panel ("Try it" and the reply examples) stays next to the field tables with its bottom
   at the bottom of the screen (a tall panel first scrolls until its bottom gets there). --side-h is set by OpView. */
@media (min-width: 1181px) {
  .op-side { position: sticky; align-self: start; top: calc(100vh - var(--side-h, 0px) - 12px); }
}
.tryit { background: var(--code-bg); color: var(--code-text); border-radius: 12px; padding: 14px; }
.tryit-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tryit-title { font-weight: 700; font-size: 14px; }
.tryit-hint { font-size: 12px; color: #f0c060; }
.tryit-params { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.tparam { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 8px; }
.tparam-name code { background: none; color: var(--code-text); padding: 0; }
.tparam-name em { color: #f0a050; font-style: normal; margin-left: 2px; }
.tparam-name small { color: var(--code-muted); }
.tparam-body { grid-template-columns: 1fr; }
.pinput { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pinput input[type=text], .pinput input[type=password], .pinput select, .pinput .num, .tparam textarea {
  background: #1a2433; color: var(--code-text); border: 1px solid #2c3a4f; border-radius: 7px; padding: 5px 8px; min-width: 0; width: 100%;
}
.pinput .num { width: 76px; flex: none; }
.pinput input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.tparam textarea { font: 12px var(--mono); resize: vertical; }
.pinput .val { background: none; color: var(--code-muted); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #3a475b; border-radius: 22px; cursor: pointer; transition: background .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); }
.tryit-url { display: flex; gap: 8px; align-items: flex-start; background: #0a1019; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.tryit-url code { background: none; color: var(--code-text); padding: 0; word-break: break-all; font-size: 12px; }
.tryit-actions { display: flex; gap: 8px; }   /* one row: the side buttons shrink before anything wraps */
.tryit-actions .btn:not(.primary) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tryit-actions .btn:not(.primary) { background: #1a2433; color: var(--code-text); border-color: #2c3a4f; }
.tryit-result { margin-top: 12px; border-top: 1px solid #243045; padding-top: 10px; }
.res-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--code-muted); margin-bottom: 6px; flex-wrap: wrap; }
.res-msg { color: #ff9b9b; margin: 0 0 6px; font-weight: 600; }
.res-hints { margin: 0; padding-left: 18px; font-size: 13px; color: var(--code-text); }
.res-hints li { margin: 3px 0; }
.tryit-result .muted { color: var(--code-muted); }

pre.code { margin: 0; background: #0a1019; color: var(--code-text); border-radius: 8px; padding: 10px 12px; overflow: auto; max-height: 420px; font: 12.5px/1.5 var(--mono); }
.examples { background: var(--code-bg); border-radius: 12px; padding: 10px; }
.ex-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.ex-tab { border: 0; background: transparent; color: var(--code-muted); font-size: 12px; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.ex-tab.on { background: #1f2a3b; color: var(--code-text); }
/* reply codes as tabs (200 | 429): the chosen one bright, the others dimmed */
.code-tab { border: 0; cursor: pointer; opacity: .45; }
.code-tab.on, .code-tab:hover { opacity: 1; }
.ex-head .ex-sep { width: 1px; height: 14px; background: #2c3a4f; margin: 0 2px; }

/* ---------- OCPP doc page ---------- */
.docsec { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px 22px; margin: 18px 0; }
.docsec h2 { margin: 0 0 8px; font-size: 20px; }
.doctable h4 { margin: 14px 0 4px; }
td.col-code { max-width: 290px; }
td.col-code code { white-space: normal; overflow-wrap: break-word; }   /* lists wrap at spaces, a single name stays whole */
td.col-text { min-width: 240px; }
td.col-support { text-align: center; font-weight: 700; width: 70px; }
th.col-support { text-align: center; }
td.sup-yes { color: var(--ok); }
td.sup-no { color: var(--muted); }
td.sup-part { color: var(--warn-text); font-weight: 500; font-size: 12px; }

.foot { margin-top: 40px; color: var(--muted); font-size: 13px; text-align: center; }
.scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .op-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .main [id] { scroll-margin-top: 20px; }
  .top { position: static; }
  .top-row { padding: 10px 16px; gap: 10px 8px; }
  .menu-btn { display: inline-grid; place-items: center; }
  /* phone: row 1 is menu, brand, languages and theme; AC / DC (or the cloud title and YAML button) go below */
  .brand { font-size: 15px; gap: 6px; }
  .langs { margin-left: auto; order: 1; }
  .langs button { padding: 5px 6px; }
  .theme-btn { order: 2; width: 26px; }
  .products { margin-left: 0; order: 3; width: 100%; }
  .prod { flex: 1; min-width: 0; }
  .prod small { overflow: hidden; text-overflow: ellipsis; }
  .badge { white-space: normal; }   /* a long hardware badge wraps instead of widening the page */
  .sections { margin-left: 0; order: 4; }
  .sections button { padding: 6px 8px; }
  .ai { order: 5; margin-left: auto; }
  .ai-btn { padding: 6px 10px; }
  .top-row .cloud-head { display: flex; align-items: center; gap: 8px; order: 3; width: 100%; }   /* beats display: contents below */
  .yaml-btn .lbl-long { display: none; }   /* phone: "For AI", like the button on the AC / DC pages */
  .yaml-btn .lbl-short { display: inline; }
  .cloud-head .cloud-tag { margin-left: 0; }
  /* phone, four short rows: title + address | quick chips | login + password | remember, connect, state */
  .devbar { padding: 8px 16px; gap: 6px 8px; }
  .dev-host { flex: 1 1 150px; width: auto; font-size: 12px; }
  .devbar .chips { flex-basis: 100%; flex-wrap: nowrap; }
  .devbar .chip { padding: 3px 8px; font-size: 11px; white-space: nowrap; }
  .dev-login { flex: 1 1 40%; width: auto; }
  .pass-wrap { flex: 1 1 40%; min-width: 0; }
  .dev-pass { flex: 1; width: auto; min-width: 0; }
  .devbar .btn.primary { margin-left: auto; }
  /* overview head: the product chip and the firmware version in one row, the title under them */
  .ov-head .fw { order: 1; }
  .ov-head h1 { order: 2; flex-basis: 100%; }
  .body { grid-template-columns: minmax(0, 1fr); }
  .nav { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: 86vw; max-width: 320px; z-index: 50; transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .nav.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .main { padding: 16px; }
  .overview, .op, .docsec { padding: 14px 16px; border-radius: 12px; }
  .tparam { grid-template-columns: 1fr; gap: 4px; }
  .md th, .md td, table.fields th, table.fields td { padding: 6px 7px; }
  /* phone: a wide table scrolls inside itself instead of widening the page; long endpoints wrap */
  .md table, table.fields { display: block; max-width: 100%; overflow-x: auto; }
  .md code, table.fields td:not(:first-child) code { overflow-wrap: anywhere; }
  table.fields td:first-child code { white-space: nowrap; }   /* names and statuses stay whole; the table scrolls */
  .tryit-actions { gap: 6px; }
  .tryit-actions .btn { padding: 6px 7px; font-size: 13px; }
}
.common-errs { margin: 14px 0 0; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.common-errs .code-pill { cursor: help; }

/* ---------- host chips, LAN scan ---------- */
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 3px 10px; font: 12px var(--mono); cursor: pointer; color: var(--muted); }
.chip:hover, .chip.on { border-color: var(--accent); color: var(--accent); }
.chip-find { font-family: var(--font); font-weight: 600; }
.scanbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 20px; border-top: 1px dashed var(--border); background: var(--soft); font-size: 13px; }
.scan-subnet { width: 110px; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 5px 8px; font: 13px var(--mono); }
.scan-prog { width: 120px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.scan-prog i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.found { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.found code { background: none; padding: 0; font-weight: 600; }
.found b { color: #fff; border-radius: 4px; padding: 0 5px; font-size: 11px; }
.found .fp-ac { background: var(--ac); } .found .fp-dc { background: var(--dc); }
.found small { color: var(--muted); }
.scan-hint { flex-basis: 100%; }

/* ---------- AI menu ---------- */
.ai { position: relative; }
.ai-btn { border: 1px solid var(--border); background: var(--panel); border-radius: 9px; padding: 6px 12px; cursor: pointer; font-weight: 600; color: #7c3aed; }
.ai-btn:hover, .ai-btn.on { border-color: #7c3aed; background: #f5f0ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ai-btn { color: #b794f6; } :root:not([data-theme="light"]) .ai-btn.on, :root:not([data-theme="light"]) .ai-btn:hover { background: #241a38; border-color: #b794f6; } }
:root[data-theme="dark"] .ai-btn { color: #b794f6; } :root[data-theme="dark"] .ai-btn.on, :root[data-theme="dark"] .ai-btn:hover { background: #241a38; border-color: #b794f6; }
.ai-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 14px 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.ai-pop p { margin: 0; }
.ai-pop ul { margin: 2px 0; padding-left: 18px; }
.ai-pop li { margin: 3px 0; }
.ai-pop li a { font-family: var(--mono); font-size: 13px; }
.ai-pop li small { color: var(--muted); }
.ai-pop .btn { justify-content: center; }
@media (max-width: 900px) {
  .ai-pop { position: fixed; left: 16px; right: 16px; top: 64px; width: auto; }
  .scanbar { padding: 8px 16px; }
}

/* ---------- code in markdown, OCPP examples ---------- */
.md pre { background: var(--code-bg); color: var(--code-text); border-radius: 8px; padding: 10px 12px; overflow: auto; font: 12.5px/1.5 var(--mono); }
.md pre code { background: none; color: inherit; padding: 0; }
.docex { margin-top: 14px; background: var(--code-bg); border-radius: 12px; padding: 10px; }
.docex-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; color: var(--code-text); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.docex-head .link { color: #8fb8ff; }
.docex pre.code { white-space: pre; }

/* ---------- x-cta: small "get this charger" link-button ---------- */
.cta { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.cta:hover { background: var(--accent); color: #fff; }
.docsec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.docsec-head h2 { margin: 0; }
@media (max-width: 900px) { .cta { margin-left: 0; white-space: normal; } }

/* ---------- firmware update bar ---------- */
.fwbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 20px; border-top: 1px solid var(--border); background: var(--warn-bg); color: var(--warn-text); font-size: 13px; }
.fwbar small { color: var(--warn-text); opacity: .85; }
.fwbar.fw-done, .fwbar.fw-unknown { background: var(--accent-soft); color: var(--text); }
.fwbar.fw-error code { background: transparent; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) { .fwbar { padding: 8px 16px; } }

/* ---------- small variant switch in example windows (e.g. A | W) ---------- */
.docex-tools { display: inline-flex; align-items: center; gap: 10px; }
.vswitch { display: inline-flex; background: #1a2433; border: 1px solid #2c3a4f; border-radius: 6px; padding: 1px; }
.vswitch button { border: 0; background: transparent; color: var(--code-muted); font: 600 11px var(--mono); padding: 2px 8px; border-radius: 5px; cursor: pointer; }
.vswitch button.on { background: #2c3a4f; color: var(--code-text); }

/* endpoint names in text that link to their description */
a.oplink { text-decoration: none; }
a.oplink code { color: var(--accent); border-bottom: 1px dotted var(--accent); }
a.oplink:hover code { background: var(--accent-soft); }

/* ---------- cloud page (#/cloud): public stations API, no button in the header ---------- */
.lbl-short { display: none; }
.cloud-head { display: contents; }   /* PC: its two items sit in the header row; phone: their own row */
.cloud-tag { margin-left: 8px; padding: 5px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 700; white-space: nowrap; }
.yaml-btn { margin-left: auto; text-decoration: none; white-space: nowrap; }
.overview h2.code-h { font-size: 18px; margin: 26px 0 4px; }
.cloud-ai { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0 6px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent-soft); }
.cloud-ai-text { flex: 1 1 320px; }
.cloud-ai-title { display: block; margin-bottom: 2px; }
.cloud-ai-url { flex-basis: 100%; order: 3; overflow-wrap: anywhere; background: var(--panel); }
.cloud-ai-btns { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.cloud-ai .btn { text-decoration: none; }
/* copy buttons: "Copy" and "Copied" share one cell, so the button keeps its size */
.swap { display: inline-grid; justify-items: center; }
.swap > span { grid-area: 1 / 1; }
.swap > .off { visibility: hidden; }
.op-link .swap { justify-items: end; }

/* very narrow phones (320 px): the language switch and theme are scaled down so they stay in row 1; the chips may wrap */
@media (max-width: 359px) {
  .langs, .theme-btn { zoom: .85; }
  .menu-btn { width: 34px; height: 34px; }
  .brand { font-size: 14px; }
  .top-row { column-gap: 6px; }
  .devbar .chips { flex-wrap: wrap; }
  .cloud-tag { padding: 5px 10px; }
  .prod { gap: 6px; padding: 4px 8px 4px 4px; }
}

/* scrollbars inside the dark code blocks: thin and dark, so they don't stand out against the code */
pre.code, .md pre, .tryit-url, .docex pre { scrollbar-width: thin; scrollbar-color: #2c3a4f transparent; }
pre.code::-webkit-scrollbar, .md pre::-webkit-scrollbar, .tryit-url::-webkit-scrollbar { width: 6px; height: 6px; }
pre.code::-webkit-scrollbar-thumb, .md pre::-webkit-scrollbar-thumb, .tryit-url::-webkit-scrollbar-thumb { background: #2c3a4f; border-radius: 6px; }
pre.code::-webkit-scrollbar-thumb:hover, .md pre::-webkit-scrollbar-thumb:hover, .tryit-url::-webkit-scrollbar-thumb:hover { background: #3d4f6b; }
pre.code::-webkit-scrollbar-track, .md pre::-webkit-scrollbar-track, .tryit-url::-webkit-scrollbar-track,
pre.code::-webkit-scrollbar-corner, .md pre::-webkit-scrollbar-corner, .tryit-url::-webkit-scrollbar-corner { background: transparent; }

/* JSON in code blocks: quiet colours, only enough to tell the kinds of values apart */
.j-key { color: #9fb6cf; }
.j-str { color: #a7c8a0; }
.j-num { color: #d8bc8f; }
.j-bool, .j-null { color: #bba6d6; }
/* folding in JSON: a small − / + in the indentation in front of a nested object or array (it takes no width) */
.j-tog { display: inline-block; width: 1.4ch; margin-left: -1.8ch; margin-right: .4ch; text-align: center; color: var(--code-muted); opacity: .45; cursor: pointer; user-select: none; }
.j-tog::before { content: '\2212'; }
.j-tog:hover { opacity: 1; color: var(--code-text); }
.j-closed > .j-tog::before { content: '+'; }
.j-more { display: none; color: var(--code-muted); cursor: pointer; padding: 0 2px; }
.j-more:hover { color: var(--code-text); }
.j-cnt { font-style: normal; font-size: .85em; opacity: .75; margin-left: 2px; }
.j-closed > .j-body { display: none; }
.j-closed > .j-more { display: inline; }
