:root {
  /* Sate Kambing — warm brown palette */
  --primary: #b5541a;        /* coklat sate / merah bata hangat */
  --primary-dark: #8f3f10;   /* coklat tua bakar */
  --primary-light: rgba(181,84,26,0.15);

  --bg: #0f0b08;             /* hitam arang */
  --bg-2: #1a1208;           /* coklat sangat gelap */
  --surface: #211608;        /* kartu coklat tua */
  --surface-2: #2c1e0f;      /* surface lebih terang */

  --text: #f5ede0;           /* krem tulang */
  --text-muted: #9a7e62;     /* coklat muda */
  --border: #3a2510;         /* border coklat gelap */

  --danger: #e05c5c;
  --warning: #d4861a;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.7);
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

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

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar .brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
  padding: 8px 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: 0.15s;
}

.sidebar nav a:hover {
  background: var(--surface);
  color: var(--text);
}

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

.sidebar .logout-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--danger);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.sidebar .logout-link:hover {
  background: rgba(224, 92, 92, 0.1);
}

.main-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  margin-left: 230px;
  padding: 24px 28px 60px;
  min-height: 100vh;
}

.topbar {
  display: none;
}

.bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .app-layout {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 0 14px 100px;
  }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    margin: 0 -14px 16px;
  }

  .topbar .brand {
    font-weight: 800;
    color: var(--primary);
    font-size: 17px;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.5);
  }

  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    padding: 6px 0;
    border-radius: 10px;
  }

  .bottom-nav a svg {
    width: 22px;
    height: 22px;
  }

  .bottom-nav a.active {
    color: var(--primary);
  }

  .card {
    padding: 16px;
    border-radius: 12px;
  }

  .page-title {
    font-size: 19px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card .value {
    font-size: 19px;
  }
}

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

/* ===== COMPONENTS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  border: 1px solid var(--border);
  width: 100%;
}

.card-title {
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

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

th,
td {
  padding: 11px 10px;
  text-align: left;
  font-size: 13.5px;
}

thead th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-2);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  min-width: 480px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(200, 137, 58, 0.35);
}

.btn-primary:hover {
  background: #d99840;
  box-shadow: 0 4px 14px rgba(200, 137, 58, 0.45);
}

.btn-danger {
  background: rgba(224, 92, 92, 0.15);
  color: var(--danger);
  border: 1px solid rgba(224, 92, 92, 0.25);
}

.btn-danger:hover {
  background: rgba(224, 92, 92, 0.25);
}

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

.btn-secondary:hover {
  background: var(--border);
}

.btn-warning {
  background: rgba(200, 137, 58, 0.15);
  color: var(--primary);
  border: 1px solid rgba(200, 137, 58, 0.25);
}

.btn-warning:hover {
  background: rgba(200, 137, 58, 0.25);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12.5px;
}

input,
select {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  width: 100%;
  margin-bottom: 14px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-2);
  color: var(--text);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 137, 58, 0.15);
}

input::placeholder {
  color: var(--text-muted);
}

label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

input[type="file"] {
  padding: 8px;
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 14px;
}

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

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}

.alert-error {
  background: rgba(224, 92, 92, 0.12);
  color: #f87171;
  border: 1px solid rgba(224, 92, 92, 0.2);
}

.alert-success {
  background: rgba(200, 137, 58, 0.12);
  color: var(--primary);
  border: 1px solid rgba(200, 137, 58, 0.2);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-card .label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

.badge {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-ok {
  background: rgba(200, 137, 58, 0.15);
  color: var(--primary);
}

.badge-low {
  background: rgba(224, 92, 92, 0.15);
  color: var(--danger);
}

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: fixed;
  inset: 0;
  background-image: url('https://images.unsplash.com/photo-1555939594-58d7cb561ad1?w=1400&auto=format&fit=crop&q=80');
  background-size: cover;
  background-position: center;
  z-index: 0;
}

.login-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.82) 0%, rgba(20, 12, 5, 0.75) 50%, rgba(0, 0, 0, 0.88) 100%);
}

.login-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
  z-index: 1;
}

.login-content {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 380px;
}

.login-badge {
  text-align: center;
  margin-bottom: 14px;
}

.login-badge span {
  display: inline-block;
  background: rgba(200, 137, 58, 0.18);
  border: 1px solid rgba(200, 137, 58, 0.4);
  color: #d4a96a;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}

.login-card {
  background: rgba(18, 12, 8, 0.65);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(200, 137, 58, 0.2);
  border-radius: 24px;
  padding: 36px 32px 32px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(200, 137, 58, 0.1) inset;
  text-align: center;
}

.login-icon {
  font-size: 46px;
  margin-bottom: 6px;
  line-height: 1;
}

.login-card h1 {
  color: #f0ebe4;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.login-card p {
  color: rgba(240, 235, 228, 0.45);
  font-size: 13.5px;
  margin-bottom: 26px;
}

.login-card input[type="password"] {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(200, 137, 58, 0.25);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 14.5px;
  text-align: center;
  letter-spacing: 0.15em;
}

.login-card input[type="password"]::placeholder {
  color: rgba(240, 235, 228, 0.3);
  letter-spacing: 0.02em;
}

.login-card input[type="password"]:focus {
  border-color: var(--primary);
  background: rgba(200, 137, 58, 0.08);
  outline: none;
  box-shadow: 0 0 0 3px rgba(200, 137, 58, 0.2);
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #1a1008;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 16px rgba(200, 137, 58, 0.45);
}

.btn-login:hover {
  background: #d99840;
  box-shadow: 0 6px 20px rgba(200, 137, 58, 0.55);
}

.btn-login:active {
  transform: scale(0.98);
}

.login-error {
  background: rgba(224, 92, 92, 0.15);
  border: 1px solid rgba(224, 92, 92, 0.3);
  color: #f87171;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.photo-credit {
  position: fixed;
  bottom: 14px;
  right: 16px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 10.5px;
  z-index: 10;
}

@media (max-width: 420px) {
  .login-card {
    padding: 28px 22px 24px;
    border-radius: 20px;
  }
}

/* ===== KASIR PAGE ===== */
.kasir-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  align-items: start;
  width: 100%;
}

