/* ── Reset / Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f0f2f5;
    color: #344767;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
:root {
    --sidebar-w: 250px;
    --header-h: 56px;
    --blue: #1a73e8;
    --blue-dark: #0d47a1;
    --card-shadow: 0 2px 12px rgba(0,0,0,.12);
}

.layout-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(195deg, #42424a 0%, #191919 100%);
    color: #fff;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 3px 0 10px rgba(0,0,0,.3);
}

.sidebar-brand {
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand img { height: 36px; }
.sidebar-brand-text { font-size: 1rem; font-weight: 600; letter-spacing: .5px; }

.sidebar-nav { flex: 1; padding: 16px 12px; }

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,.75);
    cursor: pointer;
    font-size: .875rem;
    margin-bottom: 4px;
    transition: background .2s, color .2s;
    user-select: none;
}

.sidebar-nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav-item.active { background: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(26,115,232,.5); }
.sidebar-nav-item i { font-size: 1rem; width: 20px; text-align: center; }

.layout-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--header-h);
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(0,0,0,.07);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 12px;
}

.topbar-title { font-weight: 600; font-size: 1rem; flex: 1; }

.topbar-sse {
    font-size: .75rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot-live {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 1.5s infinite;
}

.dot-dead { background: #f44336; animation: none; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .3; }
}

.page-content { padding: 24px; flex: 1; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a237e 0%, #1a73e8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #1a237e, #1a73e8);
    padding: 28px;
    text-align: center;
}

.login-header img { height: 56px; }
.login-header h2 { color: #fff; margin: 12px 0 0; font-size: 1.25rem; }

.login-body { padding: 28px; }
.login-body .form-label { font-size: .875rem; font-weight: 500; }
.login-body .form-control { border-radius: 8px; }

.login-error {
    background: #ffebee;
    color: #c62828;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .875rem;
    margin-bottom: 16px;
}

.btn-login {
    width: 100%;
    padding: 11px;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s;
}

.btn-login:hover:not(:disabled) { background: var(--blue-dark); }
.btn-login:disabled { opacity: .65; cursor: not-allowed; }

.login-version {
    text-align: center;
    font-size: .75rem;
    color: #9e9e9e;
    margin-top: 16px;
}

/* ── Forgot password (login page) ────────────────────────────────────────── */
.login-forgot-link {
    text-align: center;
    margin-top: 14px;
    font-size: .82rem;
}
.login-forgot-link a { color: #1a73e8; text-decoration: none; }
.login-forgot-link a:hover { text-decoration: underline; }
.login-forgot {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e8eaed;
}
.login-forgot h4 {
    font-size: .95rem;
    font-weight: 600;
    color: #344767;
    margin: 0 0 8px;
}
.login-forgot p {
    font-size: .82rem;
    color: #77839a;
    margin: 0 0 14px;
}
.login-forgot-done {
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .82rem !important;
    margin: 0 0 4px !important;
}

/* ── Sensor cards ────────────────────────────────────────────────────────── */
.sensors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
}

.sensor-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.sensor-card-header {
    background: linear-gradient(195deg, #1a73e8 0%, #0d47a1 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
}

.sensor-card-title { font-size: 1rem; font-weight: 600; flex: 1; text-align: center; }

.sensor-card-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.85);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1;
    transition: background .15s;
}

.icon-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .7rem;
}

.status-dot { width: 9px; height: 9px; border-radius: 50%; }
.status-online { background: #66bb6a; box-shadow: 0 0 6px #66bb6a; }
.status-offline { background: #ef5350; }

.sensor-card-body { padding: 16px; }

.gauge-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 320px;
    position: relative;
    display: block;
    overflow: hidden;
}

.sensor-info {
    text-align: center;
    padding: 8px 0 4px;
    font-size: .875rem;
    color: #555;
    line-height: 1.6;
}

.sensor-info .fill-notice { color: #e53935; font-weight: 500; }

.sensor-badges {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 6px 0;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .75rem;
    color: #666;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 3px 10px;
}

/* ── Settings slide ──────────────────────────────────────────────────────── */
.settings-slide { padding: 16px; }
.settings-slide h4 { text-align: center; font-size: 1rem; margin-bottom: 16px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .8rem; font-weight: 500; color: #555; margin-bottom: 4px; }
.form-group input, .form-group select {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: .875rem;
    outline: none;
    transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--blue); }

.depth-radio { display: flex; align-items: center; gap: 6px; }
.depth-radio label { margin: 0; font-size: .875rem; cursor: pointer; }

.tank-use-group { display: flex; gap: 8px; }
.tank-use-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: .875rem;
    transition: all .2s;
}
.tank-use-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }


.btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 500;
    transition: all .2s;
}

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: #f0f0f0; color: #555; }
.btn-secondary:hover { background: #e0e0e0; }

.email-unverified {
    background: #fff3e0;
    color: #e65100;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: .8rem;
    margin-top: 8px;
}

.email-row { display: flex; align-items: flex-end; gap: 8px; }
.email-row .form-group { flex: 1; margin-bottom: 0; }

/* ── Dialog ──────────────────────────────────────────────────────────────── */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.dialog {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    width: 100%;
    max-width: 460px;
    padding: 24px;
}

.dialog h3 { font-size: 1.1rem; margin: 0 0 8px; }
.dialog p { font-size: .875rem; color: #666; margin: 0 0 16px; }

.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.shape-options { display: flex; gap: 16px; margin: 16px 0; }
.shape-option {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    text-align: center;
    transition: all .2s;
}
.shape-option:hover { border-color: var(--blue); }
.shape-option.selected { border-color: var(--blue); background: #e8f0fe; }
.shape-option svg { display: block; margin: 0 auto 8px; width: 60px; height: 60px; }
.shape-option span { font-size: .875rem; font-weight: 500; }

/* ── History ─────────────────────────────────────────────────────────────── */
.map-card {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h) - 48px);
}

.corpo-map {
    flex: 1;
    min-height: 0;
    width: 100%;
    /* Leaflet's internal panes/controls use z-index up to ~700-1000; without
       its own stacking context those values compare directly against
       .layout-sidebar (z-index:100) in the root stacking context, so the
       map renders above the mobile slide-in sidebar. */
    isolation: isolate;
}

/* ── Szczegóły split layout ──────────────────────────────────────────────── */
.szczegoly-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h) - 48px);
    gap: 12px;
}

