:root {
  --primary: #5d371a;
  --accent: #d97706;
  --bg: #f7f1e8;
  --card: #ffffff;
  --text: #3a2a1a;
  --secondary: #8d7f61;
  --yellow: #e7b10a;
  --danger: #ef4444;
  --radius-card: 12px;
  --radius-panel: 16px;
  --radius-pill: 999px;
  --shadow: 0 4px 14px rgba(93, 55, 26, 0.08);
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  background: #e9dfce;
  color: var(--text);
}

/* Shell mobile app */
.app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(93, 55, 26, 0.18);
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--primary), #7a4a24);
  color: #fff;
  padding: 16px 16px 14px;
  border-radius: 0 0 20px 20px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ico {
  width: 22px;
  height: 22px;
  display: block;
}

.brand-logo {
  background: rgba(255, 255, 255, 0.14);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
}

.brand-logo .ico {
  width: 26px;
  height: 26px;
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.brand-text p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 400;
}

.icon-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn .ico {
  width: 22px;
  height: 22px;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
  display: flex;
  align-items: center;
}

.search-icon .ico {
  width: 16px;
  height: 16px;
}

#search-input {
  width: 100%;
  border: none;
  border-radius: var(--radius-pill);
  padding: 11px 16px 11px 38px;
  font-family: inherit;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  outline: none;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Konten */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 90px;
}

/* Tab kategori */
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.cat-tab {
  flex-shrink: 0;
  border: none;
  background: var(--card);
  color: var(--secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.15s ease;
}

.cat-tab.active {
  background: var(--primary);
  color: #fff;
}

/* Grid produk */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 12px;
  box-shadow: var(--shadow);
  border: none;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.1s ease;
  font-family: inherit;
}

.product-card:active {
  transform: scale(0.97);
}

.prod-emoji {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
}

.prod-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prod-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.prod-cat {
  font-size: 11px;
  color: var(--secondary);
  font-weight: 700;
}

.prod-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.prod-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.prod-add {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.empty-note {
  text-align: center;
  color: var(--secondary);
  padding: 40px 0;
  font-weight: 700;
}

/* Bottom bar */
.bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid #eee2d2;
  box-shadow: 0 -4px 14px rgba(93, 55, 26, 0.06);
  flex-shrink: 0;
}

.bottom-item {
  position: relative;
  background: none;
  border: none;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--secondary);
  padding: 4px 16px;
}

.bottom-item.active {
  color: var(--accent);
}

.bi-ico {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bi-ico .ico {
  width: 24px;
  height: 24px;
}

.bi-label {
  font-size: 11px;
  font-weight: 700;
}

.bottom-badge {
  position: absolute;
  top: 0;
  right: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== View Keranjang ===== */
.cart-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-panel h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-item {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-item-emoji {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cart-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.cart-item-price {
  font-size: 12px;
  color: var(--secondary);
  font-weight: 700;
}

.cart-item-subtotal {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
}

.cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--primary);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.qty-btn.minus {
  background: #fbe9d7;
  color: var(--accent);
}

.qty-btn.plus {
  background: var(--accent);
  color: #fff;
}

.qty-btn:active {
  transform: scale(0.9);
}

.cart-qty {
  font-size: 15px;
  font-weight: 800;
  min-width: 20px;
  text-align: center;
}

.cart-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--danger);
  padding: 2px;
  line-height: 1;
}

/* Subtotal / ringkasan */
.cart-summary {
  background: var(--card);
  border-radius: var(--radius-panel);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.cart-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--secondary);
  font-weight: 700;
}

.cart-summary-row.total {
  border-top: 1px dashed #e5d9c4;
  padding-top: 10px;
  font-size: 17px;
  color: var(--text);
}

.cart-summary-row.total .val {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}

