/* ============================================================
   Coffee Shop POS — Design System
   Tema: espresso / cream / caramel
   ============================================================ */

:root {
    /* Tema default: Teal (platform & retail — adaptasi desain template) */
    --bg:          #f8fafc;
    --bg-soft:     #f1f5f9;
    --surface:     #ffffff;
    --surface-2:   #f8fafc;
    --ink:         #0f172a;
    --ink-2:       #475569;
    --muted:       #94a3b8;
    --line:        #e2e8f0;
    --brand:       #0f766e;
    --brand-2:     #0d9488;
    --brand-3:     #134e4a;
    --accent:      #14b8a6;
    --accent-2:    #5eead4;
    --success:     #2f8f5b;
    --success-bg:  #e6f5ec;
    --warning:     #b07a1a;
    --warning-bg:  #fdf3dd;
    --danger:      #c0392b;
    --danger-bg:   #fdeaea;
    --info-bg:     #eaf2fb;

    /* Shape & depth */
    --radius:      14px;
    --radius-sm:   10px;
    --radius-lg:   20px;
    --shadow-sm:   0 1px 2px rgba(43, 33, 24, .05), 0 2px 8px rgba(43, 33, 24, .06);
    --shadow-md:   0 6px 18px rgba(43, 33, 24, .10);
    --shadow-lg:   0 16px 40px rgba(43, 33, 24, .18);

    --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    --mono: 'Cascadia Mono', 'Courier New', monospace;
}

/* Tema Coffee (preset kedai kopi) */
body.theme-coffee {
    --bg:          #f6f1ea;
    --bg-soft:     #efe6db;
    --surface:     #ffffff;
    --surface-2:   #faf7f2;
    --ink:         #2b2118;
    --ink-2:       #5d4c3d;
    --muted:       #9a8a7a;
    --line:        #eadfd2;
    --brand:       #6f4e37;
    --brand-2:     #8a6248;
    --brand-3:     #4a3527;
    --accent:      #c98a4b;
    --accent-2:    #e8b06b;
    --shadow-sm:   0 1px 2px rgba(43, 33, 24, .05), 0 2px 8px rgba(43, 33, 24, .06);
    --shadow-md:   0 6px 18px rgba(43, 33, 24, .10);
    --shadow-lg:   0 16px 40px rgba(43, 33, 24, .18);
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(201, 138, 75, .10), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(111, 78, 55, .08), transparent 55%),
        var(--bg);
}

body.theme-coffee .header {
    background: linear-gradient(120deg, #33241a 0%, var(--brand) 55%, #8a6248 100%);
}

body.theme-coffee .chat-header {
    background: linear-gradient(120deg, #33241a 0%, var(--brand) 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(20, 184, 166, .08), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(15, 118, 110, .06), transparent 55%),
        var(--bg);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--accent-2);
    color: var(--brand-3);
}

/* Scrollbar halus */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #d8c9b8;
    border-radius: 20px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #c3b09a; }

/* ============================================================
   Page switching
   ============================================================ */
.page { display: none; }
.page.active { display: block; }

/* ============================================================
   Login
   ============================================================ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(800px 400px at 85% 15%, rgba(20, 184, 166, .22), transparent 60%),
        radial-gradient(700px 500px at 10% 90%, rgba(15, 118, 110, .18), transparent 55%),
        linear-gradient(150deg, #0b1727 0%, #0f2a33 45%, #0f766e 100%);
}

.login-box {
    background: rgba(255, 255, 255, .97);
    padding: 42px 38px 34px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, .35) inset;
    width: 100%;
    max-width: 400px;
    animation: popIn .45s cubic-bezier(.2, .9, .3, 1.2);
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    border-radius: 50%;
    background: linear-gradient(140deg, #0f766e 0%, #14b8a6 100%);
    box-shadow: 0 10px 24px rgba(15, 118, 110, .35);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 26px;
    letter-spacing: -.4px;
}

.login-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    margin-bottom: 28px;
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   Header
   ============================================================ */
.header {
    background: linear-gradient(120deg, #0b3d38 0%, var(--brand) 55%, #14b8a6 100%);
    color: #fff;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 500;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h2 {
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -.2px;
    white-space: nowrap;
}

.header-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

.user-chip::before {
    content: '👤';
    font-size: 13px;
}

.shop-chip::before {
    content: '🏪';
}

/* Badge jumlah di nav (mis. pendaftar baru) */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
}

/* Link daftar di halaman login */
.login-footer-text {
    text-align: center;
    margin-top: 18px;
    font-size: 13.5px;
    color: var(--muted);
}

.login-footer-text a {
    color: var(--brand);
    font-weight: 650;
    text-decoration: none;
}

.login-footer-text a:hover {
    text-decoration: underline;
}

/* Filter bar (log aktivitas, dll) */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.filter-bar select,
.filter-bar input {
    padding: 9px 12px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    background: var(--surface);
    color: var(--ink);
    transition: border-color .16s, box-shadow .16s;
}

.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 138, 75, .18);
}

