:root {
    --bg: #090909;
    --panel: #111113;
    --panel-soft: #18181d;
    --border: rgba(255, 255, 255, 0.08);
    --text: #f5f1ee;
    --muted: #b7aeb0;
    --accent: #7e2637;
    --accent-strong: #a7384f;
    --cream: #efe5db;
    --success: #4caf7c;
    --danger: #da5f68;
    --warning: #f0b75c;
    --shadow: 0 22px 45px rgba(0, 0, 0, 0.28);
    --radius: 18px;
    --content-max: 1260px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.45;
    background:
        radial-gradient(circle at top left, rgba(126, 38, 55, 0.2), transparent 24%),
        radial-gradient(circle at top right, rgba(239, 229, 219, 0.05), transparent 18%),
        linear-gradient(135deg, #080809, #0c0c0f 56%, #140d10);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

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

img {
    max-width: 100%;
    display: block;
}

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

.sidebar {
    width: 264px;
    padding: 22px 18px;
    background:
        linear-gradient(180deg, rgba(19, 19, 22, 0.98), rgba(11, 11, 13, 0.98)),
        linear-gradient(135deg, rgba(126, 38, 55, 0.08), transparent 45%);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    padding: 10px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(126, 38, 55, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-logo-wrap {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(126, 38, 55, 0.22), rgba(239, 229, 219, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.brand-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}

.brand-copy {
    min-width: 0;
}

.brand-copy strong {
    display: block;
    font-size: 1rem;
    line-height: 1.2;
    color: var(--cream);
}

.brand-copy small,
.eyebrow,
.muted {
    color: var(--muted);
}

.eyebrow {
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.nav-menu {
    display: grid;
    gap: 8px;
}

.nav-menu a {
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--muted);
    background: transparent;
    transition: 0.2s ease;
    font-size: 0.95rem;
}

.nav-menu a.active,
.nav-menu a:hover {
    color: var(--cream);
    background: linear-gradient(135deg, rgba(126, 38, 55, 0.72), rgba(167, 56, 79, 0.88));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.app-content {
    flex: 1;
    min-width: 0;
    padding: 20px;
}

.app-content > * {
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
}

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

.topbar h1,
.login-card h2 {
    margin: 4px 0 0;
}

.topbar h1 {
    font-size: clamp(1.45rem, 2vw, 2rem);
    line-height: 1.1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
}

.menu-toggle {
    display: none;
    background: var(--panel-soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 44px;
    height: 44px;
}

.grid {
    display: grid;
    gap: 16px;
}

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

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

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

.card {
    min-width: 0;
    background:
        linear-gradient(180deg, rgba(24, 24, 29, 0.95), rgba(17, 17, 19, 0.98)),
        linear-gradient(135deg, rgba(126, 38, 55, 0.06), transparent 55%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 122px;
}

.stat-card strong {
    font-size: clamp(1.55rem, 2.3vw, 2rem);
    color: var(--cream);
}

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

.chart-bars {
    display: grid;
    gap: 12px;
}

.chart-row {
    display: grid;
    gap: 8px;
}

.chart-track {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.chart-value {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-radius: inherit;
}

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

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

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

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.84rem;
}

.toolbar,
.filters,
.form-grid,
.inline-actions {
    display: grid;
    gap: 14px;
}

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

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

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

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

label {
    display: grid;
    gap: 7px;
    font-size: 0.92rem;
}

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

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    color: var(--text);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #131318;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(167, 56, 79, 0.85);
    box-shadow: 0 0 0 3px rgba(167, 56, 79, 0.14);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.92rem;
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff7f8;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.btn-secondary {
    color: var(--text);
    background: var(--panel-soft);
    border: 1px solid var(--border);
}

.btn-danger {
    color: #fff;
    background: rgba(218, 95, 104, 0.15);
    border: 1px solid rgba(218, 95, 104, 0.3);
}

.btn-ghost {
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border);
}

.alert {
    padding: 13px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.92rem;
}

.alert-success {
    background: rgba(76, 175, 124, 0.14);
    border: 1px solid rgba(76, 175, 124, 0.35);
}

.alert-error {
    background: rgba(167, 56, 79, 0.16);
    border: 1px solid rgba(167, 56, 79, 0.4);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.76rem;
}

.badge.gold {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.badge.success {
    background: rgba(76, 175, 124, 0.16);
}

.badge.warning {
    background: rgba(240, 183, 92, 0.16);
}

.badge.danger {
    background: rgba(218, 95, 104, 0.16);
}

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

.empty-state {
    padding: 24px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 16px;
}

.schedule-board {
    display: grid;
    gap: 14px;
}

.schedule-item {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 14px;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    padding: 14px;
    border-radius: 16px;
}

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

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.login-layout {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    gap: 18px;
}

.login-highlight,
.login-card {
    min-height: 560px;
}

.login-highlight {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    border-radius: 30px;
    background:
        radial-gradient(circle at top left, rgba(167, 56, 79, 0.22), transparent 24%),
        linear-gradient(135deg, rgba(239, 229, 219, 0.03), rgba(126, 38, 55, 0.1)),
        linear-gradient(180deg, #141417, #0d0d10);
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.login-highlight::after {
    content: "";
    position: absolute;
    inset: auto -8% -26% auto;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(167, 56, 79, 0.22), transparent 60%);
    pointer-events: none;
}

.hero-brand {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    margin-bottom: 22px;
}

.hero-logo {
    width: 110px;
    height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.38));
}

.hero-brand .eyebrow {
    margin-bottom: 8px;
}

.login-highlight h1 {
    margin: 0;
    font-size: clamp(2.2rem, 3.2vw, 3.35rem);
    line-height: 1.02;
    letter-spacing: -0.035em;
    max-width: 12ch;
    color: var(--cream);
    text-wrap: balance;
}

.login-highlight p:not(.eyebrow) {
    max-width: 36rem;
    font-size: 1.05rem;
    line-height: 1.7;
}

.login-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.login-badges span,
.login-hint {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.form-card {
    display: grid;
    gap: 14px;
}

.login-card {
    align-content: center;
    padding: 30px;
}

.login-card h2 {
    font-size: clamp(1.45rem, 2vw, 1.85rem);
    color: var(--cream);
}

.status-low-stock {
    color: var(--warning);
    font-weight: 700;
}

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

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

    .grid.cards-3,
    .grid.columns-2,
    .filters,
    .form-grid,
    .form-grid.form-grid-3 {
        grid-template-columns: 1fr;
    }

    .login-layout {
        width: min(920px, 100%);
        grid-template-columns: 1fr;
    }

    .login-highlight,
    .login-card {
        min-height: auto;
    }

    .login-highlight h1 {
        max-width: 14ch;
    }
}

@media (max-width: 880px) {
    .sidebar {
        position: fixed;
        left: -100%;
        z-index: 20;
        transition: left 0.25s ease;
        width: 238px;
    }

    .sidebar.is-open {
        left: 0;
    }

    .menu-toggle {
        display: inline-grid;
        place-items: center;
    }

    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .app-content {
        padding: 16px;
    }

    .schedule-item {
        grid-template-columns: 1fr;
    }

    .hero-brand {
        grid-template-columns: 78px 1fr;
        gap: 16px;
    }

    .hero-logo {
        width: 78px;
        height: 78px;
    }
}

@media (max-width: 560px) {
    html {
        font-size: 14px;
    }

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

    .topbar-user {
        width: 100%;
        justify-content: space-between;
    }

    .card {
        padding: 16px;
    }

    .login-body {
        padding: 12px;
    }

    .login-highlight {
        display: none;
    }

    .login-card {
        min-height: auto;
        padding: 20px 16px;
    }

    .login-card h2 {
        font-size: 1.3rem;
    }
}
