/* Loyalty+ — shared stylesheet (hosted app and demo build) */

:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #fbfcfe;
  --ink: #131820;
  --ink-2: #5b6472;
  --ink-3: #8b95a5;
  --line: #e2e7ef;
  --line-2: #d3dae5;
  --accent: #0b5cff;
  --accent-ink: #ffffff;
  --good: #0f8a4d;
  --good-bg: #e6f6ed;
  --warn: #9a6200;
  --warn-bg: #fdf3e0;
  --bad: #c0392b;
  --bad-bg: #fdeceb;
  --info-bg: #e9f0ff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 20px rgba(16,24,40,.05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root:not([data-theme="light"]) {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1218;
    --panel: #161c25;
    --panel-2: #1b222c;
    --ink: #e9edf3;
    --ink-2: #a3adbc;
    --ink-3: #7c8595;
    --line: #262f3b;
    --line-2: #333e4d;
    --accent: #5b8dff;
    --accent-ink: #06101f;
    --good: #4ecf8b;
    --good-bg: #102a1d;
    --warn: #f0b344;
    --warn-bg: #2c2312;
    --bad: #ff8175;
    --bad-bg: #2e1614;
    --info-bg: #16203a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1218; --panel: #161c25; --panel-2: #1b222c; --ink: #e9edf3; --ink-2: #a3adbc;
  --ink-3: #7c8595; --line: #262f3b; --line-2: #333e4d; --accent: #5b8dff; --accent-ink: #06101f;
  --good: #4ecf8b; --good-bg: #102a1d; --warn: #f0b344; --warn-bg: #2c2312; --bad: #ff8175;
  --bad-bg: #2e1614; --info-bg: #16203a; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* .field sets display:flex, which would otherwise beat the browser's [hidden] rule */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- layout */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 40; background: var(--panel);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 14px; padding: 10px 16px; flex-wrap: wrap;
}
.logo { font-size: 19px; font-weight: 800; letter-spacing: -.5px; white-space: nowrap; }
.logo span { color: var(--accent); }
.topbar .spacer { flex: 1; }
.who { text-align: right; line-height: 1.25; }
.who b { display: block; font-size: 13px; }
.who small { color: var(--ink-2); font-size: 11.5px; }

.scope-select, .btn, .field input, .field select, .field textarea, .input {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px;
  padding: 7px 10px; color: var(--ink);
}
.scope-select { max-width: 230px; }

.tabs {
  display: flex; gap: 2px; padding: 0 10px; background: var(--panel);
  border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 53px; z-index: 39;
}
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 11px 14px;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 13.5px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

main { padding: 18px; max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }

/* ----------------------------------------------------------------- bits */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}
.card > h2, .card > h3 { margin: 0 0 12px; font-size: 14px; letter-spacing: .2px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 14.5px; }
.card-head .spacer { flex: 1; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; box-shadow: var(--shadow);
}
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-2); }
.stat .v { font-size: 27px; font-weight: 750; letter-spacing: -1px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.btn {
  cursor: pointer; font-weight: 550; font-size: 13px; padding: 8px 13px;
  transition: filter .12s ease, background .12s ease;
}
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.danger { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 11.5px; color: var(--ink-2); font-weight: 550; }
.field input, .field select, .field textarea { width: 100%; }
.field.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.split { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(0,1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--ink-2); padding: 9px 10px; background: var(--panel-2);
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--panel-2); }
table.data tr.selected { background: var(--info-bg); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 600; letter-spacing: .2px; white-space: nowrap;
}
.pill.new { background: var(--info-bg); color: var(--accent); }
.pill.invited { background: var(--info-bg); color: var(--accent); }
.pill.contacted { background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line-2); }
.pill.callback { background: var(--warn-bg); color: var(--warn); }
.pill.booked { background: var(--good-bg); color: var(--good); }
.pill.attended, .pill.sold, .pill.accepted, .pill.approved, .pill.completed, .pill.arrived { background: var(--good-bg); color: var(--good); }
.pill.not_interested, .pill.unreachable, .pill.declined, .pill.no_show, .pill.cancelled { background: var(--bad-bg); color: var(--bad); }
.pill.requested { background: var(--warn-bg); color: var(--warn); }
.pill.draft, .pill.presented, .pill.confirmed, .pill.pending, .pill.exported, .pill.sent, .pill.opened { background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line-2); }

