/* KOBE — shadcn-inspired UI, layered on Tailwind CDN */
/* Theme: ubah api/config/theme.php → php docs/generate_theme_css.php */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap');

/* === THEME TOKENS START (auto-generated) === */
:root {
    /* Brand (primary) */
    --brand:            #F70425;
    --brand-dark:       #C1031D;
    --brand-light:      #F94A62;
    --brand-soft:       #FEEDF0;
    --brand-rgb:        247, 4, 37;
    --brand-ring:       rgba(var(--brand-rgb), 0.22);

    /* Aliases dipakai komponen lama */
    --maroon:           var(--brand);
    --maroon-dark:      var(--brand-dark);
    --maroon-light:     var(--brand-light);
    --maroon-soft:      var(--brand-soft);
    --maroon-ring:      var(--brand-ring);
    --gold:             var(--brand);
    --gold-light:       var(--brand-light);
    --gold-pale:        var(--brand-soft);
    --brown:            var(--brand);
    --brown-light:      var(--brand-light);

    /* Surface */
    --bg:               #FAFAFA;
    --fg:               #18181B;
    --border:           #E8E4E5;
    --border-soft:      #F1EEF0;
    --muted:            #71717A;
    --card:             #FFFFFF;
    --radius:           0.625rem;
    --sidebar-w:        240px;

    /* Accent washes (tipis) */
    --accent-yellow:    #EAB308;
    --accent-green:     #22A05A;
    --accent-yellow-rgb: 234, 179, 8;
    --accent-green-rgb:  34, 160, 90;

    --wash:
        radial-gradient(ellipse 70% 55% at 8% 0%, rgba(var(--brand-rgb), 0.055), transparent 55%),
        radial-gradient(ellipse 55% 45% at 92% 8%, rgba(var(--accent-yellow-rgb), 0.045), transparent 50%),
        radial-gradient(ellipse 60% 50% at 78% 100%, rgba(var(--accent-green-rgb), 0.04), transparent 55%),
        radial-gradient(ellipse 40% 35% at 20% 85%, rgba(var(--brand-rgb), 0.03), transparent 50%);

    --login-wash:
        radial-gradient(ellipse 55% 40% at 12% 18%, rgba(var(--brand-rgb), 0.04), transparent 70%),
        radial-gradient(ellipse 45% 35% at 88% 22%, rgba(var(--accent-yellow-rgb), 0.035), transparent 70%),
        radial-gradient(ellipse 50% 40% at 70% 90%, rgba(var(--accent-green-rgb), 0.03), transparent 70%);
}
/* === THEME TOKENS END === */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    margin: 0;
    font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--fg);
    background-color: var(--bg);
    background-image: var(--wash);
    background-attachment: fixed;
    line-height: 1.5;
    font-feature-settings: "rlig" 1, "calt" 1;
}

