* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

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

img {
    max-width: 100%;
}

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

.login-card,
.panel,
.card,
.stat-card,
.driver-task-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(18, 36, 31, 0.05);
}

.login-card {
    width: min(100%, 420px);
    padding: 28px;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #162622;
    color: #eef4f2;
    padding: 24px 20px;
}

.main-shell {
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.content {
    padding: 24px;
}

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

.brand-block.centered {
    justify-content: center;
    text-align: center;
    flex-direction: column;
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.brand-logo.large {
    width: 84px;
    height: 84px;
}

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

.nav-link {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    color: #d8e1de;
}

.nav-link.active,
.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.page-header h1,
.page-header h2,
.page-header h3,
.stat-card h3,
.login-card h1,
.card h3,
.driver-task-card h3 {
    margin-top: 0;
}

.muted {
    color: var(--color-muted);
}

.small {
    font-size: 0.88rem;
}

.stack {
    display: grid;
    gap: 14px;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 10px;
    padding: 11px 16px;
    background: var(--brand-primary);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

.btn:hover {
    background: var(--brand-primary-hover);
}

.btn-secondary {
    background: #eef2f0;
    color: var(--color-text);
}

.btn-secondary:hover {
    background: #dde5e1;
}

.btn-danger {
    background: var(--status-danger);
}

.field {
    display: grid;
    gap: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: #fff;
    font: inherit;
}

.field textarea {
    min-height: 110px;
    resize: vertical;
}

.panel,
.card {
    padding: 18px;
}

.stat-card {
    padding: 18px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

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

.data-table th {
    background: #f0f4f2;
    font-size: 0.92rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(47, 143, 82, 0.12);
    color: var(--status-success);
}

.badge-warning {
    background: rgba(217, 135, 28, 0.14);
    color: var(--status-warning);
}

.badge-danger {
    background: rgba(196, 69, 54, 0.14);
    color: var(--status-danger);
}

.badge-info {
    background: rgba(47, 110, 167, 0.14);
    color: var(--status-info);
}

.badge-neutral {
    background: rgba(108, 117, 125, 0.14);
    color: var(--status-neutral);
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
}

.alert-success {
    background: rgba(47, 143, 82, 0.12);
    color: var(--status-success);
}

.alert-danger {
    background: rgba(196, 69, 54, 0.12);
    color: var(--status-danger);
}

.filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.cards-mobile {
    display: none;
    gap: 14px;
}

.mobile-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 16px;
}

.key-value {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
}

.driver-task-card {
    padding: 18px;
}

.driver-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.map {
    width: 100%;
    min-height: 420px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
}

.inline-form {
    display: inline;
}

.section-title {
    margin-bottom: 10px;
}

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding-bottom: 12px;
    }

    .topbar,
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .filters,
    .grid.cols-2,
    .grid.cols-3,
    .grid.cols-4,
    .driver-actions {
        grid-template-columns: 1fr;
    }

    .key-value {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

@media (max-width: 760px) {
    .content {
        padding: 16px;
    }

    .data-table {
        display: none;
    }

    .cards-mobile {
        display: grid;
    }
}
