/* Loyalty Platform — single theme file. Brand pink matches the register
   app's Customer Service button/header (#c7366e). */
:root {
  --brand: #c7366e;
  --brand-dark: #a8265a;
  --brand-soft: #fbe9f1;
  --ink: #1c2430;
  --muted: #66727f;
  --line: #e3e8ee;
  --bg: #f6f7f9;
  --card: #ffffff;
  --ok: #177245;
  --ok-bg: #e5f4ec;
  --warn: #9a6a00;
  --warn-bg: #fdf3d7;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, Arial, sans-serif; color: var(--ink); background: var(--bg); }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
a { color: var(--brand-dark); }
table { border-collapse: collapse; width: 100%; background: var(--card); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
input[type=text], input[type=tel], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600;
  background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-dark); }
.btn.soft { background: var(--brand-soft); color: var(--brand-dark); }
.btn.ok { background: var(--ok); }
.btn.bad { background: var(--bad); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.notice-ok { background: var(--ok-bg); color: var(--ok); border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; font-weight: 600; }
.notice-err { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; font-weight: 600; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip-pending { background: var(--warn-bg); color: var(--warn); }
.chip-completed { background: var(--ok-bg); color: var(--ok); }
.chip-cancelled { background: var(--bad-bg); color: var(--bad); }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > div { flex: 1; min-width: 140px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.filters a { padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.filters a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
code.key { font-size: 17px; background: var(--warn-bg); padding: 10px 14px; border-radius: 10px; display: block; word-break: break-all; }

/* Admin layout */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-side { width: 210px; background: #22131b; color: #f5dbe7; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.admin-side .brand { font-size: 19px; font-weight: 700; color: #fff; padding: 4px 10px 14px; }
.admin-side a { color: #f5dbe7; text-decoration: none; padding: 9px 10px; border-radius: 8px; }
.admin-side a:hover { background: #3a1f2e; }
.admin-side a.on { background: var(--brand); color: #fff; }
.admin-side a.out { margin-top: auto; }
.admin-main { flex: 1; padding: 22px 26px; max-width: 1100px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .n { font-size: 30px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }

/* Cashier layout — touch friendly, fits the 1024x720 panel.
   v1.0.1: scaled down a step at the owner's request (it rendered too big
   on the register's screen) — still comfortable touch targets. */
body.cashier { background: #fff; }
.cs-top { display: flex; justify-content: space-between; align-items: center; background: var(--brand); color: #fff; padding: 9px 14px; }
.cs-title { font-size: 16px; font-weight: 700; }
.cs-reg { background: rgba(255,255,255,.22); padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.cs-nav { display: flex; gap: 8px; padding: 9px 14px 0; }
.cs-nav a { flex: 1; text-align: center; padding: 10px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-dark);
  text-decoration: none; font-size: 15px; font-weight: 700; border: 2px solid transparent; }
.cs-nav a.on { border-color: var(--brand); background: #fff; }
.cs-main { padding: 12px 14px 20px; max-width: 980px; margin: 0 auto; }
.cs-main h1 { font-size: 19px; }
.cs-main h2 { font-size: 15px; margin: 16px 0 8px; }
.cs-main .card { padding: 12px; }
.cs-main .btn { padding: 10px 18px; font-size: 15px; }
.cs-main input, .cs-main select, .cs-main textarea { font-size: 15px; padding: 10px; }
.cs-main th, .cs-main td { padding: 6px 8px; }
.order-actions { display: flex; gap: 8px; }
.login-box { max-width: 380px; margin: 60px auto; }

/* Admin on phones / small screens (v1.0.1): the sidebar becomes an
   off-canvas drawer opened from the ☰ button in the mobile bar;
   stat cards reflow and wide tables scroll sideways inside the page. */
.mobile-bar { display: none; }
.side-backdrop { display: none; }
@media (max-width: 860px) {
  .mobile-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
  .side-toggle { border: 1px solid var(--line); background: var(--card); border-radius: 10px;
    font-size: 19px; line-height: 1; padding: 8px 13px; cursor: pointer; color: var(--ink); }
  .mobile-brand { font-size: 17px; font-weight: 700; }
  .admin-side { position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: 232px;
    transform: translateX(-105%); transition: transform .22s ease; overflow-y: auto; }
  body.side-open .admin-side { transform: none; box-shadow: 0 0 44px rgba(0,0,0,.45); }
  .side-backdrop { position: fixed; inset: 0; background: rgba(15,8,12,.45); z-index: 40; }
  body.side-open .side-backdrop { display: block; }
  /* min-width: 0 is the load-bearing fix: a flex item (and grid items)
     otherwise refuse to shrink below their widest content, so one wide
     table stretched the whole page past the phone's edge (v1.0.1 bug). */
  .admin-main { padding: 14px; max-width: none; min-width: 0; overflow-x: clip; }
  .admin-main h1 { font-size: 19px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 12px; min-width: 0; }
  .stat .n { font-size: 24px; }
  .stat .l { overflow-wrap: anywhere; }
  .admin-main table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .row > div { min-width: 120px; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
}
