:root {
    --ink: #1f2937;
    --muted: #667085;
    --line: #d9e2ec;
    --page: #f5f7fb;
    --panel: #ffffff;
    --brand: #146c94;
    --brand-2: #1d8a75;
    --danger: #b42318;
    --warning: #b54708;
    --success: #027a48;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

a {
    color: var(--brand);
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
    background: #102a43;
    color: #e6f0f7;
    padding: 20px 16px;
}

.brand {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.25;
}

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    padding: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d6e4f0;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
}

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

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.content {
    padding: 24px;
}

.page-title {
    margin: 0;
    font-size: 24px;
}

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

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

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

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

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 8px;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    min-height: 38px;
    padding: 8px 10px;
    font: inherit;
    background: #fff;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

label {
    font-weight: 700;
    display: block;
    margin: 10px 0 6px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 16px;
}

.form-grid .wide {
    grid-column: span 3;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid var(--brand);
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    padding: 8px 13px;
    cursor: pointer;
    font-weight: 700;
}

.btn.secondary {
    background: #fff;
    color: var(--brand);
}

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

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

table {
    border-collapse: collapse;
    min-width: 860px;
    width: 100%;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: #edf2f7;
    font-size: 12px;
    text-transform: uppercase;
    color: #475569;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 2px 9px;
    background: #e6f4ef;
    color: var(--success);
    font-weight: 700;
    font-size: 12px;
}

.badge.warn {
    background: #fff4e5;
    color: var(--warning);
}

.badge.danger {
    background: #fee4e2;
    color: var(--danger);
}

.alert {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #eaf4ff;
    color: #184e77;
}

.alert-success {
    background: #e6f4ef;
    color: var(--success);
}

.alert-danger {
    background: #fee4e2;
    color: var(--danger);
}

.alert-warning {
    background: #fff4e5;
    color: var(--warning);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #102a43, #0f766e);
}

.login-box {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 8px;
    padding: 28px;
}

.login-logo {
    width: 92px;
    max-height: 72px;
    object-fit: contain;
    display: block;
    margin-bottom: 14px;
}

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

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tab-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
}

.tab-button.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

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

    .sidebar {
        position: static;
    }

    .stats,
    .two,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .wide {
        grid-column: auto;
    }

    .topbar,
    .content {
        padding-left: 16px;
        padding-right: 16px;
    }
}

[dir="rtl"] th,
[dir="rtl"] td {
    text-align: right;
}

[dir="rtl"] .sidebar,
[dir="rtl"] .topbar,
[dir="rtl"] .toolbar,
[dir="rtl"] .brand,
[dir="rtl"] .nav-link {
    direction: rtl;
}

.map-picker {
    width: 100%;
    min-height: 320px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