/* ── Sidebar ───────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0;
    z-index: 40;
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

#sidebar .logo-area {
    padding: 1.1rem 1rem 0.9rem;
    border-bottom: 1px solid var(--border-soft);
}

#sidebar .logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--maroon);
    line-height: 1.1;
}

#sidebar .logo-sub {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 3px;
    font-weight: 500;
}

#sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.9rem;
    margin: 0 0.4rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #52525B;
    border-left: none;
    border-radius: calc(var(--radius) - 2px);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}

#sidebar nav a:hover {
    background: var(--maroon-soft);
    color: var(--maroon-dark);
}

#sidebar nav a.active {
    background: var(--maroon);
    color: #fff;
    font-weight: 600;
}

#sidebar nav .nav-group-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #A1A1AA;
    padding: 0.85rem 1rem 0.3rem;
}

#sidebar nav .nav-link-top { margin-bottom: 0.15rem; }
#sidebar nav .nav-accordion { margin: 0.1rem 0; }

#sidebar nav .nav-accordion-btn {
    width: calc(100% - 0.8rem);
    margin: 0 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #A1A1AA;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
#sidebar nav .nav-accordion-btn:hover {
    color: var(--maroon);
    background: var(--maroon-soft);
}
#sidebar nav .nav-accordion-btn span { flex: 1; }
#sidebar nav .nav-chevron {
    transition: transform 0.2s;
    opacity: 0.55;
}
#sidebar nav .nav-accordion.open .nav-chevron { transform: rotate(180deg); }
#sidebar nav .nav-accordion-body {
    display: none;
    padding-bottom: 0.15rem;
}
#sidebar nav .nav-accordion.open .nav-accordion-body { display: block; }
#sidebar nav .nav-accordion-body a {
    padding-left: 2.1rem;
    font-size: 0.78rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

#sidebar .border-t { border-color: var(--border-soft) !important; }

/* ── POS product UI ────────────────────────────────── */
.pos-shell {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 360px);
    gap: 0.85rem;
    align-items: start;
}
@media (max-width: 1024px) {
    .pos-shell { grid-template-columns: 1fr; }
}
.pos-catalog-panel { min-height: 70vh; }
.pos-bill-panel {
    position: sticky;
    top: 60px;
    max-height: calc(100vh - 72px);
    overflow: auto;
}
.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 0.55rem;
}
.pos-product-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        linear-gradient(165deg, rgba(var(--brand-rgb), 0.03), transparent 42%),
        linear-gradient(320deg, rgba(var(--accent-green-rgb), 0.025), transparent 40%),
        var(--card);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    text-align: left;
    padding: 0;
    width: 100%;
    font-family: inherit;
}
.pos-product-card:hover {
    border-color: rgba(var(--brand-rgb), 0.35);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(var(--brand-rgb), 0.08);
}
.pos-product-card .thumb {
    aspect-ratio: 1;
    background: #F7F5F6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.pos-product-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pos-product-card .thumb .ph {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--maroon);
    opacity: 0.4;
    letter-spacing: -0.03em;
}
.pos-product-card .meta { padding: 0.45rem 0.5rem 0.55rem; }
.pos-product-card .meta .name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fg);
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 1.9em;
}
.pos-product-card .meta .price {
    font-size: 0.7rem;
    color: var(--maroon);
    font-weight: 600;
    margin-top: 0.15rem;
}
.pos-product-card .meta .stock {
    font-size: 0.65rem;
    color: #A1A1AA;
    margin-top: 0.1rem;
}
.pos-product-card .meta .stock .stock-zero { color: #B45309; font-weight: 600; }
.pos-product-card .meta .stock .stock-neg { color: #B91C1C; font-weight: 600; }
.pos-product-card.is-zero .thumb,
.pos-product-card.is-neg .thumb {
    outline: 1px dashed #F59E0B;
}
.pos-tabs {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    padding-bottom: 0.3rem;
    -webkit-overflow-scrolling: touch;
}
.pos-tab {
    flex-shrink: 0;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    color: #52525B;
    cursor: pointer;
    font-family: inherit;
}
.pos-tab.active {
    background: var(--maroon);
    border-color: var(--maroon);
    color: #fff;
}
.pos-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 27, 0.45);
    backdrop-filter: blur(2px);
    z-index: 60;
    display: none;
    align-items: stretch;
    justify-content: center;
    padding: 0.75rem;
}
.pos-picker-overlay.open { display: flex; }
.pos-picker-modal {
    background: #FAFAFA;
    border-radius: 0.85rem;
    border: 1px solid var(--border);
    width: min(1100px, 100%);
    max-height: calc(100vh - 1.5rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}
.pos-picker-head {
    background: #fff;
    border-bottom: 1px solid var(--border-soft);
    padding: 0.7rem 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}
.pos-picker-body {
    flex: 1;
    overflow: auto;
    padding: 0.75rem 0.9rem;
}
.pos-picker-foot {
    background: #fff;
    border-top: 1px solid var(--border-soft);
    padding: 0.65rem 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
    justify-content: space-between;
}
.pos-stage-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-height: 72px;
    overflow: auto;
}
.pos-chip {
    background: var(--maroon-soft);
    border: 1px solid rgba(var(--brand-rgb), 0.15);
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    color: var(--maroon-dark);
}
.pos-qty-modal {
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 27, 0.4);
    z-index: 70;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.pos-qty-modal.open { display: flex; }
.pos-qty-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    width: min(360px, 100%);
    padding: 1.1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.16);
}
.pos-pay-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}
.pos-pay-method {
    border: 1px solid var(--border);
    background: #FAFAFA;
    border-radius: var(--radius);
    padding: 0.6rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #3F3F46;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    font-family: inherit;
}
.pos-pay-method:hover { border-color: #D4D4D8; background: #fff; }
.pos-pay-method.active {
    border-color: var(--maroon);
    background: var(--maroon-soft);
    color: var(--maroon-dark);
    box-shadow: inset 0 0 0 1px var(--maroon);
}
.pos-auth-icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}
.pos-auth-icon.cancel {
    background: #FEF2F2;
    color: #B91C1C;
    border: 1px solid #FECACA;
}
.pos-auth-icon.void {
    background: #FFF7ED;
    color: #C2410C;
    border: 1px solid #FED7AA;
}

