/* cpms-core Phase-0 stylesheet.
 * Uses the shared Pipelet tokens loaded by base.html, with CPMS aliases kept
 * for existing page components.
 */
:root {
    --bg-page:        #f5efe4;
    --bg-surface:     var(--color-bg-primary, #ffffff);
    --bg-surface-hover: var(--color-bg-active, #fbf7ef);
    --text-primary:   var(--color-text-primary, #181D27);
    --text-secondary: var(--color-text-secondary, #535862);
    --text-tertiary:  var(--color-text-quaternary, #A4A7AE);
    --border-subtle:  var(--color-border-secondary, rgba(0, 0, 0, 0.08));
    --border-strong:  var(--color-border-primary, rgba(0, 0, 0, 0.16));
    --accent:         var(--brand-500, #1170cf);
    --accent-hover:   var(--brand-600, #0353a8);
    --green:          var(--success-500, #1d805f);
    --red:            var(--error-500, #db1f2e);
    --radius-sm:      6px;
    --radius-md:      8px;
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;
    --shadow-card: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06));
    --shadow-card-hover: var(--shadow-md, 0 2px 6px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.08));
    --font-sans:  var(--font-family, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    --font-serif: var(--font-family-serif, 'GT Alpina', 'Source Serif 4', Georgia, 'Times New Roman', serif);
    --font-mono:  var(--font-family-mono, 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace);
}

html[data-theme="dark"] {
    --bg-page: var(--color-bg-secondary, #161B26);
    --bg-surface: var(--color-bg-primary, #0C0E12);
    --bg-surface-hover: var(--color-bg-active, #1F242F);
    --text-primary: var(--color-text-primary, #F5F5F6);
    --text-secondary: var(--color-text-secondary, #CECFD2);
    --text-tertiary: var(--color-text-quaternary, #85888E);
    --border-subtle: var(--color-border-secondary, rgba(255, 255, 255, 0.08));
    --border-strong: var(--color-border-primary, rgba(255, 255, 255, 0.18));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--color-bg-gradient, linear-gradient(180deg, var(--bg-page) 0%, #fffefb 100%));
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---------- Header ---------- */
#app-header {
    background: var(--color-bg-glass, rgba(255,255,255,0.82));
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: var(--color-text-primary);
    padding: 0 var(--spacing-3xl, 24px);
    height: 56px;
    display: flex;
    align-items: center;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--color-border-secondary, rgba(0,0,0,0.08));
}

#app-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #c49a6c, var(--brand-500, #1170cf) 50%, #c49a6c);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg, 12px);
    min-width: 0;
}

.header-icon {
    width: auto;
    height: 22px;
    color: var(--color-text-primary);
    flex-shrink: 0;
}

#app-header h1 {
    margin: 0;
    font-family: var(--font-family-serif, var(--font-family));
    font-size: var(--text-lg, 18px);
    font-weight: var(--font-weight-medium, 500);
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg, 12px);
}

/* Legacy brand styles are still used by login and microsite templates. */
.topbar {
    position: sticky;
    top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    height: 56px;
    padding: 0 var(--sp-7);
    background: var(--color-bg-glass, rgba(255, 255, 255, 0.82));
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
}
.topbar-brand {
    display: inline-flex; align-items: center; gap: var(--sp-3);
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 400;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}
.topbar-brand em {
    font-style: italic;
    font-weight: 700;
    color: var(--accent);
}
.topbar-brand-logo {
    width: auto; height: 22px;
    color: var(--accent);
    flex-shrink: 0;
}
.topbar-left {
    display: inline-flex; align-items: center; gap: var(--sp-3);
}

/* ---------- Prefs dropdown (right of topbar) ---------- */
.prefs-dropdown {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}
.prefs-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--color-border-secondary, rgba(0,0,0,0.08));
    border-radius: var(--radius-md, 8px);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: var(--text-sm, 14px);
    font-weight: 600;
    transition: all 0.15s ease;
}
.prefs-toggle:hover {
    background: var(--color-bg-active, rgba(0,0,0,0.04));
    color: var(--color-text-primary);
}
.prefs-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 160px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 10px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: var(--spacing-xs, 4px) 0;
}
.prefs-menu.open { display: block; }
.prefs-section { padding: 2px 0; }
.prefs-section-label {
    padding: 4px 14px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
}
.prefs-user { padding: 8px 14px 4px; }
.prefs-user-email {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-primary);
    word-break: break-all;
}
.prefs-user-role {
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-top: 2px;
}
.prefs-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 7px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: var(--text-sm, 14px);
    color: var(--color-text-quaternary);
    text-align: left;
    transition: background 0.1s, color 0.1s;
}
.prefs-item:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}
.prefs-item.active {
    color: var(--color-text-primary);
    font-weight: 600;
}
.prefs-item.active::after {
    content: '\2713';
    margin-left: auto;
    font-size: 0.85em;
    color: var(--brand-500, #1170cf);
}
.prefs-item-danger { color: var(--error-500, #db1f2e); }
.prefs-item-danger:hover {
    background: var(--color-bg-error-subtle, rgba(219,31,46,0.08));
    color: var(--error-500, #db1f2e);
}
.prefs-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

/* ---------- Sidebar ---------- */
.app-shell {
    display: flex;
    align-items: flex-start;
    max-width: 1560px;
    margin: 0 auto;
}
/* ---- Sidebar — grouped, collapsible, broker-portal parity ---- */
.app-sidebar {
    flex: 0 0 240px;
    width: 240px;
    border-right: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    padding: var(--sp-5) 0;
    overflow-y: auto;
    position: sticky;
    top: 56px;
    /* Always fill the viewport (minus header) so the surface stays
       continuous even with collapsed groups — sonst endet der
       Hintergrund mitten auf der Seite. */
    height: calc(100vh - 56px);
    transition: transform 0.2s ease, flex-basis 0.2s ease, width 0.2s ease;
}
.app-sidebar.collapsed {
    transform: translateX(-100%);
    flex: 0 0 0;
    width: 0;
    border-right: none;
    padding-left: 0;
    padding-right: 0;
}
.sidebar-nav {
    display: flex; flex-direction: column;
    gap: var(--sp-4);
    padding: 0 var(--sp-3);
}
.sidebar-group {
    display: flex; flex-direction: column; gap: 2px;
}
.sidebar-group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: var(--sp-2) var(--sp-3) 4px;
    background: transparent;
    border: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: color 120ms;
}
.sidebar-group-title:hover { color: var(--text-secondary); }
.sidebar-chevron {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: transform 160ms ease;
}
.sidebar-group-title[aria-expanded="false"] .sidebar-chevron {
    transform: rotate(-90deg);
}
.sidebar-group-body {
    display: flex; flex-direction: column; gap: 2px;
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 180ms ease, opacity 180ms ease;
}
.sidebar-group.collapsed .sidebar-group-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}
.sidebar-link {
    display: block;
    padding: 6px var(--sp-3);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 120ms, color 120ms;
}
.sidebar-link:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.sidebar-link.active {
    background: rgba(17,112,207,0.10); color: var(--accent); font-weight: 500;
}

/* Sub-section label WITHIN a collapsible group. Non-interactive divider
   that clusters a long flat list (e.g. OCPP Operations) into scannable
   themes. Collapses/expands together with its parent group. */
.sidebar-subhead {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-tertiary);
    padding: var(--sp-3) var(--sp-3) 3px;
    margin-top: 2px;
    opacity: 0.85;
    user-select: none;
}
.sidebar-subhead:first-child { margin-top: 0; }

/* Sidebar-toggle button in the topbar */
.sidebar-toggle {
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md, 8px);
    padding: 6px 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 120ms, color 120ms;
}
.sidebar-toggle:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}
/* ========== Health badge ========== */
.health-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px; border-radius: var(--radius-pill, 999px);
    font-size: 11px; font-weight: 600;
    font-family: var(--font-mono);
    line-height: 1; white-space: nowrap;
}
.health-badge--healthy  { background: rgba(29,128,95,0.12); color: var(--success-500, #1d805f); }
.health-badge--warn     { background: rgba(247,144,9,0.14); color: var(--warning-500, #a65e00); }
.health-badge--critical { background: rgba(219,31,46,0.14); color: var(--error-600, #ab0a15); }
.health-badge--unknown  { background: rgba(0,0,0,0.06);    color: var(--text-disabled); }
.health-badge .health-sub { font-weight: 500; opacity: 0.7; margin-left: 2px; }

.health-meter { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
.health-meter-item { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--sp-3); }
.health-meter-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-disabled); margin-bottom: 4px; }
.health-meter-value { font-size: 18px; font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); }

.sidebar-link--live {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sidebar-link--live em {
    font-family: var(--font-serif, serif);
    font-style: italic;
    color: var(--accent);
}
.sidebar-live-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #1d805f;
    margin-left: auto;
    animation: sl-pulse 1.8s ease-out infinite;
}
@keyframes sl-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(29,128,95,0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(29,128,95,0); }
    100% { box-shadow: 0 0 0 0 rgba(29,128,95,0); }
}

/* Responsive: on narrow viewports the sidebar becomes an overlay drawer.
   The header sidebar-toggle button opens/closes it. */
@media (max-width: 900px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 56px;
        height: calc(100vh - 56px);
        z-index: 50;
        box-shadow: var(--shadow-card-hover);
        /* Collapsed by default on mobile — user reveals via sidebar-toggle. */
        transform: translateX(-100%);
    }
    .app-sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    .app-sidebar.collapsed {
        transform: translateX(-100%);
    }
}

/* ---------- Layout ---------- */
.container {
    flex: 1 1 auto;
    min-width: 0;
    padding: var(--sp-8) var(--sp-7);
}
.page-header { margin-bottom: var(--sp-8); }
.page-title {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 40px;
    letter-spacing: -0.5px;
    margin: 0 0 var(--sp-3) 0;
}
.page-desc {
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0;
    max-width: 68ch;
}

/* ---------- Cards ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-5);
}
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-5) var(--sp-5) var(--sp-5);
    box-shadow: var(--shadow-card);
    transition: box-shadow 160ms, transform 160ms;
    position: relative;
}
.card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}
.card h3 {
    margin: 0 0 var(--sp-2) 0;
    font-size: 17px;
    font-weight: 600;
}
.card-desc {
    margin: 0 0 var(--sp-4) 0;
    color: var(--text-secondary);
    font-size: 13px;
}
.card-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(17, 112, 207, 0.08);
    color: var(--accent);
    font-size: 11px;
    font-family: var(--font-mono);
}

/* ---------- Login ---------- */
.page-login {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: var(--sp-6);
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-7);
    box-shadow: var(--shadow-card-hover);
}
.login-brand {
    display: flex; align-items: center; gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}
.login-brand h1 {
    margin: 0;
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 26px;
    letter-spacing: -0.4px;
}
.login-brand em {
    font-style: italic;
    font-weight: 700;
    color: var(--accent);
}
.login-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 var(--sp-5) 0;
}
.login-error {
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-4);
    background: rgba(219, 31, 46, 0.06);
    border: 1px solid rgba(219, 31, 46, 0.2);
    border-radius: var(--radius-sm);
    color: var(--red);
    font-size: 13px;
}
#login-form label {
    display: block;
    margin-bottom: var(--sp-4);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}