.cart-checkout {
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  padding: 13px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.cart-checkout:active {
  transform: scale(0.98);
}

/* Keranjang kosong */
.cart-empty {
  background: var(--card);
  border-radius: var(--radius-panel);
  padding: 40px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.cart-empty-ico {
  font-size: 52px;
}

.cart-empty-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.cart-empty-desc {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 700;
}

.cart-empty-btn {
  margin-top: 6px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  padding: 11px 22px;
  cursor: pointer;
}

/* Scrollbar halus */
.app-content::-webkit-scrollbar {
  width: 0;
}

/* ===== View Pembayaran ===== */
.back-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
  cursor: pointer;
  padding: 0;
  align-self: flex-start;
  margin-bottom: 4px;
}

.pay-panel h2,
.riwayat-panel h2,
.detail-panel h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}

.pay-total-card {
  background: linear-gradient(135deg, var(--primary), #7a4a24);
  color: #fff;
  border-radius: var(--radius-panel);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.pay-total-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 700;
}

.pay-total-val {
  font-size: 30px;
  font-weight: 800;
  color: var(--yellow);
}

.pay-total-items {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

.pay-form {
  background: var(--card);
  border-radius: var(--radius-panel);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pay-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.pay-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: var(--radius-card);
  padding: 0 14px;
  border: 2px solid transparent;
}

.pay-input-wrap:focus-within {
  border-color: var(--accent);
}

.pay-prefix {
  font-size: 16px;
  font-weight: 800;
  color: var(--secondary);
  margin-right: 8px;
}

.pay-input {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  padding: 12px 0;
  outline: none;
}

.pay-kembalian {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fdf6ec;
  border-radius: var(--radius-card);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.pay-kembalian-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}

.pay-kembalian-val.kurang {
  color: var(--danger);
}

.pay-warning {
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
  background: #fdecec;
  border-radius: var(--radius-card);
  padding: 10px 12px;
}

.pay-form .cart-checkout:disabled {
  background: #d8cbb6;
  cursor: not-allowed;
}

/* ===== Layar Sukses ===== */
.sukses-card {
  background: var(--card);
  border-radius: var(--radius-panel);
  padding: 32px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  margin-top: 30px;
}

.sukses-ico {
  font-size: 56px;
}

.sukses-card h2 {
  font-size: 21px;
  font-weight: 800;
  color: var(--primary);
}

.sukses-desc {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 700;
}

.sukses-info,
.detail-summary {
  width: 100%;
  background: var(--bg);
  border-radius: var(--radius-card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.sukses-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.sukses-row.total {
  border-top: 1px dashed #e5d9c4;
  padding-top: 8px;
  font-size: 16px;
}

.sukses-row.total span:last-child {
  font-weight: 800;
  color: var(--accent);
}

.sukses-card .cart-checkout {
  width: 100%;
  margin-top: 8px;
}

.sukses-secondary {
  width: 100%;
  border: 2px solid var(--primary);
  border-radius: var(--radius-pill);
  background: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  padding: 12px;
  cursor: pointer;
}

/* ===== View Riwayat ===== */
.riwayat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.riwayat-head h2 {
  margin-bottom: 0;
}

.riwayat-clear {
  border: none;
  background: none;
  color: var(--danger);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.riwayat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.riwayat-item {
  background: var(--card);
  border: none;
  border-radius: var(--radius-card);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
}

.riwayat-item:active {
  transform: scale(0.98);
}

.riwayat-item-ico {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.riwayat-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.riwayat-item-time {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.riwayat-item-meta {
  font-size: 12px;
  color: var(--secondary);
  font-weight: 700;
}

.riwayat-item-total {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
}

.riwayat-item-arrow {
  font-size: 20px;
  color: var(--secondary);
  font-weight: 800;
}

/* ===== Detail Riwayat ===== */
.detail-time {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 700;
  margin-bottom: 12px;
}

.detail-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-item {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-item-emoji {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.detail-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.detail-item-qty {
  font-size: 12px;
  color: var(--secondary);
  font-weight: 700;
}

.detail-item-sub {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
}

.detail-summary {
  margin-top: 12px;
}