/* ── Main layout ───────────────────────────────────── */
#main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    background: transparent;
    transition: margin-left 0.25s ease;
}

/* Desktop: sidebar bisa disembunyikan */
body.sidebar-collapsed #sidebar {
    transform: translateX(-100%);
}
body.sidebar-collapsed #main-content {
    margin-left: 0;
}
body.sidebar-collapsed #sidebar-overlay {
    display: none !important;
}

.topbar-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #52525B;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}
.topbar-menu-btn:hover {
    background: #f4f4f5;
    border-color: var(--border);
    color: var(--maroon);
}

/* Settings tabs */
.settings-tabs {
    display: flex;
    gap: 0.35rem;
    padding: 0.3rem;
    background: #f4f4f5;
    border-radius: var(--radius);
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}
.settings-tab {
    border: none;
    background: transparent;
    padding: 0.45rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #71717a;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.settings-tab:hover { color: var(--maroon-dark); background: rgba(255,255,255,.7); }
.settings-tab-active,
.settings-tab.settings-tab-active {
    background: #fff;
    color: var(--maroon-dark);
    box-shadow: 0 1px 3px rgba(24,24,27,.08);
}

#topbar {
    height: 52px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.15rem;
    position: sticky;
    top: 0;
    z-index: 30;
    gap: 0.25rem;
}

.topbar-user {
    position: relative;
    margin-left: auto;
}
.topbar-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.35rem 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}
.topbar-user-btn:hover,
.topbar-user.open .topbar-user-btn {
    border-color: rgba(var(--brand-rgb), 0.35);
    background: var(--maroon-soft);
}
.topbar-chevron {
    color: #A1A1AA;
    transition: transform 0.15s;
}
.topbar-user.open .topbar-chevron {
    transform: rotate(180deg);
    color: var(--maroon);
}
.topbar-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(24, 24, 27, 0.1);
    padding: 0.35rem;
    z-index: 50;
}
.topbar-dropdown-user {
    padding: 0.55rem 0.65rem 0.5rem;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 0.2rem;
}
.topbar-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    border: none;
    background: transparent;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.8125rem;
    font-weight: 500;
    color: #3F3F46;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.topbar-dropdown-item:hover { background: #F4F4F5; }
.topbar-dropdown-logout { color: #B91C1C; }
.topbar-dropdown-logout:hover {
    background: #FEF2F2;
    color: #991B1B;
}

#page-content {
    padding: 1.1rem 1.15rem 1.5rem;
    overflow-x: hidden;
}

#app-content {
    max-width: 100%;
    min-width: 0;
}

/* ── Cards ─────────────────────────────────────────── */
.card {
    background:
        linear-gradient(155deg, rgba(var(--brand-rgb), 0.028), transparent 40%),
        linear-gradient(310deg, rgba(var(--accent-yellow-rgb), 0.022), transparent 38%),
        linear-gradient(30deg, rgba(var(--accent-green-rgb), 0.02), transparent 42%),
        rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.05rem;
    box-shadow: 0 1px 2px rgba(24, 24, 27, 0.03);
}

.card-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #A1A1AA;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--maroon-dark);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.stat-sub {
    font-size: 0.72rem;
    color: #A1A1AA;
    margin-top: 0.2rem;
}

/* ── Accent line ───────────────────────────────────── */
.accent-line {
    height: 2px;
    background: linear-gradient(90deg, var(--brand), rgba(var(--accent-yellow-rgb), 0.55), rgba(var(--accent-green-rgb), 0.45));
    border-radius: 2px;
    margin-bottom: 0.85rem;
    opacity: 0.85;
}