#login-form input {
    display: block;
    width: 100%;
    margin-top: var(--sp-1);
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    color: var(--text-primary);
    background: #fff;
}
#login-form input:focus {
    outline: 2px solid rgba(17, 112, 207, 0.2);
    border-color: var(--accent);
}
.btn-primary {
    /* Momentum (Webex/mdc-button) action style: full-pill capsule. */
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 120ms;
}
.btn-primary:hover { background: var(--accent-hover); }
/* Login form's primary needs to span the full width — keep that opt-in
   via a separate modifier so other pages can use compact pill buttons. */
#login-form .btn-primary { width: 100%; }
.login-status {
    margin-top: var(--sp-3);
    font-size: 13px;
    color: var(--text-secondary);
    min-height: 1.2em;
}
.login-status.success { color: var(--green); }
.login-status.error   { color: var(--red); }

/* ---------- Breadcrumb + page-header row ---------- */
.breadcrumb {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: var(--sp-2);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }
.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--sp-5);
}
.header-actions {
    display: flex;
    gap: var(--sp-3);
    flex-shrink: 0;
}

/* ---------- Buttons (Momentum mdc-button pill style) ---------- */
.btn-ghost {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 18px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-primary);
    font: inherit; font-weight: 500;
    cursor: pointer;
    transition: background 120ms, border-color 120ms;
}
.btn-ghost:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
}
.btn-linklike {
    border: none;
    background: transparent;
    color: var(--accent);
    font: inherit;
    padding: 0;
    cursor: pointer;
}
.btn-linklike:hover { text-decoration: underline; }
.btn-linklike.danger { color: var(--red); }
.btn-linklike:disabled { color: var(--text-tertiary); cursor: wait; }