.prefs { display: inline-flex; gap: 3px; }
.pref {
  width: 20px; height: 20px; border-radius: 5px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 10px; font-weight: 700; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--ink-3);
}
.pref.on { background: var(--good-bg); border-color: transparent; color: var(--good); }
.pref.dnc { background: var(--bad-bg); border-color: transparent; color: var(--bad); }

.banner {
  border-radius: 8px; padding: 10px 13px; font-size: 13px; margin-bottom: 12px;
  border: 1px solid var(--line-2); background: var(--panel-2);
}
.banner.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.banner.bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.banner.good { background: var(--good-bg); border-color: transparent; color: var(--good); }
.banner.info { background: var(--info-bg); border-color: transparent; color: var(--accent); }

.empty { padding: 34px 16px; text-align: center; color: var(--ink-2); font-size: 13px; }

/* ---------------------------------------------------------- slot picker */
.slotday { margin-bottom: 14px; }
.slotday h4 { margin: 0 0 7px; font-size: 12.5px; color: var(--ink-2); }
.slotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.slot {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 7px;
  padding: 7px 4px; text-align: center; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.slot small { display: block; font-weight: 400; font-size: 10px; color: var(--ink-3); }
.slot:hover:not(.full) { border-color: var(--accent); }
.slot.full { opacity: .45; cursor: not-allowed; }
.slot.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.slot.on small { color: var(--accent-ink); opacity: .8; }

/* ------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li:before {
  content: ''; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--line-2);
}
.timeline li.inbound:before { background: var(--accent); }
.timeline .when { font-size: 11px; color: var(--ink-3); }

/* --------------------------------------------------------------- modals */
.modal-back {
  position: fixed; inset: 0; background: rgba(10,14,20,.5); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 24px 14px; overflow: auto;
}
.modal {
  background: var(--panel); border-radius: 12px; width: 100%; max-width: 720px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3); border: 1px solid var(--line);
}
.modal.wide { max-width: 980px; }
.modal header {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal header h3 { margin: 0; font-size: 15px; flex: 1; }
.modal .body { padding: 16px; }
.modal footer { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.x { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink-2); }

/* --------------------------------------------------------------- toasts */
.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 13px; max-width: 340px;
}
.toast.bad { border-left-color: var(--bad); }
.toast.good { border-left-color: var(--good); }

/* ---------------------------------------------------------- login page */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 26px;
}
.login .logo { font-size: 27px; margin-bottom: 3px; }
.login p.sub { margin: 0 0 20px; color: var(--ink-2); font-size: 13px; }
.login .field { margin-bottom: 12px; }
.login .btn { width: 100%; justify-content: center; margin-top: 6px; }
.demo-users { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.demo-users h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); }
.demo-user {
  display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer;
}
.demo-user:hover { border-color: var(--accent); }
.demo-user b { font-size: 13px; }
.demo-user small { display: block; color: var(--ink-2); font-size: 11px; }
.demo-user .rolechip {
  margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  background: var(--info-bg); color: var(--accent); border-radius: 999px; padding: 2px 8px; font-weight: 700;
}

