/* Kiandra: aplikasi toko. Satu berkas, tanpa framework. */
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-display: swap; src: url(fonts/cormorant-garamond-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Mulish"; font-weight: 400; font-display: swap; src: url(fonts/mulish-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Mulish"; font-weight: 600; font-display: swap; src: url(fonts/mulish-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Mulish"; font-weight: 700; font-display: swap; src: url(fonts/mulish-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 700; font-display: swap; src: url(fonts/cormorant-garamond-latin-700-normal.woff2) format("woff2"); }

:root {
  --bg: #F6F2EA;
  --bg-soft: #F7EFE2;
  --card: #FFFDF9;
  --border: #E6DCCB;
  --primary: #4A1421;
  --primary-dark: #2A0A12;
  --gold-text: #4A1421;
  --tab: #F4E9EA;
  --tab-border: #E3C9CE;
  --text: #1D1B18;
  --muted: #5C544B;
  --accent: #8A6424;
  --gold-lt: #D8B56A;
  --ok-bg: #E9F3E6; --ok: #2F6A2B;
  --err-bg: #FBE9E5; --err: #9B2C1B;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 24, .05), 0 6px 18px rgba(29, 27, 24, .05);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Mulish", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: var(--gold-text); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font: 700 2rem/1.1 var(--serif); }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: .95rem; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.r { text-align: right; }
.center { text-align: center; }
.pre { white-space: pre-line; }
.link { color: var(--gold-text); cursor: pointer; font-weight: 600; }
[hidden] { display: none !important; }

/* ---------- Kerangka ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 8px max(16px, env(safe-area-inset-left)); background: var(--card);
  border-bottom: 3px solid var(--primary);
}
/* Identitas toko: disalin persis dari website lama (style.css lama baris 1179-1183). Jangan diubah. */
.brand { align-items: center; display: flex; gap: 11px; letter-spacing: 0; white-space: nowrap; }
.brand-logo-gold { display: block; flex: 0 0 auto; object-fit: contain; }
.brand-name { color: #151311; display: grid; font-family: Georgia, serif; font-size: 23px; font-weight: 500; letter-spacing: .09em; line-height: 1; }
.brand-name em { color: #936a27; font-family: Arial, sans-serif; font-size: 10px; font-style: normal; font-weight: 700; letter-spacing: .31em; margin-top: 7px; }
.brand-link { display: flex; align-items: center; min-height: 44px; text-decoration: none; }
/* Nama KIANDRA JEWELLERY selalu tampil di samping logo (permintaan pemilik). */
.auth-brand { display: flex; justify-content: center; margin-bottom: 14px; }
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav-link {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600; border: 1px solid transparent;
}
.topnav-link:hover { color: var(--text); background: var(--bg); }
.topnav-link.active { background: var(--primary); border-color: var(--primary); color: #FBF3E4; }
.menu summary { color: var(--primary); }
.topuser { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; border-radius: 12px; text-decoration: none; color: var(--text); }
.topuser:hover { background: var(--bg); }
.topuser-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--primary); color: #EBD9AE; border: 2px solid var(--gold-lt); font: 500 15px Georgia, serif; }
.topuser-avatar img { width: 100%; height: 100%; object-fit: cover; }
.topuser-name { display: flex; flex-direction: column; line-height: 1.2; font-weight: 700; font-size: .95rem; white-space: nowrap; }
.topuser-name small { font-weight: 400; font-size: .75rem; color: var(--muted); }
@media (max-width: 1100px) { .topuser-name { display: none; } }
.menu { position: relative; }
.menu summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; cursor: pointer; border: 1px solid var(--border); background: var(--card); }
.menu summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: 52px; width: min(300px, calc(100vw - 32px)); max-height: calc(100vh - 80px); overflow: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px;
}
.menu-user { display: flex; flex-direction: column; padding: 8px 10px; margin: 0 0 4px; border-bottom: 1px solid var(--border); }
.menu-user span { font-size: .8rem; color: var(--muted); }
.menu-group { padding: 4px 0; border-bottom: 1px solid var(--border); }
.menu-group:last-child { border: 0; }
.menu-group-label { margin: 6px 10px 2px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.menu-group a, .menu-button {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 10px; border-radius: 10px;
  color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.menu-group a:hover, .menu-button:hover { background: var(--bg); }
.menu-button.danger { color: var(--err); }
.main { max-width: 1240px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-left)) 64px; }
.bare-main { max-width: 1100px; }

@media (max-width: 860px) {
  /* backdrop-filter membuat elemen fixed di dalamnya ikut bilah atas, jadi dimatikan di HP. */
  .topbar { padding-bottom: 8px; }

  .topnav {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0; justify-content: space-around; gap: 0;
    background: var(--card); border-top: 1px solid var(--border); padding: 6px 4px max(6px, env(safe-area-inset-bottom));
  }
  .topnav-link { flex-direction: column; gap: 2px; padding: 4px 6px; font-size: .7rem; border-radius: 12px; min-width: 64px; }
  .topnav-link.active { background: var(--tab); border-color: transparent; color: var(--primary); }
  .menu { margin-left: auto; }
  .main { padding-bottom: 96px; }
  h1 { font-size: 1.7rem; }
}

/* ---------- Komponen ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head p { margin: 0; max-width: 70ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.eyebrow { margin: 0 0 4px; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.section-title { font: 700 1.4rem var(--serif); margin: 20px 0 10px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-focus { border-color: var(--tab-border); box-shadow: 0 0 0 3px rgba(241, 228, 196, .7), var(--shadow); }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > .card { margin-bottom: 0; }
.order-first { order: -1; }
.grid-2, .grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.grid-2-cards > .card { margin-bottom: 0; }
.grid-2-cards + * { margin-top: 16px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions form { display: contents; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text);
  font: 600 .95rem var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.btn-large { min-height: 54px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.grow { flex: 1 1 260px; }
.field-label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.req { color: var(--err); }
.field-hint { font-size: .78rem; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); font: 16px var(--sans);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[readonly] { background: var(--bg-soft); }
input[type="file"] { padding: 8px; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.input-small { width: 90px; }
.input-medium { width: 150px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form .field { flex: 1 1 180px; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.qr-input { display: flex; gap: 6px; }
.qr-input input { text-transform: uppercase; font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; }
.choice { border: 0; padding: 0; margin: 0; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.choice-item { flex: 1 1 140px; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; }
.choice-item:has(input:checked) { background: var(--tab); border-color: var(--tab-border); }
.choice-item small { display: block; color: var(--muted); font-size: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: .85rem; }
.chip.active { background: var(--tab); border-color: var(--tab-border); color: var(--gold-text); font-weight: 600; }
.chip-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--muted); text-decoration: none; font-weight: 600; }
.tab.active { background: var(--tab); border-color: var(--tab-border); color: var(--gold-text); }

.flashes { margin-bottom: 12px; }
.flash { margin: 0 0 8px; padding: 12px 14px; border-radius: 12px; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); }
.note { padding: 10px 14px; border-radius: 12px; background: var(--bg-soft); border: 1px dashed var(--tab-border); }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge-available, .badge-completed, .badge-verified, .badge-accepted { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-sold, .badge-submitted, .badge-in_progress, .badge-pending { background: var(--tab); color: var(--gold-text); border-color: var(--tab-border); }
.badge-void, .badge-melted, .badge-needs_rebuild, .badge-cancelled, .badge-rejected { background: var(--err-bg); color: var(--err); border-color: transparent; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { margin: 0; font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-value { margin: 2px 0 0; font: 700 1.6rem/1.2 var(--serif); color: var(--gold-text); font-variant-numeric: tabular-nums; }
.stat-hint { margin: 2px 0 0; font-size: .78rem; color: var(--muted); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
tfoot td { font-weight: 700; border-bottom: 0; }
tr.total td, .total { font-weight: 700; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts.big { font-size: 1.05rem; }
.facts.cols { grid-template-columns: repeat(auto-fit, minmax(120px, max-content) minmax(140px, 1fr)); }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0 0 8px; }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .total { font-size: 1.35rem; font-family: var(--serif); color: var(--gold-text); padding-top: 8px; border-top: 1px solid var(--border); }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.inactive { opacity: .6; }
.list-main { flex: 1 1 260px; min-width: 0; }
.list-main p { margin: 2px 0 0; }
.list-extra { flex-basis: 100%; }
.list-extra[open] { padding: 12px; background: var(--bg-soft); border-radius: 12px; }
.list-extra summary { margin-bottom: 8px; }
.timeline { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Barang & katalog ---------- */
.product-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.product-card { position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); }
.product-card:hover { border-color: var(--accent); }
.product-card img, .product-card .img-placeholder { aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--bg-soft); }
.product-meta { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.product-name { font-weight: 600; line-height: 1.3; }
.price { font-weight: 700; color: var(--gold-text); font-variant-numeric: tabular-nums; }
.ribbon { position: absolute; top: 8px; left: 8px; background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.img-placeholder { display: grid; place-items: center; background: var(--bg-soft); }
.img-placeholder img { opacity: .5; width: 40px; height: 40px; }
.category-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.category-tile { display: flex; flex-direction: column; justify-content: center; min-height: 72px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); text-decoration: none; }
.category-tile strong { font: 700 1.2rem var(--serif); color: var(--gold-text); }
.flyer-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.flyer { display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; }
.flyer a { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.flyer img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.flyer-full { width: 100%; border-radius: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; padding: 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.filters .field { flex: 1 1 150px; }
.catalog { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.detail-panel { position: sticky; top: 76px; }
.detail-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; margin-bottom: 10px; }
@media (max-width: 900px) { .catalog { grid-template-columns: 1fr; } .detail-panel { position: static; } }
.detail-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .detail-layout { grid-template-columns: 1fr; } }
.gallery { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
.gallery figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.gallery figure:first-child { grid-column: 1 / -1; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); cursor: zoom-in; }
.form-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); align-items: start; }
.form-grid > .card { margin-bottom: 0; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }
.photo-preview, .existing-photos { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); margin: 10px 0; }
.photo-preview figure { margin: 0; position: relative; }
.photo-preview img, .existing-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.photo-preview figcaption { font-size: .7rem; color: var(--muted); }
.existing-photo { position: relative; padding: 0; border: 0; background: none; cursor: pointer; }
.existing-photo span { position: absolute; bottom: 4px; left: 4px; background: rgba(29,27,24,.7); color: #fff; font-size: .7rem; padding: 1px 6px; border-radius: 6px; }
.live-price { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--bg-soft); }
.live-price p { margin: 0; }
.customer-view { max-width: 720px; margin: 0 auto; text-align: center; }
.customer-view .gallery { margin: 16px 0; }
.customer-view .facts { text-align: left; max-width: 420px; margin: 0 auto 12px; }
.avatar { border-radius: 50%; object-fit: cover; }

