:root {
  --bg: #090b0f;
  --bg-2: #11141a;
  --panel: #15191f;
  --panel-2: #1b2028;
  --panel-soft: #202630;
  --line: rgba(255,255,255,.10);
  --line-strong: rgba(255,255,255,.18);
  --text: #f7f8fb;
  --muted: #9fa8b6;
  --red: #ed1b2f;
  --red-2: #a50c1f;
  --gold: #f3c65d;
  --green: #42d68a;
  --danger: #ff5964;
  --shadow: 0 18px 50px rgba(0,0,0,.32);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(237,27,47,.14), transparent 30%),
    radial-gradient(circle at 88% 5%, rgba(87,112,255,.08), transparent 26%),
    linear-gradient(180deg, #080a0e, #10131a 48%, #090b10);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: #ff8590; }
.hidden { display: none !important; }

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 110px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 2px 20px;
}
.app-header img { width: 126px; max-height: 52px; object-fit: contain; }
.app-header h1 { margin: 0; font-size: 1.12rem; letter-spacing: .03em; }
.app-header p { margin: 3px 0 0; color: var(--muted); font-size: .86rem; }

.public-tabs, .role-tabs {
  display: flex;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  background: rgba(20,24,30,.78);
  backdrop-filter: blur(18px);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow-x: auto;
}
.public-tabs button, .role-tabs button {
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 13px;
  padding: 11px 16px;
  font-weight: 700;
  white-space: nowrap;
}
.public-tabs button.active, .role-tabs button.active {
  color: white;
  background: linear-gradient(135deg, var(--red), #a70d20);
  box-shadow: 0 8px 22px rgba(237,27,47,.22);
}

.panel, .operation-card, .list-panel, .detail-panel, .workspace > .grid > div {
  background: linear-gradient(180deg, rgba(26,31,39,.96), rgba(18,22,28,.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel, .operation-card { padding: 22px; margin-bottom: 18px; }
.public-card { max-width: 560px; margin: 24px auto; }
.public-card-head h2 { margin: 6px 0 8px; font-size: 1.75rem; }
.public-card-head p { color: var(--muted); line-height: 1.55; }
.eyebrow { margin: 0; color: #d4dae4; font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.section-help, .empty, .message { color: var(--muted); line-height: 1.55; }

.form { display: grid; gap: 14px; }
.form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form label { display: grid; gap: 7px; }
.form label > span, fieldset legend { font-size: .8rem; color: #c8d0dc; font-weight: 700; }
.form small { color: var(--muted); line-height: 1.45; }
input, select, textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.11);
  background: #0f1319;
  color: white;
  border-radius: 13px;
  padding: 12px 13px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(237,27,47,.8);
  box-shadow: 0 0 0 3px rgba(237,27,47,.12);
}
textarea { min-height: 110px; resize: vertical; }

.primary, .link-button, .icon-text, .danger-action, .export-row button, .choice-options button, .background-options button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 750;
}
.primary {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--red), #9f0d1e);
  box-shadow: 0 9px 22px rgba(237,27,47,.2);
}
.link-button, .icon-text, .export-row button, .choice-options button, .background-options button {
  color: #dce2ec;
  background: #151a21;
}
.link-button:hover, .icon-text:hover, .choice-options button:hover, .background-options button:hover { border-color: rgba(237,27,47,.55); }
.danger-action { color: white; background: #4e141d; border-color: rgba(255,89,100,.25); }
button:disabled { opacity: .4; cursor: not-allowed; }

.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 16px 0 14px;
}
.section-head h2 { margin: 3px 0; }
.section-head #staff-role { color: var(--muted); margin: 0; }

.toolbar, .admin-toolbar, .admin-history-search, .actions, .export-row {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.toolbar { margin-bottom: 14px; }
.toolbar input, .admin-toolbar input, .admin-history-search input { flex: 1 1 260px; }
.grid { display: grid; grid-template-columns: minmax(260px,.82fr) minmax(0,1.7fr); gap: 16px; }
.list-panel, .detail-panel { padding: 18px; }
.vehicle-list { display: grid; gap: 8px; max-height: 640px; overflow: auto; }
.vehicle-row {
  text-align: left; border: 1px solid var(--line); background: #11161d; color: white; border-radius: 13px; padding: 12px 13px;
}
.vehicle-row strong { display: block; }
.vehicle-row span { display: block; color: var(--muted); font-size: .82rem; margin-top: 3px; }
.vehicle-row:hover { border-color: rgba(237,27,47,.5); transform: translateY(-1px); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: linear-gradient(180deg,#181d24,#11151b); border: 1px solid var(--line); border-radius: 17px; padding: 18px; }
.stat-card span, .stat-card small { color: var(--muted); display: block; }
.stat-card strong { display: block; font-size: 1.8rem; margin: 6px 0; }
.admin-customer-grid { display: grid; grid-template-columns: minmax(220px,.8fr) minmax(0,1.2fr); gap: 14px; margin-top: 14px; }
.admin-customer-detail { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #11161d; }
.admin-actions, .campaign-admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.staff-access-list, .campaign-admin-list { display: grid; gap: 9px; margin-top: 14px; }
.staff-access-row, .campaign-admin-item, .history-record {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line); background:#11161d; border-radius: 13px;
}
.status-pill { padding: 4px 8px; border-radius: 999px; font-size: .72rem; margin-left: 8px; }
.status-active { background: rgba(66,214,138,.14); color: #71e5aa; }
.status-inactive { background: rgba(255,255,255,.08); color: var(--muted); }
.choice-options, .background-options { border: 0; padding: 0; display:flex; flex-wrap:wrap; gap:8px; }
.choice-options button.active, .background-options button.active { color: white; border-color: var(--red); background: rgba(237,27,47,.15); }
.permission-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.privacy-consent { grid-column:1/-1; display:grid; gap:9px; padding:14px; border:1px solid var(--line); border-radius:14px; background:#11161d; }
.consent { display:flex !important; grid-template-columns:auto 1fr !important; align-items:flex-start; gap:10px !important; color:#cbd2dd; font-size:.86rem; }
.consent input { width:auto; margin-top:3px; }

.scanner-frame { position:relative; max-width:460px; overflow:hidden; border-radius:16px; border:1px solid var(--line); margin:12px 0; }
.scanner-frame video { width:100%; display:block; }
.scanner-overlay { position:absolute; inset:0; border:2px solid rgba(237,27,47,.35); }
.scanner-line { position:absolute; left:12%; right:12%; height:2px; top:50%; background:var(--red); box-shadow:0 0 14px var(--red); animation:scan 2s ease-in-out infinite; }
@keyframes scan { 0%,100% { transform:translateY(-90px);} 50% { transform:translateY(90px);} }

/* PREMIUM CUSTOMER CARD */
.premium-loyalty-view { display: grid; gap: 14px; }
.premium-card-shell {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border: 1px solid rgba(255,76,91,.52);
  border-radius: 26px;
  padding: 24px;
  box-shadow: 0 26px 70px rgba(0,0,0,.44), inset 0 0 0 1px rgba(255,255,255,.04);
  isolation: isolate;
}
.premium-card-shell::before {
  content:""; position:absolute; inset:0; z-index:-2;
  background: linear-gradient(118deg, rgba(255,255,255,.03), transparent 42%), radial-gradient(circle at 80% 40%, rgba(237,27,47,.18), transparent 30%);
}
.premium-card-glow { position:absolute; width:380px; height:380px; right:-150px; top:-170px; border-radius:50%; background:rgba(237,27,47,.20); filter:blur(36px); z-index:-1; }
.premium-card-header { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.premium-brand-lockup { display:flex; align-items:center; gap:12px; min-width:0; }
.premium-card-logo { width:72px; max-height:42px; object-fit:contain; filter:drop-shadow(0 3px 10px rgba(0,0,0,.35)); }
.premium-brand-lockup p { margin:0; font-size:.86rem; font-weight:850; letter-spacing:.08em; text-transform:uppercase; }
.premium-brand-lockup small { color:#c0c6d0; font-size:.68rem; letter-spacing:.12em; text-transform:uppercase; }
.premium-card-qr-wrap { flex:0 0 auto; display:grid; justify-items:center; gap:4px; background:#fff; border-radius:14px; padding:7px; box-shadow:0 12px 28px rgba(0,0,0,.38); }
.premium-card-qr-wrap canvas { width:94px !important; height:94px !important; display:block; }
.premium-card-qr-wrap small { color:#16181b; font-size:.6rem; font-weight:800; letter-spacing:.06em; }
.premium-card-staff-tag { padding:7px 10px; border-radius:999px; color:#ffd1d5; border:1px solid rgba(237,27,47,.35); background:rgba(237,27,47,.12); font-size:.68rem; font-weight:800; }
.premium-card-title-row { display:flex; justify-content:space-between; align-items:center; gap:20px; margin:26px 0 22px; }
.premium-overline { margin:0 0 4px; color:#abb3bf; font-size:.67rem; letter-spacing:.18em; font-weight:800; }
.premium-card-title-row h2 { margin:0; font-size:clamp(1.9rem,4vw,3.3rem); letter-spacing:.04em; text-transform:uppercase; }
.premium-card-accent { display:flex; gap:5px; transform:skewX(-24deg); opacity:.75; }
.premium-card-accent span { width:15px; height:76px; background:linear-gradient(180deg,#d2182d,#640c18); display:block; }
.premium-card-accent span:nth-child(2) { background:#8f949d; }
.premium-card-accent span:nth-child(3) { background:#353b44; }
.premium-member-grid { display:grid; grid-template-columns:1.5fr 1fr 1fr; gap:12px; padding:16px 0; border-top:1px solid rgba(255,255,255,.13); border-bottom:1px solid rgba(255,255,255,.13); }
.premium-member-grid > div { min-width:0; }
.premium-member-grid span { display:block; color:#adb5c2; font-size:.72rem; margin-bottom:4px; }
.premium-member-grid strong { display:block; font-size:1rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.premium-member-grid small { color:#7f8997; font-size:.67rem; }
.premium-progress-head { display:flex; justify-content:space-between; gap:12px; margin-top:18px; font-size:.82rem; }
.premium-progress-head span { color:#d2d7df; }
.premium-progress-track { height:8px; border-radius:999px; background:rgba(255,255,255,.17); overflow:hidden; margin-top:9px; }
.premium-progress-track span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#ff243b,#e8162c 58%,#ff6675); box-shadow:0 0 14px rgba(237,27,47,.55); }

.premium-panel { background:linear-gradient(180deg,rgba(26,31,38,.98),rgba(16,20,26,.98)); border:1px solid var(--line); border-radius:20px; padding:18px; box-shadow:0 14px 32px rgba(0,0,0,.20); }
.premium-section-heading { display:flex; align-items:center; gap:11px; margin-bottom:15px; }
.premium-section-heading.compact { margin-bottom:12px; }
.premium-section-heading > div:nth-child(2) { min-width:0; }
.premium-section-heading p { margin:0; color:#c3cad5; font-size:.77rem; font-weight:800; letter-spacing:.04em; }
.premium-section-heading h3 { margin:3px 0 0; font-size:1rem; }
.premium-section-icon { flex:0 0 34px; height:34px; display:grid; place-items:center; border-radius:11px; background:#252c35; color:white; font-weight:900; }
.premium-section-icon.reward { color:#1a1506; background:linear-gradient(145deg,#ffe28a,#e3ad36); }
.premium-rule-note { margin-left:auto; color:var(--muted); font-size:.72rem; }

.premium-batch-tools, .premium-service-jump { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.premium-batch-tools strong { margin:auto; }
.premium-service-jump label { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.premium-service-jump input { width:100px; padding:8px 10px; }
.premium-service-jump small { color:var(--muted); }
.premium-text-action { border:0; background:transparent; color:#ff7b88; padding:8px 0; font-weight:800; }

.service-batch { margin-bottom:12px !important; }
.service-batch .batch-row { display:flex; justify-content:space-between; gap:10px; align-items:center; margin-bottom:12px; }
.service-batch .batch-row span { color:var(--muted); font-size:.76rem; }
.stamp-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.stamp {
  position:relative;
  min-height:112px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  border:1px solid rgba(255,255,255,.17);
  background:#11161d;
  color:#d6dce5;
  padding:10px 6px;
  text-align:center;
  transition:.18s ease;
}
button.stamp:hover { transform:translateY(-2px); border-color:rgba(237,27,47,.65); }
.stamp-circle { border-radius:999px; aspect-ratio:1; min-height:auto; }
.stamp-rounded { border-radius:22px; }
.stamp-hex { clip-path:polygon(25% 5%,75% 5%,100% 50%,75% 95%,25% 95%,0 50%); }
.stamp strong { font-size:1rem; }
.stamp small { color:#8f98a6; font-size:.68rem; }
.stamp.filled { color:white; background:radial-gradient(circle at 35% 30%,#ff3950,#d20f26 60%,#8c0b1a); border-color:#ff3a4f; box-shadow:inset 0 0 0 1px rgba(255,255,255,.08),0 6px 14px rgba(237,27,47,.18); }
.stamp.filled small { color:#ffe8eb; }
.stamp.missed { background:repeating-linear-gradient(135deg,#1b1e24,#1b1e24 7px,#242831 7px,#242831 14px); border-color:rgba(255,89,100,.38); color:#ff848e; }
.stamp.selected { outline:3px solid rgba(255,255,255,.7); outline-offset:2px; }
.stamp.reward { border-color:rgba(243,198,93,.7); box-shadow:0 0 0 1px rgba(243,198,93,.08); }
.stamp.reward-ready { background:radial-gradient(circle at 35% 30%,#f4d777,#b98727 68%,#76520c); border-color:#ffe18b; color:#191307; }
.reward-label { position:absolute; top:-8px; left:50%; transform:translateX(-50%); width:max-content; max-width:92%; padding:3px 7px; border-radius:999px; background:linear-gradient(135deg,#ffe990,#d7a32e); color:#231a05; font-size:.58rem; font-weight:900; box-shadow:0 4px 10px rgba(0,0,0,.24); }
.journey-note { margin:12px 0 0; color:var(--muted); font-size:.77rem; line-height:1.5; }

.premium-summary-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.premium-reward-highlight { display:grid; gap:5px; border-radius:14px; padding:13px; border:1px solid var(--line); background:#11161d; }
.premium-reward-highlight strong { font-size:1rem; }
.premium-reward-highlight span { color:var(--muted); font-size:.79rem; }
.premium-reward-highlight.status-redeemed { border-color:rgba(66,214,138,.32); background:rgba(66,214,138,.07); }
.premium-reward-highlight.status-not_eligible { border-color:rgba(255,89,100,.32); background:rgba(255,89,100,.07); }
.premium-summary-copy { color:var(--muted); margin:0; }

.premium-reward-record-list { display:grid; gap:8px; }
.premium-reward-record { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px; border-radius:13px; background:#11161d; border:1px solid var(--line); }
.premium-reward-record > div:first-child { display:grid; gap:2px; }
.premium-reward-record small { color:var(--muted); }
.premium-reward-record-actions { display:grid; justify-items:end; gap:6px; }
.premium-status-badge { display:inline-flex; padding:5px 8px; border-radius:999px; font-size:.67rem; font-weight:850; background:#242a33; color:#dfe5ee; }
.premium-status-badge.status-redeemed { background:rgba(66,214,138,.14); color:#72e8ad; }
.premium-status-badge.status-not_eligible { background:rgba(255,89,100,.14); color:#ff8c95; }
.premium-status-badge.status-eligible { background:rgba(243,198,93,.14); color:#f6d77e; }
.premium-mini-button { border:1px solid var(--line); color:white; background:#20262e; border-radius:9px; padding:6px 8px; font-size:.68rem; }

.premium-history-list { display:grid; gap:2px; }
.premium-history-row { display:grid; grid-template-columns:34px minmax(0,1fr) 110px 90px; gap:10px; align-items:center; padding:10px 4px; border-bottom:1px solid rgba(255,255,255,.07); }
.premium-history-row:last-child { border-bottom:0; }
.premium-history-icon { width:29px; height:29px; border-radius:50%; display:grid; place-items:center; background:rgba(66,214,138,.12); color:#65e4a5; font-weight:900; }
.premium-history-row.is-missed .premium-history-icon { background:rgba(255,89,100,.12); color:#ff7883; }
.premium-history-main { display:grid; gap:2px; min-width:0; }
.premium-history-main small, .premium-history-date { color:var(--muted); font-size:.72rem; }
.premium-history-status { justify-self:end; padding:5px 8px; border-radius:999px; font-size:.65rem; font-weight:850; }
.premium-history-status.completed { color:#72e8ad; background:rgba(66,214,138,.12); }
.premium-history-status.missed { color:#ff8c95; background:rgba(255,89,100,.12); }
.premium-activity-list { list-style:none; margin:0; padding:0; display:grid; gap:7px; }
.premium-activity-list li { display:grid; grid-template-columns:105px 1fr; gap:9px; padding:9px 0; border-bottom:1px solid rgba(255,255,255,.06); color:#dce1e9; }
.premium-activity-list span { color:var(--muted); font-size:.72rem; }

.campaign-card-list { display:grid; gap:9px; }
.campaign-card-item { border:1px solid var(--line); background:#11161d; border-radius:14px; padding:13px; }
.campaign-card-item > div { display:flex; justify-content:space-between; gap:10px; }
.campaign-card-item span { color:#ffd074; }
.campaign-card-item p, .campaign-card-item small { color:var(--muted); }

#stamp-form, .actions { margin-top:14px; }
#stamp-form { background:linear-gradient(180deg,#171c23,#10141a); border:1px solid var(--line); border-radius:18px; padding:18px; }

.bottom-nav {
  position:fixed;
  left:50%; bottom:14px; transform:translateX(-50%);
  z-index:20;
  display:flex;
  gap:3px;
  padding:7px;
  border:1px solid var(--line);
  background:rgba(18,22,28,.92);
  backdrop-filter:blur(18px);
  border-radius:19px;
  box-shadow:0 18px 50px rgba(0,0,0,.46);
}
.bottom-nav button { width:76px; border:0; background:transparent; color:#8f99a8; padding:8px 6px; border-radius:13px; display:grid; justify-items:center; gap:4px; }
.bottom-nav button.active { color:white; background:rgba(237,27,47,.14); }
.bottom-nav svg { width:20px; height:20px; fill:currentColor; }
.bottom-nav span { font-size:.65rem; font-weight:750; }

dialog { width:min(720px,calc(100% - 28px)); border:1px solid var(--line); border-radius:20px; color:white; background:#151a21; padding:20px; box-shadow:var(--shadow); }
dialog::backdrop { background:rgba(0,0,0,.72); backdrop-filter:blur(4px); }

@media (max-width: 820px) {
  .shell { width:min(100% - 18px,760px); padding-top:10px; }
  .grid, .admin-customer-grid, .form-grid, .premium-summary-grid, .permission-grid { grid-template-columns:1fr; }
  .stat-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .premium-card-shell { min-height:0; padding:18px; border-radius:22px; }
  .premium-card-title-row { margin:18px 0 16px; }
  .premium-card-title-row h2 { font-size:1.75rem; }
  .premium-card-accent { display:none; }
  .premium-member-grid { grid-template-columns:1fr 1fr; }
  .premium-member-wide { grid-column:1/-1; }
  .premium-card-qr-wrap canvas { width:78px !important; height:78px !important; }
  .premium-card-logo { width:58px; }
  .stamp-grid { grid-template-columns:repeat(4,minmax(68px,1fr)); overflow-x:auto; padding:4px 2px 10px; }
  .stamp { min-width:78px; min-height:78px; }
  .premium-history-row { grid-template-columns:30px minmax(0,1fr) auto; }
  .premium-history-date { display:none; }
  .premium-history-status { grid-column:3; }
  .premium-section-heading { align-items:flex-start; }
  .premium-rule-note { display:none; }
  .bottom-nav { bottom:8px; width:calc(100% - 18px); justify-content:space-around; }
  .bottom-nav button { width:auto; flex:1; }
}

@media (max-width: 520px) {
  .app-header img { width:105px; }
  .app-header h1 { font-size:1rem; }
  .public-tabs, .role-tabs { border-radius:14px; }
  .panel, .operation-card { padding:16px; border-radius:17px; }
  .stat-grid { grid-template-columns:1fr 1fr; gap:8px; }
  .stat-card { padding:13px; }
  .stat-card strong { font-size:1.45rem; }
  .premium-card-header { align-items:flex-start; }
  .premium-brand-lockup { gap:8px; }
  .premium-brand-lockup p { font-size:.72rem; }
  .premium-brand-lockup small { display:none; }
  .premium-card-qr-wrap { padding:5px; border-radius:11px; }
  .premium-card-qr-wrap canvas { width:68px !important; height:68px !important; }
  .premium-card-qr-wrap small { font-size:.5rem; }
  .premium-card-title-row h2 { font-size:1.45rem; }
  .premium-member-grid { gap:10px; }
  .premium-member-grid strong { font-size:.88rem; }
  .premium-progress-head { font-size:.72rem; }
  .premium-panel { padding:14px; border-radius:17px; }
  .stamp-grid { gap:7px; }
  .stamp { min-width:72px; min-height:72px; padding:7px 4px; }
  .stamp strong { font-size:.86rem; }
  .reward-label { font-size:.5rem; }
  .premium-reward-record { align-items:flex-start; }
  .premium-reward-record-actions { justify-items:start; }
  .premium-history-row { padding:9px 0; }
  .premium-history-status { font-size:.58rem; }
}

/* ===== Responsive application refinements ===== */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img, video, canvas { max-width: 100%; }

/* Wide web layout */
@media (min-width: 1200px) {
  .shell { width: min(1280px, calc(100% - 48px)); padding-top: 22px; }
  .dashboard { max-width: 1240px; margin: 0 auto; }
  .grid { grid-template-columns: minmax(300px,.78fr) minmax(0,1.72fr); gap: 20px; }
  .admin-customer-grid { grid-template-columns: minmax(280px,.78fr) minmax(0,1.22fr); gap: 18px; }
  .operation-card, .panel { padding: 26px; }
  .vehicle-list { max-height: 72vh; }
}

/* Tablet / small laptop */
@media (min-width: 821px) and (max-width: 1199px) {
  .shell { width: min(100% - 28px, 1050px); }
  .grid { grid-template-columns: minmax(240px,.8fr) minmax(0,1.4fr); }
  .admin-customer-grid { grid-template-columns: minmax(230px,.8fr) minmax(0,1.2fr); }
  .role-tabs { position: sticky; top: 8px; z-index: 15; }
}

/* Phone / tablet common */
@media (max-width: 820px) {
  body { padding-bottom: 84px; }
  .shell { width: min(100% - 16px, 760px); padding-bottom: 96px; }
  .app-header { padding: 8px 2px 12px; gap: 10px; }
  .app-header img { flex: 0 0 auto; }
  .section-head { align-items: flex-start; margin-top: 8px; }
  .section-head > div { min-width: 0; }
  .section-head h2 { font-size: clamp(1.18rem, 5vw, 1.55rem); }
  .section-head #staff-role { overflow-wrap: anywhere; }

  .public-tabs, .role-tabs {
    position: sticky;
    top: 4px;
    z-index: 18;
    margin-bottom: 12px;
    padding: 5px;
    gap: 5px;
    scrollbar-width: none;
  }
  .public-tabs::-webkit-scrollbar, .role-tabs::-webkit-scrollbar { display: none; }
  .public-tabs button, .role-tabs button { min-height: 44px; padding: 10px 13px; }

  .toolbar, .admin-toolbar, .admin-history-search, .actions, .export-row { align-items: stretch; }
  .toolbar input, .admin-toolbar input, .admin-history-search input { flex-basis: 100%; }
  .toolbar button, .admin-toolbar button, .admin-history-search button, .actions button, .export-row button { min-height: 44px; }

  .grid, .admin-customer-grid, .form-grid, .premium-summary-grid, .permission-grid { grid-template-columns: 1fr; }
  .list-panel, .detail-panel { padding: 14px; }
  .vehicle-list { max-height: 42vh; }
  .admin-customer-detail { min-height: 110px; }
  .staff-access-row, .campaign-admin-item, .history-record { align-items: flex-start; flex-direction: column; }
  .campaign-admin-actions { width: 100%; }
  .campaign-admin-actions button { flex: 1 1 auto; }
  .privacy-consent { grid-column: 1; }

  input, select, textarea { min-height: 44px; font-size: 16px; }
  textarea { min-height: 120px; }
  button { touch-action: manipulation; }

  .bottom-nav {
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100% - 16px);
    max-width: 560px;
    padding: 6px;
    border-radius: 18px;
  }
  .bottom-nav button { min-height: 48px; }
  .bottom-nav span { font-size: .68rem; }
  dialog { width: calc(100% - 16px); max-height: calc(100vh - 28px); overflow: auto; padding: 16px; }
}

/* Small phone */
@media (max-width: 520px) {
  .shell { width: calc(100% - 12px); padding-top: 6px; }
  .app-header { padding-inline: 4px; }
  .app-header img { width: 92px; }
  .app-header h1 { font-size: .96rem; }
  .app-header p { font-size: .75rem; }
  .panel, .operation-card { padding: 14px; border-radius: 16px; }
  .public-card { margin: 12px auto; }
  .public-card-head h2 { font-size: 1.42rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { min-width: 0; padding: 12px; }
  .stat-card span, .stat-card small { font-size: .72rem; }
  .stat-card strong { font-size: 1.35rem; }
  .choice-options, .background-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .choice-options button, .background-options button { width: 100%; }
  .consent { font-size: .8rem; }
  .scanner-frame { max-width: 100%; }
}

/* Very small phone */
@media (max-width: 380px) {
  .shell { width: calc(100% - 8px); }
  .stat-grid { grid-template-columns: 1fr; }
  .public-tabs button, .role-tabs button { padding-inline: 10px; font-size: .82rem; }
  .choice-options, .background-options { grid-template-columns: 1fr; }
}

/* ===== Native app on phone + roomier web workspace v2 ===== */

/* Large desktop workspace */
@media (min-width: 1360px) {
  .shell { width: min(1440px, calc(100% - 64px)); }
  .dashboard { max-width: 1400px; }
  .grid { grid-template-columns: minmax(320px, .72fr) minmax(0, 1.78fr); gap: 22px; }
  .admin-customer-grid { grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr); gap: 22px; }
  .operation-card, .panel { padding: 28px; }
  .role-tabs { max-width: 1080px; margin-inline: auto; }
}

/* Desktop: navigation looks like a web app toolbar instead of a mobile dock. */
@media (min-width: 821px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 24px; }
  .role-tabs {
    position: sticky;
    top: 10px;
    z-index: 18;
    backdrop-filter: blur(16px);
  }
}

/* Phone native-app treatment */
@media (max-width: 820px) {
  body {
    background: #080b0f;
    min-height: 100dvh;
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }
  .shell {
    width: 100%;
    max-width: none;
    padding: 0 8px calc(96px + env(safe-area-inset-bottom));
  }
  .app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: 0 -8px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 10px;
    background: rgba(8,11,15,.94);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .app-header img { width: 96px; }
  .app-header h1 { font-size: .98rem; }
  .app-header p { font-size: .72rem; }
  .section-head { padding-inline: 6px; }
  .public-tabs, .role-tabs {
    position: sticky;
    top: calc(58px + env(safe-area-inset-top));
    z-index: 25;
    margin: 6px 0 10px;
    border-radius: 14px;
    background: rgba(18,22,28,.92);
    backdrop-filter: blur(16px);
  }
  .workspace { min-width: 0; }
  .panel, .operation-card {
    border-radius: 15px;
    padding: 14px;
    margin-bottom: 10px;
  }
  .grid, .admin-customer-grid { gap: 10px; }
  .list-panel, .detail-panel { border-radius: 14px; }
  .toolbar, .admin-toolbar, .admin-history-search, .actions, .export-row {
    gap: 8px;
  }
  input, select, textarea, button { border-radius: 11px; }
  input, select, textarea { width: 100%; font-size: 16px; }
  button { min-height: 44px; }
  .vehicle-row { padding: 12px; border-radius: 12px; }
  .bottom-nav {
    display: flex;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    transform: none;
    bottom: max(8px, env(safe-area-inset-bottom));
    border-radius: 18px;
    padding: 6px;
    background: rgba(18,22,28,.96);
    box-shadow: 0 12px 32px rgba(0,0,0,.48);
  }
  .bottom-nav button { min-width: 0; flex: 1 1 0; min-height: 50px; }
  .bottom-nav svg { width: 19px; height: 19px; }
  .bottom-nav span { font-size: .64rem; }
  dialog {
    border-radius: 18px 18px 0 0;
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    max-height: 88dvh;
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  }
}

/* Small phones */
@media (max-width: 480px) {
  .shell { padding-inline: 6px; }
  .app-header { margin-inline: -6px; padding-inline: 10px; }
  .app-header img { width: 88px; }
  .public-tabs button, .role-tabs button { padding: 9px 10px; font-size: .78rem; }
  .panel, .operation-card { padding: 12px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .stat-card { padding: 11px; }
  .stat-card strong { font-size: 1.28rem; }
  .bottom-nav { left: 6px; right: 6px; }
}

@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr; }
  .bottom-nav span { font-size: .6rem; }
  .bottom-nav svg { width: 18px; height: 18px; }
}


/* Staff access action buttons */
.staff-access-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.staff-access-actions .staff-delete-button {
  min-width: 72px;
}

@media (max-width: 640px) {
  .staff-access-actions {
    width: 100%;
    justify-content: stretch;
  }

  .staff-access-actions > button {
    flex: 1 1 0;
    min-height: 42px;
  }
}


/* Three-level Staff Access controls */
.staff-access-level-guide {
  margin: 14px 0 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.staff-access-level-guide > strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
}
.staff-access-level-guide p {
  margin: 5px 0;
  color: var(--muted, #aeb7c6);
  line-height: 1.45;
}
.staff-access-actions .staff-delete-button {
  min-width: 108px;
}
.staff-access-actions .staff-permanent-delete-button {
  min-width: 142px;
  background: #6f111a;
  border-color: #a92b37;
}
.staff-access-actions .staff-permanent-delete-button:hover {
  background: #8b1521;
}
@media (max-width: 720px) {
  .staff-access-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .staff-access-actions .staff-permanent-delete-button {
    grid-column: 1 / -1;
  }
}

/* =========================================================
   PDPA SUMMARY & RECORDS
   ========================================================= */
.pdpa-dashboard-card .stat-grid{margin-top:16px}
.pdpa-toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:18px 0}
.pdpa-toolbar select,.pdpa-toolbar button{min-height:42px}
.pdpa-list{display:grid;gap:10px}
.pdpa-row{display:grid;grid-template-columns:minmax(0,1.6fr) repeat(3,minmax(110px,.7fr)) auto;gap:12px;align-items:center;padding:14px;border:1px solid rgba(128,128,128,.18);border-radius:14px;background:rgba(255,255,255,.02)}
.pdpa-row strong,.pdpa-row span,.pdpa-row small{display:block}
.pdpa-row .pdpa-customer-meta small{opacity:.7;margin-top:4px}
.pdpa-status{font-weight:800}
.pdpa-status.yes{color:#14804a}
.pdpa-status.no{color:#b42318}
.pdpa-row button{white-space:nowrap}
.pdpa-dialog{width:min(760px,94vw);max-height:90vh;border:0;border-radius:20px;padding:0}
.pdpa-dialog::backdrop{background:rgba(0,0,0,.55)}
.pdpa-dialog-body{padding:22px;max-height:86vh;overflow:auto}
.pdpa-record-sheet{background:#fff;color:#111;border-radius:16px;padding:20px}
.pdpa-record-head{border-bottom:2px solid #111;padding-bottom:14px;margin-bottom:16px}
.pdpa-record-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 20px;margin:14px 0}
.pdpa-record-grid div{padding:8px 0;border-bottom:1px solid #ddd}
.pdpa-history-list{display:grid;gap:8px;margin-top:12px}
.pdpa-history-item{padding:10px 12px;border:1px solid #ddd;border-radius:10px}
.pdpa-history-item small{display:block;margin-top:4px;color:#666}
@media(max-width:760px){
  .pdpa-row{grid-template-columns:1fr 1fr}
  .pdpa-row .pdpa-customer-meta{grid-column:1/-1}
  .pdpa-row button{grid-column:1/-1;width:100%}
  .pdpa-record-grid{grid-template-columns:1fr}
}
@media print{
  body.pdpa-print-mode *{visibility:hidden!important}
  body.pdpa-print-mode #pdpa-record-dialog,
  body.pdpa-print-mode #pdpa-record-dialog *{visibility:visible!important}
  body.pdpa-print-mode #pdpa-record-dialog{position:absolute;inset:0;width:100%;max-height:none;border-radius:0}
  body.pdpa-print-mode #pdpa-record-dialog .section-head button,
  body.pdpa-print-mode #pdpa-record-dialog .actions{display:none!important}
}

/* PDPA choice-change workflow */
.pdpa-row-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.pdpa-choice-box{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.pdpa-choice-box label{margin:0}
.pdpa-history-item small strong{color:inherit}
@media(max-width:720px){.pdpa-row-actions{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr}.pdpa-row-actions button{width:100%}.pdpa-choice-box{grid-template-columns:1fr}}