/* --------------------------------------------------------- offer editor */
.offer-figures { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.figrow { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.figrow.total { border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 9px; font-weight: 700; }
.figrow .v { font-variant-numeric: tabular-nums; }
.headline-fig {
  background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px;
}
.headline-fig .k { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; opacity: .85; }
.headline-fig .v { font-size: 30px; font-weight: 800; letter-spacing: -1.2px; }

.bar { height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }

.tag {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  background: var(--warn-bg); color: var(--warn); border-radius: 5px; padding: 2px 6px;
}

.demo-ribbon {
  background: var(--warn-bg); color: var(--warn); font-size: 12px; padding: 6px 16px;
  border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.demo-ribbon .spacer { flex: 1; }

/* ------------------------------------------------ bell and notifications */
.bell {
  position: relative; background: none; border: 1px solid var(--line-2); border-radius: 8px;
  padding: 6px 9px; cursor: pointer; font-size: 15px; line-height: 1;
}
.bell:hover { border-color: var(--accent); }
.bell-count {
  position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff;
  border-radius: 999px; font-size: 10px; font-weight: 700; padding: 1px 5px; min-width: 16px; text-align: center;
}
.inbox { list-style: none; margin: 0; padding: 0; }
.inbox li {
  display: flex; gap: 10px; padding: 11px 10px; border-bottom: 1px solid var(--line); cursor: pointer;
  border-left: 3px solid transparent; border-radius: 6px;
}
.inbox li:hover { background: var(--panel-2); }
.inbox li.unread { border-left-color: var(--accent); background: var(--info-bg); }
.inbox li:last-child { border-bottom: 0; }
.inbox .ico { font-size: 17px; line-height: 1.3; }
.inbox .when { font-size: 11px; color: var(--ink-3); margin-top: 3px; }

/* -------------------------------------------------------- scan-only hero */
.scan-hero { text-align: center; padding: 40px 22px; max-width: 560px; margin: 0 auto 16px; }
.scan-hero-icon { font-size: 46px; line-height: 1; margin-bottom: 10px; }
.scan-hero h2 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.3px; }
.scan-hero p { margin: 0 auto; max-width: 420px; font-size: 13.5px; }
.btn.big { font-size: 15px; padding: 13px 26px; margin-top: 18px; }

/* ---------------------------------------------------------- call script */
.script-card { border: 1px solid var(--warn) !important; }
blockquote.script {
  margin: 0; padding: 11px 14px; background: var(--warn-bg); color: var(--warn);
  border-radius: 8px; font-size: 13.5px; line-height: 1.5; font-style: italic;
}
.yesno { display: flex; gap: 8px; }
.yesno .btn { min-width: 74px; justify-content: center; }

/* ----------------------------------------------------- offer builder bits */
.offer-slot {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.offer-slot:last-child { border-bottom: 0; }
.slot-no {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px; margin-top: 18px;
  background: var(--info-bg); color: var(--accent); font-weight: 800; font-size: 13px;
  display: grid; place-items: center;
}
ol.offer-list { margin: 12px 0 0; padding-left: 20px; }
ol.offer-list li { padding: 5px 0; font-size: 13px; }
ol.offer-list li b { font-weight: 650; }
ol.offer-list li span { display: block; color: var(--ink-2); font-size: 12px; margin-top: 2px; }

/* --------------------------------------------------- offer sheet preview */
.sheet-preview {
  background: #f2f4f7; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px;
  height: min(66vh, 780px);
}
.sheet-preview iframe { width: 100%; height: 100%; border: 0; border-radius: 6px; background: #fff; }

/* ------------------------------------------------------- camera scanner */
.scanner {
  position: relative; background: #000; border-radius: 10px; overflow: hidden;
  aspect-ratio: 4 / 3; display: grid; place-items: center;
}
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.plate-guide {
  position: absolute; left: 10%; right: 10%; top: 37%; height: 26%;
  border: 2px dashed rgba(255, 255, 255, .85); border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35);
}

/* ------------------------------------------------------ invitation page */
.invite-wrap { min-height: 100vh; display: flex; justify-content: center; padding: 24px 14px 40px; }
.invite {
  width: 100%; max-width: 480px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 24px;
}
.invite-head { border-bottom: 3px solid var(--accent); padding-bottom: 10px; margin-bottom: 16px; }
.invite-head .logo { font-size: 24px; }
.invite h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.3px; }
.invite h2 { font-size: 14px; margin: 20px 0 4px; }
.invite .btn { width: 100%; margin-top: 10px; }
.invite .row .btn { width: auto; flex: 1; }
.invite .slotgrid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.invite .slot { padding: 9px 4px; }
.ref-card {
  background: var(--info-bg); border-radius: 10px; padding: 12px 14px; margin: 16px 0; text-align: center;
}
.ref-card .k { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-2); }
.ref-card .v { font-size: 21px; font-weight: 700; letter-spacing: 1.5px; color: var(--accent); }
.invite-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 20px; }

/* preview frame used to show the invitation inside the app */
.phone-frame {
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--bg);
  max-height: 62vh; overflow: auto; padding: 8px;
}
.phone-frame .invite { box-shadow: none; max-width: 100%; }
.phone-frame .invite-wrap { min-height: 0; padding: 0; }

/* -------------------------------------------------------- audit entries */
.audit-detail { color: var(--ink-2); font-size: 12px; }
.act {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink-2);
}
.act.view { background: var(--info-bg); border-color: transparent; color: var(--accent); }
.act.create { background: var(--good-bg); border-color: transparent; color: var(--good); }
.act.export, .act.print { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.act.consent_change, .act.purge, .act.delete { background: var(--bad-bg); border-color: transparent; color: var(--bad); }

@media (max-width: 640px) {
  main { padding: 12px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .who { display: none; }
  .tabs { top: 49px; }
}
@media print { .topbar, .tabs, .demo-ribbon, .toasts { display: none; } }