/* ── Badge status ──────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-present { background: #DCFCE7; color: #166534; }
.badge-absent  { background: #FEE2E2; color: #991B1B; }
.badge-late    { background: #FEF3C7; color: #92400E; }
.badge-leave   { background: #E0E7FF; color: #3730A3; }
.badge-pending { background: #F4F4F5; color: #52525B; }
.badge-active  { background: #DCFCE7; color: #166534; }
.badge-inactive{ background: #FEE2E2; color: #991B1B; }

/* ── Table ─────────────────────────────────────────── */
.table-wrap,
.card.overflow-x-auto,
.card:has(> table.tbl),
.card:has(> .tbl) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
.card.overflow-x-auto { padding-bottom: 0.3rem; }
.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.tbl th {
    background: rgba(248, 240, 241, 0.75);
    color: var(--maroon-dark);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.55rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.tbl td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-soft);
    color: #3F3F46;
    vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(248, 240, 241, 0.45); }

/* ── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
    font-family: inherit;
    line-height: 1.25;
}
.btn:focus-visible {
    outline: 2px solid var(--maroon);
    outline-offset: 2px;
}
.btn-primary {
    background: var(--maroon);
    color: #fff;
    box-shadow: 0 1px 2px rgba(var(--brand-rgb), 0.2);
}
.btn-primary:hover { background: var(--maroon-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-gold {
    background: var(--maroon-light);
    color: #fff;
}
.btn-gold:hover { background: var(--maroon); }
.btn-outline {
    background: #fff;
    color: var(--maroon-dark);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: rgba(var(--brand-rgb), 0.4);
    background: var(--maroon-soft);
    color: var(--maroon);
}
.btn-danger { background: #DC2626; color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-sm { padding: 0.28rem 0.55rem; font-size: 0.75rem; }

.btn-group {
    display: inline-flex;
    align-items: stretch;
}
.btn-group > .btn {
    border-radius: 0;
    margin: 0;
}
.btn-group > .btn:first-child {
    border-top-left-radius: calc(var(--radius) - 2px);
    border-bottom-left-radius: calc(var(--radius) - 2px);
}
.btn-group > .btn:last-child {
    border-top-right-radius: calc(var(--radius) - 2px);
    border-bottom-right-radius: calc(var(--radius) - 2px);
}
.btn-group > .btn + .btn {
    margin-left: -1px;
}
.btn-group > .btn:hover {
    z-index: 1;
    position: relative;
}

/* ── Form inputs ───────────────────────────────────── */
.form-input {
    width: 100%;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.8125rem;
    color: var(--fg);
    background: #fff;
    transition: border-color 0.12s, box-shadow 0.12s;
    outline: none;
    font-family: inherit;
}
.form-input:focus {
    border-color: var(--maroon);
    box-shadow: 0 0 0 3px var(--maroon-ring);
}
.form-input.input-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.form-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: #52525B;
    margin-bottom: 0.25rem;
    display: block;
}

