:root {
    --navy: #12233F;
    --navy-active: #24406E;
    --blue: #1D5BBF;
    --blue-dark: #174A9C;
    --ground: #F4F6F9;
    --ink: #18212F;
    --muted: #566174;
    --line: #E1E5EB;
    --green: #27AE60;
    --yellow: #F1C40F;
    --red: #EB5757;
}

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    flex: 0 0 240px;
    background: var(--navy);
    color: #FFFFFF;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    padding: 0 14px;
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
}

.brand-tag {
    font-size: 13px;
    color: #A9B7CE;
    margin-top: 2px;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 8px;
    color: #C9D3E3;
    text-decoration: none;
}

.nav-item:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
    color: #FFFFFF;
    background: var(--navy-active);
    font-weight: 600;
}

.nav-count {
    background: var(--yellow);
    color: #3D2E00;
    border-radius: 999px;
    padding: 1px 9px;
    font-size: 12.5px;
    font-weight: 700;
}

.sidebar-user {
    margin-top: auto;
    padding: 0 14px;
    font-size: 13.5px;
    color: #A9B7CE;
}

.sidebar-user strong {
    color: #FFFFFF;
}

.btn-logout {
    margin-top: 10px;
    width: 100%;
    min-height: 40px;
    border: 1px solid #6F82A3;
    border-radius: 8px;
    background: transparent;
    color: #FFFFFF;
    font-size: 14px;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.1);
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 28px 32px;
}

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

.page-title {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
}

.page-sub {
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}

.panel {
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

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

.panel-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1 1 170px;
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
}

.stat-label {
    font-size: 13.5px;
    color: var(--muted);
}

.stat-value {
    font-size: 30px;
    font-weight: 600;
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}

.stat-value.warn {
    color: #7A5B00;
}

