/* ============================================================
   0. DESIGN TOKENS — Rindang Teduh
   Palet terinspirasi kedai teduh berpepohonan: hijau tua sebagai
   warna utama, krem hangat untuk latar, dan amber sebagai aksen.
   Warna status (antri/diproses/selesai/bahaya) tetap dipertahankan
   konsisten di seluruh halaman agar mudah dikenali sekilas.
   ============================================================ */
:root {
    --brand-900: #0b3d31;
    --brand-700: #146356;
    --brand-600: #1a7a68;
    --brand-100: #e3f2ec;

    --brand-200: #FFF200;

    --amber-600: #c2760f;
    --amber-500: #e08e1d;
    --amber-100: #fdf0dd;

    --blue-600: #2563eb;
    --blue-100: #e5edfd;

    --red-600: #dc2626;
    --red-500: #ef4444;
    --red-100: #fdeaea;

    --green-600: #15803d;
    --green-100: #e0f5e6;

    --ink-900: #1c2521;
    --ink-700: #3f4a45;
    --ink-500: #6b7a73;
    --ink-300: #9fb0a8;

    --bg: #f6f7f3;
    --surface: #ffffff;
    --border: #e3e7e1;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(15, 35, 28, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 35, 28, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 35, 28, 0.12);
}

/* ============================================================
   1. RESET & BASE
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--ink-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select {
    font-family: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--brand-600);
    outline-offset: 2px;
}

/* ============================================================
   2. NAVBAR / HEADER
   ============================================================ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 50;
}

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

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

.header-brand h1 {
    font-size: 19px;
    font-weight: 800;
    margin: 0;
    color: var(--brand-900);
    letter-spacing: -0.01em;
}

.header-subtitle {
    font-size: 12px;
    color: var(--ink-500);
    margin: 2px 0 0 0;
}

.header-nav-tabs {
    display: flex;
    gap: 4px;
    align-items: center;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.nav-tab-btn {
    width: auto;
    margin: 0;
    padding: 7px 14px;
    background: transparent;
    color: var(--ink-700);
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-tab-btn:hover {
    background: var(--surface);
    color: var(--brand-900);
}

.nav-tab-btn.active {
    background: var(--brand-700);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.nav-tab-btn.locked {
    color: var(--ink-300);
}

.nav-tab-btn.locked:hover {
    background: var(--red-100);
    color: var(--red-600);
}

.lock-indicator {
    font-size: 11px;
}

.header-user {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-700);
    background: var(--brand-100);
    padding: 6px 12px;
    border-radius: 999px;
}

.btn-logout {
    width: auto;
    margin: 0;
    padding: 9px 16px;
    background: transparent;
    color: var(--red-600);
    border: 1px solid var(--red-100);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-logout:hover {
    background: var(--red-100);
}

/* ============================================================
   3. POS KASIR (index.html)
   ============================================================ */
.pos-layout {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 28px;
}

.card-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.card-panel h2 {
    font-size: 17px;
    font-weight: 800;
    color: var(--ink-900);
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.menu-card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-card:hover {
    border-color: var(--brand-600);
    box-shadow: var(--shadow-md);
}

.menu-card.out-of-stock {
    opacity: 0.5;
    background: var(--bg);
    cursor: not-allowed;
    border-color: var(--border);
}

.menu-title {
    font-weight: 700;
    font-size: 14.5px;
    color: var(--ink-900);
    margin-bottom: 4px;
}

.menu-price {
    font-size: 13px;
    color: var(--brand-700);
    font-weight: 700;
}

.cart-items-box {
    max-height: 280px;
    overflow-y: auto;
    border-bottom: 1px solid var(--border);
    margin-bottom: 15px;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
}

.cart-total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: 800;
    color: var(--ink-900);
    padding: 12px 0;
}

.pos-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.btn-action {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: #ffffff;
    transition: filter 0.15s ease;
}

.btn-action:hover { filter: brightness(0.94); }
.btn-action:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-open { background: var(--amber-500); }
.btn-closed { background: var(--brand-700); }

.history-panel {
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 15px;
}

.history-panel h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-500);
    margin-bottom: 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

/* ============================================================
   4. MANAGER DASHBOARD (manager.html)
   ============================================================ */
.manager-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 28px 40px 28px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    padding: 20px 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand-600);
    box-shadow: var(--shadow-sm);
}

.stat-card.blue { border-left-color: var(--blue-600); }
.stat-card.red { border-left-color: var(--red-500); }

.stat-card h3 {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-500);
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-card p {
    font-size: 26px;
    font-weight: 800;
    color: var(--ink-900);
    letter-spacing: -0.01em;
}

/* ============================================================
   5. STATUS BADGES (dipakai di riwayat kasir & manager)
   ============================================================ */
.badge-status {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: white;
}
.badge-status.antri { background: var(--amber-500); }
.badge-status.diproses { background: var(--blue-600); }
.badge-status.selesai { background: var(--green-600); }
.badge-status.unpaid { background: var(--red-500); }

