@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;800&display=swap');

:root {
  --primary: #0f766e;
  --primary-dark: #0b5c56;
  --primary-light: #14b8a6;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --danger: #dc2626;
  --success: #15803d;
  --bg: #fdf8ee;
  --card: #ffffff;
  --text: #262421;
  --muted: #756f63;
  --border: #ecdfc4;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(120, 90, 30, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, -apple-system, Helvetica, Arial, sans-serif;
  background: #efe6cf;
  color: var(--text);
  font-size: 16px;
}

.app-shell {
  max-width: 460px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 50px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
}

/* ===== Login ===== */
.login-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px 26px;
  text-align: center;
  background: linear-gradient(180deg, #fffaf0 0%, var(--bg) 60%);
}
.login-logo {
  font-size: 56px;
  margin-bottom: 10px;
  width: 96px; height: 96px;
  line-height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  margin-left: auto; margin-right: auto;
  box-shadow: var(--shadow);
}
.login-title { font-size: 24px; margin: 4px 0 4px; color: var(--primary-dark); font-weight: 800; }
.login-subtitle { color: var(--muted); margin: 0 0 26px; font-size: 15px; }
.login-form { text-align: left; display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: 14px; font-weight: 700; margin-top: 12px; color: var(--text); }
.login-form input[type=text],
.login-form input[type=password] {
  padding: 15px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 17px;
  background: #fff;
}
.login-form input:focus { outline: none; border-color: var(--primary-light); }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 15px; }
.checkbox-row input { width: 20px; height: 20px; accent-color: var(--primary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 18px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 22px; }
.btn-primary { background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: #fff; box-shadow: 0 6px 16px rgba(15,118,110,.28); }
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text); border: 2px solid var(--border); }
.btn-accent { background: linear-gradient(135deg, #fbbf24, var(--accent)); color: #4a2e00; box-shadow: 0 6px 16px rgba(245,158,11,.3); }
.btn-danger { background: #fff; color: var(--danger); border: 2px solid #f3c9c9; }
.btn-large { padding: 20px; font-size: 18px; }
.btn-small { padding: 9px 12px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; gap: 12px; padding: 18px 16px; }
.btn-row .btn { flex: 1; }

/* ===== Tombol bawah tetap diam (fixed), hanya konten yang discroll ===== */
.btn-row-fixed {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  background: var(--bg);
  border-top: 2px solid var(--border);
  box-shadow: 0 -6px 20px rgba(120,90,30,.10);
  z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}
.btn-row-fixed .btn-line { display: flex; gap: 10px; }
.btn-row-fixed .btn-line + .btn-line { margin-top: 10px; }
.btn-row-fixed .btn-line .btn { flex: 1; margin-top: 0; }

/* Padding bawah konten supaya tidak tertutup tombol fixed.
   -sm: 1 baris tombol, -md: 2 baris, -lg: 3 baris (mis. nota dengan banyak barang) */
.content-scroll-pad { padding-bottom: 100px; }
.content-scroll-pad-md { padding-bottom: 150px; }
.content-scroll-pad-lg { padding-bottom: 200px; }

/* ===== Header ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .greeting { font-weight: 800; font-size: 17px; }
.topbar .greeting small { display:block; font-weight: 500; font-size: 12px; opacity: .85; }
.topbar .top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topbar .btn-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}
.topbar .btn-switch {
  background: var(--accent);
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: #4a2e00;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}
.topbar .btn-settings {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

/* ===== Content ===== */
.content { flex: 1; padding: 18px; }
.field-label { font-size: 15px; font-weight: 700; margin: 20px 0 8px; color: var(--primary-dark); }
.fixed-field {
  padding: 14px 16px;
  background: #f4ecd6;
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  border: 1px dashed var(--border);
}
.search-input {
  width: 100%;
  padding: 15px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 17px;
  background: #fff;
}
.search-input:focus { outline: none; border-color: var(--primary-light); }
.suggest-list {
  margin-top: 8px;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.suggest-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  cursor: pointer;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item.recent { background: #e6f5f0; font-weight: 700; }
.suggest-item.recent::after { content: " • Terakhir dipakai"; font-size: 11px; color: var(--primary); font-weight: 500; }
.suggest-item.ongkir { background: #fff4e0; font-weight: 700; color: var(--accent-dark); }
.suggest-item:active { background: #f0f0f0; }

input[type=number] {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 22px;
  text-align: center;
  background: #fff;
}
input[type=number]:focus { outline: none; border-color: var(--primary-light); }
select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 17px;
  background: #fff;
}

.field-hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ===== Nota ===== */
.nota-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 26px 22px;
  margin: 16px;
  border: 2px dashed var(--border);
  box-shadow: var(--shadow);
  text-align: center;
}
.nota-brand {
  font-family: 'Cinzel', 'Segoe UI', serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: .04em;
  color: var(--primary-dark);
  margin: 0;
}
.nota-belanja-di {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin: 10px 0 2px;
}
.nota-tempat {
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 14px;
}
.nota-meta {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nota-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
.nota-table th { background: #f4ecd6; text-align: left; padding: 8px 6px; }
.nota-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #eee; }
.nota-total { display: flex; justify-content: space-between; font-weight: 800; margin-top: 14px; font-size: 18px; color: var(--primary-dark); border-top: 2px solid var(--border); padding-top: 10px; }

.alert { padding: 12px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 12px; font-weight: 600; border: 1px solid transparent; }
.alert-error { background: #fdecea; color: var(--danger); border-color: #f3c9c9; }
.alert-info { background: #e6f5f0; color: var(--primary-dark); border-color: #cdeee4; }
.alert-warning { background: #fff4e0; color: var(--accent-dark); border-color: #ffe2ab; }

/* Riwayat */
.riwayat-item {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.riwayat-item .tempat { font-weight: 800; color: var(--primary-dark); }
.riwayat-item .meta { color: var(--muted); font-size: 13px; margin: 2px 0; }
.riwayat-item .lihat { color: var(--primary); font-size: 13px; font-weight: 700; }
.riwayat-item .by-user { display:inline-block; background:#f4ecd6; color:var(--accent-dark); font-size:11px; font-weight:700; padding:2px 8px; border-radius: 20px; margin-top:4px; }

/* Pembatas hari di daftar Riwayat: "Senin, 07 Agustus 2026" */
.riwayat-date-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.riwayat-date-sep::before, .riwayat-date-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.riwayat-habis {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 18px 0 6px;
}

.filter-tabs { display: flex; gap: 8px; padding: 0 16px 12px; }
.filter-tabs a { flex:1; text-align:center; padding: 10px; border-radius: 10px; font-size: 13px; font-weight: 700; text-decoration:none; border: 2px solid var(--border); color: var(--text); background:#fff; }
.filter-tabs a.active { background: var(--primary); color:#fff; border-color: var(--primary); }

/* ===== Tabel Harga Satuan ===== */
.harga-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.harga-table thead th { background: #f4ecd6; text-align: left; padding: 12px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--primary-dark); }
.harga-table tbody td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.harga-table tbody tr:last-child td { border-bottom: none; }

/* ===== Menu Pengaturan (list tombol) ===== */
.pengaturan-list { display: flex; flex-direction: column; gap: 10px; }
.pengaturan-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px; border-radius: 12px; background: #fff; border: 1px solid var(--border);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.pengaturan-item .lbl { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 15px; }
.pengaturan-item .lbl .ic { font-size: 20px; }
.pengaturan-item .chev { color: var(--muted); font-size: 18px; }

/* ===== Preset grid (harga periodik) ===== */
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.preset-grid .btn { margin-top: 0; }

/* ===== Popup konfirmasi (mobile) ===== */
.mobile-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(30, 22, 8, 0.55);
  z-index: 100; align-items: center; justify-content: center; padding: 20px;
}
.mobile-modal-overlay.open { display: flex; }
.mobile-modal-box {
  background: #fff; border-radius: var(--radius); padding: 22px 20px;
  width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.mobile-modal-box h3 { margin: 0 0 6px; font-size: 17px; color: var(--primary-dark); }
.mobile-modal-box p { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.mobile-modal-box .modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.mobile-modal-box .modal-actions .btn { flex: 1; margin-top: 0; }