.szczegoly-selector-bar {
    flex-shrink: 0;
    background: linear-gradient(195deg, #1a73e8 0%, #0d47a1 100%);
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: var(--card-shadow);
}

.szczegoly-sensor-select {
    flex: 1;
    min-width: 160px;
    max-width: 360px;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: .875rem;
    font-family: monospace;
    background: rgba(255,255,255,.15);
    color: #fff;
}
.szczegoly-sensor-select option { color: #344767; background: #fff; }

/* ── Build date (login footer + sidebar) ─────────────────────────────────── */
.build-date { white-space: nowrap; }
.sidebar-build-date {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px 8px;
    font-size: .7rem;
    color: rgba(255,255,255,.4);
    white-space: nowrap;
}

/* ── Language switcher ───────────────────────────────────────────────────── */
.lang-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px 10px;
    color: rgba(255,255,255,.55);
    font-size: .75rem;
}
.lang-btn {
    border: 1px solid rgba(255,255,255,.25);
    background: transparent;
    color: rgba(255,255,255,.75);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
}
.lang-btn:hover { background: rgba(255,255,255,.12); }
.lang-btn.active {
    background: #1a73e8;
    border-color: #1a73e8;
    color: #fff;
}
/* Login page has a light background — needs its own colours */
.lang-switch--login {
    position: absolute;
    top: 16px;
    right: 20px;
    padding: 0;
    color: #90a0b7;
}
.lang-switch--login .lang-btn { border-color: #c9d3e0; color: #526480; }
.lang-switch--login .lang-btn:hover { background: #e8f0fe; }
.lang-switch--login .lang-btn.active { background: #1a73e8; border-color: #1a73e8; color: #fff; }

/* ── CSV export button (history toolbar) ─────────────────────────────────── */
.csv-btn {
    border: 1px solid rgba(255,255,255,.45);
    background: rgba(255,255,255,.15);
    color: #fff;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.csv-btn:hover:not(:disabled) { background: rgba(255,255,255,.28); }
.csv-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Typeahead sensor picker ─────────────────────────────────────────────── */
.sensor-picker {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 160px;
    max-width: 360px;
}
/* Messages filter: sits in a header row next to the refresh button, no stretching */
.sensor-picker--sm {
    flex: 0 0 auto;
    min-width: 0;
    width: 200px;
    max-width: 200px;
}
.sensor-picker .sensor-picker-input {
    width: 100%;
    max-width: none;
    flex: 1;
    padding-right: 24px;   /* room for the caret */
}
.sensor-picker .sensor-picker-input::placeholder { color: rgba(255,255,255,.7); }
.sensor-picker-caret {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,.75);
    font-size: .8rem;
    pointer-events: none;
}
/* position:fixed — must escape the overflow:hidden on .users-card */
.sensor-picker-list {
    position: fixed;
    z-index: 4000;
    margin: 0;
    padding: 4px;
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.22);
    font-size: .8rem;
    font-family: monospace;
    color: #344767;
}
.sensor-picker-item {
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sensor-picker-item.is-active { background: #e8f0fe; color: #0d47a1; }
.sensor-picker-empty { padding: 6px 10px; color: #9e9e9e; }

.szczegoly-top {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.szczegoly-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.szczegoly-card-header {
    flex-shrink: 0;
    background: linear-gradient(195deg, #1a73e8 0%, #0d47a1 100%);
    color: #fff;
    padding: 10px 16px;
    font-weight: 600;
    font-size: .875rem;
}

/* Card header carrying tabs instead of a single title (Parametry / Progi alarmowe) */
.szczegoly-card-header--tabs {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px 0 4px;
}
.card-tabs { display: flex; min-width: 0; }
.card-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255,255,255,.68);
    font-weight: 600;
    font-size: .8rem;
    font-family: inherit;
    padding: 10px 11px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.card-tab:hover { color: #fff; }
.card-tab.active { color: #fff; border-bottom-color: #fff; }
/* .sef-header-btn floats right in a plain header; in the flex one it just centres. */
.szczegoly-card-header--tabs .sef-header-btn { float: none; align-self: center; }

.szczegoly-card-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px;
}

/* Info marker next to each parameter label — the description is in its title */
.param-help {
    margin-left: 5px;
    font-size: .72rem;
    color: #b0bac9;
    cursor: help;
}
.param-help:hover { color: #1a73e8; }

.help-tip {
    position: fixed;
    z-index: 5000;
    width: 300px;
    background: rgba(30,30,40,.94);
    color: #fff;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: .78rem;
    font-weight: 400;
    line-height: 1.5;
    box-shadow: 0 4px 14px rgba(0,0,0,.28);
    white-space: pre-line;  /* the connection status is several short lines */
    pointer-events: none;   /* never swallow the hover that opened it */
}

.param-status {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: .75rem;
    font-weight: 600;
    vertical-align: middle;
}

.param-status--ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.param-status--pending {
    background: #fff3e0;
    color: #e65100;
}

.param-status--default {
    background: #f5f5f5;
    color: #9e9e9e;
}

.szczegoly-bottom {
    flex: 1;
    min-height: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.szczegoly-chart-area {
    flex: 1;
    min-height: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 7px 20px;
    font-size: .85rem;
    margin: 0;
}
.detail-grid dt { color: #888; white-space: nowrap; }
.detail-grid dd { margin: 0; font-weight: 500; color: #344767; word-break: break-word; }

/* Sensor edit form inside Szczegóły card */
.sef-header-btn { float: right; background: none; border: none; color: #fff; cursor: pointer; font-size: 1rem; padding: 0; opacity: .85; }
.sef-header-btn:hover { opacity: 1; }
.sensor-edit-form { display: flex; flex-direction: column; gap: 10px; }
.sef-row { display: grid; grid-template-columns: 140px 1fr; align-items: start; gap: 8px; font-size: .85rem; }
.sef-row > label:first-child { color: #888; padding-top: 5px; white-space: nowrap; }
.sef-input { width: 100%; border: 1px solid #d0d7de; border-radius: 6px; padding: 5px 8px; font-size: .85rem; color: #344767; outline: none; background: #fff; }
.sef-input:focus { border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,.15); }
.sef-input-sm { width: 80px; }
/* Params card labels ("Minimalne wskazanie [cm]") don't fit the default 140px column */
.sensor-edit-form--params .sef-row { grid-template-columns: 1fr 110px; }
.sensor-edit-form--params .sef-row > label:first-child { white-space: normal; }
.sensor-edit-form--params .sef-input-sm { width: 100%; }
.sef-radio-group { display: flex; flex-direction: column; gap: 4px; }
.sef-radio { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.sef-addr-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sef-addr-row { display: flex; gap: 4px; align-items: center; }
.sef-addr-row .sef-input { flex: 1; min-width: 0; }
.sef-gps-btn { flex-shrink: 0; width: 30px; height: 30px; border: 1px solid #d0d7de; border-radius: 6px; background: #f6f8fa; cursor: pointer; color: #1a73e8; font-size: .85rem; display: flex; align-items: center; justify-content: center; }
.sef-gps-btn:hover:not(:disabled) { background: #e8f0fe; border-color: #1a73e8; }
.sef-gps-btn:disabled { opacity: .5; cursor: not-allowed; }
.sef-gps-coords { font-size: .75rem; color: #888; font-family: monospace; padding-left: 1px; }
#map-picker { cursor: crosshair; }
.sef-error { color: #e53935; font-size: .8rem; }

/* ── Alarm thresholds card ───────────────────────────────────────────────── */
.threshold-head,
.threshold-row {
    display: grid;
    grid-template-columns: 1fr 68px 68px 24px;
    align-items: center;
    gap: 6px;
    font-size: .85rem;
}
.threshold-head { font-size: .72rem; color: #9aa4b2; text-transform: uppercase; letter-spacing: .3px; }
.threshold-head span:not(:first-child) { text-align: center; }
.threshold-row > label { color: #888; white-space: normal; line-height: 1.15; }
.threshold-row .sef-input { padding: 4px 6px; text-align: right; }
.threshold-check { width: auto; margin: 0 auto; }
/* Placeholder where a metric has no such bound (battery has no upper one). */
.threshold-na { color: #d0d7de; text-align: center; cursor: help; }
/* A threshold kept on file but switched off still shows its values, struck out. */
.threshold-disabled { color: #9e9e9e; text-decoration: line-through; }
.threshold-hint { margin: 12px 0 0; font-size: .75rem; color: #9aa4b2; line-height: 1.35; }

/* ── Firmware tab ────────────────────────────────────────────────────────── */
.fw-upgrade {
    margin-top: 14px;
    padding: 12px;
    background: #f6f8fa;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
}
.fw-upgrade-title { font-size: .8rem; font-weight: 600; color: #344767; margin-bottom: 8px; }
.fw-notice {
    margin-top: 12px;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: .8rem;
    display: flex;
    align-items: flex-start;
    gap: 7px;
    line-height: 1.35;
}

/* Notification-mail flag on the user list */
.notify-on  { color: #f57c00; }
.notify-off { color: #d0d7de; }

.history-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.history-card-header {
    background: linear-gradient(195deg, #1a73e8 0%, #0d47a1 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-card-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }

.history-controls { display: flex; align-items: center; gap: 8px; }

.period-btns { display: flex; gap: 4px; }
.period-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.5);
    background: none;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    font-size: .75rem;
    transition: all .15s;
}
.period-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.period-btn.active { background: rgba(255,255,255,.25); color: #fff; border-color: rgba(255,255,255,.8); }

.period-range { display: flex; align-items: center; gap: 4px; }
.period-range-sep { color: rgba(255,255,255,.7); font-size: .8rem; }
.period-date-input {
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.5);
    background: rgba(255,255,255,.12);
    color: #fff;
    font-size: .75rem;
    cursor: pointer;
    width: 120px;
    color-scheme: dark;
}
.period-date-input:focus { outline: none; border-color: rgba(255,255,255,.9); background: rgba(255,255,255,.2); }

.battery-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: .8rem;
    color: rgba(255,255,255,.85);
}

.toggle-switch {
    position: relative;
    width: 32px;
    height: 18px;
    background: rgba(255,255,255,.3);
    border-radius: 9px;
    transition: background .2s;
}

.toggle-switch.on { background: #4caf50; }

.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

.toggle-switch.on .toggle-knob { transform: translateX(14px); }

.chart-container { padding: 16px; min-height: 520px; position: relative; }

/* ── D3 chart styles ─────────────────────────────────────────────────────── */
.chart-area { fill: rgba(8, 72, 146, 0.15); }
.chart-line { fill: none; stroke: #0d47a1; stroke-width: 1.5px; }
.chart-line-battery { fill: none; stroke: red; stroke-width: 1.5px; }
.chart-line-humidity { fill: none; stroke: green; stroke-width: 1.5px; }
.chart-line-temp { fill: none; stroke: orange; stroke-width: 1.5px; }
.dot { fill: #2e2461; }
.dot-bat { fill: #8d2c2c; }

.chart-grid line { stroke: #e8e8e8; }
.chart-grid path { stroke-width: 0; }

.chart-tooltip {
    position: absolute;
    background: rgba(0,0,0,.78);
    color: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: .78rem;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
    transition: opacity .15s;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0 0;
    font-size: .8rem;
    color: #555;
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-color { display: inline-block; width: 28px; height: 14px; border-radius: 3px; }

/* ── Hamburger button ────────────────────────────────────────────────────── */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #344767;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    margin-right: 4px;
    line-height: 1;
}
.hamburger-btn:hover { background: #f0f0f0; }

/* ── Mobile overlay ──────────────────────────────────────────────────────── */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .hamburger-btn { display: block; }
    .mobile-overlay { display: block; }

    .layout-sidebar {
        width: var(--sidebar-w);
        transform: translateX(calc(-1 * var(--sidebar-w)));
        transition: transform .25s ease;
    }
    .layout-sidebar.sidebar-mobile-open {
        transform: translateX(0);
    }

    .layout-main { margin-left: 0; }
    .sensors-grid { grid-template-columns: 1fr; }

    .szczegoly-selector-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .szczegoly-sensor-select {
        max-width: 100%;
    }
    .sensor-picker { max-width: 100%; }
    .history-controls {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
    .period-btns { flex-wrap: nowrap; }
    .period-date-input { width: 110px; }

    .szczegoly-top { grid-template-columns: 1fr; }
    .szczegoly-wrap { height: auto; }
    .szczegoly-bottom { min-height: 300px; }
}

/* ── Sidebar org label ───────────────────────────────────────────────────── */
/* Chart-scoped toggles, sitting above the plot they control.
   .battery-toggle and .toggle-switch were written for the blue selector bar, so their
   label and off-state track are white — invisible on the chart card. Both are restated
   here for a light background; the on-state green already reads on either. */
.chart-toggles .battery-toggle { color: #55617a; }
.chart-toggles .toggle-switch { background: #cfd6e0; }
.chart-toggles .toggle-switch.on { background: #4caf50; }

.chart-toggles {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 10px 14px 8px;
    border-bottom: 1px solid #eef1f5;
}

/* ── Map pins and alarm tooltips ─────────────────────────────────────────── */
/* divIcon brings its own box; strip it so only the SVG shows. */
.corpo-pin { background: none; border: none; }
.map-alarm {
    border-left: 3px solid;
    padding: 2px 0 4px 8px;
    margin-bottom: 7px;
    font-size: .82rem;
    line-height: 1.45;
}
.map-tooltip { font-size: .8rem; line-height: 1.45; }
.map-tooltip--alarm { border: 1px solid #e53935; }

/* Threshold alarms sit in the same table as the pipeline's own notifications;
   the badge colour is what tells them apart. */
.msg-badge--alarm { background: #fff3e0; color: #e65100; }

/* ── Browser push toggle in the sidebar ──────────────────────────────────── */
.sidebar-push { padding: 0 14px 8px; }
.sidebar-push-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .72rem;
    color: rgba(255,255,255,.55);
    cursor: pointer;
    user-select: none;
}
.sidebar-push-row:hover { color: rgba(255,255,255,.8); }
.sidebar-push-row.busy { pointer-events: none; opacity: .6; }
.sidebar-push-note {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    margin-top: 5px;
    font-size: .66rem;
    line-height: 1.3;
    color: #ffb74d;
}
.sidebar-push-note--err { color: #ef9a9a; }
.sidebar-push-note--ok  { color: #a5d6a7; }
.sidebar-push-test {
    margin-top: 6px;
    background: none;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 6px;
    color: rgba(255,255,255,.6);
    font-family: inherit;
    font-size: .66rem;
    padding: 3px 8px;
    cursor: pointer;
}
.sidebar-push-test:hover:not(:disabled) { color: #fff; border-color: rgba(255,255,255,.35); }
.sidebar-push-test:disabled { opacity: .5; cursor: default; }

/* ── Master: organisation switcher in the sidebar ────────────────────────── */
/* The menu opens upwards — the switcher sits at the bottom of the sidebar. */
.sidebar-org-switch { position: relative; padding: 0 10px 8px; }
.sidebar-org-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    color: rgba(255,255,255,.85);
    font-family: inherit;
    font-size: .74rem;
    padding: 7px 9px;
    cursor: pointer;
    text-align: left;
}
.sidebar-org-btn:hover:not(:disabled) { background: rgba(255,255,255,.13); }
.sidebar-org-btn:disabled { opacity: .6; cursor: default; }
.sidebar-org-btn-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-caret-open { transform: rotate(180deg); }

.master-badge {
    flex-shrink: 0;
    background: #f57c00;
    color: #fff;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .4px;
}

.sidebar-org-menu {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 100%;
    margin-bottom: 6px;
    background: #16223c;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 10px;
    box-shadow: 0 8px 26px rgba(0,0,0,.45);
    padding: 5px;
    max-height: 46vh;
    overflow-y: auto;
    z-index: 40;
}
.sidebar-org-menu-head {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: rgba(255,255,255,.4);
    padding: 5px 8px 6px;
}
.sidebar-org-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    border-radius: 6px;
    color: rgba(255,255,255,.82);
    font-family: inherit;
    font-size: .78rem;
    padding: 7px 8px;
    cursor: pointer;
    text-align: left;
}
.sidebar-org-item:hover { background: rgba(255,255,255,.1); }
.sidebar-org-item.active { background: rgba(26,115,232,.35); color: #fff; font-weight: 600; }
.sidebar-org-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-org-item-meta { flex-shrink: 0; font-size: .68rem; color: rgba(255,255,255,.45); font-variant-numeric: tabular-nums; }
.sidebar-org-item--add {
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,.1);
    border-radius: 0 0 6px 6px;
    color: #8ab4f8;
    gap: 6px;
}

/* Toast for "organisation created", above everything but the dialogs. */
.org-notice {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 600;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 18px;
    border-radius: 10px;
    font-size: .85rem;
    box-shadow: 0 6px 24px rgba(0,0,0,.18);
    max-width: 90vw;
}

.sidebar-org-label {
    font-size: .72rem;
    color: rgba(255,255,255,.5);
    padding: 0 14px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Users view ──────────────────────────────────────────────────────────── */
.users-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.users-card-header {
    background: linear-gradient(195deg, #1a73e8 0%, #0d47a1 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.users-card-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }

.users-table-wrap { overflow-x: auto; }

.th-sort {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.th-sort:hover { background: #f0f4ff; }
.th-sort .fa { margin-left: 4px; opacity: .45; font-size: .7rem; }
.th-sort .fa-sort-up, .th-sort .fa-sort-down { opacity: 1; color: #1a73e8; }

.sensor-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.sensor-search-icon {
    position: absolute;
    left: 9px;
    color: #9e9e9e;
    font-size: .8rem;
    pointer-events: none;
}
.sensor-search-input {
    padding: 5px 10px 5px 28px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: .82rem;
    width: 200px;
    background: #fff;
    color: #344767;
    outline: none;
}
.sensor-search-input:focus { border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,.15); }

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid #f0f0f0;
}
.page-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    color: #344767;
    font-size: .8rem;
    transition: background .15s;
}
.page-btn:hover:not(:disabled) { background: #f0f4ff; border-color: #1a73e8; color: #1a73e8; }
.page-btn:disabled { opacity: .35; cursor: default; }
.page-info { font-size: .82rem; color: #555; }

.msg-sensor-filter {
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: .8rem;
    font-family: monospace;
    background: rgba(255,255,255,.15);
    color: #fff;
}
.msg-sensor-filter option { color: #344767; background: #fff; }

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.users-table thead tr {
    background: #f5f7fa;
    border-bottom: 2px solid #e8eaed;
}

.users-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: #555;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.users-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    color: #344767;
}

.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover td { background: #f9fafc; }
.sensor-row-clickable { cursor: pointer; }
.sensor-row-clickable:hover td { background: #e8f0fe !important; }

/* ── Rows whose sensor is currently outside a threshold ──────────────────── */
/* Same split as the map pins: red = tank (a level breach, someone has to go out),
   orange = device health (battery/temperature/humidity). The tint stays pale so the
   row is still readable — it marks the row, it does not shout over its contents —
   and the left bar carries the weight, which also survives on a mono display. */
.sensor-row--alarm td { background: #fdeeee; }
.sensor-row--alarm-device td { background: #fdf3e6; }
.sensor-row-clickable.sensor-row--alarm:hover td { background: #fbe0e0 !important; }
.sensor-row-clickable.sensor-row--alarm-device:hover td { background: #fbe9d2 !important; }

/* The bar has to sit on the first cell that is actually rendered, and which one that
   is changes with the breakpoint: .col-expand is display:none from 769px up, so
   anchoring to td:first-child would draw it on a hidden cell and show nothing. */
.sensor-row--alarm td.col-expand,
.sensor-row--alarm td.cell-login,
.sensor-row--alarm.sensor-detail-row td:first-child { position: relative; }

.sensor-row--alarm td.col-expand::before,
.sensor-row--alarm td.cell-login::before,
.sensor-row--alarm.sensor-detail-row td:first-child::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: #e53935;
}
.sensor-row--alarm-device td.col-expand::before,
.sensor-row--alarm-device td.cell-login::before,
.sensor-row--alarm-device.sensor-detail-row td:first-child::before { background: #f57c00; }

/* Below 769px the expand column is back, so the id cell is no longer the first one
   and its bar would land mid-row. */
@media (max-width: 768px) {
    .sensor-row--alarm td.cell-login::before { display: none; }
}
@media (min-width: 769px) {
    .sensor-row--alarm td.col-expand::before { display: none; }
}

.sensor-alarm-bell { margin-right: 6px; }
.sensor-alarm-bell--tank   { color: #e53935; }
.sensor-alarm-bell--device { color: #f57c00; }

/* ── Expand toggle column ────────────────────────────────────────────────── */
.col-expand {
    width: 32px;
    padding: 0 4px !important;
    text-align: center;
}

.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9e9e9e;
    padding: 4px 6px;
    line-height: 1;
    border-radius: 4px;
    transition: color .15s;
}
.expand-btn:hover { color: #1a73e8; }
.expand-btn i { transition: transform .15s; display: inline-block; }
.expand-btn.expanded i { transform: rotate(90deg); }

/* ── Responsive: hide secondary columns on narrow screens ────────────────── */
@media (max-width: 768px) {
    .col-secondary { display: none; }
}

/* On wider screens hide the expand button — columns are visible */
@media (min-width: 769px) {
    .col-expand { display: none; }
    .date-short { display: none; }
}

@media (max-width: 768px) {
    .date-full { display: none; }
}

/* ── Expanded detail row ─────────────────────────────────────────────────── */
.sensor-detail-row td {
    background: #f0f4ff !important;
    padding: 8px 12px 10px 36px !important;
    border-top: none !important;
}
.sensor-detail-row:hover td { background: #f0f4ff !important; }

.sensor-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px 16px;
}

.sdg-item {
    display: flex;
    flex-direction: column;
    font-size: .8rem;
}

.sdg-label {
    font-size: .7rem;
    font-weight: 600;
    color: #9e9e9e;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 1px;
}

.cell-login {
    font-family: monospace;
    font-size: .82rem;
    color: #555;
}

.cell-gps {
    font-size: .78rem;
    color: #555;
    max-width: 200px;
}

.role-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    margin-right: 4px;
    background: #e8f0fe;
    color: #1a73e8;
    border: 1px solid #c5d8fd;
    text-transform: lowercase;
}

.role-badge.role-admin {
    background: #fce8e6;
    color: #c5221f;
    border-color: #f5c6c5;
}

.role-badge.role-hr {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
}

/* ── Roles checklist (hr user modal) ────────────────────────────────────── */
.roles-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.roles-checklist-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid #ddd;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 500;
    color: #555;
    user-select: none;
    transition: all .15s;
}

.roles-checklist-item:hover { border-color: #1a73e8; color: #1a73e8; }

.roles-checklist-item.checked {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
}

.roles-checklist-item input[type="checkbox"] {
    width: auto;
    border: none;
    padding: 0;
    margin: 0;
    accent-color: #1a73e8;
    cursor: pointer;
}

/* ── Sensor detail dialog ────────────────────────────────────────────────── */
.sensor-detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: .875rem;
    margin: 16px 0;
}

.sd-label {
    color: #777;
    font-weight: 500;
    white-space: nowrap;
    align-self: center;
}

.sd-value {
    color: #344767;
    word-break: break-all;
    align-self: center;
}

/* ── Loader ──────────────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.page-empty {
    text-align: center;
    padding: 60px 24px;
    color: #9e9e9e;
}

.page-empty i { font-size: 3rem; margin-bottom: 12px; display: block; }


/* ── Autofill detection ──────────────────────────────────────────────────── */
/* Chrome writes autofilled values straight into the DOM without firing an event
   Vue's v-model listens to, so the next re-render wipes them. It does apply
   :-webkit-autofill, though — hanging a no-op animation off that pseudo-class
   gives an `animationstart` event that fires exactly when the fill happens,
   whatever the timing. app.js listens for it and copies the value into the model. */
@keyframes aq-autofill-start { from { opacity: 1; } to { opacity: 1; } }
.login-body input:-webkit-autofill {
    animation-name: aq-autofill-start;
    animation-duration: 1ms;
}

/* ── Premium ─────────────────────────────────────────────────────────────── */

/* Crown at the end of a sensor row. Only rendered when a plan is active, so it
   never needs a "no premium" variant — absence is the signal. */
.premium-crown {
    color: #f9a825;
    margin-left: 6px;
    cursor: help;
    font-size: .95rem;
    vertical-align: middle;
}
.premium-crown:hover { color: #f57f17; }

/* Premium state of the open sensor, right-aligned in the blue selector bar.
   `margin-left:auto` pushes it to the far edge without a spacer element, and it
   survives the bar wrapping on narrow screens. */
.premium-bar {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}
.premium-bar--on {
    background: rgba(249,168,37,.22);
    border: 1px solid rgba(249,168,37,.75);
    color: #ffe082;
}
.premium-bar--on .fa { color: #ffca28; }
.premium-bar--off {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.35);
    color: rgba(255,255,255,.8);
}

/* A locked control keeps its position and stays clickable — the click opens the
   upsell. Only the tint says it will not do the thing. */
.sef-header-btn--locked { opacity: .6; position: relative; }
.sef-header-btn--locked:hover { opacity: .9; }
.sef-lock-badge {
    font-size: .55rem;
    margin-left: 2px;
    vertical-align: super;
    color: #ffca28;
}

/* Locked CSV wears the same tint as the locked premium badge beside it (.premium-bar--off)
   — the two sit in one bar and both mean "this needs a plan", so they should not look
   like two different states. Full opacity and a solid edge: the button still works,
   it just leads somewhere else. */
.csv-btn.is-locked {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.35);
    color: rgba(255,255,255,.8);
}
.csv-btn.is-locked:hover { background: rgba(255,255,255,.22); color: #fff; }

.btn--locked { background: #9e9e9e; border-color: #9e9e9e; }
.btn--locked:hover { background: #8a8a8a; }

.premium-teaser { color: #a1720a; }

.premium-dialog-crown { color: #f9a825; margin-right: 8px; }
.premium-dialog-status { font-weight: 600; margin-top: 4px; }
.premium-dialog-device {
    font-family: monospace;
    font-size: .82rem;
    color: #666;
    margin-top: 2px;
}
.premium-dialog-soon {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #e3f2fd;
    color: #0d47a1;
    font-size: .85rem;
}
/* Shop links stand in for the pay button while in-panel payment is off, so they carry
   its weight: full width, stacked, one per device type. */
.premium-shop-links { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.premium-shop-link { text-align: center; text-decoration: none; }

@media (max-width: 700px) {
    /* On a wrapped bar the badge would sit alone on its own line pushed right;
       full width reads better than a lonely pill. */
    .premium-bar { margin-left: 0; width: 100%; justify-content: center; }
}

/* ── Premium cart ────────────────────────────────────────────────────────── */
.premium-cart { max-width: 560px; }

.premium-cart-hint { color: #666; font-size: .85rem; margin: 4px 0 10px; }

/* The sensor list is the tall part; cap it so the total and the pay button stay on
   screen for an organisation with many sensors. */
.premium-cart-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}
.premium-cart-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: .85rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
}
.premium-cart-row:last-child { border-bottom: none; }
.premium-cart-row:hover { background: #f7f9fc; }
.premium-cart-id   { font-family: monospace; font-weight: 600; }
.premium-cart-name { color: #666; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.premium-cart-active { color: #a1720a; white-space: nowrap; font-size: .78rem; }

.premium-cart-summary {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fffdf5;
    border: 1px solid #f2e0b0;
}
.premium-cart-summary-title {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #a1720a;
    margin-bottom: 6px;
}
.premium-cart-device {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    padding: 2px 0;
    flex-wrap: wrap;
}
.premium-cart-covers { color: #777; font-size: .78rem; }
.premium-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f2e0b0;
    font-size: .9rem;
}
.premium-cart-total strong { font-size: 1.1rem; }
.premium-cart-unit { color: #999; font-size: .75rem; margin-top: 2px; }

.premium-cart-error {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #ffebee;
    color: #c62828;
    font-size: .85rem;
}

.premium-return-ok  { color: #2e7d32; font-weight: 600; }
.premium-return-bad { color: #c62828; font-weight: 600; }

/* Buying is reachable without being blocked first — this is the button that makes it
   so. Gold rather than the primary blue, to read as the premium action next to
   "Dodaj czujnik" without competing with it. */
.btn-premium {
    background: #f9a825;
    border-color: #f9a825;
    color: #3b2c00;
}
.btn-premium:hover { background: #f57f17; border-color: #f57f17; color: #fff; }

/* The badge in the Szczegóły bar is a button now; strip the UA chrome so it still
   reads as a badge, and show it is clickable. */
.premium-bar {
    font-family: inherit;
    cursor: pointer;
    transition: filter .12s ease;
}
.premium-bar:hover { filter: brightness(1.15); }

/* The allowed range, stated in the row rather than discovered by being rejected. */
.threshold-range {
    color: #9e9e9e;
    font-size: .72rem;
    font-weight: 400;
    margin-left: 4px;
    white-space: nowrap;
}
.threshold-row--bad .sef-input { border-color: #e57373; background: #fff8f8; }
.threshold-row-error {
    color: #c62828;
    font-size: .78rem;
    margin: 2px 0 6px;
}

/* Retail buyers supply the receipt address here; corporate accounts already have one. */
.premium-cart-email { margin-top: 12px; }
.premium-cart-email label {
    display: block;
    font-size: .78rem;
    color: #555;
    margin-bottom: 4px;
}
.premium-cart-email .sef-input { width: 100%; }
.premium-cart-emailhint { color: #999; font-size: .74rem; margin-top: 3px; }

/* ── Retail premium bar ──────────────────────────────────────────────────── */
.retail-premium-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 8px 14px;
    border-radius: 10px;
    background: #fffdf5;
    border: 1px solid #f2e0b0;
}
.retail-premium-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: .85rem;
    font-weight: 600;
    flex: 1;
}
.retail-premium-status.is-on  { color: #a1720a; }
.retail-premium-status.is-off { color: #757575; }
.retail-premium-devices { display: inline-flex; gap: 6px; flex-wrap: wrap; font-weight: 400; }
.retail-premium-device {
    font-size: .74rem;
    font-family: monospace;
    background: rgba(249,168,37,.18);
    border-radius: 999px;
    padding: 1px 8px;
    white-space: nowrap;
}
/* A lapsed device inside an otherwise-covered account must not read as covered. */
.retail-premium-device.is-off { background: #eee; color: #888; text-decoration: line-through; }

/* The retail settings form, now inside the Szczegóły "Ustawienia czujnika" card. The
   card body already pads and the card header already names it, so drop the tile-era
   padding and centred heading. */
.settings-slide--details { padding: 0; }
.settings-slide--details h4 { text-align: left; font-size: .85rem; color: #666; margin-bottom: 10px; }

/* Retail custom range: marks the date pickers as the active choice, like a period
   button, and explains a start date that had to be moved forward. */
.period-range.active .period-date-input { border-color: #fff; box-shadow: 0 0 0 1px #fff; }
.retail-range-notice {
    margin: 6px 2px 0;
    font-size: .8rem;
    color: #5f6b7a;
}
.retail-range-upsell { color: #a1720a; font-weight: 600; margin-left: 4px; }

/* Toggle names beside the chart take the colour of the line they switch. */
.chart-toggles .series-label { font-weight: 600; }

/* ── 3D tank ─────────────────────────────────────────────────────────────── */
.tank3d { position: relative; width: 100%; }
.tank3d-canvas { display: block; width: 100%; height: 100%; }
.tank3d--tile { aspect-ratio: 1 / 1; max-height: 260px; }
/* Corporate card: percentage to the LEFT of the tank rather than over it, so the box can
   be short and the reading details below it scroll less. */
.tank3d--card { height: 140px; margin-bottom: 8px; }
/* Percentage and tank read as ONE group, centred in the card: the canvas is only as wide
   as the vessel needs (not stretched across the card, which left the number stranded at
   the far edge with a wide gap), and the number is right-aligned against it. */
.tank3d--beside { display: flex; align-items: center; justify-content: center; gap: 4px; }
.tank3d--beside .tank3d-canvas { flex: 0 0 auto; width: 190px; max-width: 60%; height: 100%; }
.tank3d--beside .tank3d-label {
    position: static;
    order: -1;
    flex: 0 0 auto;
    padding: 0;
    text-align: right;
    background: none;
    box-shadow: none;
}
/* The fill percentage sits on the animation itself, top-left, on a soft pill so it
   stays legible over glass, liquid and background alike. */
.tank3d-label {
    position: absolute;
    left: 10px;
    top: 8px;
    display: grid;
    gap: 1px;
    padding: 4px 10px 5px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 1px 4px rgba(13, 71, 161, .12);
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}
.tank3d-label b { font-size: 1.35rem; line-height: 1.1; color: #0d47a1; }
.tank3d-label span { font-size: .72rem; color: #4a5d77; }
.tank3d--card .tank3d-label b { font-size: 1.9rem; }
.tank3d--card .tank3d-label span { font-size: .8rem; }

/* ── Google / Apple sign-in ──────────────────────────────────────────────── */
.login-social { display: grid; gap: 10px; margin-top: 16px; }
.login-social-divider {
    display: flex; align-items: center; gap: 10px;
    color: #9aa3b5; font-size: .8rem;
}
.login-social-divider::before, .login-social-divider::after {
    content: ""; flex: 1; height: 1px; background: #e3e7ee;
}
.login-social-google { display: flex; justify-content: center; min-height: 44px; }
/* Apple's guidelines: black button, white logo and text, same height as Google's. */
.btn-apple {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; width: 100%;
    border: 0; border-radius: 4px;
    background: #000; color: #fff;
    font-size: .95rem; font-weight: 500;
    cursor: pointer;
}
.btn-apple svg { width: 15px; height: 18px; }
.btn-apple:disabled { opacity: .6; cursor: default; }
.login-social-hint { margin: 0; text-align: center; font-size: .75rem; color: #8a93a6; }

/* The date the "days to full" count points at, a step quieter than the count itself. */
.days-to-full-date { color: #7b8599; margin-left: 2px; }

/* ── Cancel / Save in the card header while editing ──────────────────────── */
/* The header does not scroll with the card body, so these stay in view however long the
   form is — at the bottom of the form they were usually scrolled out of sight. */
.card-edit-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.szczegoly-card-header--tabs .card-edit-actions { align-self: center; }
.card-edit-actions--float { float: right; margin-top: -3px; }
.card-edit-btn {
    border: 1px solid rgba(255,255,255,.55);
    background: transparent;
    color: #fff;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
}
.card-edit-btn:hover { background: rgba(255,255,255,.14); }
.card-edit-btn--save { background: #fff; border-color: #fff; color: #0d47a1; }
.card-edit-btn--save:hover { background: #e8f0fe; }
.card-edit-btn--save i { margin-right: 5px; }
.card-edit-btn:disabled { opacity: .55; cursor: default; }
.card-edit-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* Save errors now sit at the top of the form, right under the header's Save button. */
.sef-error--top {
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #fdecea;
}

/* A prediction whose date has already passed: said plainly, in the alarm red. */
.sensor-info .fill-notice--overdue { color: #c62828; font-weight: 600; }
.days-to-full-overdue { color: #c62828; font-weight: 600; }

/* While a tab's form is being edited, the other tab steps aside for Cancel / Save:
   switching tabs mid-edit would only hide unsaved changes, and on a narrow card the
   buttons otherwise run over the second tab's label. */
.card-tabs--editing .card-tab:not(.active) { display: none; }

/* (i) help icon beside a chart switch: a little more room and an easier target than the
   inline icons in the parameter lists. */
.chart-toggle-help { font-size: .8rem; margin-left: 6px; padding: 2px; cursor: help; }
.chart-toggle-help:focus-visible { outline: 2px solid #1a73e8; outline-offset: 2px; border-radius: 50%; }