/* ---------- Transaksi ---------- */
.sale-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); align-items: start; margin-bottom: 16px; }
.sale-layout > .card { margin-bottom: 0; }
.pay-card { position: sticky; top: 76px; }
@media (max-width: 900px) { .sale-layout { grid-template-columns: 1fr; } .pay-card { position: static; } }
.cart { list-style: none; margin: 12px 0 0; padding: 0; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-img, .customer-box .cart-img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; flex: none; }
.cart-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.customer-box { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.discounts { margin: 8px 0 12px; }
.discounts summary { min-height: 44px; display: flex; align-items: center; }
dialog { border: 1px solid var(--border); border-radius: 18px; padding: 22px; max-width: min(520px, calc(100vw - 32px)); background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(29, 27, 24, .45); }
.ref5 { font: 600 1.4rem ui-monospace, Consolas, monospace; letter-spacing: 0.3em; }
.big-total { font: 700 2.4rem var(--serif); color: var(--gold-text); margin: 8px 0; font-variant-numeric: tabular-nums; }
.scanner-dialog { width: min(520px, calc(100vw - 24px)); }
.scanner-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.scanner-view { width: 100%; min-height: 260px; background: #111; border-radius: 12px; overflow: hidden; }
.file-btn { margin-top: 8px; }
.editor-dialog { width: min(720px, calc(100vw - 24px)); max-width: none; }
.editor-canvas { width: 100%; aspect-ratio: 1; border-radius: 12px; background: #eee; touch-action: none; cursor: grab; }
.editor-controls { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 10px 0; }
.editor-controls input[type="range"] { min-height: 32px; padding: 0; accent-color: var(--primary); }
.lightbox { width: min(960px, calc(100vw - 16px)); max-width: none; padding: 10px; background: #111; }
.lightbox img { width: 100%; max-height: 80vh; object-fit: contain; }

/* ---------- Laporan ---------- */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row-line { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; padding: 8px; border-radius: 12px; background: var(--bg-soft); }
.row-out { margin: 0; display: flex; flex-direction: column; }
.perf { display: flex; flex-direction: column; gap: 8px; }
.perf-row { display: grid; gap: 10px; grid-template-columns: minmax(140px, 1fr) 2fr minmax(160px, auto); align-items: center; }
.perf-bar { height: 10px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.perf-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
@media (max-width: 640px) { .perf-row { grid-template-columns: 1fr; } }
.emp-charts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.emp-chart p { margin: 0 0 6px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.bar-group { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.bar { width: 40%; max-width: 14px; border-radius: 4px 4px 0 0; }
.bar-sales, .dot-sales { background: var(--primary); }
.bar-buyback, .dot-buyback { background: #C9A86A; }
.dot-expenses { background: #9B2C1B; }
.bar-label { position: absolute; bottom: -18px; font-size: .65rem; color: var(--muted); }
.legend { display: flex; gap: 8px; align-items: center; margin: 8px 0 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.line-chart { width: 100%; height: auto; }
.line-chart .grid { stroke: var(--border); }
.line-chart .axis { font-size: 11px; fill: var(--muted); }
.line-sales { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.line-expenses { fill: none; stroke: #9B2C1B; stroke-width: 2; stroke-dasharray: 5 4; }

/* ---------- Dokumen & cetak ---------- */
.doc { max-width: 820px; margin: 0 auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.doc .row-actions { margin-bottom: 16px; }
.doc-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--accent); }
.doc-head.center { flex-direction: column; text-align: center; }
.doc-head h1 { font-size: 1.8rem; margin: 0; }
.doc-head p { margin: 0; }
.cert-body { display: grid; gap: 16px; grid-template-columns: 220px 1fr; align-items: start; }
.cert-img { width: 100%; border-radius: 12px; }
@media (max-width: 640px) { .cert-body { grid-template-columns: 1fr; } }
.daily-report { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.sheet { margin-top: 18px; break-inside: avoid; }
.sheet h2 { font: 700 1.2rem var(--serif); border-bottom: 1px solid var(--accent); padding-bottom: 4px; }
.sheet-cols { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .sheet-cols { grid-template-columns: 1fr; } }
.sheet-table { font-size: .78rem; }
.sheet-table caption { text-align: left; font-weight: 700; padding: 4px 0; }
.sheet-table td, .sheet-table th { padding: 3px 5px; }
.empty-row td { height: 22px; }
.label-page { max-width: 640px; margin: 0 auto; }
.label { display: flex; width: 76mm; height: 25mm; border: 1px dashed var(--muted); background: #fff; margin: 20px 0; }
.label-half { width: 38mm; height: 25mm; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 1mm; }
.label-qr svg { width: 22mm; height: 22mm; }
.label-text { font: 600 7pt Arial, sans-serif; gap: 1mm; text-align: center; border-left: 1px dashed #ccc; }
.label-text strong { font-size: 8pt; }

.auth { min-height: 90vh; display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); text-align: center; }
.auth-card form, .auth-card .steps, .auth-card details { text-align: left; }

.auth-foot { margin-top: 16px; font-size: .9rem; }
.qr-box { display: grid; place-items: center; margin: 12px 0; }
.qr-box svg { width: 220px; height: 220px; }
.secret { display: block; padding: 8px; background: var(--bg-soft); border-radius: 8px; word-break: break-all; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.codes code { display: block; padding: 6px; background: var(--bg-soft); border-radius: 8px; }
.steps { padding-left: 18px; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11px; }
  .topbar, .no-print, .flashes { display: none !important; }
  .main { padding: 0; max-width: none; }
  .card, .doc, .daily-report { border: 0; box-shadow: none; padding: 0; }
  .sheet { break-before: page; }
  .sheet:first-of-type { break-before: auto; }
  a { color: inherit; text-decoration: none; }
  .label { border: 0; margin: 0; }
}

/* Logo asli tidak persegi: jaga proporsinya. */
img[src*="logo-crest"] { height: auto; object-fit: contain; }
.label-preview { width: 148px; height: auto; border: 1px dashed var(--muted); background: #fff; image-rendering: pixelated; }

/* ---------- Editor Website ---------- */
.site-editor { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.se-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--border); }
.se-pages, .se-devices, .se-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.se-devices .active { background: var(--tab); border-color: var(--tab-border); color: var(--gold-text); }
.se-actions { margin-left: auto; }
.se-status { flex-basis: 100%; color: var(--muted); }
.se-body { flex: 1; display: grid; grid-template-columns: 240px minmax(0, 1fr) 300px; min-height: 0; }
.se-left, .se-right { overflow: auto; background: var(--card); border-right: 1px solid var(--border); padding: 10px; }
.se-right { border-right: 0; border-left: 1px solid var(--border); }
.se-title { font-weight: 700; font-size: .85rem; margin: 0 0 8px; color: var(--muted); }
.se-canvas { min-width: 0; min-height: 0; background: #e9e4da; }
.se-canvas #gjs { height: 100%; }
.se-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.se-tabs button { cursor: pointer; }
.se-hint { margin-top: 16px; }
@media (max-width: 1000px) { .se-body { grid-template-columns: 200px minmax(0, 1fr); } .se-right { position: fixed; right: 0; top: 110px; bottom: 0; width: 280px; z-index: 5; box-shadow: var(--shadow); } }
/* Warna GrapesJS disesuaikan dengan tema toko */
.site-editor .gjs-one-bg { background-color: var(--card); }
.site-editor .gjs-two-color { color: var(--text); }
.site-editor .gjs-three-bg { background-color: var(--primary); color: #fff; }
.site-editor .gjs-four-color, .site-editor .gjs-four-color-h:hover { color: var(--primary); }
.site-editor .gjs-block { width: calc(50% - 10px); min-height: 70px; padding: 8px; margin: 5px; border-radius: 10px; border: 1px solid var(--border); box-shadow: none; font: 600 .78rem var(--sans); }
.site-editor .gjs-block:hover { border-color: var(--accent); color: var(--gold-text); }
.site-editor .gjs-block-category .gjs-title { background: var(--bg-soft); color: var(--gold-text); font: 700 .8rem var(--sans); border-bottom: 1px solid var(--border); }
.site-editor .gjs-sm-sector .gjs-sm-sector-title, .site-editor .gjs-layer-title { background: var(--bg-soft); color: var(--text); }
.site-editor .gjs-field { background: #fff; border: 1px solid var(--border); color: var(--text); }
.site-editor .gjs-cv-canvas { width: 100%; height: 100%; top: 0; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 600; }

/* ---------- Verifikasi akun pelanggan ---------- */
.chip-ok { background: #E6F2EA; color: #2E7D4F; }
.verify-wait { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px dashed var(--accent); border-radius: 14px; }
.claim-code { border: 1px dashed currentColor; border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.claim-code code { font-size: 1.15rem; letter-spacing: 0.12em; }

/* ---------- Persetujuan perangkat ---------- */
.note-alert { border-style: solid; border-color: #C9A24D; background: #FBF1DC; }
.note-alert a { font-weight: 600; color: inherit; }
.device-wait { padding: 14px 16px; border: 1px dashed var(--tab-border); border-radius: 14px; margin: 12px 0; }
.device-wait p { margin: 0 0 6px; }

/* ---------- Dashboard (kanvas: AdminDashboard) ---------- */
.dash-hero { display: flex; flex-wrap: wrap; border-radius: 24px; overflow: hidden; background: #FBF7EF; border: 1px solid #EDE3D2; margin-bottom: 16px; }
.dash-hero-text { flex: 1 1 420px; min-width: 0; padding: 36px 40px; display: flex; flex-direction: column; gap: 10px; }
.dash-hero-text .eyebrow { font-size: .78rem; letter-spacing: .28em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.dash-hero-text h1 { margin: 0; font: 700 3rem/1.05 var(--serif); color: var(--primary-dark); }
.dash-who { margin: 0; font-size: 1.15rem; color: #3D3A35; }
.dash-rule { width: 72px; height: 2px; background: var(--gold-lt); margin: 6px 0; }
.dash-hero-text p.muted { margin: 0; }
.dash-hero-art { flex: 1 1 320px; min-height: 220px; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #5E1B2B 0%, var(--primary) 55%, var(--primary-dark) 100%); }
.dash-hero-art img { width: 150px; height: 150px; opacity: .95; }
.dash-stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 16px; }
.dash-stats .stat { padding: 20px 22px; border-radius: 20px; }
.dash-stats .stat-value { font-size: 2.2rem; }
.stat-unit { font: 500 .95rem var(--sans); color: var(--muted); }
.dash-scan { display: flex; align-items: center; gap: 16px; min-height: 96px; padding: 20px 24px; border-radius: 20px; background: var(--primary); color: #FBF3E4; text-decoration: none; }
.dash-scan:hover { background: #5E1B2B; color: #FBF3E4; }
.dash-scan svg { width: 34px; height: 34px; flex: none; }
.dash-scan-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dash-scan-text strong { font-size: 1.3rem; }
.dash-scan-text span { color: #EBD9AE; font-size: .9rem; }
.dash-scan > span:last-child { font-size: 1.4rem; }
.dash-section { margin-bottom: 16px; }
.dash-section-head { margin-bottom: 12px; }
.dash-section-head h2 { margin: 0 0 2px; }
.dash-section-head p { margin: 0; }
.product-grid-lg { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.dash-two { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
.dash-two .card { margin-bottom: 0; }
.flyer-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.discount-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.discount-list a { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); text-decoration: none; }
.discount-img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; }
.discount-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 640px) {
  .dash-hero-text { padding: 26px 22px; }
  .dash-hero-text h1 { font-size: 2.3rem; }
  .dash-hero-art { display: none; }
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .dash-stats .stat { padding: 16px; }
  .dash-stats .stat:first-child { grid-column: 1 / -1; }
  .dash-stats .stat-value { font-size: 1.8rem; }
  .dash-scan { min-height: 0; padding: 16px; gap: 10px; flex-wrap: wrap; }
  .dash-scan-text strong { font-size: 1.05rem; }
  .dash-scan > span:last-child { display: none; }
}

/* ---------- Transaksi (kanvas: AdminTransaksi) ---------- */
.sale-layout .card { border-radius: 20px; padding: 22px 24px; }
.sale-layout .card-head h2 { font-size: 1.2rem; }
.sale-layout .card-focus { border-color: #E2CF9E; box-shadow: 0 0 0 3px #F1E4C4, var(--shadow); }
.sale-layout .qr-input input { min-height: 52px; font-size: 1.05rem; }
.sale-layout .qr-input .btn-icon { width: 52px; min-height: 52px; }
.sale-layout .inline-form .btn { min-height: 52px; }
.cart-item { border-bottom: 0; border-top: 1px solid #EFE7D8; padding: 12px 0; gap: 12px; }
.cart-img { width: 60px; height: 60px; border-radius: 12px; }
.cart-item > strong.num { font-size: 1.05rem; white-space: nowrap; }
.cart-item .btn-small { width: 44px; min-height: 44px; padding: 0; border: 1px solid var(--border); border-radius: 12px; font-size: 1.2rem; }
.cart-main span.small { font-family: ui-monospace, Consolas, monospace; }
.cart-subtotal { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding-top: 10px; border-top: 1px solid #EFE7D8; font-weight: 700; }
.customer-box { padding: 14px 16px; border-radius: 14px; background: #FAF7F1; }
.customer-box strong { font-size: 1.1rem; }
.totals { font-size: .98rem; gap: 8px 12px; }
.totals dd.minus { color: var(--ok); }
.totals dt.total { font: 700 1.6rem var(--serif); color: var(--text); }
.totals dd.total { font: 700 1.9rem var(--serif); }
.pay-card .discounts { border: 1px solid #EFE7D8; border-radius: 12px; padding: 4px 14px; }
.pay-card .choice-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pay-card .choice-item { position: relative; flex-direction: column; justify-content: center; text-align: center; gap: 2px; min-height: 64px; padding: 8px 6px; font-weight: 700; }
.pay-card .choice-item input { position: absolute; opacity: 0; pointer-events: none; }
.pay-card .choice-item:has(input:checked) { border: 1.5px solid #E2CF9E; background: #F1E4C4; color: var(--primary); }
.pay-card .choice-item:has(input:focus-visible) { outline: 3px solid var(--gold-lt); outline-offset: 2px; }
.pay-card .btn-large { min-height: 56px; font-size: 1.1rem; border-radius: 14px; }
@media (max-width: 640px) { .sale-layout .card { padding: 18px 16px; } }

/* Banner Selamat datang: model tanpa latar (dipotong dari foto Gemini) berdiri di atas latar marun banner.
   Bagian bawah foto menempel ke dasar banner, di atas kepala ada ruang kosong. */
.dash-hero-photo { position: relative; min-height: 400px; border-color: transparent; overflow: hidden;
  background: radial-gradient(ellipse at 70% 40%, #7A2A35 0%, #4A1520 50%, #2E0B0F 100%); }
.dash-hero-photo .dash-hero-img { position: absolute; bottom: 0; right: 6%; height: 90%; width: auto; max-width: none; }
.dash-hero-photo .dash-hero-text { position: relative; z-index: 1; flex: 0 1 55%; justify-content: center; }
.dash-hero-photo .eyebrow { color: var(--gold-lt); }
.dash-hero-photo h1 { color: #FBF3E4; }
.dash-hero-photo .dash-who { color: #F3E7D3; }
.dash-hero-photo .dash-hero-text p.muted { color: #E0CDB2; }
@media (max-width: 1100px) { .dash-hero-photo .dash-hero-img { right: 2%; } }
@media (max-width: 720px) {
  .dash-hero-photo { flex-direction: column; min-height: 0; }
  .dash-hero-photo .dash-hero-img { position: static; display: block; height: 280px; margin: 28px auto 0; order: 2; }
  .dash-hero-photo .dash-hero-text { flex: none; order: 1; padding-bottom: 0; }
}

/* Layar penuh: isi aplikasi memakai seluruh lebar perangkat (hanya jarak tepi). */
.main { max-width: none; padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
@media (max-width: 860px) { .main { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); } }

/* Menu utama (Dashboard, Katalog, Transaksi, Scan QR) selalu di tengah bilah atas pada layar lebar. */
.topright { display: flex; align-items: center; gap: 12px; }
@media (min-width: 861px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .topbar .brand-link { justify-self: start; }
  .topnav { margin-left: 0; justify-self: center; }
  .topright { justify-self: end; }
}
@media (max-width: 860px) { .topright { margin-left: auto; } .topright .menu { margin-left: 0; } }
.main.bare-main { max-width: 1100px; }
/* Layar sedang: menu dirapatkan agar nama KIANDRA JEWELLERY dan menu tengah tidak bertabrakan. */
@media (min-width: 861px) and (max-width: 1000px) {
  .topnav { gap: 2px; }
  .topnav-link { padding: 0 10px; gap: 0; }
  .topnav-link svg { display: none; }
}

/* Model produk dengan foto: foto persegi di atas, nama dan jumlah di bawah. */
.category-grid-photo { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.category-tile.has-photo { justify-content: flex-start; padding: 0 0 12px; overflow: hidden; gap: 2px; }
.category-tile.has-photo img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; margin-bottom: 8px; transition: transform .25s ease; }
.category-tile.has-photo:hover img { transform: scale(1.04); }
.category-tile.has-photo strong, .category-tile.has-photo span { padding: 0 12px; }
@media (max-width: 860px) { .category-grid-photo { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } }

/* ---------- Bilah navigasi marun anggur, garis emas (permintaan pemilik) ---------- */
.topbar { background: var(--primary); border-bottom: 3px solid var(--gold-lt); }
.topbar .brand-name { color: #E3C47A; }
.topbar .brand-name em { color: var(--gold-lt); }
.topnav-link { color: #EBD9AE; }
.topnav-link:hover { color: #FBF3E4; background: rgba(255, 255, 255, .08); }
.topnav-link.active { background: #E9D29A; border-color: #E9D29A; color: var(--primary-dark); }
.topbar .menu summary { background: transparent; border-color: rgba(216, 181, 106, .55); color: #EBD9AE; }
.topbar .menu summary:hover { background: rgba(255, 255, 255, .08); }
.topuser { color: #FBF3E4; }
.topuser:hover { background: rgba(255, 255, 255, .08); }
.topuser-name small { color: #E0CDB2; }
.topuser-avatar { background: #5E1B2B; }
@media (max-width: 860px) {
  .topnav { background: var(--primary); border-top: 2px solid var(--gold-lt); }
  .topnav-link { color: #EBD9AE; }
  .topnav-link.active { background: #E9D29A; border-color: transparent; color: var(--primary-dark); }
}
