:root {
    --bg: #0f1318;
    --panel: #171d24;
    --panel-soft: #202832;
    --line: #2b3542;
    --text: #eef4f7;
    --muted: #9aa9b7;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #f59e0b;
    --danger: #ef4444;
    --success: #22c55e;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color-scheme: dark;
}

body.modal-open {
    overflow: hidden;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    background: #090d12;
    color: #fff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 78px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .18);
}

.brand small,
.user-box small {
    display: block;
    color: var(--muted);
}

.sidebar nav {
    display: grid;
    gap: 4px;
}

.sidebar nav a,
.user-box a {
    position: relative;
    color: #dce7ee;
    padding: 11px 12px 11px 16px;
    border-radius: 8px;
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.sidebar nav a:hover,
.user-box a:hover {
    background: #60a5fa;
    color: #07111f;
    transform: translateX(4px);
    box-shadow: 0 8px 22px rgba(96, 165, 250, .22);
}

.sidebar nav a::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 3px;
    height: 0;
    border-radius: 999px;
    background: #bfdbfe;
    transform: translateY(-50%);
    transition: height .18s ease;
}

.sidebar nav a:hover::before {
    height: 22px;
}

.user-box {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .10);
}

.main {
    margin-left: 260px;
    padding: 28px;
}

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

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

.page-head h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

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

.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));
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}

.metric strong {
    display: block;
    font-size: 28px;
    margin-top: 6px;
}

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

.dashboard-total {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(360px, .9fr);
    gap: 18px;
    align-items: center;
    margin-top: 16px;
    border-color: rgba(37, 99, 235, .38);
}

.dashboard-total h2 {
    margin: 6px 0;
    font-size: 34px;
}

.dashboard-total p {
    margin: 0;
}

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

.total-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.total-strip div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.total-strip strong,
.total-strip span {
    display: block;
}

.total-strip strong {
    font-size: 24px;
}

.total-strip span {
    color: var(--muted);
    margin-top: 4px;
}

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

.section-head h2,
.section-head p {
    margin: 0;
}

.section-head p {
    margin-top: 4px;
}

.branch-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

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

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

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

.branch-card > strong {
    display: block;
    font-size: 26px;
    margin-bottom: 14px;
}

.branch-card-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.branch-card-metrics span {
    display: grid;
    gap: 3px;
    padding: 10px;
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--muted);
}

.branch-card-metrics b {
    color: var(--text);
}

.branch-movement-report {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.report-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--muted);
}

.report-head b {
    color: var(--text);
}

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

.movement-grid span {
    display: grid;
    gap: 3px;
    min-height: 54px;
    padding: 9px;
    border-radius: 8px;
    background: rgba(37, 99, 235, .08);
    color: var(--muted);
}

.movement-grid b {
    color: var(--text);
    font-size: 14px;
}

.expiry-alert-card {
    border-color: rgba(245, 158, 11, .38);
}

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

.expiry-alert-item {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.expiry-alert-item.warn {
    border-color: rgba(245, 158, 11, .38);
    background: rgba(245, 158, 11, .08);
}

.expiry-alert-item.danger {
    border-color: rgba(239, 68, 68, .38);
    background: rgba(239, 68, 68, .10);
}

.expiry-alert-item strong {
    color: var(--text);
}

.expiry-alert-item span {
    color: var(--muted);
}

.movement-branch-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.movement-branch-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #11171f;
    color: var(--text);
}

.movement-branch-card.active,
.movement-branch-card:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, .10);
}

.movement-branch-card > span {
    color: var(--muted);
}

.movement-branch-card strong {
    font-size: 24px;
}

.movement-branch-card div {
    display: grid;
    gap: 4px;
}

.movement-branch-card small {
    color: var(--muted);
}

.action-card {
    display: grid;
    align-content: space-between;
    gap: 16px;
}

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

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
    min-height: 40px;
    line-height: 1.2;
    white-space: nowrap;
}

.btn.secondary,
button.secondary {
    background: #334155;
}

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

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

.btn.small,
button.small {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 13px;
}

button:hover,
.btn:hover {
    background: var(--primary-dark);
    color: #fff;
}

form > button,
label > button {
    justify-self: start;
}

.icon-btn {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--text);
    border: 1px solid var(--line);
    font-size: 0;
    line-height: 1;
    position: relative;
}

