/* M2PRO B.V. | Author Codex | VECS portal presentation.
 * VECS Legenda 2026: brand colors, full logo and Myriad Pro preference.
 * Maintenance context below. */
:root {
    --ink: #282d3c;
    --muted: #62636b;
    --purple: #5f0c52;
    --green: #a9b41a;
    --line: #e6e8ee;
    --surface: #fff;
    --bg: #f5f5f5;
    --teal: #28836c;
    --blue: #28758c;
    --amber: #ad7416;
    font-family: "Myriad Pro", "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-variant-numeric: tabular-nums;
}
.inventory-search {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
}
.inventory-search input { width: min(100%, 360px); }
.inventory-pages {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin: 24px 0;
}
/* Inventory context 2026-11-09: compact search/paging keeps cards dominant. */
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 3px solid var(--purple);
    outline-offset: 3px;
}
.topbar {
    min-height: 88px;
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 16px max(28px, calc((100vw - 1600px) / 2));
    background: var(--surface);
    border-bottom: 3px solid var(--green);
    flex-wrap: wrap;
}
.brand { display: flex; flex: 0 0 auto; align-items: center; }
.brand-logo { display: block; width: 220px; height: auto; object-fit: contain; }
nav { display: flex; gap: 32px; font-size: 14px; font-weight: 600; }
nav a { padding: 12px 0; }
.identity { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 13px; }
.identity small { display: block; color: var(--muted); margin-top: 4px; }
main { max-width: 1664px; margin: auto; padding: 36px 32px 22px; }
h1 { font-size: 32px; font-weight: 650; letter-spacing: -1px; margin: 0 0 7px; }
h2 { font-size: 22px; font-weight: 600; }
h1, h2, h3 { color: var(--purple); }
.eyebrow { font-size: 10px; letter-spacing: 1.7px; font-weight: 700; color: var(--muted); }
.muted { color: var(--muted); font-size: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; margin-top: 28px; }
.card, .panel { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 25px; }
.card { border-top: 3px solid var(--purple); }
.card small { color: var(--muted); }
.card span { color: var(--purple); font-size: 13px; }
.panel { margin-top: 25px; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 65vw; font-family: inherit; margin: 0; }
.login { max-width: 460px; margin: 8vh auto; }
label { display: block; margin-top: 20px; font-size: 13px; }
input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 7px; margin-top: 8px; }
button { background: var(--purple); color: white; border: 0; border-radius: 7px; padding: 10px 17px; cursor: pointer; }
.login button { margin-top: 24px; width: 100%; }
.secondary { background: white; color: var(--muted); border: 1px solid var(--line); }
@media (max-width: 650px) {
    .topbar { flex-wrap: wrap; gap: 16px; padding: 17px 20px; }
    nav { order: 3; width: 100%; font-size: 12px; }
    .identity { gap: 10px; font-size: 11px; }
    main { padding: 25px 16px; }
    h1 { font-size: 26px; }
    .cards { grid-template-columns: 1fr; }
    .panel { padding: 17px; }
}
/* M2PRO FILE CONTEXT: reviewed 2026-11-12. Branding follows Legenda 2026:
 * HEX colors take precedence over conflicting purple RGB notation in the PDF.
 * Myriad Pro is preferred locally; no licensed webfont binary is supplied.
 * Full unmodified logo includes its tagline. Semantic warning/error and chart
 * colors remain distinct; green is an accent, not small text on white.
 * Historical 2026-11-09 Chrome review does not validate subsequent changes. */