.stat-note {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

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

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

.data-table th {
    text-align: left;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #EEF1F5;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

.data-table .num {
    text-align: right;
}

.data-table .actions {
    text-align: right;
    white-space: nowrap;
}

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

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-in {
    background: #E6F6EC;
    color: #1B6B3C;
}

.status-in .status-dot {
    background: var(--green);
}

.status-low {
    background: #FDF6D8;
    color: #7A5B00;
}

.status-low .status-dot {
    background: var(--yellow);
}

.status-out {
    background: #FDE8E8;
    color: #A12626;
}

.status-out .status-dot {
    background: var(--red);
}

.status-ordered {
    background: #E3EDFB;
    color: #17479A;
}

.status-ordered .status-dot {
    background: var(--blue);
}

.inline-form {
    display: inline;
}

.line-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.line-form .field {
    flex: 1 1 160px;
}

.line-form .field.wide {
    flex: 2 1 260px;
}

.summary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
}

.summary-label {
    font-size: 13px;
    color: var(--muted);
}

.summary-value {
    font-size: 16px;
    font-weight: 600;
    margin-top: 2px;
}

button.btn-brand,
button.btn-quiet,
button.btn-danger-quiet {
    cursor: pointer;
}

.qty-input {
    width: 96px;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid #B9C1CE;
    border-radius: 8px;
    font-size: 15px;
    text-align: right;
    color: var(--ink);
    background: #FFFFFF;
}

.qty-input:focus {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

.check-cell {
    width: 44px;
}

.check-cell input {
    width: 18px;
    height: 18px;
}

.supplier-heading {
    font-size: 15px;
    font-weight: 600;
    margin: 18px 0 6px;
}

.supplier-heading:first-child {
    margin-top: 0;
}

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

.table-link {
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.btn-brand {
    background: var(--blue);
    border: 1px solid var(--blue);
    color: #FFFFFF;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.btn-brand:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
    color: #FFFFFF;
}

.btn-quiet {
    background: #FFFFFF;
    border: 1px solid #B9C1CE;
    color: var(--ink);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13.5px;
    text-decoration: none;
    display: inline-block;
}

.btn-quiet:hover {
    background: var(--ground);
    color: var(--ink);
}

.btn-danger-quiet {
    background: #FFFFFF;
    border: 1px solid #E3A3A3;
    color: #A12626;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13.5px;
    text-decoration: none;
    display: inline-block;
}

.btn-danger-quiet:hover {
    background: #FDE8E8;
    color: #A12626;
}

.search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 14px;
}

.search-row .field {
    flex: 1 1 260px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 6px;
}

.field input,
.field select {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #B9C1CE;
    border-radius: 8px;
    font-size: 15px;
    color: var(--ink);
    background: #FFFFFF;
}

.field input:focus,
.field select:focus {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

.form-panel {
    max-width: 640px;
}

.form-panel .field {
    margin-bottom: 16px;
}

.field-hint {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 4px;
}

.field-error {
    color: #A12626;
    font-size: 13px;
    margin-top: 4px;
}

.notice {
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.notice-success {
    background: #E6F6EC;
    color: #1B6B3C;
}

.notice-error {
    background: #FDE8E8;
    color: #A12626;
}

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

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--navy);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #FFFFFF;
    border-radius: 14px;
    padding: 32px;
}

.login-card .field {
    margin-bottom: 16px;
}

.login-brand {
    font-size: 22px;
    font-weight: 700;
}

.login-tag {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 24px;
}

@media (max-width: 800px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        flex: 0 0 auto;
        gap: 16px;
    }

    .nav-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-user {
        margin-top: 0;
    }

    .app-main {
        padding: 20px 16px;
    }
}

.total-row td {
    font-weight: 600;
    border-top: 2px solid var(--line);
    border-bottom: 0;
}

.report-meta {
    color: var(--muted);
    font-size: 13.5px;
    margin-bottom: 14px;
}

.report-meta strong {
    color: var(--ink);
    font-weight: 600;
}

@media print {
    .app-sidebar,
    .no-print {
        display: none;
    }

    .app-main {
        padding: 0;
    }

    body {
        background: #FFFFFF;
    }

    .panel {
        border: 0;
        padding: 0;
    }
}

.nav-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 28px;
}

.menu-toggle {
    display: none;
}

@media (max-width: 800px) {
    .app-sidebar {
        padding: 10px 16px;
        gap: 0;
    }

    .sidebar-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .brand {
        padding: 0;
    }

    .menu-toggle {
        position: relative;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        width: 46px;
        height: 46px;
        border: 1px solid #6F82A3;
        border-radius: 8px;
        background: transparent;
        cursor: pointer;
    }

    .menu-bar {
        display: block;
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: #FFFFFF;
    }

    .menu-count {
        position: absolute;
        top: -7px;
        right: -7px;
    }

    .nav-body {
        display: none;
        gap: 14px;
        padding: 12px 0 8px;
    }

    .app-sidebar.open .nav-body {
        display: flex;
    }

    .nav-list {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .sidebar-user {
        padding: 0 14px;
    }
}

@media print {
    .menu-toggle {
        display: none;
    }
}

.data-table th {
    white-space: normal;
    padding: 10px 8px;
    vertical-align: bottom;
}

.data-table td {
    padding: 11px 8px;
}

.data-table .actions {
    white-space: normal;
    min-width: 132px;
}

.data-table .actions a,
.data-table .actions button {
    margin: 2px 0 2px 2px;
}

.data-table .btn-brand,
.data-table .btn-quiet,
.data-table .btn-danger-quiet {
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 500;
}

.field select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23566174' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}

.line-form {
    align-items: flex-start;
}

.line-form > button,
.line-form > a {
    margin-top: 26px;
    min-height: 42px;
}

.line-form > a {
    display: inline-flex;
    align-items: center;
}

button.btn-brand,
button.btn-quiet,
button.btn-danger-quiet {
    font-family: inherit;
    line-height: inherit;
}
