/* ============================================================
   Catatoko POS — main.css
   Modern clean UI — Inter font, refined spacing & shadows
   ============================================================ */

/* ── Google Font Import ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── Reset & Variables ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary:    #2563eb;
  --color-primary-dk: #1d4ed8;
  --color-primary-lt: #eff6ff;
  --color-bg:         #f1f5f9;
  --color-bg-alt:     #f8fafc;
  --color-surface:    #ffffff;
  --color-border:     #e2e8f0;
  --color-border-lt:  #f1f5f9;
  --color-text:       #0f172a;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;
  --color-success:    #16a34a;
  --color-warning:    #d97706;
  --color-danger:     #dc2626;
  --color-info:       #0284c7;
  --radius:           14px;
  --radius-sm:        8px;
  --radius-lg:        20px;
  --shadow:           0 1px 4px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md:        0 4px 16px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.04);
  --shadow-lg:        0 8px 32px rgba(15,23,42,.10);
  --font:             'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --nav-width:        240px;
  --transition:       .15s ease;
}

/* ── Theme overrides ─────────────────────────────────────── */
[data-theme="orange"] { --color-primary: #ea580c; --color-primary-dk: #c2410c; --color-primary-lt: #fff7ed; }
[data-theme="red"]    { --color-primary: #dc2626; --color-primary-dk: #b91c1c; --color-primary-lt: #fef2f2; }
[data-theme="green"]  { --color-primary: #16a34a; --color-primary-dk: #15803d; --color-primary-lt: #f0fdf4; }
[data-theme="blue"]   { --color-primary: #2563eb; --color-primary-dk: #1d4ed8; --color-primary-lt: #eff6ff; }
[data-theme="purple"] { --color-primary: #9333ea; --color-primary-dk: #7e22ce; --color-primary-lt: #faf5ff; }
[data-theme="brown"]  { --color-primary: #92400e; --color-primary-dk: #78350f; --color-primary-lt: #fef3c7; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Nav ─────────────────────────────────────────────────── */
.app-nav {
  background: #ffffff;
  color: var(--color-text);
  position: sticky;
  top: 0;
  z-index: 100;
  border-right: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}
.nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 64px;
  border-bottom: 1px solid var(--color-border-lt);
}
.nav-brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
  letter-spacing: -.02em;
}
.nav-brand-sub {
  font-size: .72rem;
  color: var(--color-text-muted);
  font-weight: 400;
  display: block;
  margin-top: -2px;
}
.nav-toggle {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--color-bg); }

.nav-menu {
  display: none;
  padding: 8px 12px 16px;
  border-top: 1px solid var(--color-border-lt);
}
.nav-menu.open { display: block; }

.nav-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-light);
  padding: 14px 8px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  min-height: 42px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  gap: 10px;
  margin-bottom: 2px;
}
.nav-link:hover {
  background: var(--color-bg);
  color: var(--color-text);
}
.nav-link.active {
  background: var(--color-primary-lt);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-user {
  padding: 12px;
  border-top: 1px solid var(--color-border-lt);
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-user-name {
  color: var(--color-text);
  font-size: .85rem;
  font-weight: 600;
}
.nav-user-role {
  color: var(--color-text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Logout button — ikuti tema */
.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--color-primary-lt);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-sm);
  color: var(--color-primary) !important;
  font-size: .85rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none !important;
  min-height: 40px;
  transition: background var(--transition);
  width: 100%;
  text-align: center;
}
.btn-logout:hover,
.btn-logout:visited,
.btn-logout:active {
  background: var(--color-primary);
  color: #fff !important;
  text-decoration: none !important;
}

/* ── Desktop Sidebar ─────────────────────────────────────── */
@media (min-width: 768px) {
  .app-nav {
    position: fixed !important;
    top: 0; left: 0;
    width: var(--nav-width);
    height: 100vh;
    overflow-y: auto;
    display: flex !important;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    z-index: 200;
  }
  .nav-header { height: 72px; padding: 0 20px; }
  .nav-toggle { display: none !important; }
  .nav-menu {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    padding: 8px 12px;
    border-top: none;
  }
  .nav-user { margin-top: auto; padding: 16px 12px; }

  .page-content,
  .container {
    margin-left: var(--nav-width) !important;
  }
  .kasir-layout {
    margin-left: 0 !important;
    padding-left: var(--nav-width);
    box-sizing: border-box;
    width: 100vw;
    max-width: 100vw;
  }
  .login-page { margin-left: 0 !important; }
}

/* ── Container / Layout ──────────────────────────────────── */
.container { max-width: 960px; margin: 0 auto; padding: 16px; }
.page-content { padding: 16px; }

@media (min-width: 768px) {
  .page-content { padding: 28px 32px; }
  .container {
    padding: 28px 32px;
    max-width: 100%;
    margin: 0 !important;          /* batalkan margin: 0 auto */
    margin-left: var(--nav-width) !important;
  }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--color-text);
}
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border-lt);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border-lt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-header h3 { font-size: .95rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.card-body { padding: 20px; }
.card-link { display: block; padding: 16px; text-decoration: none; color: var(--color-text); transition: background var(--transition); }
.card-link:hover { background: var(--color-bg); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font);
  line-height: 1;
  min-height: 40px;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -.01em;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dk);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-lt);
}
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; transform: translateY(-1px); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: .8rem; min-height: 34px; }