/* ============================================================
   Navigation
   ============================================================ */
.nav-menu {
    background: var(--surface);
    padding: 10px 28px 0;
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
    position: sticky;
    top: 60px;
    z-index: 400;
}
.nav-menu::-webkit-scrollbar { display: none; }

.nav-item {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--ink-2);
    border-radius: 10px 10px 0 0;
    border-bottom: 3px solid transparent;
    transition: color .18s, background .18s, border-color .18s;
    white-space: nowrap;
}

.nav-item:hover {
    color: var(--brand);
    background: var(--surface-2);
}

.nav-item.active {
    color: var(--brand);
    border-bottom-color: var(--accent);
    font-weight: 650;
}

/* Menu terkunci (belum termasuk paket) */
.nav-item.locked {
    opacity: .55;
}

.nav-item.locked:hover {
    color: var(--danger);
    opacity: .85;
}

/* Modul yang termasuk paket tapi fiturnya masih disiapkan */
.nav-item.soon-feature {
    opacity: .8;
}

.nav-item.soon-feature:hover {
    color: var(--accent);
    opacity: 1;
}

/* ============================================================
   Layout
   ============================================================ */
.main-content {
    padding: 28px;
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeUp .3s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.content-section { display: none; }
.content-section.active { display: block; }

.content-section h2 {
    margin-bottom: 20px;
    color: var(--ink);
    font-size: 23px;
    letter-spacing: -.3px;
}

/* ============================================================
   Alerts
   ============================================================ */
.alerts-container { margin-bottom: 22px; }

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
    animation: slideIn .25s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.alert-warning {
    background: var(--warning-bg);
    border-left: 4px solid var(--warning);
    color: #7c5810;
}

.alert-danger {
    background: var(--danger-bg);
    border-left: 4px solid var(--danger);
    color: #8f2c20;
}

/* ============================================================
   Stat cards
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.stat-card {
    background: var(--surface);
    padding: 22px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--brand) 100%);
}

.stat-card h3 {
    font-size: 13.5px;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.stat-value {
    font-size: 31px;
    font-weight: 750;
    color: var(--brand-3);
    margin: 6px 0;
    letter-spacing: -.6px;
    font-variant-numeric: tabular-nums;
}

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

/* ============================================================
   Chart
   ============================================================ */
.chart-container {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
    margin-bottom: 26px;
}

.chart-container h3 {
    margin-bottom: 18px;
    color: var(--ink);
    font-size: 16px;
}

#salesChart {
    width: 100% !important;
    height: 300px !important;
}

/* ============================================================
   Popularity
   ============================================================ */
.popularity-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}

.popularity-box {
    background: var(--surface);
    padding: 22px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
}

.popularity-box h3 {
    margin-bottom: 12px;
    color: var(--ink);
    font-size: 15.5px;
}