/* ---------- Tables ---------- */
.data-table {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    font-size: 13px;
}
.data-table th, .data-table td {
    text-align: left;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-subtle);
}
.data-table th {
    background: var(--bg-surface-hover);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: none;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-surface-hover); }
.data-table td.num, .data-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    font-size: 12px;
}
.data-table td code, .data-table td .num-inline {
    font-family: var(--font-mono);
    font-size: 12px;
}
.data-table.compact th, .data-table.compact td {
    padding: var(--sp-2) var(--sp-3);
}
.row-actions { display: flex; gap: var(--sp-3); align-items: center; justify-content: flex-end; }
.muted { color: var(--text-tertiary); }

/* ---------- Tags ---------- */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-family: var(--font-mono);
    margin-left: var(--sp-2);
}
.tag-ok    { background: rgba(29, 128, 95, 0.12); color: var(--green); }
.tag-muted { background: rgba(0, 0, 0, 0.06); color: var(--text-tertiary); }
/* V2G / discharge — same teal as the broker-portal ocpp-badge.ocpp-2-1
   and the chargersim V2G chip, so the visual language matches across
   the three UIs (broker, chargersim, cpms). Added 2026-05-23 (Phase 2B
   session-visibility). */
.tag-v2g   { background: rgba(20, 184, 166, 0.14); color: #0d9488; border: 1px solid rgba(20, 184, 166, 0.40); }
.v2g-export-cell { color: #0d9488; font-weight: 600; }

/* ---------- KPI row ---------- */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--sp-3);
    margin-bottom: var(--sp-6);
}
.kpi {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-4) var(--sp-4);
    display: flex; flex-direction: column; gap: 4px;
}
.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}
.kpi-value {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 500;
    color: var(--text-primary);
}
.kpi-value.small { font-size: 16px; font-family: var(--font-mono); }
.kpi-value.live, .live { color: var(--green); }

