/* MessdatenStudio – Stylesheet (keine externen Abhängigkeiten, CSP-konform) */

/* VOLTERIQ corporate styling ------------------------------------------------ */

:root {
    --font-sans: "Rubik", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Cascadia Code", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;

    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e4e8ef;
    --border-strong: #cfd6e1;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --subtle: #94a3b8;

    --primary: #7cb033;
    --primary-hover: #688f29;
    --primary-soft: #f1f7e8;
    --primary-ring: rgb(124 176 51 / 24%);

    --success-soft: #ecfdf3;
    --success-border: #bbf7d0;
    --danger: #dc2626;
    --danger-strong: #b91c1c;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --info-soft: #eff6ff;
    --info-border: #bfdbfe;

    --sidebar-bg: #1e4775;
    --sidebar-bg-2: #173a61;
    --sidebar-text: #dce7f2;
    --sidebar-text-strong: #ffffff;
    --sidebar-border: rgb(255 255 255 / 7%);
    --sidebar-width: 256px;

    --radius: 12px;
    --radius-lg: 16px;
    --shadow-xs: 0 1px 2px rgb(15 23 42 / 5%);
    --shadow-sm: 0 1px 3px rgb(15 23 42 / 6%), 0 1px 2px rgb(15 23 42 / 4%);
    --shadow-lg: 0 24px 48px -12px rgb(15 23 42 / 22%);
}

/* Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 650; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

code {
    padding: 1px 5px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 0.86em;
}

:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }

[hidden] { display: none !important; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
    flex: none;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -60px;
    left: 12px;
    z-index: 100;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--text);
    color: #fff;
    font-weight: 600;
}
.skip-link:focus { top: 12px; text-decoration: none; }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* App shell ----------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    padding: 20px 14px 16px;
    border-right: 1px solid var(--sidebar-border);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-text);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 16px;
    letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 500; }
.brand-name strong { font-weight: 750; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #fff;
    box-shadow: 0 6px 16px -4px rgb(59 130 246 / 55%);
}
.brand-mark.brand-mark-logo {
    width: 42px;
    height: 42px;
    overflow: hidden;
    border-radius: 10px;
    background: #1e4775;
}
.brand-mark-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.sidebar .brand { padding: 4px 10px 22px; color: var(--sidebar-text-strong); }
.brand-light { color: #f8fafc; }

.nav { display: flex; flex: 1; flex-direction: column; gap: 2px; overflow-y: auto; }

.nav-section {
    margin: 18px 12px 8px;
    color: #64748b;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.nav-section:first-child { margin-top: 4px; }

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--sidebar-text);
    font-weight: 550;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgb(255 255 255 / 6%); color: var(--sidebar-text-strong); text-decoration: none; }
.nav-link.is-active { background: rgb(124 176 51 / 18%); color: #fff; }
.nav-link.is-active::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: -14px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #7cb033;
}
.nav-link.is-active .icon { color: #a7cf6d; }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 14px;
    border-top: 1px solid var(--sidebar-border);
}
.sidebar-footer form { margin: 0; }

.account {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--sidebar-text-strong);
}
.account:hover, .account.is-active { background: rgb(255 255 255 / 6%); text-decoration: none; }
.account-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.account-text strong { overflow: hidden; font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.account-text small { color: var(--sidebar-text); font-size: 12px; }

.avatar {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.sidebar .avatar { background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #fff; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 54px; height: 54px; font-size: 19px; }
.avatar-xl { width: 76px; height: 76px; font-size: 26px; }

.sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgb(15 23 42 / 45%); }
.sidebar-backdrop[hidden] { display: none; }

.main { display: flex; flex: 1; flex-direction: column; min-width: 0; margin-left: var(--sidebar-width); }

.topbar { display: none; }

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
}

.content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 32px 36px 40px; }
.content:focus { outline: none; }
.content > * + * { margin-top: 20px; }

.footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px 36px 26px;
    color: var(--subtle);
    font-size: 12.5px;
}
.footer span { display: inline-flex; align-items: center; gap: 6px; }
.footer .icon { width: 14px; height: 14px; }

/* Page header --------------------------------------------------------- */

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin-bottom: 6px; color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.page-subtitle { margin-top: 6px; color: var(--muted); font-size: 14.5px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--muted); font-size: 13px; font-weight: 600; }
.back-link:hover { color: var(--text); text-decoration: none; }
.back-link .icon { width: 16px; height: 16px; }
.title-with-avatar { display: flex; align-items: center; gap: 16px; }
.title-with-avatar .page-subtitle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgb(37 99 235 / 30%), inset 0 1px 0 rgb(255 255 255 / 12%); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { border-color: var(--border-strong); background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { border-color: #b8c2d1; background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #eef2f7; color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger-strong); }
.btn-sm { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-lg { min-height: 46px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; padding: 0; }
.btn:disabled, .btn.is-busy { cursor: progress; opacity: 0.7; }

/* Cards --------------------------------------------------------------- */

.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 22px 14px; }
.card-title { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.card-subtitle { margin-top: 3px; color: var(--muted); font-size: 13px; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.card-body { padding: 4px 22px 22px; }
.card-header + .table-wrap { border-top: 1px solid var(--border); }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 24px; text-align: center; }
.empty-state.compact { padding: 40px 20px; }
.empty-state p { max-width: 460px; color: var(--muted); }
.empty-state .btn { margin-top: 8px; }
.empty-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 6px;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
}
.empty-icon .icon { width: 26px; height: 26px; }

/* Alerts -------------------------------------------------------------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid;
    border-radius: var(--radius);
    font-size: 13.5px;
}
.content > .alert:first-child, .auth-card .alert { margin-bottom: 16px; }
.alert-success { border-color: var(--success-border); background: var(--success-soft); color: #14532d; }
.alert-error { border-color: var(--danger-border); background: var(--danger-soft); color: #7f1d1d; }
.alert-info { border-color: var(--info-border); background: var(--info-soft); color: #1e3a8a; }
.alert-warning { border-color: #fde68a; background: #fffbeb; color: #78350f; }
.alert-icon { width: 20px; height: 20px; }
.alert-body { flex: 1; min-width: 0; }
.alert-meta { margin-left: 6px; opacity: 0.8; }
.alert-text { display: block; margin-top: 2px; }
.alert-link { display: inline-block; margin-top: 8px; color: inherit; font-weight: 650; text-decoration: underline; }
.alert-close {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: -4px -4px -4px 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
}
.alert-close:hover { background: rgb(0 0 0 / 5%); opacity: 1; }
.alert-close .icon { width: 16px; height: 16px; }
.error-list { margin: 8px 0 0; padding-left: 18px; }
.error-list li + li { margin-top: 3px; }

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

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.label { padding: 0; color: var(--text-2); font-size: 13px; font-weight: 600; }
.optional { margin-left: 4px; color: var(--subtle); font-weight: 500; }
.hint { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.hint .icon { width: 15px; height: 15px; }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }

.input {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover { border-color: #b8c2d1; }
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }
.input-lg { min-height: 46px; font-size: 15px; }
input[type="date"] { font-variant-numeric: tabular-nums; }

.select {
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    appearance: none;
}

.role-options { display: flex; flex-direction: column; gap: 8px; }
.role-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.role-option:hover { border-color: #b8c2d1; }
.role-option input { margin: 3px 0 0; accent-color: var(--primary); }
.role-option span { display: flex; flex-direction: column; gap: 1px; }
.role-option strong { font-size: 13.5px; }
.role-option small { color: var(--muted); font-size: 12.5px; }
.role-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
fieldset:disabled .role-option { cursor: not-allowed; opacity: 0.65; }

.switch { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: relative; flex: none; width: 40px; height: 22px; margin-top: 1px; border-radius: 999px; background: #cbd5e1; transition: background 0.2s; }
.switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgb(15 23 42 / 25%);
    transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.switch input:disabled ~ * { cursor: not-allowed; opacity: 0.6; }
.switch > span:last-child { display: flex; flex-direction: column; }
.switch small { color: var(--muted); font-size: 12.5px; }

/* Export -------------------------------------------------------------- */

.export-card { padding: 20px 22px; }
.export-form { display: flex; flex-direction: column; gap: 20px; }
.export-head { display: flex; align-items: center; gap: 14px; }
.export-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 0.85fr); gap: 22px; }
.export-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.export-field > legend { margin-bottom: 10px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 550;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-hover); box-shadow: inset 0 0 0 1px var(--primary); }
.date-range { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: 12px; margin-top: 14px; }
.period-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.period-field span { color: var(--muted); font-size: 12px; font-weight: 600; }
.period-field .input { min-height: 38px; padding: 6px 10px; font-size: 13.5px; }