.badge-area {
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}
.badge-area.bar { background: var(--blue-100); color: #0369a1; }
.badge-area.dapur { background: var(--amber-100); color: #c2410c; }

/* ============================================================
   6. RESPONSIVE MEDIA QUERIES
   ============================================================ */
@media (max-width: 960px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 12px 16px;
    }
    .pos-layout, .manager-wrapper, .inventory-wrapper {
        padding-left: 14px;
        padding-right: 14px;
    }
}

/* ============================================================
   MODAL & FORMULIR TAMBAH MENU
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11, 61, 49, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 26px;
    box-shadow: var(--shadow-lg);
}

.modal-card h2 {
    color: var(--ink-900);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-700);
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--ink-900);
    background: var(--surface);
    outline: none;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    border-color: var(--brand-600);
}

.recipe-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.recipe-row select {
    flex: 2;
}

.recipe-row input {
    flex: 1;
}

.btn-remove-row {
    width: auto;
    margin: 0;
    padding: 8px 11px;
    background: var(--red-100);
    color: var(--red-600);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: bold;
    cursor: pointer;
}

.btn-add-ingredient {
    width: auto;
    margin: 6px 0 16px 0;
    padding: 7px 12px;
    background: var(--brand-100);
    color: var(--brand-700);
    border: 1px dashed var(--brand-600);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn-restock {
    padding: 9px 18px;
    color: #ffffff;
    border: none;
}

/* ============================================================
   7. INVENTORY PAGE (inventory.html)
   ============================================================ */
.inventory-wrapper {
    max-width: 1200px;
    margin: 24px auto 40px auto;
    padding: 0 28px;
}

.inventory-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.inventory-filter-bar h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--ink-900);
}

.filter-buttons, .kds-filter-bar {
    display: flex;
    gap: 6px;
    background: var(--surface);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.kds-filter-bar {
    max-width: fit-content;
    margin: 20px 28px 0 28px;
}

.btn-filter {
    background: transparent;
    border: none;
    color: var(--ink-700);
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-filter:hover {
    background: var(--bg);
    color: var(--ink-900);
}

.btn-filter.active {
    background: var(--brand-700);
    color: #ffffff;
}

.table-responsive {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.inventory-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
    font-size: 13px;
}

.inventory-table th {
    background-color: var(--bg);
    color: var(--ink-500);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
}

.inventory-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--ink-700);
    vertical-align: middle;
}

.inventory-table tbody tr:hover {
    background-color: var(--bg);
}

.inventory-table tbody tr:last-child td {
    border-bottom: none;
}

.inventory-table td:nth-child(1) {
    color: var(--ink-300);
    font-weight: 600;
    width: 40px;
}

.inventory-table td:nth-child(4) {
    font-weight: 700;
    color: var(--ink-900);
}

.inventory-table td:nth-child(5) {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--ink-900);
}

.table-empty {
    text-align: center;
    padding: 32px 18px !important;
    color: var(--ink-300);
    font-size: 13px;
    white-space: normal;
}

.inventory-table input[type="text"],
.inventory-table input[type="number"] {
    width: 84px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--ink-900);
    outline: none;
    transition: border-color 0.15s ease;
}

.inventory-table input[type="text"]:focus,
.inventory-table input[type="number"]:focus {
    border-color: var(--brand-600);
}

.restock-action {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-restock {
    padding: 7px 13px;
    background: var(--brand-600);
    color: #ffffff;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-restock:hover {
    background: var(--brand-100);
    color:var(--brand-700);
    border: 1px solid var(--brand-600);
}

/* Status stok — dipakai oleh inventoryTable.js */
.stock-tag {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.stock-tag.tag-safe { background: var(--green-100); color: var(--green-600); }
.stock-tag.tag-low { background: var(--amber-100); color: var(--amber-600); }
.stock-tag.tag-danger { background: var(--red-100); color: var(--red-600); }

/* ============================================================
   8. KDS — KITCHEN DISPLAY SYSTEM (dapur.html)
   Bagian ini sebelumnya TIDAK memiliki styling sama sekali.
   ============================================================ */
.kds-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px 28px 40px 28px;
    max-width: 1400px;
    margin: 0 auto;
}

.kds-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    border-top: 4px solid var(--amber-500);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    
}

.kds-card.diproses {
    border-top-color: var(--blue-600);
}

.kds-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 18px 12px 18px;
}

.kds-order-id {
    font-size: 15px;
    font-weight: 800;
    color: var(--ink-900);
}

.kds-table-name {
    font-size: 12.5px;
    color: var(--ink-500);
    margin-top: 2px;
}

.kds-time {
    font-size: 11.5px;
    color: var(--ink-300);
    white-space: nowrap;
}

.kds-items {
    list-style: none;
    padding: 0 18px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kds-item-row {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 12px;
    border-left: 3px solid var(--amber-500);
}

.kds-item-row.diproses {
    border-left-color: var(--blue-600);
}

.kds-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--ink-900);
}

.kds-item-name strong {
    color: var(--brand-700);
}

.kds-item-note {
    margin-top: 6px;
    font-size: 12px;
    color: var(--ink-700);
    background: var(--amber-100);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}

.kds-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.kds-badge {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: white;
}
.kds-badge.antri { background: var(--amber-500); }
.kds-badge.diproses { background: var(--blue-600); }
.kds-badge.selesai { background: var(--green-600); }

.btn-kds {
    width: auto;
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.btn-kds:hover { filter: brightness(0.95); }
.btn-kds.process { background: var(--blue-600); }
.btn-kds.done { background: var(--green-600); }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--ink-500);
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink-700);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13px;
    color: var(--ink-300);
}

