:root {
    --navy: #142b4d;
    --navy-2: #0f213d;
    --orange: #f47b20;
    --blue: #174e91;
    --green: #18a75f;
    --red: #dc3f4f;
    --amber: #d98522;
    --bg: #f5f7fa;
    --card: #ffffff;
    --line: #dce2ea;
    --text: #171d29;
    --muted: #657184;
    --soft-blue: #eaf2ff;
    --soft-green: #e9f9f0;
    --soft-orange: #fff1e7;
    --soft-red: #fff0f2;
    --shadow: 0 18px 48px rgba(15, 28, 52, .16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

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

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 256px;
    background: linear-gradient(180deg, var(--navy), var(--navy-2));
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.brand {
    height: 72px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-mark {
    width: 60px;
    height: 40px;
    display: grid;
    place-items: center;
    background: #07152a;
    border: 1px solid rgba(255,255,255,.12);
    font-weight: 900;
    color: var(--orange);
}

.brand strong {
    display: block;
    font-size: 16px;
}

.brand span,
.version {
    color: rgba(255,255,255,.66);
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 6px;
    padding: 16px 12px;
}

.nav a {
    min-height: 44px;
    display: grid;
    grid-template-columns: 24px 1fr 12px;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.86);
    font-weight: 700;
    font-size: 14px;
}

.nav a.active {
    background: var(--orange);
    color: #fff;
    box-shadow: 0 8px 22px rgba(244,123,32,.28);
}

.nav .chevron {
    justify-self: end;
    font-size: 22px;
    line-height: 1;
}

.icon {
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    border: 1.8px solid currentColor;
    border-radius: 5px;
    opacity: .95;
}

.icon-users,
.icon-tool,
.icon-transfer,
.icon-report,
.icon-building {
    border-radius: 50%;
}

.icon-tool::after {
    content: "";
    width: 10px;
    height: 2px;
    background: currentColor;
    transform: rotate(-45deg);
}

.icon-transfer::before,
.icon-report::before,
.icon-building::before,
.icon-users::before,
.icon-grid::before {
    content: "";
    width: 8px;
    height: 8px;
    background: currentColor;
    opacity: .9;
}

.version {
    margin-top: auto;
    padding: 18px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,.08);
}

.main {
    margin-left: 256px;
    min-height: 100vh;
}

.topbar {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    font-weight: 800;
}

.content {
    padding: 28px 24px 44px;
}

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

.page-head h1 {
    margin: 0;
    font-size: 25px;
    line-height: 1.2;
}

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

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

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

.btn.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.btn.success {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

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

.btn.ghost {
    background: transparent;
}

.btn.block {
    width: 100%;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

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

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

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

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

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

.card {
    padding: 18px;
}

.stat {
    min-height: 102px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
}

.stat label {
    color: var(--muted);
    display: block;
    margin-bottom: 8px;
}

.stat strong {
    display: block;
    font-size: 32px;
    line-height: 1;
}

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

.stat .badge-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--soft-blue);
    color: var(--blue);
    font-weight: 900;
}

.panel {
    padding: 20px;
}

.panel h2,
.panel h3 {
    margin: 0 0 16px;
    font-size: 17px;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 12px;
    margin-bottom: 22px;
}

.toolbar.single {
    grid-template-columns: 1fr;
}

.search,
.field input,
.field select,
.field textarea,
.select-like {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    min-height: 38px;
    padding: 9px 12px;
    color: var(--text);
}

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

.field label {
    display: block;
    font-weight: 800;
    margin-bottom: 7px;
    font-size: 14px;
}

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

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

.field.full {
    grid-column: 1 / -1;
}

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

.entity-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.entity-title {
    display: flex;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--soft-blue);
    color: var(--blue);
    font-weight: 900;
    flex: 0 0 auto;
}

.card h3 {
    margin: 0;
    font-size: 16px;
}

.card p {
    margin: 3px 0;
    color: var(--muted);
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef2f7;
    color: #344052;
    font-size: 12px;
    font-weight: 900;
}

.pill.green {
    background: var(--soft-green);
    color: #087947;
}

.pill.orange {
    background: var(--soft-orange);
    color: #a44c0f;
}

.pill.red {
    background: var(--soft-red);
    color: #b32234;
}

.pill.blue {
    background: var(--soft-blue);
    color: var(--blue);
}

.pill.yellow {
    background: #fff5c7;
    color: #876700;
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-top: 16px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.list {
    display: grid;
}

.list-row {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--line);
    padding: 12px 0;
}

.list-row:first-child {
    border-top: 0;
}

.list-row h4 {
    margin: 0 0 2px;
}

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

.tab {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 14px;
    background: #fff;
    font-weight: 900;
}

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

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.66);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 50;
}

.modal.open {
    display: flex;
}

.modal-card {
    width: min(720px, 100%);
    max-height: min(90vh, 860px);
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.modal-card.small {
    width: min(420px, 100%);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 20px 24px 10px;
}

.modal-head h2 {
    margin: 0;
    font-size: 20px;
}

.modal-body {
    padding: 14px 24px 24px;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.segmented label {
    margin: 0;
}

.segmented input {
    position: absolute;
    opacity: 0;
}

.segmented span {
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    display: grid;
    place-items: center;
    font-weight: 900;
    cursor: pointer;
}

.segmented input:checked + span {
    border-color: var(--blue);
    background: var(--soft-blue);
    color: var(--blue);
}

.qr-wrap {
    text-align: center;
}

.qr-wrap img {
    width: 220px;
    height: 220px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.chart-bars {
    display: flex;
    align-items: end;
    gap: 18px;
    height: 220px;
    padding: 20px 10px 0;
    border-bottom: 1px solid var(--line);
}

.bar {
    flex: 1;
    display: grid;
    gap: 8px;
    align-content: end;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.bar span {
    display: block;
    min-height: 4px;
    background: var(--blue);
    border-radius: 5px 5px 0 0;
}

.status-chart {
    display: grid;
    gap: 10px;
}

.progress-line {
    display: grid;
    grid-template-columns: 150px 1fr 42px;
    align-items: center;
    gap: 12px;
}

.progress-line span:nth-child(2) {
    height: 8px;
    border-radius: 999px;
    background: var(--blue);
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-weight: 800;
}

.alert.success {
    background: var(--soft-green);
    color: #087947;
    border: 1px solid #bdebd1;
}

.alert.error {
    background: var(--soft-red);
    color: #b32234;
    border: 1px solid #ffd2d8;
}

.empty {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 32px;
    color: var(--muted);
    text-align: center;
    background: #fff;
}

.hidden {
    display: none !important;
}

@media (max-width: 1100px) {
    .stats,
    .stats.three,
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .sidebar {
        position: static;
        width: auto;
    }

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

    .version {
        display: none;
    }

    .main {
        margin-left: 0;
    }

    .page-head,
    .toolbar {
        grid-template-columns: 1fr;
        display: grid;
    }

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

    .modal {
        padding: 12px;
    }
}

