* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --line: #dfe4ea;
    --text: #182230;
    --muted: #667085;
    --nav: #101828;
    --nav2: #1d2939;
    --accent: #1570ef;
    --accent-soft: #eff8ff;
    --good: #067647;
    --good-bg: #ecfdf3;
    --warn: #b54708;
    --warn-bg: #fffaeb;
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --info: #175cd3;
    --info-bg: #eff8ff;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        Inter,
        Segoe UI,
        Arial,
        sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

button {
    cursor: pointer;
}

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

.sidebar {
    background: var(--nav);
    color: #fff;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 3px 4px 26px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: .5px;
    background: #fff;
    color: var(--nav);
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    color: #98a2b3;
    font-size: 12px;
    margin-top: 2px;
}

.nav {
    display: grid;
    gap: 7px;
}

.nav-btn {
    border: 0;
    border-radius: 9px;
    color: #d0d5dd;
    background: transparent;
    padding: 12px 12px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn:hover,
.nav-btn.active {
    color: #fff;
    background: var(--nav2);
}

.nav-icon {
    width: 24px;
    text-align: center;
}

.sidebar-foot {
    margin-top: auto;
    color: #98a2b3;
    font-size: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.online-dot {
    width: 8px;
    height: 8px;
    background: #12b76a;
    border-radius: 50%;
}

.main {
    min-width: 0;
}

.topbar {
    height: 90px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 17px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.eyebrow {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 25px;
}

h2 {
    margin-bottom: 5px;
    font-size: 18px;
}

h3 {
    font-size: 15px;
}

p {
    color: var(--muted);
    font-size: 13px;
}

.top-actions {
    display: flex;
    gap: 8px;
}

.btn {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 14px;
    font-weight: 650;
}

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

.btn.secondary {
    background: #fff;
    color: #344054;
    border-color: #d0d5dd;
}

.btn.small {
    padding: 6px 9px;
    font-size: 12px;
}

.screen {
    display: none;
    padding: 24px 28px;
}

.screen.active {
    display: block;
}

.kpi-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.kpi {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 17px 18px;
}

.kpi span {
    color: var(--muted);
    font-size: 12px;
}

.kpi strong {
    display: block;
    margin-top: 8px;
    font-size: 27px;
}

.kpi.warning strong {
    color: var(--warn);
}

.kpi.good strong {
    color: var(--good);
}

.kpi.info strong {
    color: var(--info);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.panel-head {
    padding: 17px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.panel-head p {
    margin-bottom: 0;
}

.search-wrap input {
    width: 310px;
}

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

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

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf0f3;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    background: #fafbfc;
}

tr:hover td {
    background: #fafcff;
}

.ref {
    font-weight: 800;
}

.sub {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 3px;
}

.empty {
    padding: 35px;
    color: var(--muted);
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 8px;
    font-weight: 700;
    font-size: 11px;
}

.badge.good {
    color: var(--good);
    background: var(--good-bg);
}

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

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

.badge.info {
    color: var(--info);
    background: var(--info-bg);
}

.badge.neutral {
    color: #475467;
    background: #f2f4f7;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 9px 10px;
    background: #fff;
    color: var(--text);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px #eff4ff;
}

label {
    display: grid;
    gap: 6px;
    color: #344054;
    font-size: 12px;
    font-weight: 650;
}

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

.span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.two-column {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);
    gap: 18px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(16,24,40,.55);
    display: grid;
    place-items: center;
    padding: 25px;
}

.modal.hidden {
    display: none;
}

.modal-card {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-height: 92vh;
    overflow: auto;
    box-shadow:
        0 22px 60px rgba(16,24,40,.25);
}

.modal-card.large {
    max-width: 850px;
}

.modal-head {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-head h2 {
    margin-bottom: 0;
}

.icon-btn {
    width: 35px;
    height: 35px;
    border: 0;
    border-radius: 8px;
    background: #f2f4f7;
    font-size: 24px;
    line-height: 1;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16,24,40,.35);
    z-index: 29;
}

.drawer-overlay.hidden {
    display: none;
}

.drawer {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: min(780px, 92vw);
    background: #fff;
    z-index: 30;
    box-shadow:
        -16px 0 45px rgba(16,24,40,.18);
    transform: translateX(101%);
    transition: transform .2s ease;
    overflow: hidden;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-head {
    height: 85px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-head h2 {
    margin-bottom: 0;
}

.drawer-content {
    height: calc(100vh - 85px);
    overflow-y: auto;
    padding: 18px 20px 45px;
}

.detail-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 18px;
}

.detail {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px;
}

.detail span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.detail strong {
    font-size: 13px;
}

.section-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 13px;
    overflow: hidden;
}

.section-title {
    background: #fafbfc;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-body {
    padding: 12px;
}

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

.item-row {
    border: 1px solid #eaecf0;
    border-radius: 8px;
    padding: 9px 10px;
}

.item-row strong {
    font-size: 12px;
}

.item-row p {
    margin: 4px 0 0;
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 7px;
    margin-top: 10px;
}

.inline-form.three {
    grid-template-columns:
        150px
        1fr
        auto;
}

.box-list {
    padding: 14px;
    display: grid;
    gap: 9px;
}

.box-card {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 11px;
}

.box-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.box-card strong {
    font-size: 14px;
}

.box-meta {
    color: var(--muted);
    font-size: 11px;
    display: grid;
    gap: 3px;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 100;
    border-radius: 10px;
    padding: 12px 16px;
    background: #101828;
    color: #fff;
    box-shadow:
        0 12px 30px rgba(16,24,40,.25);
    max-width: 400px;
}

.toast.error {
    background: #b42318;
}

.toast.hidden {
    display: none;
}

@media (max-width: 1050px) {

    .shell {
        grid-template-columns: 80px 1fr;
    }

    .brand > div:last-child,
    .nav-btn:not(.active) {
        font-size: 0;
    }

    .nav-btn {
        justify-content: center;
    }

    .sidebar-foot {
        display: none;
    }

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

    .two-column {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {

    .shell {
        display: block;
    }

    .sidebar {
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
    }

    .brand {
        padding: 0 10px 0 0;
    }

    .nav {
        display: flex;
    }

    .topbar {
        height: auto;
        align-items: flex-start;
        gap: 12px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .screen {
        padding: 15px;
    }

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

    .span-2 {
        grid-column: span 1;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .search-wrap input {
        width: 100%;
    }
}