:root {
    --bg: #f8fafc;
    --card: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #e2e8f0;
    --line-soft: #f1f5f9;
    --sidebar: #0f172a;
    --sidebar-deep: #020617;
    --amber: #f59e0b;
    --amber-soft: #fffbeb;
    --success: #10b981;
    --success-soft: #ecfdf5;
    --danger: #f43f5e;
    --danger-soft: #fff1f2;
    --info: #3b82f6;
    --info-soft: #eff6ff;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

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

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.hidden {
    display: none !important;
}

.mobile-only,
.mobile-header {
    display: none;
}

.sidebar {
    width: 264px;
    min-height: 100vh;
    flex: 0 0 264px;
    background: var(--sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar-brand {
    min-height: 88px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--amber);
    color: #111827;
    box-shadow: 0 12px 24px rgba(245, 158, 11, 0.25);
    font-size: 22px;
}

.logo-mark.small {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 18px;
}

.sidebar-brand h1,
.sidebar-brand p {
    margin: 0;
}

.sidebar-brand h1 {
    font-size: 16px;
    line-height: 1.15;
    letter-spacing: 0;
}

.sidebar-brand p {
    margin-top: 4px;
    color: #fbbf24;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.chef-card {
    margin: 0;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(2, 6, 23, 0.35);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.chef-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: linear-gradient(135deg, #f59e0b, #ea580c);
}

.chef-card p {
    margin: 0 0 3px;
    color: #94a3b8;
    font-size: 12px;
}

.chef-card strong {
    color: #e2e8f0;
    font-size: 14px;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.nav-btn {
    width: 100%;
    min-height: 46px;
    margin-bottom: 8px;
    border: 0;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    transition: 160ms ease;
}

.nav-btn:hover {
    background: rgba(30, 41, 59, 0.8);
    color: #f8fafc;
}

.nav-btn.active {
    background: var(--amber);
    color: #111827;
    box-shadow: 0 12px 24px rgba(245, 158, 11, 0.12);
}

.nav-btn span {
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar-footer a {
    display: block;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.sidebar-footer a:hover {
    color: #fff;
}

.main-shell {
    flex: 1;
    min-width: 0;
    padding: 28px;
    overflow-y: auto;
}

.tab-panel {
    max-width: 1440px;
    margin: 0 auto;
}

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

.page-heading h2 {
    margin: 0;
    font-size: 30px;
    line-height: 1.15;
    letter-spacing: 0;
}

.page-heading p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.date-pill,
.filter-bar,
.panel,
.kpi-card,
.catalog-card,
.production-card {
    background: var(--card);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.date-pill {
    min-height: 44px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 14px;
    color: #475569;
    white-space: nowrap;
    font-size: 13px;
}

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

.kpi-card {
    position: relative;
    min-height: 170px;
    padding: 22px;
    overflow: hidden;
    border-radius: 20px;
}

.kpi-card p {
    margin: 0;
    color: var(--muted-2);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.kpi-card > strong {
    display: block;
    margin-top: 10px;
    font-size: 30px;
    line-height: 1.1;
}

.kpi-card.dark {
    background: #020617;
    color: #fff;
    border-color: #020617;
}

.kpi-watermark {
    position: absolute;
    right: 8px;
    bottom: -16px;
    color: rgba(245, 158, 11, 0.08);
    font-size: 78px;
    font-weight: 800;
}

.tag {
    display: inline-flex;
    margin-top: 18px;
    border-radius: 9px;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 700;
}

.tag.success {
    background: var(--success-soft);
    color: #047857;
}

.tag.danger {
    background: var(--danger-soft);
    color: #be123c;
}

.tag.warning {
    background: var(--amber-soft);
    color: #b45309;
}

.tag.dark-tag {
    background: rgba(255, 255, 255, 0.1);
    color: #fbbf24;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--amber);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 22px;
    margin-bottom: 22px;
}

.panel {
    border-radius: 20px;
    padding: 22px;
}

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

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

.panel-title span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.chart-box {
    position: relative;
    height: 260px;
}

.chart-box.large {
    height: 330px;
}

.legend-grid,
.diagnostic-grid,
.cards-grid,
.mini-kpi-grid {
    display: grid;
    gap: 14px;
}

.legend-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
    color: var(--muted);
    font-size: 12px;
}

.dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-right: 6px;
    border-radius: 999px;
    vertical-align: -1px;
}

.success-bg {
    background: var(--success);
}

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

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

.warning-bg {
    background: var(--amber);
}

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

.diagnostic-card {
    border: 1px solid;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 12px;
}

.diagnostic-card strong {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
}

.diagnostic-card p {
    margin: 0;
    font-size: 12px;
    line-height: 1.55;
}

.diagnostic-card.success {
    background: var(--success-soft);
    border-color: #bbf7d0;
    color: #065f46;
}

.diagnostic-card.warning {
    background: var(--amber-soft);
    border-color: #fde68a;
    color: #92400e;
}

.diagnostic-card.danger {
    background: var(--danger-soft);
    border-color: #fecdd3;
    color: #9f1239;
}

.filter-bar {
    margin-bottom: 18px;
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.filter-bar strong {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.filter-bar input,
.filter-bar select,
.form-grid input,
.form-grid select,
.login-form input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
    color: var(--ink);
    padding: 10px 12px;
    outline: 0;
    transition: 160ms ease;
}

.filter-bar input:focus,
.filter-bar select:focus,
.form-grid input:focus,
.form-grid select:focus,
.login-form input:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.filter-bar > input {
    flex: 1 1 220px;
}

.filter-bar > select {
    width: auto;
    min-width: 210px;
}

.filter-bar.split {
    justify-content: space-between;
}

.filter-bar.split label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-bar.split input {
    width: auto;
}

.filter-bar.split span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

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

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

th,
td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--line-soft);
}

th {
    background: #f8fafc;
    color: var(--muted-2);
    font-size: 11px;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
}

td {
    color: #334155;
    font-size: 14px;
}

tbody tr:hover {
    background: #f8fafc;
}

.align-right {
    text-align: right;
}

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

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 800;
}

.badge.amber {
    background: #fef3c7;
    color: #92400e;
}

.badge.orange {
    background: #ffedd5;
    color: #9a3412;
}

.badge.green {
    background: #d1fae5;
    color: #065f46;
}

.badge.rose {
    background: #ffe4e6;
    color: #9f1239;
}

.badge.blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.purple {
    background: #f3e8ff;
    color: #6b21a8;
}

.badge.slate {
    background: #f1f5f9;
    color: #475569;
}

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

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

.catalog-card,
.production-card {
    border-radius: 20px;
    padding: 22px;
}

.catalog-card {
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.catalog-card:hover {
    border-color: rgba(245, 158, 11, 0.75);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.catalog-head,
.production-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-soft);
}

.catalog-head h3,
.production-head h3 {
    margin: 8px 0 0;
    font-size: 18px;
}

.catalog-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
    padding: 14px;
    border-radius: 14px;
    background: #f8fafc;
}

.catalog-metrics p,
.mini-kpi p {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.catalog-metrics strong,
.mini-kpi strong {
    font-size: 18px;
}

.catalog-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

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

.mini-kpi {
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    border: 1px solid;
}

.mini-kpi.success {
    background: var(--success-soft);
    border-color: #bbf7d0;
}

.mini-kpi.slate {
    background: #f8fafc;
    border-color: var(--line);
}

.mini-kpi.danger {
    background: var(--danger-soft);
    border-color: #fecdd3;
}

.mini-kpi.warning {
    background: var(--amber-soft);
    border-color: #fde68a;
}

.production-list {
    display: grid;
    gap: 16px;
}

.production-head p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

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

.slider-row label {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.slider-row input[type="range"] {
    width: 100%;
    accent-color: var(--amber);
}

.pill-count {
    white-space: nowrap;
    border-radius: 999px;
    padding: 3px 8px;
    background: #f8fafc;
    color: var(--ink);
}

.production-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 14px;
    padding: 14px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.btn,
.icon-button,
.row-action {
    border: 0;
    border-radius: 12px;
    min-height: 42px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 800;
    text-decoration: none;
    transition: 150ms ease;
}

.btn-primary {
    background: var(--amber);
    color: #111827;
    box-shadow: 0 12px 22px rgba(245, 158, 11, 0.18);
}

.btn-primary:hover {
    background: #fbbf24;
}

.btn-dark {
    background: #0f172a;
    color: #fff;
}

.btn-dark:hover {
    background: #1e293b;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    background: #f8fafc;
    color: var(--ink);
}

.btn-full {
    width: 100%;
}

.btn-small {
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12px;
}

.row-action {
    min-height: 36px;
    width: 36px;
    padding: 0;
    background: transparent;
    color: var(--muted-2);
}

.row-action:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.icon-button {
    width: 40px;
    min-height: 40px;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 22px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    padding: 18px;
    display: grid;
    place-items: center;
    background: rgba(2, 6, 23, 0.65);
    backdrop-filter: blur(8px);
}

.modal-card {
    width: min(560px, 100%);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow);
}

.modal-header {
    padding: 20px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #0f172a;
    color: #fff;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-header button {
    border: 0;
    background: transparent;
    color: #cbd5e1;
    font-size: 26px;
}

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

.form-grid label,
.login-form label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.form-grid input,
.form-grid select,
.login-form input {
    margin-top: 7px;
    font-size: 14px;
    font-weight: 600;
    text-transform: none;
}

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

.inline-fields {
    display: grid;
    grid-template-columns: 1fr 86px;
    gap: 8px;
}

.notice {
    border-radius: 16px;
    padding: 14px;
    background: var(--amber-soft);
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 700;
}

.form-actions {
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 60;
    max-width: 360px;
    border-radius: 16px;
    padding: 14px 16px;
    display: grid;
    gap: 4px;
    background: #0f172a;
    color: #fff;
    box-shadow: var(--shadow);
    transform: translateY(24px);
    opacity: 0;
    pointer-events: none;
    transition: 180ms ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast span {
    color: #cbd5e1;
    font-size: 12px;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at top left, rgba(245, 158, 11, 0.18), transparent 34%),
        #0f172a;
}

.login-shell {
    width: min(460px, 100%);
}

.login-card {
    border-radius: 28px;
    padding: 32px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.35);
}

.login-card .brand-mark {
    width: 56px;
    height: 56px;
    margin-bottom: 18px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--amber);
    font-size: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--amber);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.login-card h1 {
    margin: 0;
    font-size: 30px;
}

.login-copy {
    margin: 10px 0 22px;
    color: var(--muted);
    line-height: 1.6;
}

.login-form {
    display: grid;
    gap: 15px;
}

.form-alert {
    margin-bottom: 16px;
    border-radius: 14px;
    padding: 12px;
    background: var(--danger-soft);
    color: #9f1239;
    font-size: 13px;
    font-weight: 800;
}

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

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

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

@media (max-width: 768px) {
    body {
        display: block;
    }

    .mobile-only,
    .mobile-header {
        display: flex;
    }

    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 30;
        min-height: 64px;
        padding: 12px 16px;
        align-items: center;
        justify-content: space-between;
        background: var(--sidebar);
        color: #fff;
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
    }

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

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 40;
        width: min(300px, 88vw);
        min-height: 100vh;
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

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

    .chef-card {
        display: none;
    }

    .main-shell {
        padding: 20px 14px;
    }

    .page-heading {
        display: grid;
    }

    .page-heading h2 {
        font-size: 25px;
    }

    .date-pill,
    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .kpi-grid,
    .diagnostic-grid,
    .cards-grid,
    .mini-kpi-grid,
    .slider-grid {
        grid-template-columns: 1fr;
    }

    .chart-box,
    .chart-box.large {
        height: 260px;
    }

    .filter-bar.split,
    .filter-bar.split label,
    .production-foot,
    .catalog-foot {
        display: grid;
    }

    .filter-bar.split input {
        width: 100%;
    }

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