:root {
    --bg: #eef2f7;
    --panel: #ffffff;
    --panel-soft: #f7f9fc;
    --text: #172033;
    --muted: #6d7b93;
    --line: #d9e1ee;
    --brand: #2563eb;
    --brand-dark: #1e4fc4;
    --danger-bg: #fff0f0;
    --danger-text: #b42318;
    --shadow: 0 18px 50px rgba(18, 34, 66, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.10), transparent 32%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 520px);
    background: var(--panel);
    border: 1px solid rgba(217, 225, 238, 0.8);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.auth-brand h1 {
    margin: 0;
    font-size: 32px;
}

.auth-brand p,
.muted,
.auth-note {
    margin: 6px 0 0;
    color: var(--muted);
}

.auth-badge {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1d4ed8, #4f8dfd);
    color: #fff;
    font-weight: 700;
    font-size: 20px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: var(--panel-soft);
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 18px;
}

.auth-tab {
    text-align: center;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 600;
}

.auth-tab.active {
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 8px 20px rgba(20, 35, 63, 0.08);
}

.auth-error {
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--danger-bg);
    color: var(--danger-text);
    margin-bottom: 16px;
    font-size: 14px;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form label {
    display: grid;
    gap: 8px;
}

.auth-form span {
    font-size: 14px;
    font-weight: 600;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 15px;
    background: #fff;
}

.remember-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.remember-row input {
    width: 18px;
    height: 18px;
}

.primary-btn,
.secondary-btn {
    border: 0;
    border-radius: 16px;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.primary-btn {
    background: linear-gradient(135deg, var(--brand), #5b9bff);
    color: #fff;
}

.primary-btn:hover {
    background: linear-gradient(135deg, var(--brand-dark), #4b8ef5);
}

.secondary-btn {
    background: var(--panel-soft);
    color: var(--text);
    border: 1px solid var(--line);
}

.panel-shell {
    min-height: 100vh;
    position: relative;
}

.panel-toggle {
    display: none;
}

.panel-sidebar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
    border-right: 1px solid rgba(217, 225, 238, 0.8);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(88vw, 320px);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 2000;
    box-shadow: var(--shadow);
}

.panel-toggle:checked ~ .panel-sidebar {
    transform: translateX(0);
}

.panel-sidebar-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.panel-sidebar-head h2 {
    margin: 0;
    font-size: 24px;
}

.panel-sidebar-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.panel-nav {
    display: grid;
    gap: 8px;
}

.panel-spacer {
    flex: 1;
    min-height: 24px;
}

.panel-nav-link {
    border-radius: 16px;
    padding: 14px 16px;
    color: var(--muted);
    font-weight: 600;
    transition: 0.18s ease;
}

.panel-nav-link:hover,
.panel-nav-link.active {
    background: #edf4ff;
    color: var(--brand-dark);
}

.panel-logout {
    margin-top: 0;
}

.full-width {
    width: 100%;
}

.panel-content {
    padding: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.panel-header h1 {
    margin: 0;
    font-size: 40px;
}

.panel-user {
    margin-left: auto;
    min-width: 84px;
    text-align: right;
    color: var(--muted);
}

.burger-btn {
    width: 52px;
    height: 52px;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    border-radius: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(18, 34, 66, 0.08);
    padding: 0 14px;
    cursor: pointer;
}

.burger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
}

.hero-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(91, 155, 255, 0.04));
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 28px;
    padding: 24px;
    margin-bottom: 18px;
}

.hero-text {
    margin: 0;
    max-width: 720px;
    line-height: 1.6;
    font-size: 17px;
}

.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    color: var(--muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.stats-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(91, 155, 255, 0.04));
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 28px;
    padding: 24px;
    margin-bottom: 18px;
}

.stats-hero h2 {
    margin: 0 0 10px;
    font-size: 32px;
}

.stats-date-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stats-date-form input[type="date"] {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 15px;
    background: #fff;
    color: var(--text);
}

.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stats-warning {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #fff4e5;
    color: #9a5b00;
    border: 1px solid #ffd8a8;
    font-weight: 600;
}

.warning-action-form {
    margin-top: 14px;
}

.admin-success {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #ecfdf3;
    color: #0f7a37;
    border: 1px solid #b7ebc6;
    font-weight: 600;
}

.stats-summary-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 18px 20px;
    box-shadow: 0 12px 28px rgba(18, 34, 66, 0.05);
}

.stats-summary-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 12px;
    font-size: 14px;
}