.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-card {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.option-card:hover { border-color: #b8c2d1; }
.option-card input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--primary); }
.option-card > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.option-card strong { font-size: 13.5px; }
.option-card small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.option-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.option-card:has(input:focus-visible) { outline: 3px solid var(--primary-ring); outline-offset: 2px; }

.export-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; border-top: 1px solid var(--border); }
.export-summary { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.export-summary .icon { color: var(--primary); }
.export-summary.is-empty { color: #b45309; }
.export-summary.is-empty .icon { color: #d97706; }
.export-footer .btn { min-height: 42px; padding: 0 22px; }

/* Meter selection ----------------------------------------------------- */

.pick-group { display: flex; flex-direction: column; min-width: 0; }
.pick-head:has(input:indeterminate) { border-color: #93b4f5; background: #f7f9ff; }
.pick-details { margin-top: 4px; }
.pick-details > summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 6px;
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}
.pick-details > summary::-webkit-details-marker { display: none; }
.pick-details > summary::before {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s;
}
.pick-details[open] > summary::before { transform: translateY(-2px) rotate(45deg); }
.pick-details > summary:hover { background: var(--primary-soft); }
.pick-panel { margin-top: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.pick-tools { display: flex; align-items: center; gap: 2px; padding: 8px; border-bottom: 1px solid var(--border); }
.pick-search.input { flex: 1; min-width: 0; min-height: 32px; padding: 4px 10px; font-size: 13px; }
.link-button {
    flex: none;
    padding: 5px 8px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.link-button:hover { background: var(--primary-soft); }
.pick-list { max-height: 252px; margin: 0; padding: 4px; overflow-y: auto; list-style: none; }
.pick-item {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
}
.pick-item:hover { background: var(--surface-2); }
.pick-item input { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); }
.pick-serial { font-weight: 600; font-variant-numeric: tabular-nums; }
.pick-location { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.pick-empty { padding: 10px 12px; color: var(--muted); font-size: 12.5px; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.dot.status-active { background: #22c55e; }
.dot.status-warn { background: #f59e0b; }
.dot.status-stale { background: #ef4444; }

/* Trends -------------------------------------------------------------- */

.trend-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); align-items: start; gap: 20px; }
.trend-filter { display: flex; flex-direction: column; gap: 18px; padding: 20px; }
.trend-filter legend { margin-bottom: 8px; }
.trend-filter .date-range { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
.trend-filter .pick-list { max-height: 340px; }
.trend-apply { display: flex; flex-direction: column; gap: 8px; }
.btn.is-pending { box-shadow: 0 0 0 4px var(--primary-ring); }
.trend-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.chart-card .card-header { flex-wrap: wrap; }
.chart-box { position: relative; height: 420px; padding: 0 18px 10px; }
.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    background: rgb(255 255 255 / 90%);
    color: var(--muted);
    text-align: center;
}
.chart-empty .icon { width: 28px; height: 28px; color: var(--subtle); }
.chart-note { display: flex; align-items: flex-start; gap: 8px; padding: 12px 22px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.chart-note .icon { width: 15px; height: 15px; margin-top: 2px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: #eef2f7; }
.segmented-option { position: relative; display: inline-flex; }
.segmented-option input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-option span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.segmented-option span:hover { color: var(--text); }
.segmented-option input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented-option input:focus-visible + span { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.meter-cell { display: flex; align-items: center; gap: 12px; }
.table-compact th, .table-compact td { padding-top: 10px; padding-bottom: 10px; }
.swatch { flex: none; width: 24px; height: 8px; }
.cell-warn { color: #b45309; font-weight: 600; }

/* Tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table thead th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.table tr > :first-child { padding-left: 22px; }
.table tr > :last-child { padding-right: 22px; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr:hover > * { background: #fafbfd; }
.table tbody th { color: var(--text-2); font-weight: 600; }
.table .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cell-title { color: var(--text); font-weight: 600; }
.cell-sub { margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.cell-wrap { min-width: 260px; }
.actions-col { width: 1%; text-align: right; white-space: nowrap; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.row-actions form { margin: 0; }
.user-cell { display: flex; align-items: center; gap: 12px; }

/* Badges -------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.6;
    white-space: nowrap;
}
.badge-blue, .badge-role-editor { background: #eff6ff; color: #1d4ed8; }
.badge-green { background: #ecfdf3; color: #15803d; }
.badge-red { background: #fef2f2; color: #b91c1c; }
.badge-amber { background: #fffbeb; color: #b45309; }
.badge-violet, .badge-role-admin { background: #f5f3ff; color: #6d28d9; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status-active { color: #15803d; }
.status-active::before { background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.status-inactive { color: #64748b; }
.status-inactive::before { background: #cbd5e1; box-shadow: 0 0 0 3px #f1f5f9; }
.status-warn { color: #b45309; }
.status-warn::before { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.status-stale { color: #b91c1c; }
.status-stale::before { background: #ef4444; box-shadow: 0 0 0 3px #fee2e2; }

/* Data sources -------------------------------------------------------- */

.source-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.source-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
}
.source-icon .icon { width: 22px; height: 22px; }
.source-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, auto)) minmax(0, 1fr);
    gap: 12px 28px;
    margin: 0;
    padding: 4px 22px 18px;
}
.source-stats div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.source-stats dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.source-stats dd { margin: 0; color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.badge-list { display: flex; flex-wrap: wrap; gap: 6px; }
.source-card > .table-wrap, .source-card > .empty-state { border-top: 1px solid var(--border); }
.source-message { display: flex; align-items: flex-start; gap: 10px; color: var(--text-2); }
.source-message .icon { margin-top: 2px; color: #d97706; }
.date-status { display: flex; align-items: center; gap: 12px; }
.date-status .status { font-size: 12.5px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.data-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 20px; scroll-margin-top: 84px; }

/* Layouts ------------------------------------------------------------- */

.layout-split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 20px; }
.layout-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* Import -------------------------------------------------------------- */

.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 26px 18px;
    border: 2px dashed var(--border-strong);
    border-radius: 14px;
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone:focus-within { box-shadow: 0 0 0 4px var(--primary-ring); }
.dropzone.has-file { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.dropzone-input { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; opacity: 0; }
.dropzone-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 4px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.dropzone-title { font-weight: 650; }
.dropzone-file { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.dropzone.has-file .dropzone-file { color: var(--primary-hover); font-weight: 600; }

.auth-brand {
    min-height: 44px;
}

.auth-brand::after {
    content: "VOLTERIQ";
    color: #1e4775;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.auth-brand .brand-logo { display: none; }

.brand-light {
    background: rgb(255 255 255 / 4%);
    border-radius: 12px;
    padding: 12px 16px;
}

.brand-light .brand-logo { display: block; }

.prose p { margin-bottom: 12px; color: var(--text-2); }
.code {
    margin: 0 0 14px;
    padding: 12px 14px;
    overflow-x: auto;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.6;
}
.checklist { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; color: var(--text-2); font-size: 13px; list-style: none; }
.checklist li { display: flex; gap: 8px; }
.checklist code { white-space: nowrap; }
.checklist .icon { width: 16px; height: 16px; margin-top: 2px; color: #16a34a; }

.timeline { margin: 0; padding: 0 22px 18px; list-style: none; }
.timeline li { position: relative; display: flex; gap: 12px; padding: 8px 0; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; top: 24px; bottom: -6px; left: 4px; width: 2px; background: var(--border); }
.timeline-dot { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.timeline-title { color: var(--text-2); font-size: 13px; word-break: break-word; }
.timeline-meta { color: var(--muted); font-size: 12px; }

/* Profile ------------------------------------------------------------- */

.profile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 32px 24px; text-align: center; }
.profile h2 { margin-top: 10px; font-size: 20px; }
.profile-role { max-width: 320px; color: var(--muted); font-size: 13px; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin: 18px 0 0; padding-top: 18px; border-top: 1px solid var(--border); }
.details div { display: flex; flex-direction: column; gap: 2px; }
.details dt { color: var(--muted); font-size: 12px; }
.details dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

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

.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 44px 56px;
    overflow: hidden;
    background:
        radial-gradient(900px 520px at -10% -10%, rgb(73 125 183 / 72%) 0%, transparent 58%),
        radial-gradient(700px 420px at 110% 110%, rgb(124 176 51 / 30%) 0%, transparent 55%),
        linear-gradient(145deg, #173a61 0%, #1e4775 58%, #173a61 100%);
    color: #cbd5e1;
}
.auth-hero-body { max-width: 540px; }
.auth-hero h2 { color: #fff; font-size: 34px; font-weight: 750; line-height: 1.15; letter-spacing: -0.03em; }
.auth-hero p { margin-top: 14px; color: #dbe6f2; font-size: 15.5px; }
.hero-chart {
    display: block;
    width: 100%;
    height: auto;
    margin: 34px 0 30px;
    padding: 18px;
    border: 1px solid rgb(255 255 255 / 8%);
    border-radius: 18px;
    background: rgb(255 255 255 / 3%);
    box-shadow: 0 30px 60px -30px rgb(0 0 0 / 60%);
}
.hero-features { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.hero-features li { display: flex; align-items: center; gap: 12px; color: #dbe3ef; font-size: 14.5px; }
.hero-features .icon { background: rgb(124 176 51 / 18%); color: #b3d98a; }
.auth-hero-footer { color: #c1d0df; }
.auth-panel {
    background:
        radial-gradient(700px 500px at 100% 100%, rgb(124 176 51 / 9%), transparent 58%),
        linear-gradient(145deg, #edf5fb 0%, #dceaf5 100%);
    justify-content: flex-end;
    padding: 48px clamp(48px, 7vw, 112px) 48px 48px;
}
.auth-card {
    width: 100%;
    max-width: 460px;
    margin-left: 24px;
    padding: 38px 42px;
    border: 1px solid rgb(30 71 117 / 10%);
    border-radius: 18px;
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 24px 60px -28px rgb(30 71 117 / 38%);
}
.auth-card h1 { font-size: 32px; }
.auth-card .input-lg { min-height: 52px; }
.auth-card .btn-lg { min-height: 52px; }
.auth-hero .hero-tagline {
    margin: 10px 0 0;
    color: #8ed15a;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* Responsive ---------------------------------------------------------- */

@media (max-width: 1280px) {
    .layout-split { grid-template-columns: minmax(0, 1fr) 340px; }
}

@media (max-width: 1180px) {
    .export-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .export-field:first-child { grid-column: 1 / -1; }
    .layout-split { grid-template-columns: minmax(0, 1fr); }
    .trend-layout { grid-template-columns: minmax(0, 1fr); }
    .source-stats { grid-template-columns: repeat(3, minmax(0, auto)); }
    .source-stats div:last-child { grid-column: 1 / -1; }
    .data-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .sidebar { box-shadow: none; transform: translateX(-100%); transition: transform 0.25s ease; }
    .sidebar.is-open { box-shadow: var(--shadow-lg); transform: none; }
    .main { margin-left: 0; }
    .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        border-bottom: 1px solid var(--border);
        background: rgb(255 255 255 / 94%);
    }
    .topbar .brand-mark { width: 30px; height: 30px; }
    .content { padding: 22px 18px 32px; }
    .footer { padding: 14px 18px 22px; }
    .layout-two { grid-template-columns: minmax(0, 1fr); }
    .data-tools { grid-template-columns: minmax(0, 1fr); }
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-hero { display: none; }
    .auth-panel {
        justify-content: center;
        padding: 48px 24px;
    }
    .auth-card { margin-left: 0; }
    .auth-panel .auth-brand { display: inline-flex; }
}

@media (max-width: 640px) {
    h1 { font-size: 22px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .card-header { flex-direction: column; }
    .footer { flex-direction: column; }
    .export-grid { grid-template-columns: minmax(0, 1fr); }
    .export-footer { flex-direction: column; align-items: stretch; }
    .source-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .chart-box { height: 320px; padding: 0 8px 8px; }
    .auth-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
    body { background: #fff; }
    .sidebar, .topbar, .footer, .export-card, .data-tools, .card-actions, .page-actions, .alert-close, .row-actions, .actions-col, .trend-filter { display: none !important; }
    .trend-layout { display: block; }
    .main { margin: 0; }
    .content { max-width: none; padding: 0; }
    .card { box-shadow: none; break-inside: avoid; }
}