/* ── Modal ─────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 27, 0.4);
    backdrop-filter: blur(2px);
    z-index: 50;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background:
        linear-gradient(160deg, rgba(var(--brand-rgb), 0.03), transparent 35%),
        #fff;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.15rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14);
}

.modal-box.modal-box-item {
    max-width: min(960px, 96vw);
    width: 96vw;
    max-height: 92vh;
    overflow-y: auto;
    padding: 1.1rem 1.25rem 1.2rem;
}
.item-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.7fr);
    gap: 1rem;
    align-items: start;
}
.item-form-side {
    background: var(--maroon-soft);
    border: 1px solid rgba(var(--brand-rgb), 0.1);
    border-radius: var(--radius);
    padding: 0.75rem;
}
.item-img-preview {
    width: 100%;
    aspect-ratio: 1;
    max-height: 220px;
    border: 1.5px dashed rgba(var(--brand-rgb), 0.25);
    border-radius: var(--radius);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
@media (max-width: 820px) {
    .item-form-grid { grid-template-columns: 1fr; }
    .item-img-preview {
        max-height: 180px;
        aspect-ratio: 16 / 10;
    }
}

.modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--maroon-dark);
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-soft);
    letter-spacing: -0.02em;
}

/* ── Pagination ────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; }
.pagination button {
    padding: 0.28rem 0.55rem;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    background: #fff;
    cursor: pointer;
    color: #52525B;
    transition: all 0.12s;
    font-family: inherit;
}
.pagination button:hover,
.pagination button.active {
    background: var(--maroon);
    border-color: var(--maroon);
    color: #fff;
    font-weight: 600;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Toast ─────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.toast {
    padding: 0.65rem 0.95rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    animation: slideIn 0.22s ease;
    min-width: 200px;
    max-width: 340px;
}
.toast-success { background: #15803D; }
.toast-error   { background: #DC2626; }
.toast-info    { background: var(--maroon); }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Login page ────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background-color: var(--bg, #FAFAFA);
    background-image: var(--login-wash, var(--wash));
}
.login-shell {
    width: 100%;
    max-width: 860px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(24, 24, 27, 0.06);
}
.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.75rem;
    min-width: 0;
}
.login-panel-form {
    background: #fff;
}
.login-panel-info {
    background: var(--brand-soft);
    border-left: 1px solid #EFE8E9;
    justify-content: center;
    padding: 2rem 1.75rem;
}
.login-info-inner {
    width: 100%;
    max-width: 300px;
}
.login-card {
    width: 100%;
    max-width: 300px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}
.login-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--maroon);
    line-height: 1;
}
.login-brand-sub {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 0.3rem;
    font-weight: 500;
}
.login-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--fg);
    margin: 1.15rem 0 0.2rem;
}
.login-desc {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 1rem;
    line-height: 1.45;
}
.login-info-kicker {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--maroon);
    margin-bottom: 0.55rem;
}
.login-info-title {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.3;
    color: var(--maroon-dark);
    margin: 0 0 0.5rem;
}
.login-info-text {
    font-size: 0.8rem;
    line-height: 1.5;
    color: #6B5C5F;
    margin: 0 0 1.15rem;
}
.login-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.7rem;
}
.login-feature {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0;
    border: none;
    background: transparent;
}
.login-feature-dot {
    width: 0.4rem;
    height: 0.4rem;
    margin-top: 0.4rem;
    border-radius: 999px;
    background: var(--maroon);
    opacity: 0.55;
    flex-shrink: 0;
}
.login-feature strong {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--maroon-dark);
    letter-spacing: -0.01em;
}
.login-feature span {
    font-size: 0.72rem;
    color: #7A6A6D;
    line-height: 1.35;
}

@media (max-width: 800px) {
    .login-page { padding: 1rem; align-items: flex-start; }
    .login-shell {
        grid-template-columns: 1fr;
        max-width: 420px;
        margin-top: 0.5rem;
    }
    .login-panel-info {
        border-left: none;
        border-top: 1px solid rgba(var(--brand-rgb), 0.08);
        order: 1;
        padding: 1.25rem 1.35rem 1.4rem;
    }
    .login-panel-form {
        order: 0;
        padding: 1.5rem 1.35rem 1.25rem;
    }
    .login-info-inner,
    .login-card { max-width: none; }
    .login-info-title { font-size: 1.05rem; }
}

/* ── Mobile: sidebar overlay ───────────────────────── */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 27, 0.4);
    z-index: 35;
}

@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.open { transform: translateX(0); }
    #sidebar-overlay.open { display: block; }
    #main-content { margin-left: 0; }
    body.sidebar-collapsed #sidebar { transform: translateX(-100%); }
    body.sidebar-collapsed #sidebar.open { transform: translateX(0); }
    #topbar {
        padding: 0 0.7rem;
        height: 50px;
    }
    #page-content { padding: 0.75rem; }
    .card {
        padding: 0.8rem;
        border-radius: var(--radius);
    }
    .card.overflow-x-auto {
        margin-left: -0.1rem;
        margin-right: -0.1rem;
    }
    .tbl { font-size: 0.78rem; }
    .tbl th,
    .tbl td { padding: 0.45rem 0.55rem; }
    .card.overflow-x-auto .tbl td { white-space: nowrap; }
    .modal-box {
        width: calc(100% - 1.25rem);
        max-width: none;
        padding: 1rem;
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    .stat-value { font-size: 1.3rem; }
    #toast-container {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
    }
    .toast {
        max-width: none;
        min-width: 0;
    }
    #app-content > .flex.justify-between,
    #app-content > .mb-4.flex,
    #app-content .flex.justify-between.items-center.mb-4 {
        flex-wrap: wrap;
        gap: 0.55rem;
    }
    #app-content .grid.grid-cols-3,
    #app-content .grid.grid-cols-4 {
        grid-template-columns: 1fr 1fr;
    }
    #app-content .grid.grid-cols-3 > :last-child:nth-child(odd),
    #app-content .grid.grid-cols-4 > :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
    .form-input, .btn { min-height: 40px; }
    .settings-tabs { width: 100%; }
    .settings-tab { flex: 1; text-align: center; }
    canvas { max-width: 100%; }
}