.stats-summary-card strong {
    font-size: 34px;
    line-height: 1;
}

.stats-log-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 12px 28px rgba(18, 34, 66, 0.05);
}

.stats-log-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.stats-log-head h3 {
    margin: 0 0 6px;
    font-size: 24px;
}

.stats-log-head p {
    margin: 0;
    color: var(--muted);
}

.stats-log-list {
    display: grid;
    gap: 14px;
}

.stats-log-item {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 14px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.stats-log-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.stats-log-time {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-dark);
}

.stats-log-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.stats-log-line span {
    color: var(--muted);
    font-size: 14px;
}

.stats-log-title,
.stats-log-details {
    margin: 0;
    line-height: 1.55;
}

.stats-log-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.stats-log-details {
    color: var(--muted);
}

.stats-empty {
    border: 1px dashed var(--line);
    border-radius: 20px;
    padding: 20px;
    color: var(--muted);
    background: var(--panel-soft);
}

.map-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.map-summary-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 18px 20px;
    box-shadow: 0 12px 28px rgba(18, 34, 66, 0.05);
}

.map-summary-card h3 {
    margin: 0 0 6px;
    font-size: 24px;
}

.map-summary-card p {
    margin: 0;
    color: var(--muted);
}

.map-filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.map-filter-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    padding: 11px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.map-filter-chip.active {
    background: #edf4ff;
    border-color: rgba(37, 99, 235, 0.45);
    color: var(--brand-dark);
}

.map-filter-chip[data-filter="battery"].active {
    background: rgba(47, 107, 255, 0.10);
    border-color: rgba(47, 107, 255, 0.35);
    color: #2f6bff;
}

.map-filter-chip[data-filter="firmware"].active {
    background: rgba(255, 138, 0, 0.12);
    border-color: rgba(255, 138, 0, 0.35);
    color: #ff8a00;
}

.map-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 30px;
    padding: 12px;
    box-shadow: 0 12px 28px rgba(18, 34, 66, 0.05);
}

.maintenance-map {
    width: 100%;
    height: min(72vh, 780px);
    border-radius: 24px;
    overflow: hidden;
    background: #dfe8f5;
}

.maintenance-marker-wrap {
    background: transparent;
    border: 0;
}

.maintenance-marker {
    position: relative;
    display: inline-flex;
    width: 24px;
    height: 24px;
    border-radius: 999px 999px 999px 0;
    transform: rotate(-45deg);
    box-shadow: 0 8px 18px rgba(18, 34, 66, 0.18);
}

.maintenance-marker-dot {
    position: absolute;
    inset: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
}

.info-card {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
}

.info-card h2 {
    margin: 0 0 10px;
    font-size: 20px;
}

.info-card p {
    margin: 0;
    line-height: 1.55;
    color: var(--muted);
}

.admin-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 12px 28px rgba(18, 34, 66, 0.05);
}

.admin-card h2 {
    margin: 0 0 8px;
    font-size: 24px;
}

.admin-card-text {
    margin: 0 0 18px;
    color: var(--muted);
}

.admin-user-form {
    display: grid;
    gap: 14px;
    max-width: 520px;
}

.admin-user-form label {
    display: grid;
    gap: 8px;
}

.admin-user-form span {
    font-size: 14px;
    font-weight: 600;
}

.admin-user-form input[type="text"],
.admin-user-form input[type="password"],
.admin-user-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 15px;
    background: #fff;
    font: inherit;
}

.admin-user-form textarea {
    resize: vertical;
    min-height: 84px;
    line-height: 1.45;
}

.admin-check-row {
    margin-top: -2px;
}

.postomat-status {
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.postomat-status.is-ok {
    background: #eefbf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.postomat-status.is-error {
    background: #fff6ea;
    color: #b45309;
    border: 1px solid #f8d9a7;
}

.postomat-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.postomat-flags span {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--muted);
}

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

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
}

.users-table th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    z-index: 1900;
}

.panel-toggle:checked ~ .panel-overlay {
    display: block;
}

@media (max-width: 920px) {

    .panel-content {
        padding: 18px;
    }

    .panel-header h1 {
        font-size: 30px;
    }

    .panel-user {
        display: none;
    }

    .stats-hero {
        flex-direction: column;
    }

    .stats-date-form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .map-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .map-filter-row {
        width: 100%;
    }

    .stats-log-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (max-width: 640px) {
    .auth-card {
        padding: 22px;
        border-radius: 22px;
    }

    .auth-brand h1 {
        font-size: 26px;
    }
}