.popularity-item {
    padding: 11px 4px;
    border-bottom: 1px dashed var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.popularity-item:last-child { border-bottom: none; }

.popularity-item-name { font-weight: 550; color: var(--ink-2); }

.popularity-item-value {
    color: var(--accent);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ============================================================
   Transaction
   ============================================================ */
.transaction-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
}

.menu-list, .cart {
    background: var(--surface);
    padding: 22px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
}

.menu-list h3, .cart h3 {
    margin-bottom: 16px;
    color: var(--ink);
    font-size: 16px;
}

.cart { position: sticky; top: 130px; }

.menu-item {
    padding: 14px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    background: var(--surface-2);
    transition: border-color .16s, background .16s, transform .16s, box-shadow .16s;
}

.menu-item:hover {
    border-color: var(--accent);
    background: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.menu-item.disabled {
    opacity: .55;
    cursor: not-allowed;
    background: #f4efe9;
    filter: grayscale(.3);
}

.menu-item.disabled:hover {
    border-color: var(--line);
    transform: none;
    box-shadow: none;
}

.menu-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.menu-item-name {
    font-weight: 650;
    font-size: 15.5px;
}

.menu-item-price {
    color: var(--success);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.menu-item-category {
    color: var(--muted);
    font-size: 13px;
    text-transform: capitalize;
}

.menu-item-status {
    color: var(--danger);
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
    letter-spacing: .3px;
}

/* Warning badges di menu */
.ingredient-warnings {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px dashed var(--line);
    padding-top: 8px;
}

.ingredient-warning-badge {
    font-size: 10.5px;
    padding: 3px 9px;
    border-radius: 20px;
    display: inline-block;
    width: fit-content;
    font-weight: 650;
}

.warning-stockout { background: var(--danger-bg);  color: #a02c1f; }
.warning-expired  { background: #fdeee0;           color: #b35c00; }
.warning-expsoon  { background: var(--warning-bg); color: #8a6a12; }

/* Cart */
.cart-item {
    padding: 11px 2px;
    border-bottom: 1px dashed var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 600; }

.cart-item-qty {
    display: flex;
    gap: 8px;
    align-items: center;
}

.qty-btn {
    background: var(--surface-2);
    color: var(--brand);
    border: 1.5px solid var(--line);
    width: 27px;
    height: 27px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    font-weight: 700;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.cart-total {
    padding: 16px 0;
    border-top: 2px solid var(--brand);
    margin-top: 16px;
    font-size: 19px;
    font-weight: 750;
    color: var(--brand-3);
    display: flex;
    justify-content: space-between;
    font-variant-numeric: tabular-nums;
}

.payment-section { margin-top: 14px; }

/* ============================================================
   Tables
   ============================================================ */
.table-container {
    background: var(--surface);
    padding: 8px 18px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
    margin-top: 18px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead { background: transparent; }

th {
    padding: 14px 12px;
    text-align: left;
    color: var(--muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .7px;
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}

td {
    padding: 13px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

tbody tr { transition: background .14s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    display: inline-block;
    letter-spacing: .2px;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: #1e6b41; }
.badge-warning { background: var(--warning-bg); color: #8a6a12; }
.badge-danger  { background: var(--danger-bg);  color: #9c2f22; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    color: var(--ink-2);
    font-size: 13.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    transition: border-color .16s, box-shadow .16s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 138, 75, .18);
}

.form-group input[readonly] {
    background: var(--surface-2);
    color: var(--ink-2);
}

.form-group small { display: block; margin-top: 5px; color: var(--muted); font-size: 12.5px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    padding: 11px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 650;
    font-family: inherit;
    transition: transform .14s, box-shadow .14s, background .16s, opacity .16s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn:active { transform: translateY(1px) scale(.99); }

.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(111, 78, 55, .28);
}

.btn-primary:hover { box-shadow: 0 6px 18px rgba(111, 78, 55, .38); }

.btn-secondary {
    background: #efe8e0;
    color: var(--ink-2);
    border: 1px solid var(--line);
}

.btn-secondary:hover { background: #e6ddd2; }

.btn-danger {
    background: linear-gradient(135deg, #c0392b 0%, #a5301f 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(192, 57, 43, .25);
}

.btn-danger:hover { box-shadow: 0 6px 16px rgba(192, 57, 43, .35); }

.btn-success {
    background: linear-gradient(135deg, #2f8f5b 0%, #26764a 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 143, 91, .25);
}

.btn-success:hover { box-shadow: 0 6px 16px rgba(47, 143, 91, .35); }

.btn-block { width: 100%; margin-top: 8px; }

.btn-sm {
    padding: 7px 12px;
    font-size: 12px;
    border-radius: 8px;
}

/* ============================================================
   Modal
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(35, 26, 18, .55);
    backdrop-filter: blur(3px);
    overflow-y: auto;
}

.modal.active {
    display: block;
    animation: fadeIn .18s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: var(--surface);
    margin: 5% auto;
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 92%;
    max-width: 500px;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp .28s cubic-bezier(.2, .9, .3, 1.05);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-content h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--ink);
    letter-spacing: -.2px;
}

.close {
    position: absolute;
    right: 18px;
    top: 14px;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s, color .15s;
}

.close:hover {
    color: var(--ink);
    background: var(--surface-2);
}

/* ============================================================
   Tabs (Inventory)
   ============================================================ */
.tabs-bar {
    margin: 20px 0;
    border-bottom: 1px solid var(--line);
}

.tab-btn {
    padding: 11px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 650;
    font-family: inherit;
    font-size: 14px;
    color: var(--muted);
    border-bottom: 3px solid transparent;
    transition: color .16s, border-color .16s;
}

.tab-btn:hover { color: var(--brand); }

.tab-btn.active {
    color: var(--brand);
    border-bottom-color: var(--accent);
}

.tab-content { animation: fadeUp .25s ease; }

/* ============================================================
   Shift
   ============================================================ */
.shift-status {
    border-radius: var(--radius);
    padding: 18px 20px;
    font-size: 14.5px;
}

.shift-status-active {
    background: linear-gradient(135deg, #e9f7ef 0%, #dff2e7 100%);
    border: 1px solid #bfe4cd;
    border-left: 5px solid var(--success);
}

.shift-status-empty {
    background: var(--surface-2);
    border: 1px dashed var(--line);
    color: var(--ink-2);
}

.shift-status h4 {
    font-size: 16px;
    color: #1e6b41;
    margin-bottom: 10px;
}

.shift-status p { margin: 5px 0; }

/* Report <pre> */
#shiftReportContent pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--ink-2);
    background: var(--surface-2);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    overflow-x: auto;
}

/* ============================================================
   Error message
   ============================================================ */
.error-message {
    color: var(--danger);
    margin-top: 12px;
    font-size: 13.5px;
    min-height: 18px;
    text-align: center;
}

/* ============================================================
   Toast notification
   ============================================================ */
.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    color: var(--ink);
    padding: 13px 16px 13px 14px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
    border-left: 5px solid var(--brand);
    font-size: 14px;
    max-width: 360px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    pointer-events: auto;
    animation: toastIn .28s cubic-bezier(.2, .9, .3, 1.1);
}

.toast.leaving { animation: toastOut .22s ease forwards; }

.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info    { border-left-color: var(--accent); }

.toast-icon { font-size: 16px; line-height: 1.3; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px) scale(.97); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(30px) scale(.97); }
}

/* ============================================================
   AI Chat Widget
   ============================================================ */
#ai-chat-btn {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 9999;
    background: linear-gradient(140deg, var(--brand) 0%, var(--accent) 120%);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 58px;
    height: 58px;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(111, 78, 55, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s, box-shadow .18s;
}

#ai-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 30px rgba(111, 78, 55, .55);
}

.chat-window {
    display: none;
    position: fixed;
    bottom: 92px;
    right: 22px;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 440px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
}

.chat-window.open { display: flex; animation: slideUp .25s ease; }

.chat-header {
    background: linear-gradient(120deg, #0b3d38 0%, var(--brand) 100%);
    color: #fff;
    padding: 13px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14.5px;
}

.chat-header .close-chat {
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    opacity: .85;
    transition: opacity .15s;
}

.chat-header .close-chat:hover { opacity: 1; }

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    max-width: 86%;
    line-height: 1.45;
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
}

.chat-msg-ai {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--line);
    border-bottom-left-radius: 4px;
    color: var(--ink);
}

.chat-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg-error {
    align-self: flex-start;
    background: var(--danger-bg);
    border: 1px solid #f2c9c4;
    color: #9c2f22;
}

.chat-msg-loading {
    align-self: flex-start;
    color: var(--muted);
    font-style: italic;
    font-size: 13px;
    padding: 8px 4px;
}

.chat-footer {
    padding: 12px;
    border-top: 1px solid var(--line);
    background: #fff;
    display: flex;
    gap: 8px;
}

.chat-footer input {
    flex: 1;
    padding: 10px 13px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .16s, box-shadow .16s;
}

.chat-footer input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 138, 75, .16);
}

.chat-footer button {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 650;
    font-family: inherit;
    font-size: 13.5px;
    transition: opacity .15s, transform .15s;
}

.chat-footer button:hover { transform: translateY(-1px); }
.chat-footer button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ============================================================
   Receipt
   ============================================================ */
#receiptContent { font-family: var(--mono); }

/* ============================================================
   INTERAKTIF — loading, skeleton, animasi, komponen baru
   ============================================================ */

/* Tombol loading (spinner) */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
    opacity: .85;
}
.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn-secondary.loading::after {
    border-color: rgba(111, 78, 55, .25);
    border-top-color: var(--brand);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #ede3d6 25%, #f7f0e7 37%, #ede3d6 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease infinite;
    border-radius: 8px;
}
@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
.skeleton-line { height: 13px; margin: 6px 0; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-card {
    height: 78px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
}
.skeleton-td { height: 14px; }

/* Search box */
.search-box {
    position: relative;
    margin-bottom: 12px;
}
.search-box input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
    transition: border-color .16s, box-shadow .16s;
}
.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 138, 75, .18);
}
.search-box .search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: .6;
    pointer-events: none;
}

/* Chip filter kategori */
.chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.chip {
    padding: 7px 14px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .16s;
}
.chip:hover { border-color: var(--accent); color: var(--brand); }
.chip.active {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 3px 10px rgba(111, 78, 55, .25);
}

/* Quick cash (pembayaran cepat) */
.quick-cash {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: -8px 0 16px;
}
.quick-cash-btn {
    padding: 8px 13px;
    border: 1.5px dashed var(--line);
    background: var(--surface-2);
    color: var(--ink-2);
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 650;
    font-family: inherit;
    cursor: pointer;
    transition: all .15s;
}
.quick-cash-btn:hover {
    border-style: solid;
    border-color: var(--accent);
    color: var(--brand);
    background: #fff;
    transform: translateY(-1px);
}

/* Animasi keranjang */
.cart-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.cart-count-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cart-count-badge.pop { animation: pop .35s cubic-bezier(.2, .9, .3, 1.6); }
@keyframes pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.45); }
    100% { transform: scale(1); }
}
.cart-item.new-item { animation: slideInCart .3s ease; }
@keyframes slideInCart {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Bell notifikasi */
.notif-wrap { position: relative; }
.notif-bell {
    position: relative;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 17px;
    cursor: pointer;
    transition: background .16s, transform .16s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.notif-bell:hover { background: rgba(255, 255, 255, .25); transform: translateY(-1px); }
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--brand);
}
.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    max-width: calc(100vw - 32px);
    max-height: 380px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1500;
}
.notif-dropdown.open { display: block; animation: slideUp .22s ease; }

