html, body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f7fb;
    color: #1f2937;
}

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

.sidebar {
    background: #0f172a;
    color: white;
    padding: 24px 16px;
}

.brand {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 24px;
    line-height: 1.2;
}

.nav-link {
    display: block;
    color: #e5e7eb;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 17px;
    font-weight: 700;
    transition: background .15s ease, color .15s ease;
}

.nav-link.active,
.nav-link:hover {
    background: #1e293b;
    color: #ffffff;
}

.content {
    padding: 24px;
}

h1 {
    margin-top: 0;
}

.toolbar,
.form-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar {
    grid-template-columns: 1fr auto auto;
    align-items: center;
}

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

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

.input,
textarea,
select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    background: #374151;
    color: white;
    font-weight: 700;
}

.btn.primary {
    background: #2563eb;
}

.btn.danger {
    background: #dc2626;
    color: #ffffff;
}

.alert {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.alert.ok {
    background: #dcfce7;
    color: #166534;
}

.check {
    display: flex;
    gap: 8px;
    align-items: center;
}

.page-title {
    font-size: 2.7rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #0f172a;
    margin: 0 0 18px 0;
}

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

.input-search {
    height: 54px;
    font-size: 18px;
    border-radius: 14px;
    border: 1px solid #d8e1ea;
    background: #ffffff;
    padding: 0 16px;
}

.check-clean {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
}

.btn-refresh {
    height: 54px;
    min-width: 110px;
    padding: 0 20px;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 800;
    background: #243b53;
    color: #ffffff;
    border: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.summary-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 18px 18px 16px 18px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    background: #ffffff;
    min-height: 104px;
}

.summary-card::before {
    content: "";
    position: absolute;
    inset: 0;
    top: 20%;
    z-index: 0;
}

.summary-card > * {
    position: relative;
    z-index: 1;
}

.summary-label {
    font-size: 18px;
    font-weight: 900;
    color: #1e293b;
    margin-bottom: 10px;
}

.summary-number {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    color: #0f172a;
}

.summary-total::before {
    background: linear-gradient(to bottom, transparent 0%, transparent 20%, #e2e8f0 20%, #e2e8f0 100%);
}

.summary-normal::before {
    background: linear-gradient(to bottom, transparent 0%, transparent 20%, #bbf7d0 20%, #bbf7d0 100%);
}

.summary-warning::before {
    background: linear-gradient(to bottom, transparent 0%, transparent 20%, #fde68a 20%, #fde68a 100%);
}

.summary-critical::before {
    background: linear-gradient(to bottom, transparent 0%, transparent 20%, #fdba74 20%, #fdba74 100%);
}

.summary-out::before {
    background: linear-gradient(to bottom, transparent 0%, transparent 20%, #fca5a5 20%, #fca5a5 100%);
}

.summary-late::before {
    background: linear-gradient(to bottom, transparent 0%, transparent 20%, #c4b5fd 20%, #c4b5fd 100%);
}

.inventory-panel {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.inventory-grid {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.inventory-grid thead th {
    font-size: 19px;
    font-weight: 900;
    color: #0f172a;
    background: #f8fafc;
    padding: 18px 14px;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
}

.inventory-grid tbody td {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    padding: 14px 14px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

.inventory-grid tbody tr:hover {
    background: #f8fbff;
}

.row-out {
    background: linear-gradient(to right, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.02));
}

.row-critical {
    background: linear-gradient(to right, rgba(249, 115, 22, 0.08), rgba(249, 115, 22, 0.02));
}

.row-warning {
    background: linear-gradient(to right, rgba(250, 204, 21, 0.08), rgba(250, 204, 21, 0.02));
}

.th-center,
.num-cell,
.status-cell {
    text-align: center;
}

.code-cell {
    font-weight: 900;
    color: #1d4ed8;
}

.num-cell {
    font-size: 20px;
    font-weight: 900;
    color: #0f172a;
}

.stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 118px;
    height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -0.02em;
    border: 1px solid transparent;
    box-shadow: none;
}

.stock-badge-normal {
    background: #bbf7d0 !important;
    color: #166534 !important;
    border-color: #4ade80 !important;
}

.stock-badge-warning {
    background: #fef08a !important;
    color: #854d0e !important;
    border-color: #eab308 !important;
}

.stock-badge-critical {
    background: #fdba74 !important;
    color: #9a3412 !important;
    border-color: #f97316 !important;
}

.stock-badge-out {
    background: #fca5a5 !important;
    color: #991b1b !important;
    border-color: #ef4444 !important;
}

.stock-badge-late {
    background: #c4b5fd !important;
    color: #5b21b6 !important;
    border-color: #8b5cf6 !important;
}

.adjust-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.adjust-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.unlock-state {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 15px;
}

.unlock-on {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.unlock-off {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.unlock-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.unlock-input {
    width: 180px;
}

.inline-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inspector-create-box,
.item-create-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px;
}

.field-help {
    margin-top: 6px;
    font-size: 13px;
    color: #64748b;
}

.adjust-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 14px 0;
}

.preview-chip {
    background: #f1f5f9;
    border: 1px solid #dbeafe;
    color: #0f172a;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
}

.button-row {
    margin-top: 12px;
}

.select-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px 90px;
    gap: 10px;
    align-items: center;
}

.inspector-row {
    grid-template-columns: minmax(0, 1fr) 112px;
}

.select-action-row .input,
.select-action-row select {
    min-width: 0;
    width: 100%;
}

.action-btn {
    min-width: 0;
    width: 100%;
    height: 46px;
    padding: 0 12px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

@media (max-width: 1400px) {
    .summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .select-action-row,
    .inspector-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toolbar-clean {
        flex-wrap: wrap;
    }

    .inventory-panel {
        overflow-x: auto;
    }

    .inventory-grid {
        min-width: 1100px;
    }
}
