:root {
  --primary: #5c4033;
  --primary-dark: #463126;
  --accent: #b08d57;
  --accent-light: #d4b483;
  --bg: #f7f1ea;
  --card-bg: #fffdfa;
  --text: #33302d;
  --muted: #8a8078;
  --border: #e5dacd;
  --danger: #b3382c;
  --success: #2f7a4a;
  --warning: #96690a;
  --info: #2a6f97;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(92, 64, 51, 0.08);
  --shadow-lg: 0 8px 30px rgba(92, 64, 51, 0.14);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

h1, h2, h3, .brand-text, .login-title {
  font-family: "Playfair Display", Georgia, serif;
  letter-spacing: 0.01em;
}

/* ===== Navbar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--primary);
  color: #f5ede3;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #f5ede3;
  text-decoration: none;
  min-width: 0;
}

.brand-icon { font-size: 1.35rem; }

.brand-text {
  font-size: 1.15rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text em {
  font-style: italic;
  color: var(--accent-light);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.nav-user {
  color: #d9c9b8;
  font-size: 0.9rem;
  max-width: 9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  border: 1px solid var(--accent-light);
  border-radius: 999px;
  color: #f5ede3;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

.nav-btn:hover, .nav-btn:active {
  background: var(--accent-light);
  color: var(--primary-dark);
}

/* ===== Layout ===== */
.container {
  flex: 1;
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.footer {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}
.footer p { margin: 0; }

.footer-credit {
  margin-top: 0.25rem !important;
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* ===== Alerts ===== */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid transparent;
  font-size: 0.95rem;
}
.alert-danger  { background: #fdecea; color: var(--danger);  border-color: #f2c4bd; }
.alert-success { background: #e9f5ee; color: var(--success); border-color: #bfe3cc; }
.alert-warning { background: #fbf3dd; color: var(--warning); border-color: #ecd9a4; }
.alert-info    { background: #e8f1f8; color: var(--info);    border-color: #bcd8ec; }

/* ===== Login ===== */
.login-wrap {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  padding: 2.25rem 1.75rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-emblem {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.login-title {
  margin: 0 0 0.25rem;
  font-size: 1.7rem;
  color: var(--primary);
}

.login-title em { color: var(--accent); }

.subtitle {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.login-card form { text-align: left; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.1rem; }

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--primary-dark);
}

.form-control {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 141, 87, 0.2);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
}

.form-check label { margin: 0; font-weight: 500; color: var(--text); }

.field-error {
  display: block;
  margin-top: 0.3rem;
  color: var(--danger);
  font-size: 0.85rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #f5ede3;
  box-shadow: var(--shadow);
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-block { width: 100%; }

/* ===== Page head ===== */
.page-head { margin-bottom: 1.25rem; }
.page-head h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--primary);
}
.page-sub { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }

/* ===== Menu beranda ===== */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.menu-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.menu-card:hover, .menu-card:active {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.menu-icon {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  border-radius: 14px;
}

.menu-body { flex: 1; min-width: 0; }
.menu-body h3 { margin: 0 0 0.15rem; font-size: 1.15rem; color: var(--primary); }
.menu-body p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.menu-arrow {
  font-size: 1.6rem;
  color: var(--accent);
  line-height: 1;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}
.back-link:hover { color: var(--primary); }

/* ===== Passkey ===== */
.pemisah {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.pemisah::before, .pemisah::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

.passkey-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border: 1px dashed var(--accent-light);
  border-radius: var(--radius);
}
.passkey-info { flex: 1; min-width: 200px; }
.passkey-info h3 { margin: 0 0 0.2rem; font-size: 1rem; color: var(--primary); }
.passkey-info p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.passkey-card .btn { width: auto; }

/* ===== Produk ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.9rem;
}

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.product-media { aspect-ratio: 1; background: #efe6da; }

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  opacity: 0.45;
}

.product-body { padding: 0.8rem 0.9rem 1rem; }

.product-body h3 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.price {
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-stock { background: #e9f5ee; color: var(--success); }
.tag-terjual { background: #e9f5ee; color: var(--success); }

.btn-terjual {
  background: var(--success);
  color: #fff;
  border: 1.5px solid var(--success);
}
.btn-terjual:hover { background: #256339; }

/* ===== Modal ===== */
.modal {
  border: none;
  border-radius: calc(var(--radius) + 4px);
  padding: 1.75rem 1.5rem;
  width: min(92vw, 420px);
  box-shadow: var(--shadow-lg);
  background: var(--card-bg);
  color: var(--text);
}
.modal::backdrop { background: rgba(51, 48, 45, 0.55); }
.modal-title {
  margin: 0 0 0.2rem;
  font-size: 1.4rem;
  color: var(--primary);
}
.modal-sub { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.95rem; }

.modal-qr { text-align: center; }
.qr-gambar {
  width: min(70vw, 260px);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 auto 0.75rem;
  display: block;
}
.qr-url { margin: 0 0 1.25rem; font-size: 0.85rem; overflow-wrap: anywhere; }
.qr-url a { color: var(--accent); }

/* ===== Katalog publik ===== */
.product-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.product-card .item-tags { margin-top: 0.45rem; }
.katalog-head { text-align: center; }

/* ===== Detail publik ===== */
.tag-habis { background: #fdecea; color: var(--danger); }

.detail-wrap { display: flex; justify-content: center; }
.detail-card-wrap { width: 100%; max-width: 560px; }
.detail-card-wrap .back-link { margin-bottom: 0.6rem; }

.detail-card {
  width: 100%;
  max-width: 560px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.detail-media { aspect-ratio: 1; background: #efe6da; }
.detail-media img,
.detail-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-media video { background: #1c1c1c; object-fit: contain; }

/* ===== Galeri media ===== */
.galeri-thumbs {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  overflow-x: auto;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.galeri-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #efe6da;
}
.galeri-thumb.aktif { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.galeri-thumb img,
.galeri-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }

.media-tanda {
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 0.8rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* ===== Grid media di form edit ===== */
.media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.media-tile {
  position: relative;
  width: 96px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #efe6da;
}
.media-tile img,
.media-tile video {
  width: 100%;
  height: 96px;
  object-fit: cover;
  display: block;
}
.media-tile .media-tanda { bottom: 30px; }

.media-hapus {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.3rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--danger);
  background: var(--card-bg);
  cursor: pointer;
}
.media-hapus input { accent-color: var(--danger); }
.detail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  opacity: 0.4;
}

.detail-body { padding: 1.5rem 1.5rem 1.75rem; }
.detail-title { margin: 0 0 0.6rem; font-size: 1.6rem; color: var(--primary); }
.detail-harga {
  margin: 0.75rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.detail-footer {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.badge-empty { background: #fdecea; color: var(--danger); }

/* ===== Filter sidebar ===== */
.koleksi-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem 1rem;
}

.filter-summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
}

.filter-form { margin-top: 0.85rem; }

.filter-label {
  margin: 0 0 0.45rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary-dark);
}

.chip-group-kecil { margin-bottom: 1rem; gap: 0.4rem; }
.chip-group-kecil .chip-face { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

.filter-actions { display: flex; gap: 0.6rem; }
.filter-actions .btn { flex: 1; width: auto; text-align: center; }

@media (min-width: 900px) {
  .koleksi-layout { flex-direction: row; align-items: flex-start; }
  .filter-sidebar { width: 240px; flex-shrink: 0; position: sticky; top: 4.5rem; }
  .filter-summary { pointer-events: none; }
  .filter-summary::marker, .filter-summary::-webkit-details-marker { content: ""; display: none; }
  .koleksi-main { flex: 1; min-width: 0; }
}

/* ===== Daftar koleksi ===== */
.page-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.item-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.item-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.item-thumb {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #efe6da;
}

.item-thumb-rusak {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  opacity: 0.4;
}

.item-main { min-width: 0; flex: 1; }
.item-main h3 { margin: 0 0 0.4rem; font-size: 1.15rem; color: var(--primary); }

.item-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }

.tag {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #f0e7db;
  color: var(--primary-dark);
}

.item-detail { margin: 0; }
.item-detail > div { display: flex; gap: 0.5rem; font-size: 0.9rem; }
.item-detail dt { color: var(--muted); min-width: 6rem; flex-shrink: 0; }
.item-detail dt::after { content: ":"; }
.item-detail dd { margin: 0; overflow-wrap: anywhere; }
.item-detail a { color: var(--accent); }

.kode {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  background: #f0e7db;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  letter-spacing: 0.06em;
  color: var(--primary-dark);
}

/* Di HP: tombol aksi jadi baris penuh di bawah kartu */
.item-actions {
  display: flex;
  gap: 0.6rem;
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}
.item-actions form { margin: 0; flex: 1; }
.item-actions .btn-outline { flex: 1; }

.btn-small { padding: 0.5rem 1rem; font-size: 0.88rem; width: 100%; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--primary);
  text-align: center;
  text-decoration: none;
}
.btn-outline:hover { background: var(--accent-light); border-color: var(--accent-light); }

.btn-danger {
  background: transparent;
  border: 1.5px solid #dfc0bb;
  color: var(--danger);
}
.btn-danger:hover { background: #fdecea; border-color: var(--danger); }

/* ===== Form koleksi ===== */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow);
  max-width: 720px;
}

.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 1.25rem; }
.form-group-full { grid-column: 1 / -1; }

.form-file {
  display: block;
  width: 100%;
  padding: 0.55rem;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--muted);
}
.form-file::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.45rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--primary-dark);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.file-hint { margin: 0 0 0.4rem; font-size: 0.85rem; color: var(--muted); }

/* ===== Radio chip ===== */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.radio-chip input[type="radio"],
.radio-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.chip-face {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.radio-chip input:checked + .chip-face {
  border-color: var(--primary);
  background: #f0e7db;
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--primary);
}

.radio-chip input:focus-visible + .chip-face {
  box-shadow: 0 0 0 3px rgba(176, 141, 87, 0.35);
}

.chip-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.form-actions .btn { flex: 1; }

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.empty-state h2 { margin: 0 0 0.35rem; color: var(--primary); }
.empty-state p { margin: 0; }

/* ===== Tablet ke atas ===== */
@media (min-width: 600px) {
  .navbar { padding: 0.8rem 1.5rem; }
  .brand-text { font-size: 1.3rem; }
  .container { padding: 1.75rem 1.5rem 3rem; }
  .login-card { padding: 2.5rem 2.25rem; }
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.15rem;
  }
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-card { padding: 2rem; }
  .form-actions { justify-content: flex-start; }
  .form-actions .btn { flex: 0 0 auto; min-width: 10rem; }
  /* Di layar lebar: tombol aksi kembali ke kanan kartu */
  .item-card { flex-wrap: nowrap; justify-content: space-between; }
  .item-actions {
    width: auto;
    align-items: flex-start;
    border-top: none;
    padding-top: 0;
    flex-shrink: 0;
  }
  .item-actions form, .item-actions .btn-outline { flex: 0 0 auto; }
  .btn-small { width: auto; }
  .item-thumb { width: 86px; height: 86px; }
  .page-head h1 { font-size: 2.1rem; }
}