.kasir-menu-col {
  min-width: 0;
}

.kasir-cart-col {
  min-width: 0;
}

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

.menu-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: 0.15s;
  overflow: hidden;
}

.menu-item:active {
  transform: scale(0.97);
}

.menu-item:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 137, 58, 0.12);
}

.menu-item-img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  background: var(--bg-2);
}

.menu-item-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--text-muted);
}

.menu-item-body {
  padding: 10px 12px 12px;
}

.menu-item .nama {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 4px;
  line-height: 1.25;
  color: var(--text);
}

.menu-item .harga {
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
}

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

.cart-row .nama {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.cart-row .sub {
  font-size: 12px;
  color: var(--text-muted);
}

.cart-empty {
  color: var(--text-muted);
  font-size: 13.5px;
}

.cart-total-row {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
}

.cart-kembali-row {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: -6px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.qty-btn:active {
  background: var(--border);
}

.qty-value {
  min-width: 18px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
}

.cart-panel {
  position: sticky;
  top: 16px;
}

.cart-panel-header {
  display: none;
}

.no-desktop {
  display: none;
}

@media (max-width: 900px) {
  .kasir-grid {
    display: block;
  }

  .kasir-cart-col {
    width: 100%;
  }

  .cart-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 18px 18px 0 0;
    z-index: 90;
    margin: 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.7);
    padding: 0;
    max-height: 50px;
    overflow: hidden;
    transition: max-height 0.25s ease;
    border-top: 1px solid rgba(200, 137, 58, 0.2);
  }

  .cart-panel.cart-expanded {
    max-height: 75vh;
    overflow-y: auto;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .no-desktop {
    display: block;
  }

  .cart-panel-header {
    display: block;
    cursor: pointer;
    padding: 10px 18px 12px;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .cart-panel-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin: 0 auto 8px;
  }

  .cart-panel-summary-label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
  }

  .cart-chevron {
    font-size: 11px;
    color: var(--text-muted);
  }

  .cart-panel-body {
    padding: 0 20px 4px;
  }

  .cart-title-desktop {
    display: none;
  }

  .main-content {
    padding-bottom: 90px;
  }

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

  .menu-item-img,
  .menu-item-img-placeholder {
    height: 72px;
  }
}

/* ===== MENU IMAGES ===== */
.thumb-img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.thumb-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid var(--border);
}

.preview-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.section-gap {
  margin-top: 18px;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* ===== METODE BAYAR TOGGLE ===== */
.metode-toggle {
  display: flex;
  gap: 8px;
}

.metode-btn {
  flex: 1;
  padding: 9px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.metode-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.metode-btn.active {
  background: var(--primary);
  color: #1a1008;
  border-color: var(--primary);
}

/* ===== QRIS UPLOAD AREA ===== */
.qris-btn-group {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-qris-cam {
  flex: 2;
  padding: 14px 10px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-qris-cam:active {
  transform: scale(0.97);
}

.btn-qris-gal {
  flex: 1;
  padding: 14px 10px;
  border-radius: 12px;
  background: var(--surface-2, var(--bg));
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.btn-qris-gal:hover {
  border-color: var(--primary);
  color: var(--text);
}

/* ===== BADGE METODE ===== */
.badge-cash {
  background: rgba(200, 137, 58, 0.15);
  color: var(--primary);
}

.badge-qris {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}

/* ===== LOADING OVERLAY SPINNER ===== */
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== BADGE STOK BAHAN ===== */
.badge-stok {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.badge-stok-aman {
  background: rgba(200, 137, 58, 0.15);
  color: var(--primary);
}

.badge-stok-menipis {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.badge-stok-habis {
  background: rgba(224, 92, 92, 0.12);
  color: var(--danger);
}

/* ===== RIWAYAT TOOLBAR ===== */
.riwayat-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.riwayat-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.filter-field label {
  margin-bottom: 0;
  font-size: 11px;
}

.filter-field input {
  margin-bottom: 0;
  padding: 7px 10px;
  font-size: 13px;
}

@media (max-width:600px) {
  .riwayat-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .riwayat-filter {
    flex-direction: column;
  }

  .filter-field {
    min-width: 0;
    width: 100%;
  }
}

/* ===== STAT CARD METODE ===== */
.stat-card-cash {
  border-color: rgba(200, 137, 58, 0.3);
}

.stat-card-qris {
  border-color: rgba(52, 211, 153, 0.3);
}

.stat-cash {
  color: var(--primary);
}

.stat-qris {
  color: #34d399;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.text-right {
  text-align: right;
}