/* ---------- Detail sections ---------- */
.detail-section {
    margin-top: var(--sp-7);
}
.detail-section h2 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 500;
    margin: 0 0 var(--sp-3) 0;
}
.detail-section p { margin: 0 0 var(--sp-3) 0; }

.assign-box {
    margin-top: var(--sp-4);
    background: var(--bg-surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: var(--sp-4);
}
.assign-box summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
}
.assign-box[open] summary { margin-bottom: var(--sp-3); }

/* ---------- Forms ---------- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-6);
}
.form-inline {
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
    align-items: flex-end;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-4);
}
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 180px; }
.field-wide { grid-column: 1 / -1; }
.field-checkbox { flex-direction: row; align-items: center; gap: var(--sp-2); }
.field-checkbox input { width: 16px; height: 16px; }
.field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}
.field input, .field select, .field textarea {
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    color: var(--text-primary);
    background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid rgba(17, 112, 207, 0.2);
    border-color: var(--accent);
}
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
    margin-top: var(--sp-3);
}
.form-status {
    grid-column: 1 / -1;
    font-size: 13px;
    color: var(--text-secondary);
    min-height: 1.2em;
}
.form-status.error   { color: var(--red); }
.form-status.success { color: var(--green); }

/* ---------- Empty state ---------- */
.empty-state {
    background: var(--bg-surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: var(--sp-8);
    text-align: center;
}
.empty-state h2 {
    margin: 0 0 var(--sp-2) 0;
    font-family: var(--font-serif);
    font-weight: 500;
}
.empty-state p {
    color: var(--text-secondary);
    margin: 0 0 var(--sp-4) 0;
}

/* ---------- Dashboard-card 'live' badge ---------- */
.card-live { border-color: rgba(29, 128, 95, 0.35); }
.card-tag-live {
    background: rgba(29, 128, 95, 0.12);
    color: var(--green);
}
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
    max-width: 1320px;
    margin: var(--sp-8) auto var(--sp-6);
    padding: 0 var(--sp-7);
    display: flex;
    gap: var(--sp-5);
    font-size: 12px;
    color: var(--text-tertiary);
}
.site-footer a { color: var(--text-tertiary); }
.site-footer a:hover { color: var(--text-secondary); }

/* ---------- Diagnostic-Files Info-Box (Phase F.8) ----------
   Uses Momentum lightBronzeWebex tokens — bronze-tinted surface
   for the box, white inset for the URL pill, subtle border. */
.diag-info-box {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-3);
}
.diag-info-title {
    display: block;
    margin-bottom: var(--sp-2);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}