.icon-btn::before,
.icon-btn::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform-origin: center;
}

.icon-btn::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.icon-btn::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    padding: 20px;
}

.modal.active {
    display: grid;
    place-items: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .72);
}

.modal-panel {
    position: relative;
    width: min(1060px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(16, 24, 32, .26);
    padding: 22px;
}

.modal-panel.narrow {
    width: min(620px, 100%);
}

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

.modal-head h2 {
    margin: 0 0 4px;
}

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

form {
    display: grid;
    gap: 14px;
}

.inline-form {
    display: inline-grid;
    gap: 0;
}

.full-inline-form {
    width: 220px;
    gap: 6px;
}

.full-inline-form input,
.full-inline-form select {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 13px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #11171f;
}

.check-row input {
    width: 18px;
    min-height: 18px;
    height: 18px;
    margin: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 14px;
}

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

.field-with-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
}

.field-with-action button {
    min-height: 40px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    background: #11171f;
    color: var(--text);
    min-height: 40px;
}

.modal-panel input,
.modal-panel select {
    min-height: 48px;
}

.modal-panel .field-with-action button {
    min-height: 48px;
}

input::placeholder,
textarea::placeholder {
    color: #738393;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 2px solid rgba(37, 99, 235, .26);
}

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

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

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

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

th {
    background: var(--panel-soft);
    font-size: 13px;
    color: #cbd5df;
}

tr:hover td {
    background: rgba(255, 255, 255, .025);
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(37, 99, 235, .16);
    color: #93c5fd;
}

.badge.warn {
    background: rgba(245, 158, 11, .16);
    color: #fbbf24;
}

.badge.danger {
    background: rgba(239, 68, 68, .16);
    color: #fca5a5;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

.alert.success {
    background: rgba(34, 197, 94, .12);
    border-color: rgba(34, 197, 94, .30);
    color: #86efac;
}

.alert.error {
    background: rgba(239, 68, 68, .12);
    border-color: rgba(239, 68, 68, .30);
    color: #fca5a5;
}

.auth-card {
    width: min(440px, 100%);
}

.auth-logo {
    display: block;
    width: min(260px, 100%);
    margin: 0 auto 18px;
    border-radius: 8px;
}

.captcha-box {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.captcha-box strong,
.captcha-box span {
    display: block;
}

.captcha-box span {
    color: var(--muted);
    margin-top: 4px;
}

.captcha-image {
    display: block;
    width: 180px;
    max-width: 100%;
    height: 62px;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0b1220;
}

.scanner-panel {
    display: none;
    gap: 10px;
    margin-top: 8px;
}

.scanner-panel.active {
    display: grid;
}

.scanner-panel video {
    width: 100%;
    max-height: 280px;
    background: #05070a;
    border-radius: 8px;
}

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

.landing-page {
    width: min(1180px, calc(100vw - 40px));
    margin: 0 auto;
}

.landing-hero {
    position: relative;
    display: grid;
    gap: 34px;
    min-height: 620px;
    align-content: start;
    margin: 0 auto 28px;
    padding: 22px 48px 48px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(15, 19, 24, .90) 0%, rgba(15, 19, 24, .72) 48%, rgba(15, 19, 24, .20) 100%),
        linear-gradient(180deg, rgba(15, 19, 24, .28), rgba(15, 19, 24, .68)),
        url("../img/warehouse-hero.jpg") center right / cover no-repeat;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .28);
}

.landing-nav,
.landing-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.landing-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-weight: 800;
}

.landing-brand img {
    width: 72px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.landing-hero-content {
    max-width: 780px;
    padding-top: 20px;
    position: relative;
    z-index: 1;
}

.landing-kicker {
    display: inline-flex;
    margin-bottom: 16px;
    color: #93c5fd;
    font-weight: 800;
}

.landing-hero h1 {
    margin: 0;
    font-size: 42px;
    line-height: 1.08;
}

.landing-hero p {
    max-width: 760px;
    margin: 18px 0 24px;
    color: var(--muted);
    font-size: 18px;
}

.landing-section {
    padding: 32px 0;
}

.landing-section h2 {
    margin: 0 0 8px;
    font-size: 30px;
}

.landing-steps,
.landing-feature-grid {
    display: grid;
    gap: 14px;
}

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

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

.landing-steps article,
.landing-feature-grid article,
.landing-checks {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 18px;
}

.landing-steps span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-bottom: 14px;
    border-radius: 8px;
    background: rgba(37, 99, 235, .18);
    color: #93c5fd;
    font-weight: 800;
}