/* Di layar kecil: dropdown nempel kanan layar biar selalu kelihatan penuh */
@media (max-width: 768px) {
    .notif-dropdown {
        position: fixed;
        top: 62px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }
}
.notif-header {
    padding: 13px 16px;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: var(--surface);
}
.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink-2);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.notif-item:last-child { border-bottom: none; }
.notif-item .notif-ico { font-size: 15px; }
.notif-empty {
    padding: 26px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* Empty state */
.empty-state {
    padding: 34px 20px;
    text-align: center;
    color: var(--muted);
}
.empty-state .empty-icon { font-size: 40px; display: block; margin-bottom: 10px; opacity: .85; }
.empty-state .empty-title { font-size: 14.5px; font-weight: 650; color: var(--ink-2); margin-bottom: 4px; }
.empty-state .empty-sub { font-size: 12.5px; margin-bottom: 14px; }

/* Header tabel bisa disortir */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--brand); }
th.sortable .sort-arrow { opacity: .35; font-size: 10px; margin-left: 3px; }
th.sortable.asc .sort-arrow, th.sortable.desc .sort-arrow { opacity: 1; color: var(--accent); }

/* Tooltip grafik */
.chart-wrap { position: relative; }
.chart-tooltip {
    display: none;
    position: absolute;
    pointer-events: none;
    background: var(--brand-3);
    color: #fff;
    padding: 8px 11px;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: var(--shadow-md);
    z-index: 50;
    white-space: nowrap;
}
.chart-tooltip.visible { display: block; }