/* ── Segmented Buttons ───────────────────────────────────── */
.segmented-btn {
  display: flex;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: 100%;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font);
  min-height: 38px;
  border-radius: 6px;
  transition: all var(--transition);
}
.seg-btn.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow);
}
.seg-btn:hover:not(.active) { background: rgba(0,0,0,.04); color: var(--color-text); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-hint { font-size: .78rem; color: var(--color-text-muted); margin-top: 4px; display: block; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font);
  color: var(--color-text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 42px;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-lt);
}
textarea.form-control { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.form-group-btn { display: flex; align-items: flex-end; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #a16207; border: 1px solid #fef08a; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-primary   { background: var(--color-primary); color: #fff; }
.badge-success   { background: #dcfce7; color: #15803d; }
.badge-warning   { background: #fef9c3; color: #a16207; }
.badge-danger    { background: #fee2e2; color: #b91c1c; }
.badge-secondary { background: #e2e8f0; color: #475569; }
.badge-info      { background: #dbeafe; color: #1d4ed8; }
.badge-makanan   { background: #fef3c7; color: #92400e; }
.badge-minuman   { background: #dbeafe; color: #1d4ed8; }
.badge-tunai     { background: #dcfce7; color: #15803d; }
.badge-qris      { background: #ede9fe; color: #6d28d9; }
.badge-transfer  { background: #dbeafe; color: #1d4ed8; }
.badge-stok-aman       { background: #dcfce7; color: #15803d; }
.badge-stok-hampir-habis{ background: #fef9c3; color: #a16207; }
.badge-stok-habis      { background: #fee2e2; color: #b91c1c; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #1e293b;
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  transition: transform .3s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.toast-success { background: #15803d; }
.toast.toast-error   { background: #b91c1c; }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: fadeUp .2s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }
.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.05rem; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--color-text-muted); min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--color-bg); }
.modal-body { padding: 16px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--color-border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-struk { max-width: 360px; }

/* ── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--color-bg);
}
.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-lt);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-icon {
  width: 64px; height: 64px;
  background: var(--color-primary-lt);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 12px;
}
.login-store-name {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--color-text);
}
.login-app-name {
  color: var(--color-text-muted);
  font-size: .82rem;
  margin-top: 3px;
  font-weight: 500;
}

/* ── Kasir Layout ────────────────────────────────────────── */
.kasir-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* Warning bar — centered */
.kasir-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #fef9c3;
  border-bottom: 2px solid #f59e0b;
  padding: 12px 20px;
  font-size: .92rem;
  color: #92400e;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

/* Row wrapper */
.kasir-row {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.kasir-menu-section {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  overflow-x: hidden;
}

.kasir-cart-section {
  background: var(--color-surface);
  border-top: 2px solid var(--color-border);
  padding: 16px;
  position: sticky;
  bottom: 0;
  max-height: 58vh;
  overflow-y: auto;
  box-shadow: 0 -4px 12px rgba(0,0,0,.08);
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .kasir-layout {
    /* Pakai max-width bukan vw agar tidak ada overflow */
    width: 100%;
    max-width: 100%;
    height: 100vh;
    overflow: hidden;
  }
  .kasir-row {
    flex-direction: row;
    flex: 1;
    height: calc(100vh - 54px); /* kurangi tinggi warning jika ada */
    overflow: hidden;
  }
  .kasir-menu-section {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    padding: 20px;
  }
  .kasir-cart-section {
    /* Lebar tetap, tidak flex-shrink */
    width: 300px;
    min-width: 300px;
    flex-shrink: 0;
    border-top: none;
    border-left: 2px solid var(--color-border);
    position: relative;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    padding: 18px 16px;
    box-shadow: none;
    bottom: auto;
  }
}

/* ── Menu Grid (Kasir) ───────────────────────────────────── */
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
@media (min-width: 480px) { .menu-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .menu-grid { grid-template-columns: repeat(4, 1fr); } }

.menu-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 2px solid transparent;
  overflow: hidden;
  user-select: none;
}
.menu-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-primary); }
.menu-card.menu-habis { opacity: .5; cursor: not-allowed; }
.menu-card.menu-habis:hover { transform: none; box-shadow: var(--shadow); border-color: transparent; }
.menu-card-body { padding: 12px; }
.menu-nama { font-weight: 700; font-size: .9rem; margin-bottom: 4px; }
.menu-kategori-badge { margin-bottom: 4px; }
.menu-harga { font-size: 1rem; font-weight: 800; color: var(--color-primary); margin-bottom: 4px; }
.menu-stok-info { font-size: .75rem; }
.stok-aman .menu-stok-info { color: #15803d; }
.stok-hampir-habis .menu-stok-info { color: #a16207; }
.stok-habis .menu-stok-info { color: #b91c1c; }

/* ── Cart ────────────────────────────────────────────────── */
.cart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cart-header h2 { font-size: 1rem; font-weight: 700; }
.cart-items { min-height: 48px; margin-bottom: 12px; }
.cart-empty { color: var(--color-text-muted); font-size: .9rem; text-align: center; padding: 12px; }
.cart-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-nama { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-harga { font-size: .8rem; color: var(--color-text-muted); }
.cart-item-qty { display: flex; align-items: center; gap: 6px; }
.qty-btn { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--color-primary); background: transparent; color: var(--color-primary); font-size: 1.1rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.qty-btn:hover { background: var(--color-primary); color: #fff; }
.qty-val { min-width: 24px; text-align: center; font-weight: 700; }
.cart-item-subtotal { font-weight: 700; font-size: .88rem; white-space: nowrap; }

.cart-total-row { display: flex; align-items: center; justify-content: space-between; font-size: 1.1rem; margin-bottom: 12px; }
.cart-total-row strong { color: var(--color-primary); font-size: 1.3rem; }
.cart-kembalian-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.kembalian-val { color: var(--color-success); font-size: 1.1rem; }
.btn-pay { font-size: 1.05rem; padding: 14px; }

/* ── Struk ───────────────────────────────────────────────── */
/* ── Struk ───────────────────────────────────────────────── */
#struk-capture {
  font-family: 'Courier New', monospace;
  background: #fff;
  padding: 16px 12px;
  width: 220px;
  margin: 0 auto;
  box-sizing: border-box;
}
.struk-header { text-align: center; margin-bottom: 10px; }

/* 1. Nama toko lebih besar */
.struk-nama {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: .02em;
  margin-bottom: 6px;
  font-family: 'Courier New', monospace;
}

/* 2. No TRX, tanggal, kasir — kecil tapi tebal */
.struk-sub {
  font-size: .72rem;
  font-weight: 700;
  color: #444;
  line-height: 1.4;
}

/* 3. Garis pemisah — full width, tidak turun */
.struk-divider {
  font-size: .72rem;
  color: #555;
  margin: 6px 0;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0;
  /* Gunakan border sebagai garis, lebih rapi dari karakter */
  border-top: 1px dashed #999;
  height: 0;
  font-size: 0;  /* sembunyikan teks, pakai border */
}

/* 4. Nama produk — tebal, sedikit lebih kecil */
.struk-item {
  margin: 4px 0;
  font-size: .8rem;
}
.struk-item-nama {
  font-weight: 700;
  font-size: .8rem;
  margin-bottom: 1px;
}
.struk-item-detail {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: #555;
  padding-left: 8px;
}

/* Row total, bayar, kembalian */
.struk-row {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  margin: 3px 0;
}
.struk-row strong { font-size: .9rem; }

/* Footer pesan */
.struk-footer {
  text-align: center;
  font-size: .75rem;
  color: #666;
  margin-top: 8px;
  font-style: italic;
}

/* 5. Baris metode bayar */
.struk-metode {
  font-size: .78rem;
  font-weight: 700;
  color: #333;
  margin: 3px 0;
}

/* ── Stats Grid ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  width: 100%;
}
/* stats-3: selalu 3 kolom termasuk di mobile */
.stats-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 600px) {
  .stats-grid { gap: 12px; margin-bottom: 16px; }
  .stats-grid:not(.stats-3) { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (min-width: 900px) {
  .stats-grid:not(.stats-3) { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 14px 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border-lt);
  text-align: center;
  overflow: hidden;
  min-width: 0;
}
@media (min-width: 600px) {
  .stat-card { padding: 20px; }
}

.stat-label {
  font-size: .65rem;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-size: clamp(.85rem, 2.8vw, 1.4rem);
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -.03em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 600px) {
  .stat-label { font-size: .72rem; letter-spacing: .06em; }
  .stat-value  { font-size: 1.4rem; }
}

/* ── List Items ──────────────────────────────────────────── */
.list-items { display: flex; flex-direction: column; gap: 0; }
.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}
.list-item:last-child { border-bottom: none; }
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: .95rem; margin-bottom: 2px; }
.list-item-sub { font-size: .82rem; color: var(--color-text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.list-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; white-space: nowrap; font-size: .88rem; }

/* ── Stock Cards ─────────────────────────────────────────── */
.stock-list { display: flex; flex-direction: column; gap: 10px; }
.stock-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-left: 4px solid var(--color-success);
}
.stok-hampir-habis.stock-card { border-left-color: var(--color-warning); }
.stok-habis.stock-card { border-left-color: var(--color-danger); }
.stock-card-info { flex: 1; min-width: 0; }
.stock-card-nama { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.stock-card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.stock-numbers { font-size: .85rem; color: var(--color-text-muted); margin-bottom: 8px; }
.stock-card-actions { display: flex; flex-direction: column; gap: 6px; }

.progress-bar-wrap { margin-top: 2px; }
.progress-bar { background: var(--color-border); border-radius: 999px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width .4s; }
.progress-aman        { background: var(--color-success); }
.progress-hampir-habis{ background: var(--color-warning); }
.progress-habis       { background: var(--color-danger); }

/* ── Menu Admin Grid ─────────────────────────────────────── */
.menu-admin-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 480px) { .menu-admin-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .menu-admin-grid { grid-template-columns: repeat(3, 1fr); } }

.menu-admin-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.menu-admin-nama { font-weight: 700; font-size: .95rem; }
.menu-admin-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0; }
.menu-admin-harga { font-size: 1.05rem; font-weight: 800; color: var(--color-primary); }
.menu-admin-stok { font-size: .8rem; }
.menu-admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Toolbar ─────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .form-control { flex: 1; min-width: 120px; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 2px solid var(--color-border); }
.tab-btn { padding: 8px 16px; border: none; background: none; cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--color-text-muted); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all var(--transition); min-height: 44px; }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Section Header ──────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-header h2 { font-size: 1.05rem; font-weight: 700; }

/* ── Summary List (Opening/Closing) ─────────────────────── */
.summary-list { display: flex; flex-direction: column; gap: 0; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--color-border); font-size: .92rem; gap: 12px; }
.summary-row:last-child { border-bottom: none; }
.summary-total { font-size: 1.05rem; font-weight: 700; }
.summary-total strong { color: var(--color-primary); font-size: 1.2rem; }

/* ── Filter Form (Laporan) ───────────────────────────────── */
.filter-form { background: var(--color-surface); padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }

/* ── Data Table ──────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th { background: var(--color-bg); padding: 10px 12px; text-align: left; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); border-bottom: 2px solid var(--color-border); white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--color-bg); }
.text-right { text-align: right; }
.td-code { font-family: monospace; font-size: .78rem; color: var(--color-text-muted); }

/* ── Mobile Laporan List ─────────────────────────────────── */
.mobile-lap-list { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 768px) {
  .mobile-lap-list { display: none; }
  .table-responsive { display: block; }
}
@media (max-width: 767px) {
  .table-responsive { display: none; }
  .mobile-lap-list { display: flex; }
}
.lap-item-card { background: var(--color-bg); border-radius: var(--radius-sm); padding: 12px; border: 1px solid var(--color-border); }
.lap-item-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.lap-item-row:last-child { margin-bottom: 0; }
.lap-item-code { font-family: monospace; font-size: .75rem; color: var(--color-text-muted); }
.lap-item-meta { font-size: .78rem; color: var(--color-text-muted); }

/* ── Tema Picker ─────────────────────────────────────────── */
.tema-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.tema-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, box-shadow .15s;
  font-size: .85rem;
  flex-shrink: 0;
}
.tema-btn:hover { transform: scale(1.12); }
.tema-btn.active {
  border-color: #1e293b;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1e293b;
  transform: scale(1.08);
}
.tema-check {
  color: #fff;
  font-weight: 900;
  font-size: .8rem;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.tema-label {
  font-size: .75rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-top: 4px;
}

/* Setelan form: bahasa + tema jejer kiri, simpan di bawah center */
.setelan-lang-tema {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 20px;
}
.setelan-lang-tema .form-group { margin-bottom: 0; }
.setelan-simpan {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.setelan-simpan .btn { min-width: 220px; }

/* ── Status Card (Dashboard) ─────────────────────────────── */
.card-status { border-left: 4px solid var(--color-primary); }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.status-label { font-size: .82rem; color: var(--color-text-muted); font-weight: 600; margin-bottom: 4px; }
.status-value { font-size: 1rem; }
.status-meta { font-size: .85rem; color: var(--color-text-muted); }

/* ── Profit / Modal ──────────────────────────────────────── */
.menu-admin-profit {
  font-size: .8rem;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}
.profit-badge {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  font-size: .72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}
.profit-badge-sm {
  font-size: .78rem;
  color: #15803d;
  font-weight: 600;
}
.profit-inline {
  color: #15803d;
  font-weight: 600;
}
.stat-card-profit {
  border: 2px solid #bbf7d0;
  background: #f0fdf4;
}
.stat-card-profit .stat-value { color: #15803d; }
.text-muted { color: var(--color-text-muted); font-size: .9rem; }
.grid { display: grid; gap: 12px; }
.grid-1 { grid-template-columns: 1fr; }
code { background: var(--color-bg); padding: 2px 6px; border-radius: 4px; font-size: .88em; }
.color-bg-alt { background: var(--color-bg-alt); }

/* ── Laptop / large screen polish ───────────────────────── */
@media (min-width: 768px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .stats-3    { grid-template-columns: repeat(3, 1fr); }
  .menu-admin-grid { grid-template-columns: repeat(3, 1fr); }
  .stock-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .filter-form .form-row { align-items: flex-end; }
  .menu-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1100px) {
  .menu-grid { grid-template-columns: repeat(4, 1fr); }
  .menu-admin-grid { grid-template-columns: repeat(4, 1fr); }
  .stock-list { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   TOPPING STYLES
   ============================================================ */

/* Tag topping di cart */
.cart-item-toppings {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 3px 0 2px;
}
.topping-tag {
  font-size: .75rem;
  background: var(--color-primary-light, #fff7ed);
  color: var(--color-primary);
  border: 1px solid var(--color-primary-border, #fed7aa);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* Modal topping — hover highlight */
.topping-option:hover {
  border-color: var(--color-primary) !important;
  background: var(--color-primary-light, #fff7ed);
}

/* Baris topping di struk */
.struk-topping-row .struk-item-nama {
  font-size: .85rem;
  color: #555;
}
.struk-topping-row .struk-item-detail span:last-child {
  font-size: .85rem;
  color: #555;
}