/* Compact status keeps measurements together without empty fixed-height panels. */
.device-summary { margin: 12px 0 18px; font-size: 14px; line-height: 1.5; }
.device-summary p { margin: 5px 0; }
.device-summary small { display: block; font-size: 11px; }
.device-summary .connection { color: var(--purple); }
.device-summary .readings { font-size: 16px; }
.device-summary .status-error { color: #a32d30; font-weight: 600; }
.device-serial { font-size: 12px; overflow-wrap: anywhere; }
.status-time { margin-top: 6px; }
/* M2PRO context 2026-11-09: responsive energy/CCS graphics; no fixed viewport
 * height. Charts and system diagrams receive most space, diagnostics collapse. */
.detail-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin: 20px 0; font-size: 13px; }
.detail-toolbar span { margin-left: auto; color: var(--muted); }
.energy-panel, .charging-panel, .history-chart { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-top: 20px; }
.visual-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.visual-heading h2 { margin: 5px 0 10px; }
.visual-heading span, .visual-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.energy-flow { width: 100%; max-height: 570px; margin: 20px 0 0; }
.flow-lines path { fill: none; stroke: #c9c2d4; stroke-width: 3; stroke-dasharray: 7 7; }
.flow-node rect { fill: #fafbfe; stroke: #e0e4ed; stroke-width: 1.3; }
.flow-node.solar rect { fill: #fffaf0; stroke: #ecdfba; }
.flow-node.battery rect { fill: #f5faf7; stroke: #cbded3; }
.flow-icon { fill: none; stroke: #738195; stroke-width: 2; stroke-linecap: round; }
.node-label { fill: #33445c; font-size: 15px; font-weight: 600; }
.node-value { fill: #263a54; font-size: 35px; font-weight: 650; }
.node-unit { fill: #7d8798; font-size: 17px; font-weight: 400; }
.node-note { fill: #7d8798; font-size: 11px; }
.flow-hub circle { fill: var(--purple); stroke: #f2e8ef; stroke-width: 12; }
.hub-label { fill: white; font-size: 23px; font-weight: 650; text-anchor: middle; }
.hub-note { fill: #f0dfeb; font-size: 11px; text-anchor: middle; }
.charge-overview { display: grid; grid-template-columns: 1.6fr 1fr; align-items: center; gap: 28px; }
.charge-illustration { width: 100%; }
.charger-body { fill: #f1edf5; stroke: #b9acbe; stroke-width: 2; }
.charger-screen { fill: var(--purple); }
.charge-bolt { fill: white; }
.charge-cable { fill: none; stroke: var(--purple); stroke-width: 7; stroke-linecap: round; }
.car-body { fill: #e7edf4; stroke: #7588a0; stroke-width: 2; }
.car-window { fill: #fff; stroke: #c4cdd8; }
.car-wheel { fill: #526278; stroke: white; stroke-width: 6; }
.car-soc { fill: var(--purple); font-size: 38px; font-weight: 650; }
.charge-primary > strong { color: var(--purple); font-size: clamp(28px, 4vw, 60px); font-weight: 600; }
.charge-primary small { font-size: 13px; color: var(--muted); }
.charge-primary p { color: var(--muted); }
.charge-phases { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin-top: 12px; }
.phase { padding: 12px 5px; background: #f4f5f9; border-radius: 9px; text-align: center; color: #7f8896; font-size: 11px; }
.phase small { display: block; margin-bottom: 4px; }
.phase.active { background: var(--purple); color: white; }
.measurements { margin-top: 16px; padding: 16px 20px; background: white; border: 1px solid var(--line); border-radius: 12px; }
summary { cursor: pointer; color: var(--purple); font-weight: 600; font-size: 14px; }
.history-ranges { margin: 30px 0 0; }
.history-ranges a { padding: 8px 14px; border-radius: 8px; }
.history-ranges a[aria-current] { background: var(--purple); color: white; }
.chart-grid-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.history-chart svg { width: 100%; }
.chart-grid { fill: none; stroke: #e8ebf1; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--purple); stroke-width: 2.5; }
.chart-dot { fill: var(--purple); }
.chart-dot:hover { r: 5; }
.chart-label { fill: #7d8798; font-size: 12px; }
.chart-empty { padding: 55px 10px; text-align: center; color: var(--muted); font-size: 14px; }
.system-state { display: flex; flex-wrap: wrap; gap: 12px; color: var(--purple); font-size: 14px; }
@media (max-width: 900px) {
    .chart-grid-layout { grid-template-columns: 1fr; }
    .charge-overview { grid-template-columns: 1fr; gap: 0; }
    .charge-primary { text-align: center; margin-bottom: 20px; }
    .charge-phases { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 650px) {
    .energy-panel { overflow: auto; }
    .energy-flow { min-width: 720px; }
    .visual-heading { align-items: flex-start; flex-direction: column; gap: 0; }
}
/* IBP shows only its confirmed battery/meter channels, without hub topology. */
.storage-overview { display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: center; gap: 30px; }
.storage-battery svg { width: 100%; max-height: 250px; }
.storage-shell { fill: #f4f9f5; stroke: #9ab8a3; stroke-width: 3; }
.storage-terminal { fill: #9ab8a3; }
.storage-empty { fill: #e4f0e8; }
.storage-soc { fill: #3f7854; font-size: 48px; font-weight: 600; }
.storage-condition { padding-left: 24px; border-left: 1px solid var(--line); }
.storage-condition h2 { color: var(--purple); font-size: 20px; }
.storage-condition p { color: var(--muted); font-size: 13px; }
.meter-strip { display: flex; flex-wrap: wrap; gap: 28px; padding: 16px 8px; border-top: 1px solid var(--line); }
.meter-strip > div { min-width: 140px; }
.meter-strip strong { color: var(--muted); font-size: 12px; }
.meter-strip p { margin: 5px 0; font-size: 22px; }
.meter-strip small { color: var(--muted); font-size: 11px; }
@media (max-width: 900px) { .storage-overview { grid-template-columns: 1fr 1fr; gap: 10px; } .storage-condition { grid-column: 1 / -1; border-left: 0; padding-left: 0; } }
@media (max-width: 550px) { .storage-overview { grid-template-columns: 1fr; } }
/* Flag severity is explicit: transport ErrorFlags also contains neutral states. */
.flag-status { color: var(--muted); font-size: 14px; }
.status-error { color: #a32d30; font-weight: 600; }
/* M2PRO | Codex | 2026-11-09: compact service tabs; content keeps primary space. */
.system-tabs { display:flex; flex-wrap:wrap; gap:.35rem; border-bottom:1px solid #ddd7e0; margin:1.25rem 0 1.5rem; }
.system-tabs a { padding:.75rem 1rem; border-radius:.6rem .6rem 0 0; text-decoration:none; }
.system-tabs a[aria-current] { color:#fff; background:var(--purple); font-weight:600; }
.service-message { padding:.85rem 1rem; border-left:3px solid var(--purple); background:#eee8ef; border-radius:.4rem; }
.service-form { max-width:48rem; }
.service-form label { display:block; margin-bottom:.4rem; font-weight:600; }
.service-form input:not([type=checkbox]), .service-form textarea, .service-form select { max-width:100%; width:100%; padding:.65rem; border:1px solid #c9c5ce; border-radius:.4rem; box-sizing:border-box; font:inherit; }
.service-form select[multiple] { min-height:11rem; }
.service-form .helptext { display:block; color:var(--muted); font-size:.85rem; }
.service-form .errorlist { color:#ad2030; }
.service-inline { display:inline-block; margin:0 .5rem .5rem 0; }
.table-scroll { overflow:auto; }
.nowrap { white-space:nowrap; }
.log-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.firmware-list { display:grid; gap:1rem; }
.firmware-card h3 { margin:0; }
button:disabled { opacity:.55; cursor:not-allowed; }
/* 2026-11-10 Codex: settings workspace, compact categories and editable values. */
.settings-layout { display:grid; grid-template-columns:220px minmax(0,1fr); gap:1.5rem; align-items:start; }
.settings-categories { display:flex; flex-direction:column; gap:.3rem; }
.settings-categories a { padding:.7rem .9rem; border-radius:.5rem; text-decoration:none; }
.settings-categories a[aria-current] { background:var(--purple); color:white; }
.settings-categories small { display:block; font-size:.75rem; opacity:.85; margin-top:.15rem; }
.settings-workspace { min-width:0; }
.settings-workspace h3 { margin:.3rem 0; }
.settings-section { margin:.65rem 0; background:white; border:1px solid #e6e8ee; border-radius:.65rem; }
.settings-section summary { padding:.85rem 1rem; cursor:pointer; color:var(--purple); font-weight:600; }
.settings-fields { padding:0 1rem .6rem; }
.settings-row { display:grid; grid-template-columns:minmax(180px,1fr) minmax(180px,1.2fr); align-items:start; gap:1rem; padding:.65rem 0; border-top:1px solid #f0edf2; }
.settings-row label { padding-top:.5rem; overflow-wrap:anywhere; }
.settings-row input, .settings-row select, .settings-device { width:100%; padding:.55rem .65rem; border:1px solid #c9c5ce; border-radius:.35rem; font:inherit; box-sizing:border-box; background:white; }
.settings-device { width:auto; max-width:100%; }
.settings-row input:disabled, .settings-row select:disabled { background:#f5f4f7; color:#444957; opacity:1; }
.settings-row small { display:block; margin-top:.25rem; font-size:.8rem; }
.master-badge { display:inline-block; font-size:.72rem; font-weight:500; padding:.1rem .4rem; border:1px solid #d9c8d5; border-radius:.3rem; margin-left:.4rem; color:var(--purple); }
.settings-savebar { position:sticky; bottom:0; display:flex; align-items:center; gap:1rem; flex-wrap:wrap; padding:.8rem 0; background:var(--bg); border-top:1px solid #ddd7e0; }
.settings-editor .errorlist { color:#ad2030; }
@media(max-width:850px) { .settings-layout { grid-template-columns:1fr; } .settings-categories { flex-direction:row; overflow-x:auto; } .settings-categories a { flex:0 0 auto; } }
@media(max-width:600px) { .settings-row { grid-template-columns:1fr; gap:.25rem; } }
/* Context 2026-11-10: compact local timestamps and active product navigation. */
.local-stamp { display:inline; font-variant-numeric:tabular-nums; }
.local-stamp > span:first-child { white-space:nowrap; }
.time-age { color:var(--purple); white-space:nowrap; font-size:.92em; }
.topbar nav { flex-wrap:wrap; }
.topbar nav a[aria-current="page"] { color:var(--purple); font-weight:700; border-bottom:2px solid var(--purple); }

/* 2026-11-12: readable brand accents and responsive navigation. No fixed
 * content heights: service tables, charts and logbook retain available space. */
body { line-height: 1.45; }
.card:hover { border-color: var(--purple); box-shadow: 0 3px 12px #5f0c5212; }
button:not(:disabled):hover { filter: brightness(.9); }
.topbar nav a[aria-current="page"] { border-bottom-color: var(--green); }
.service-message { background: #f4edf3; }
.login.panel { border-top: 4px solid var(--green); }
.inventory-search label, .inventory-search input { margin-top: 0; }
.storage-terminal { fill: var(--green); }
.storage-empty { fill: #f0f2dc; }
@media (max-width: 1100px) {
    .topbar { gap: 16px 24px; }
    .topbar nav { order: 3; width: 100%; gap: 10px 24px; }
}
@media (max-width: 650px) {
    .brand-logo { width: 190px; }
    .identity { margin-left: 0; flex-wrap: wrap; min-width: 0; }
    .identity > span { overflow-wrap: anywhere; }
    .topbar nav { gap: 8px 20px; }
}

/* History workspace 2026-11-10: compact controls, chart area takes priority. */
.history-controls { display:flex; flex-wrap:wrap; gap:14px; align-items:end; margin:20px 0; }
.history-controls label, #history-session-label { display:grid; gap:5px; color:#626d7c; font-size:14px; }
.history-controls select, .history-controls input, #history-session { padding:10px; border:1px solid #dce0e8; border-radius:9px; background:white; color:#223147; max-width:100%; }
.history-plot { margin:16px 0; padding:18px; }
.history-plot h3 { margin:0 0 8px; font-size:17px; }
.history-plot > svg { width:100%; height:auto; min-height:180px; display:block; }
.history-plot svg text { fill:#66738a; font-size:11px; }
.history-grid { stroke:#e5e8f0; stroke-width:1; }
.history-cursor { stroke:#59677b; stroke-width:1; stroke-dasharray:4; }
.history-legend { display:flex; gap:6px; flex-wrap:wrap; }
.history-legend button { color:#344259; background:#f4f5f9; padding:6px 9px; font-size:13px; border:1px solid #e1e4ec; }
.history-legend button[aria-pressed=false] { opacity:.45; text-decoration:line-through; }
.history-legend svg { margin-right:6px; vertical-align:middle; }
.history-readout { font-size:13px; color:#536074; margin:6px 0 0; min-height:36px; }
#history-explorer .system-tabs button[aria-pressed=true] { background:var(--purple); color:white; }
#history-explorer .system-tabs button[aria-pressed=false] { background:white; color:var(--purple); border:1px solid #ded3dc; }
#history-session-label[hidden] { display:none; }
@media(max-width:650px) { .history-controls label { width:100%; } .history-plot { padding:10px; } .history-plot > svg { min-height:150px; } }

/* 2026-11-12: compact branded account/administration forms, responsive tables. */
.admin-editor { max-width: 780px; margin-top: 24px; }
.admin-editor form p { margin: 18px 0; }
.admin-editor label { display: block; font-weight: 600; margin-bottom: 6px; }
.admin-editor input:not([type=checkbox]), .admin-editor select { width: 100%; }
.admin-editor .helptext { display: block; color: var(--muted); font-size: 13px; }
.errorlist, [role=alert] { color: #9b1b32; }
.login code { overflow-wrap: anywhere; }

/* Context 2026-11-14: constrain grid children and long device text on phones.
   Wide measurement tables scroll within their panel, never the whole page. */
main, .panel, .card, .settings-layout > *, .history-plot { min-width:0; }
.card h2, .service-message, .history-readout { overflow-wrap:anywhere; }
@media(max-width:650px) {
    .system-tabs { flex-wrap:wrap; gap:.25rem; }
    .system-tabs a { padding:.65rem .75rem; }
    .detail-toolbar { flex-wrap:wrap; gap:.75rem; }
    .detail-toolbar label { max-width:100%; }
    .detail-toolbar input, .detail-toolbar select { max-width:100%; }
    .measurements { overflow-x:auto; }
    .table-scroll { max-width:100%; }
    pre { max-width:100%; }
    button { white-space:normal; overflow-wrap:anywhere; }
}
.login details { margin: 20px 0; }
.login img { max-width: 100%; height: auto; }