/* Toast progress bar */
.toast { position: relative; overflow: hidden; }
.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: currentColor;
    opacity: .25;
    transform-origin: left;
    animation: toastBar 4s linear forwards;
}
@keyframes toastBar {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Pager (pagination) */
.pager {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    padding: 14px 0 4px;
    flex-wrap: wrap;
}
.pager button {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.pager button:hover { border-color: var(--accent); color: var(--brand); }
.pager button.active {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    border-color: transparent;
    color: #fff;
}
.pager .pager-info { font-size: 12.5px; color: var(--muted); margin-right: 8px; }

/* ============================================================
   Platform: Upgrade paket & langganan
   ============================================================ */
.upgrade-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.upgrade-card {
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 16px 14px;
    text-align: center;
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}

.upgrade-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }

.upgrade-card.current {
    border-color: var(--success);
    background: #f0fdf4;
}

.upgrade-card h4 { font-size: 15px; margin-bottom: 2px; }

.upgrade-card .up-price {
    font-size: 17px;
    font-weight: 800;
    color: var(--brand);
    margin: 6px 0 4px;
    font-variant-numeric: tabular-nums;
}

.upgrade-card .up-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }

.upgrade-card .btn { width: 100%; }

@media (max-width: 700px) {
    .upgrade-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .transaction-container { grid-template-columns: 1fr; }
    .cart { position: static; }
}

@media (max-width: 768px) {
    .popularity-container { grid-template-columns: 1fr; }
    .main-content { padding: 16px; }
    .header { padding: 12px 16px; }
    .header-left h2 { font-size: 16px; }
    .nav-menu { padding: 8px 14px 0; top: 56px; }
    .nav-item { padding: 11px 14px; font-size: 13.5px; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 26px; }
    .user-chip { display: none; }
    .modal-content { margin: 8% auto; padding: 22px; }
}