.diag-info-url {
    display: block;
    word-break: break-all;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
    font-size: 12px;
    color: var(--text-primary);
}
.diag-info-actions {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    align-items: center;
    margin-top: var(--sp-2);
}
.diag-info-actions .btn-ghost.diag-btn-sm,
.diag-info-actions .diag-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}
.diag-info-actions .diag-link {
    font-size: 12px;
    margin-left: auto;
}
.diag-info-hint {
    display: block;
    margin-top: var(--sp-2);
    font-size: 12px;
    color: var(--text-tertiary);
}
.diag-info-hint code {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs, 4px);
    padding: 1px 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ---------- OCPP Commands page (cpms-core /ocpp-ops/commands) ----------
   Momentum lightBronzeWebex tokens throughout. The previous template used
   .data-json / .data-card classes that were never defined — JSON dumped
   into the page flow and overlapped the cards below. */

/* Scrollable response panel above the form. */
.response-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-md);
    padding: var(--sp-3) var(--sp-4);
    max-height: 360px;
    overflow: auto;
    font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre;
    word-break: normal;
    margin: 0;
}
.response-box-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--sp-2);
    gap: var(--sp-3);
}
.response-box-header .pill {
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill, 999px);
    padding: 2px 10px;
}

/* Command-tile grid. */
.cmd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--sp-4);
}
.cmd-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    transition: border-color 120ms, box-shadow 120ms;
}
.cmd-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.cmd-card h3 {
    margin: 0;
    font-family: var(--font-serif, Georgia, serif);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.1px;
    color: var(--text-primary);
}
.cmd-card form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin: 0;
}
.cmd-card .field {
    flex: 0 0 auto;
}
.cmd-card .field input,
.cmd-card .field select,
.cmd-card .field textarea {
    font-size: 13px;
}
.cmd-card .field textarea {
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    min-height: 80px;
    resize: vertical;
}
.cmd-card-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: var(--sp-2);
}

/* Two-tone station picker card. */
.station-picker {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-4) var(--sp-5);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    flex-wrap: wrap;
}
.station-picker .field {
    flex: 1 1 320px;
    margin: 0;
}
.station-picker select {
    background: #fff;
}
.station-picker .station-count {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* ---------- DataTransfer example snippets (cmd-card .examples) ---------- */
.cmd-examples {
    background: var(--bg-surface-hover);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    margin-bottom: var(--sp-2);
}
.cmd-examples-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    margin-bottom: var(--sp-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cmd-example {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-bottom: var(--sp-2);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-primary);
    position: relative;
}
.cmd-example:last-child { margin-bottom: 0; }
.cmd-example-label {
    font-family: var(--font-sans, system-ui, sans-serif);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    justify-content: space-between;
}
.cmd-example-body {
    white-space: pre;
    overflow-x: auto;
    max-height: 110px;
    overflow-y: auto;
}
.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 120ms, border-color 120ms, color 120ms;
}
.btn-copy:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.btn-copy.copied { color: var(--green); border-color: var(--green); }
.btn-fill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: rgba(17, 112, 207, 0.08);
    color: var(--accent);
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 120ms;
}
.btn-fill:hover {
    background: rgba(17, 112, 207, 0.16);
}

/* ---------- Modal (used for DataTransfer examples) ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(24, 29, 39, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: var(--sp-4);
    animation: modal-fade 120ms ease-out;
}
.modal-overlay[hidden] { display: none; }
@keyframes modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    max-width: 880px; width: 100%;
    max-height: 88vh;
    display: flex; flex-direction: column;
    animation: modal-pop 160ms ease-out;
}
@keyframes modal-pop {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.modal-header {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: var(--sp-5) var(--sp-6) var(--sp-3);
    border-bottom: 1px solid var(--border-subtle);
    gap: var(--sp-4);
}
.modal-header h2 {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.3px;
}
.modal-header p {
    margin: 0;
    font-size: 12px;
    color: var(--text-tertiary);
}
.modal-close {
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-full);
}
.modal-close:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}
.modal-body {
    padding: var(--sp-4) var(--sp-6) var(--sp-6);
    overflow-y: auto;
}
.modal-body h3 {
    margin: var(--sp-5) 0 var(--sp-2);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}
.modal-body h3:first-child { margin-top: 0; }

/* The small "ⓘ" trigger button next to a field label. */
.btn-info-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px;
    padding: 0;
    margin-left: 6px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: var(--bg-surface-hover);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    font-style: italic;
    font-family: var(--font-serif, serif);
    transition: background 120ms, color 120ms, border-color 120ms;
    vertical-align: middle;
}
.btn-info-icon:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
