/* =====================================================================
   CAFE POS - Multi-Tenant modern specialty-coffee theme
   ===================================================================== */
:root {
  --brand: #d97706;
  --brand-dark: #78350f;
  --brand-light: #fef3c7;
  --accent: #059669;
  --coffee: #292524;
  --green: #059669;
  --red: #dc2626;
  --blue: #2563eb;
  --orange: #ea580c;
  --gray: #6b7280;
  --bg: #f8f5f0;
  --card: #ffffff;
  --border: #e7e0d4;
  --shadow: 0 2px 14px rgba(41, 37, 36, 0.06);
  --radius: 16px;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--coffee);
  min-height: 100vh;
  font-size: 15px;
}

a { color: var(--brand); text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ---------- Top bar ---------- */
.topbar {
  background: linear-gradient(135deg, #292524 0%, #3b2e1f 100%);
  color: #fff;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 4px 18px rgba(41, 37, 36, 0.18);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 2px solid var(--brand);
}
.topbar .brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .brand small { font-weight: 400; opacity: .85; font-size: 12px; }
.topbar .meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge.act { background: rgba(255,255,255,.2); }
.badge.sub-active { background: var(--green); color:#fff; }
.badge.sub-expired { background: var(--red); color:#fff; }
.nav { display: flex; gap: 6px; }
.nav a {
  color: #fff; opacity: .85; padding: 6px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.18); opacity: 1; }
.btn-logout {
  background: rgba(255,255,255,.15); color:#fff; border:1px solid rgba(255,255,255,.4);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.btn-logout:hover { background: rgba(255,255,255,.3); }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (max-width: 860px) { .grid.cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card h3 { font-size: 16px; margin-bottom: 10px; }
.card h4 { font-size: 14px; margin-bottom: 8px; }
.card .muted { color: var(--gray); font-size: 13px; }

.section-title {
  font-size: 18px; font-weight: 800; margin: 22px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.section-title .count {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 12px; padding: 1px 8px;
}

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 10px; padding: 10px 16px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  letter-spacing: .2px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(41, 37, 36, 0.12); }
.btn:active { transform: scale(.98); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.success { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.warn { background: var(--orange); color: #fff; }
.btn.ghost { background: #f1f5f9; color: var(--coffee); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }

/* ---------- Forms ---------- */
.input, .select, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; background: #fff; color: var(--coffee);
  outline: none; transition: border .15s;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }

/* ---------- Status pills ---------- */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .3px; white-space: nowrap;
}
.pill.pv  { background: #ffedd5; color: #c2410c; }
.pill.ap  { background: #dbeafe; color: #1d4ed8; }
.pill.ck  { background: #fef3c7; color: #b45309; }
.pill.sv  { background: #d1fae5; color: #047857; }
.pill.br  { background: #fce7f3; color: #be185d; }
.pill.pc  { background: #f1f5f9; color: #475569; }

/* ---------- Alerts / toasts ---------- */
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  background: var(--coffee); color: #fff; padding: 12px 18px;
  border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(12px); transition: all .25s ease;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

.alert {
  padding: 10px 14px; border-radius: 10px; margin-bottom: 14px;
  font-size: 14px; font-weight: 600;
}
.alert.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert.ok  { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert.info{ background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ---------- Order / menu item rows ---------- */
.menu-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 12px; border: 1px solid var(--border);
  border-radius: 12px; background: #fff;
}
.menu-item.off {
  opacity: .55; filter: grayscale(.7);
  background: #efeae2;
}
.menu-item.off .name { color: var(--gray); }
.menu-item.off .qty-control button:disabled { opacity: .4; cursor: not-allowed; }
.menu-item .info { flex: 1; }
.menu-item .info .name { font-weight: 700; }
.menu-item .info .desc { font-size: 12px; color: var(--gray); }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; font-weight: 800; cursor: pointer; font-size: 15px;
}
.qty-control button:hover { background: var(--brand-light); }
.qty-control .qty { min-width: 22px; text-align: center; font-weight: 700; }

.line-item {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px;
}
.line-item .lt { flex: 1; }
.line-item .muted { font-size: 12px; }
.line-item .rt { text-align: right; font-weight: 600; }

/* ---------- Empty states ---------- */
.empty {
  text-align: center; color: var(--gray); padding: 34px 10px; font-size: 14px;
}
.empty .emoji { font-size: 34px; display: block; margin-bottom: 8px; }

/* ---------- Timeline (customer status) ---------- */
.timeline { display: flex; align-items: center; justify-content: center; gap: 0; margin: 18px 0 8px; flex-wrap: wrap; }
.tstep { display: flex; flex-direction: column; align-items: center; width: 110px; position: relative; }
.tstep .dot {
  width: 34px; height: 34px; border-radius: 50%; background: #f1f5f9;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  border: 3px solid var(--border); transition: all .3s;
}
.tstep .lbl { font-size: 11px; font-weight: 700; margin-top: 6px; color: var(--gray); }
.tstep.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.tstep.done .lbl { color: var(--green); }
.tstep.cur .dot { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 5px rgba(217,119,6,.22); }
.tstep.cur .lbl { color: var(--brand-dark); }
.tline { flex: 0 0 34px; height: 3px; background: var(--border); margin-top: -16px; border-radius: 3px; }
.tline.done { background: var(--green); }
@media (max-width: 600px) {
  .tstep { width: auto; flex: 1; min-width: 52px; }
  .tstep .dot { width: 28px; height: 28px; font-size: 13px; }
  .tstep .lbl { font-size: 9.5px; white-space: nowrap; }
  .tline { flex-basis: 18px; margin-top: -13px; }
}

/* ---------- Kitchen / cashier cards ---------- */
.op-card { border-left: 5px solid var(--accent); }
.op-card.br { border-left-color: var(--red); }
.op-card.ck { border-left-color: var(--orange); }
.op-card.sv { border-left-color: var(--green); }

.pending-badge {
  position: absolute; top: -8px; right: -8px; background: var(--red); color: #fff;
  border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 800;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: #fff; border-radius: 16px; max-width: 480px; width: 100%;
  padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 90vh; overflow: auto;
}
.modal h3 { margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- QRIS Renew (mirror kasir-app RenewQrisModal) ---------- */
.renew-plan {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; transition: all .15s; font-size: 14px;
}
.renew-plan:hover { border-color: var(--green); background: #ecfdf5; }
.renew-plan[data-selected] { border-color: var(--green); background: #ecfdf5; }
.renew-price { font-weight: 800; color: var(--green); font-size: 15px; }
.renew-total { font-size: 26px; font-weight: 900; color: #0f172a; margin-top: 6px; }
.renew-btn-primary {
  margin-top: 16px; text-align: center; padding: 13px; border-radius: 12px;
  background: linear-gradient(90deg, #059669, #0d9488); color: #fff; font-weight: 700;
  box-shadow: 0 6px 16px rgba(16,185,129,.25);
}
.renew-btn-primary:hover { filter: brightness(1.08); }
.renew-link {
  margin-top: 10px; font-size: 11px; color: var(--gray); word-break: break-all;
  background: #f8fafc; border-radius: 10px; padding: 8px 10px; text-align: center;
}
.renew-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--green); border-top-color: transparent;
  animation: renewspin .8s linear infinite; display: inline-block;
}
@keyframes renewspin { to { transform: rotate(360deg); } }
.renew-check {
  width: 60px; height: 60px; margin: 0 auto; border-radius: 50%;
  background: #d1fae5; color: #059669; display: flex; align-items: center;
  justify-content: center; font-size: 30px; font-weight: 900;
}
.renew-success-title { font-size: 20px; font-weight: 900; color: #0f172a; margin: 10px 0 4px; }

/* ---------- Table row ---------- */
.trow {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: #fff; gap: 10px; flex-wrap: wrap;
}

/* ---------- Subscription / payment screen ---------- */
.pay-wrap { max-width: 900px; margin: 30px auto; }
.pkg-card { border: 2px solid var(--border); border-radius: 14px; padding: 18px; text-align: center; background:#fff; }
.pkg-card.reco { border-color: var(--brand); box-shadow: 0 4px 20px rgba(217,119,6,.18); }
.pkg-card .price { font-size: 24px; font-weight: 900; color: var(--brand-dark); margin: 8px 0; }
.pkg-card .dur { font-size: 13px; color: var(--gray); }
.qris-box {
  max-width: 300px; margin: 0 auto; padding: 14px; background:#fff;
  border: 2px dashed var(--border); border-radius: 14px; text-align: center;
}
.qris-box img { width: 100%; border-radius: 8px; display:block; }

/* ---------- Misc ---------- */
.muted { color: var(--gray); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.tab-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border);
  background:#fff; font-weight: 700; cursor: pointer; font-size: 14px;
}
.tab-btn.active { background: var(--brand); color:#fff; border-color: var(--brand); }
.total-big { font-size: 22px; font-weight: 900; color: var(--brand-dark); }
h1.page-title { font-size: 22px; margin: 6px 0 4px; }
h2.sub-title { font-size: 15px; color: var(--gray); font-weight: 600; margin-bottom: 16px; }

/* Customer layout */
.cust-layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .cust-layout { grid-template-columns: 1fr; } }
.cart-sticky { position: sticky; top: 76px; }
@media (max-width: 900px) { .cart-sticky { position: static; } }

.menu-cat-title {
  font-size: 15px; font-weight: 800; margin: 14px 0 8px; color: var(--brand-dark);
  display: flex; align-items: center; gap: 8px;
}
.menu-cat-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Customer dish grid ---------- */
.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
@media (max-width: 600px) { .dish-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }

.dish-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .12s ease, box-shadow .15s ease;
}
.dish-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(41,37,36,.10); }
.dish-card.off { opacity: .5; filter: grayscale(.8); background: #f2ede5; }
.dish-card .dish-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #f6f2ea; }
.dish-card .dish-noimg {
  width: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  font-size: 48px; background: linear-gradient(135deg, #fef3c7, #fde68a); color: var(--brand-dark);
}
.dish-card .dish-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.dish-card .dish-name { font-weight: 800; font-size: 15px; line-height: 1.3; }
.dish-card .dish-price { font-size: 15px; font-weight: 800; color: var(--brand-dark); }
.dish-card .dish-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dish-card .dish-notes { width: 100%; font-size: 12px; }
.dish-card .qty-control { flex: 0 0 auto; }
.dish-card .qty-control button { width: 30px; height: 30px; }

/* ---------- Customer cart ---------- */
.cart-card {
  position: sticky; top: 76px;
  max-height: calc(100vh - 100px);
  display: flex; flex-direction: column;
}
@media (max-width: 900px) { .cart-card { position: static; max-height: none; } }
.cart-card .cart-scroll { overflow-y: auto; flex: 1; min-height: 60px; max-height: 46vh; padding-right: 2px; }
@media (max-width: 900px) { .cart-card .cart-scroll { max-height: 40vh; } }
.cart-card .cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 10px; border-bottom: 1px dashed var(--border);
}
.cart-card .cart-foot {
  border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px;
}
.cart-empty {
  text-align: center; color: var(--gray); padding: 30px 8px; font-size: 14px;
}
.cart-empty .emoji { font-size: 32px; display: block; margin-bottom: 8px; }

.cart-line {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 14px;
}
.cart-line:last-child { border-bottom: none; }
.cart-line .lt { flex: 1; min-width: 0; }
.cart-line .lt .q { font-weight: 700; }
.cart-line .rt { text-align: right; font-weight: 700; white-space: nowrap; }

/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.switch.sm { width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #fca5a5; border-radius: 26px; transition: background .25s ease; border: none;
}
.switch .slider:before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: transform .25s ease; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.switch.sm .slider:before { height: 14px; width: 14px; left: 3px; bottom: 3px; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider:before { transform: translateX(20px); }
.switch.sm input:checked + .slider:before { transform: translateX(14px); }
.switch .slider:disabled { opacity: .5; cursor: not-allowed; }
