/* Kasir Petshop — warm cream/orange theme */
:root {
  --bg: #faf6ef;
  --card: #ffffff;
  --ink: #3d2f24;
  --muted: #8a7a6a;
  --line: #eee3d4;
  --brand: #e2711d;
  --brand-ink: #b45309;
  --brand-soft: #fdf0e3;
  --green: #2e7d32;
  --green-soft: #e7f3e8;
  --red: #c0392b;
  --red-soft: #fdecea;
  --blue: #1f6feb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(61, 47, 36, .08), 0 4px 14px rgba(61, 47, 36, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
b { font-variant-numeric: tabular-nums; }

/* ---------- auth ---------- */
#authView {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--card); border-radius: 20px;
  box-shadow: var(--shadow); padding: 32px 28px; text-align: center;
}
.auth-logo {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px;
  background: var(--brand-soft); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center;
}
.auth-logo svg { width: 36px; height: 36px; }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-sub { margin: 2px 0 20px; color: var(--muted); font-size: 14px; }

/* ---------- forms ---------- */
.fld { display: block; text-align: left; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.fld input, .fld select {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.fld input:focus, .fld select:focus { outline: none; border-color: var(--brand); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; background: none; color: var(--muted);
  display: flex; align-items: center; justify-content: center; border-radius: 8px;
}
.pw-toggle svg { width: 20px; height: 20px; }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); }
.err {
  background: var(--red-soft); color: var(--red); border-radius: 10px;
  padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; text-align: left;
}
.form-grid .btn { margin-top: 4px; }
.form-actions { display: flex; gap: 8px; }

/* ---------- buttons ---------- */
.btn {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 11px 16px; font-weight: 600;
}
.btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); color: #fff; }
.btn.danger { background: var(--red-soft); border-color: transparent; color: var(--red); }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.icon-btn {
  width: 40px; height: 40px; border: 0; background: none; color: var(--ink);
  border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand-ink); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- topbar & drawer ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; background: var(--card);
  display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.brand {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; color: var(--brand-ink);
}
.brand svg { width: 22px; height: 22px; }
nav#drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(61, 47, 36, .4); }
.drawer-panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 270px; max-width: 84vw;
  background: var(--card); padding: 10px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.drawer-title { font-weight: 700; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; border: 0; background: none;
  border-radius: 10px; font-weight: 600; text-align: left; color: var(--ink);
}
.nav-item svg { width: 21px; height: 21px; color: var(--muted); }
.nav-item:hover { background: var(--brand-soft); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav-item.active svg { color: var(--brand-ink); }

/* ---------- views ---------- */
.view { flex: 1; padding: 14px; max-width: 1200px; width: 100%; margin: 0 auto; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px;
}
.card-title { font-weight: 700; font-size: 15.5px; margin-bottom: 12px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title-row .card-title { margin-bottom: 0; }
.two-col { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .two-col { grid-template-columns: 5fr 7fr; align-items: start; } }

/* ---------- kasir ---------- */
.kasir-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .kasir-grid { grid-template-columns: 7fr 5fr; align-items: start; } }
.seg { display: inline-flex; background: var(--brand-soft); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-btn {
  border: 0; background: none; padding: 7px 13px; border-radius: 9px; font-weight: 600;
  color: var(--muted); font-size: 13.5px;
}
.seg-btn.active { background: #fff; color: var(--brand-ink); box-shadow: 0 1px 2px rgba(61,47,36,.12); }
.item-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 12px; }
.item-tile {
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px;
  text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 92px;
}
.item-tile:hover { border-color: var(--brand); }
.item-tile .t-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.item-tile .t-price { color: var(--brand-ink); font-weight: 700; font-size: 13.5px; margin-top: auto; }
.item-tile .t-cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cart-card { position: sticky; top: 66px; }
.cart-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; min-height: 40px; max-height: 300px; overflow: auto; }
.cart-row { display: flex; align-items: center; gap: 8px; background: var(--brand-soft); border-radius: 10px; padding: 8px 10px; }
.cart-row .c-name { flex: 1; font-size: 13.5px; font-weight: 600; }
.cart-row .c-price { font-size: 12.5px; color: var(--muted); }
.qty-box { display: inline-flex; align-items: center; gap: 2px; background: #fff; border-radius: 8px; padding: 2px; }
.qty-box button { width: 26px; height: 26px; border: 0; background: none; font-weight: 700; color: var(--brand-ink); border-radius: 6px; }
.qty-box button:hover { background: var(--brand-soft); }
.qty-box span { min-width: 20px; text-align: center; font-weight: 700; font-size: 13.5px; }
.cart-row .c-del { border: 0; background: none; color: var(--red); width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.cart-row .c-del svg { width: 16px; height: 16px; }
.cart-row .c-del:hover { background: var(--red-soft); }
.cart-rows { border-top: 1px dashed var(--line); padding-top: 10px; }
.crow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 14px; color: var(--muted); }
.crow b { color: var(--ink); font-size: 14.5px; }
.crow input {
  width: 130px; text-align: right; padding: 7px 10px; border: 1.5px solid var(--line);
  border-radius: 8px; font-weight: 600;
}
.crow input:focus { outline: none; border-color: var(--brand); }
.crow.total { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; }
.crow.total b { font-size: 19px; color: var(--brand-ink); }
#cashRow, #changeRow { display: flex; }
.pay-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0; }
.pay-btn {
  border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 6px;
  font-weight: 600; color: var(--muted); font-size: 13.5px;
}
.pay-btn.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.pay-result { background: var(--green-soft); border-radius: 12px; padding: 14px; margin-top: 12px; text-align: center; }
.pay-result .pr-code { font-weight: 700; color: var(--green); font-size: 15px; }
.pay-result .pr-change { font-size: 26px; font-weight: 800; color: var(--green); margin: 6px 0; }
.pay-result .pr-note { font-size: 13px; color: var(--muted); }

/* ---------- lists ---------- */
.rowlist { display: flex; flex-direction: column; gap: 8px; }
.rowitem {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ri-main { flex: 1; min-width: 180px; }
.ri-title { font-weight: 700; font-size: 14.5px; }
.ri-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ri-amt { font-weight: 800; color: var(--brand-ink); font-size: 15px; white-space: nowrap; }
.pill { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--brand-soft); color: var(--brand-ink); }
.pill.off { background: var(--red-soft); color: var(--red); }
.pill.gray { background: #f1ece4; color: var(--muted); }
.ri-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { color: var(--muted); font-size: 13.5px; padding: 14px 4px; text-align: center; }
.date-filter { max-width: 170px; }

/* ---------- laporan ---------- */
.rep-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; }
.stat .s-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .s-value { font-size: 19px; font-weight: 800; color: var(--brand-ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
.rep-section { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 12px; }
.rep-section h3 { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.bar-row .b-label { width: 92px; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.bar-row .b-track { flex: 1; background: var(--bg); border-radius: 6px; height: 14px; overflow: hidden; }
.bar-row .b-fill { height: 100%; background: var(--brand); border-radius: 6px; min-width: 2px; }
.bar-row .b-val { width: 90px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
table.rep { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rep th, table.rep td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.rep th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.rep td.num, table.rep th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(61, 47, 36, .45); }
.modal-card {
  position: relative; background: #fff; border-radius: 16px; box-shadow: var(--shadow);
  width: 100%; max-width: 430px; max-height: 86dvh; overflow: auto; padding: 18px;
}
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}

@media (max-width: 640px) {
  .view { padding: 10px; }
  .card { padding: 13px; }
  .cart-card { position: static; }
  .crow input { width: 110px; }
}