.landing-steps h3,
.landing-feature-grid h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.landing-steps p,
.landing-feature-grid p,
.landing-management-grid p {
    margin: 0;
    color: var(--muted);
}

.landing-band {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.landing-management-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    gap: 20px;
    align-items: start;
}

.landing-checks {
    display: grid;
    gap: 10px;
}

.landing-checks span {
    padding-left: 18px;
    position: relative;
}

.landing-checks span::before {
    content: "";
    position: absolute;
    left: 0;
    top: .6em;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--success);
}

.landing-footer {
    padding: 24px 0 6px;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.landing-footer strong {
    color: var(--text);
}

@media (max-width: 960px) {
    .sidebar {
        position: static;
        width: auto;
        min-height: 0;
    }

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

    .main {
        margin-left: 0;
        padding: 18px;
    }

    .grid.cols-2,
    .grid.cols-3,
    .grid.cols-4,
    .form-grid,
    .dashboard-total,
    .branch-summary-grid,
    .expiry-alert-grid,
    .movement-branch-grid {
        grid-template-columns: 1fr;
    }

    .total-strip,
    .billing-grid,
    .branch-card-metrics,
    .movement-grid {
        grid-template-columns: 1fr;
    }

    .page-head {
        display: grid;
    }

    .captcha-box {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 12px;
    }

    .modal-panel {
        max-height: calc(100vh - 24px);
        padding: 18px;
    }

    .landing-hero {
        min-height: 560px;
        gap: 28px;
        padding: 18px 24px 36px;
        background:
            linear-gradient(180deg, rgba(15, 19, 24, .82), rgba(15, 19, 24, .78)),
            url("../img/warehouse-hero.jpg") center / cover no-repeat;
    }

    .landing-hero h1 {
        font-size: 34px;
    }

    .landing-steps,
    .landing-feature-grid,
    .landing-management-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 14px;
    }

    .sidebar {
        padding: 14px;
        gap: 14px;
    }

    .brand-logo {
        width: 64px;
        height: 44px;
    }

    .sidebar nav {
        grid-template-columns: 1fr;
    }

    .sidebar nav a,
    .user-box a {
        padding: 10px 12px;
    }

    .main,
    .auth-main {
        padding: 12px;
    }

    .page-head {
        gap: 12px;
        margin-bottom: 16px;
    }

    .page-head h1 {
        font-size: 24px;
    }

    .card {
        padding: 14px;
    }

    .metric strong,
    .branch-card > strong,
    .movement-branch-card strong {
        font-size: 22px;
    }

    .dashboard-total h2 {
        font-size: 26px;
    }

    .actions {
        width: 100%;
    }

    .actions .btn,
    .actions button,
    form > button {
        width: 100%;
    }

    .btn,
    button {
        white-space: normal;
        text-align: center;
    }

    .field-with-action {
        grid-template-columns: 1fr;
    }

    .check-row {
        width: 100%;
        align-items: flex-start;
    }

    .modal {
        padding: 8px;
    }

    .modal-panel {
        max-height: calc(100vh - 16px);
        padding: 14px;
    }

    .modal-head {
        gap: 10px;
    }

    .modal-head h2 {
        font-size: 22px;
    }

    input,
    select,
    textarea,
    .modal-panel input,
    .modal-panel select,
    .modal-panel .field-with-action button {
        min-height: 44px;
    }

    .table-wrap {
        margin-inline: -2px;
    }

    table {
        min-width: 680px;
    }

    th,
    td {
        padding: 10px;
    }

    .captcha-image {
        width: 100%;
    }

    .landing-page {
        width: 100%;
    }

    .landing-nav,
    .landing-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .landing-hero {
        padding: 14px 14px 30px;
        min-height: 520px;
        gap: 22px;
    }

    .landing-hero-content {
        padding-top: 8px;
    }

    .landing-brand img {
        width: 62px;
        height: 42px;
    }

    .landing-hero h1 {
        font-size: 28px;
    }

    .landing-hero p {
        font-size: 16px;
    }

    .landing-section h2 {
        font-size: 24px;
    }
}
