/* =============================================
   SmartCart v12 - Main Stylesheet
   ============================================= */
:root {
  --bg:        #0b1220;
  --panel:     #0f1b33;
  --text:      #e8eefc;
  --muted:     #a9b6d4;
  --line:      #223457;
  --primary:   #2f6bff;
  --success:   #00c853;
  --danger:    #ff4d4f;
  --warning:   #ffb020;
  --shadow:    0 10px 30px rgba(0,0,0,.35);
  --radius:    16px;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(47,107,255,.25), transparent 55%),
    radial-gradient(900px 500px at 20% 0%,   rgba(0,200,83,.18),   transparent 60%),
    var(--bg);
  color: var(--text); -webkit-text-size-adjust: 100%;
}

/* Layout */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 12px; padding: 12px; }
.controls { background: linear-gradient(180deg,rgba(17,31,59,.95),rgba(15,27,51,.95)); border: 1px solid rgba(34,52,87,.9); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }

/* Brand */
.brand { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(11,18,32,.45); border: 1px solid rgba(34,52,87,.7); margin-bottom: 10px; user-select: none; -webkit-tap-highlight-color: transparent; cursor: default; }
.brand h1 { margin: 0; font-size: 15px; line-height: 1.4; }
.pill { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: rgba(47,107,255,.18); border: 1px solid rgba(47,107,255,.35); color: var(--text); white-space: nowrap; margin-top: 2px; }

/* Nav */
.nav { display: flex; gap: 10px; margin: 10px 0; }
.tab { flex: 1; border: 1px solid rgba(34,52,87,.9); background: rgba(11,18,32,.4); color: var(--text); padding: 10px 8px; border-radius: 12px; cursor: pointer; transition: .15s; font-size: 13px; -webkit-tap-highlight-color: transparent; }
.tab.active { background: linear-gradient(180deg,rgba(47,107,255,.35),rgba(47,107,255,.12)); border-color: rgba(47,107,255,.55); }

/* Sections / Cards */
.section { background: rgba(11,18,32,.35); border: 1px solid rgba(34,52,87,.75); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.section h2 { margin: 0 0 10px; font-size: 14px; }
.card { background: rgba(11,18,32,.35); border: 1px solid rgba(34,52,87,.85); border-radius: 14px; padding: 12px; margin-bottom: 10px; }

/* Forms */
.row   { display: flex; gap: 10px; flex-wrap: wrap; }
.field { width: 100%; display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
label  { font-size: 12px; color: var(--muted); }
input, .select-input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid rgba(34,52,87,.95); background: rgba(11,18,32,.55); color: var(--text); outline: none; font-size: 16px; font-family: inherit; }
input::placeholder { color: rgba(169,182,212,.7); }
.select-input option { background: #0f1b33; color: var(--text); }

/* Buttons */
.btn { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid rgba(34,52,87,.95); background: rgba(11,18,32,.45); color: var(--text); cursor: pointer; transition: .15s; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-family: inherit; -webkit-tap-highlight-color: transparent; }
.btn:active  { transform: scale(.97); }
.btn:disabled{ opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg,rgba(47,107,255,.95),rgba(31,79,209,.92)); border-color: rgba(47,107,255,.7); }
.btn.success { background: linear-gradient(180deg,rgba(0,200,83,.9),rgba(0,150,62,.9)); border-color: rgba(0,200,83,.55); }
.btn.danger  { background: linear-gradient(180deg,rgba(255,77,79,.9),rgba(200,40,42,.9)); border-color: rgba(255,77,79,.55); }
.btn.warning { background: linear-gradient(180deg,rgba(255,176,32,.92),rgba(200,130,20,.92)); border-color: rgba(255,176,32,.55); color: #0b1220; font-weight: 700; }
.mini { width: auto; padding: 10px; font-size: 13px; }

.hint    { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 6px 0 0; }
.divider { border: 0; border-top: 1px solid rgba(34,52,87,.75); margin: 10px 0; }

/* Chip */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(34,52,87,.75); background: rgba(11,18,32,.45); font-size: 12px; }
.price-chip { border-color: rgba(0,200,83,.5); color: #86efac; font-weight: 700; }

/* Main */
.main { flex: 1; background: linear-gradient(180deg,rgba(17,31,59,.55),rgba(15,27,51,.35)); border: 1px solid rgba(34,52,87,.9); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.topbar  { display: none !important; }
.content { padding: 12px; min-height: 0; flex: 1; position: relative; }

/* Pages */
.page        { display: block; height: 100%; opacity: 0; pointer-events: none; position: absolute; inset: 0; }
.page.active { opacity: 1; pointer-events: auto; position: relative; }
#pageMap     { height: 100%; display: flex; flex-direction: column; }

/* Map */
#map { width: 100%; height: 62vh; height: 62dvh; min-height: 420px; max-height: 720px; border-radius: 16px; border: 1px solid rgba(34,52,87,.85); overflow: hidden; background: rgba(11,18,32,.25); touch-action: pan-x pan-y; overscroll-behavior: contain; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 10px 24px rgba(0,0,0,.35) !important; }
.leaflet-control-zoom a { width: 42px !important; height: 42px !important; line-height: 42px !important; font-size: 22px !important; border-radius: 12px !important; margin-bottom: 6px; background: #0f1b33 !important; color: #e8eefc !important; border: 1px solid rgba(34,52,87,.95) !important; }

/* Scanner */
.scanResult { padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(34,52,87,.85); background: rgba(11,18,32,.45); color: var(--text); font-size: 14px; line-height: 1.6; word-break: break-word; }
.scanArea { position: relative; width: 100%; max-width: 560px; margin: 0 auto; }
#reader   { width: 100%; max-width: 560px; margin: 0 auto; }
.scanOverlay { position:absolute; inset:0; pointer-events:none; display:grid; place-items:center; opacity:0; transition:.2s; }
.scanOverlay.on { opacity: 1; }
.scanFrame { width: min(88%,420px); height: min(35%,200px); border: 2px solid rgba(255,255,255,.65); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.12); }
.laser { width: calc(min(88%,420px) - 16px); height: 3px; border-radius: 999px; background: rgba(255,0,0,.88); box-shadow: 0 0 12px rgba(255,0,0,.75); position: absolute; animation: laserMove 1.6s linear infinite; }
@keyframes laserMove { 0%,100%{transform:translateY(calc(-0.5*min(35%,200px) + 8px))} 50%{transform:translateY(calc(0.5*min(35%,200px) - 8px))} }

/* Bill table */
.table { width: 100%; border-collapse: collapse; overflow: hidden; border-radius: 12px; border: 1px solid rgba(34,52,87,.75); }
.table th, .table td { padding: 10px; border-bottom: 1px solid rgba(34,52,87,.55); font-size: 13px; text-align: right; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 700; background: rgba(11,18,32,.35); }
.table tr:last-child td { border-bottom: none; }
.qtyBtns { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }

.billSummaryBar { margin-top: 14px; padding: 14px; border-radius: 16px; background: linear-gradient(90deg,rgba(47,107,255,.30),rgba(0,200,83,.22)); border: 1px solid rgba(47,107,255,.45); box-shadow: 0 12px 28px rgba(0,0,0,.22); display: flex; flex-direction: column; gap: 8px; }
.summaryItem { background: rgba(11,18,32,.45); border: 1px solid rgba(34,52,87,.7); border-radius: 14px; padding: 12px; text-align: center; }
.summaryLabel { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.summaryItem strong       { font-size: 26px; line-height: 1; }
.summaryItem.total strong { font-size: 30px; color: #ffffff; }

/* Modal */
.modalBack { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 9998; }
.modalBack.on { display: flex; }
.modal { width: min(520px,100%); background: rgba(15,27,51,.98); border: 1px solid rgba(34,52,87,.85); box-shadow: var(--shadow); border-radius: 16px; padding: 14px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 10px; font-size: 16px; }
.modal p  { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.admin-modal { border-color: rgba(124,58,237,.55) !important; background: rgba(20,12,45,.98) !important; }
.admin-modal h3 { color: #c4b5fd; }

/* Toast */
.toastContainer { position: fixed; top: max(14px,env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 999999; display: flex; flex-direction: column; gap: 10px; width: min(92vw,420px); pointer-events: none; }
.toast { opacity: 0; transform: translateY(-12px) scale(.98); transition: .25s ease; padding: 12px 14px; border-radius: 16px; background: rgba(15,27,51,.98); border: 1px solid rgba(47,107,255,.45); color: var(--text); box-shadow: 0 12px 30px rgba(0,0,0,.36); font-size: 14px; line-height: 1.5; text-align: center; backdrop-filter: blur(10px); }
.toast.show    { opacity: 1; transform: translateY(0) scale(1); }
.toast.success { border-color: rgba(0,200,83,.6);   box-shadow: 0 12px 30px rgba(0,200,83,.16); }
.toast.error   { border-color: rgba(255,77,79,.7);  box-shadow: 0 12px 30px rgba(255,77,79,.16); }
.toast.warning { border-color: rgba(255,176,32,.8); box-shadow: 0 12px 30px rgba(255,176,32,.16); }
.toast.admin   { border-color: rgba(124,58,237,.8); background: linear-gradient(180deg,rgba(30,10,60,.98),rgba(15,27,51,.98)); }

/* ═══ ADMIN MODE ═══ */
body.admin-mode .controls { border-color: rgba(124,58,237,.65); box-shadow: 0 0 0 1px rgba(124,58,237,.18),0 18px 40px rgba(124,58,237,.14); background: linear-gradient(180deg,rgba(20,12,50,.97),rgba(15,10,40,.97)); }
body.admin-mode .brand    { background: linear-gradient(135deg,rgba(124,58,237,.25),rgba(11,18,32,.55)); border-color: rgba(124,58,237,.6); }
body.admin-mode .pill     { background: rgba(124,58,237,.22); border-color: rgba(124,58,237,.6); color: #e9d5ff; font-weight: 700; }
body.admin-mode #modeBadge{ background: rgba(124,58,237,.3); border-color: rgba(124,58,237,.7); color: #e9d5ff; font-weight: 700; }
body.admin-mode .tab.active { background: linear-gradient(180deg,rgba(124,58,237,.4),rgba(124,58,237,.15)); border-color: rgba(124,58,237,.6); }
body.admin-mode #tabBill  { display: none !important; }

.admin-section { border-color: rgba(124,58,237,.4) !important; background: rgba(20,10,45,.4) !important; }
.admin-section h2 { color: #c4b5fd; }

.admin-mode-header { background: linear-gradient(90deg,rgba(124,58,237,.35),rgba(245,158,11,.2)); border: 1px solid rgba(124,58,237,.5); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #c4b5fd; }

.admin-btn-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-bottom: 8px; }
.admin-btn-grid .btn { font-size: 13px; padding: 10px 8px; }

.admin-access-area { display: flex; justify-content: center; padding: 10px 0 4px; margin-top: 6px; border-top: 1px solid rgba(34,52,87,.4); }
.admin-access-btn  { background: none; border: 1px solid rgba(34,52,87,.5); border-radius: 10px; color: rgba(169,182,212,.45); cursor: pointer; padding: 6px 18px; font-size: 16px; transition: .2s; -webkit-tap-highlight-color: transparent; }
.admin-access-btn:hover { color: var(--muted); border-color: rgba(124,58,237,.4); background: rgba(124,58,237,.08); }

/* ═══ ADMIN LOGIN FULL-SCREEN PAGE ═══ */
.admin-login-page { position: fixed; inset: 0; z-index: 99990; background: radial-gradient(800px 600px at 50% 0%,rgba(124,58,237,.3),transparent 60%), radial-gradient(600px 400px at 80% 100%,rgba(245,158,11,.15),transparent 50%), #06030f; display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.admin-login-card { width: min(460px,100%); background: rgba(15,9,35,.97); border: 1px solid rgba(124,58,237,.5); border-radius: 20px; padding: 32px 28px; box-shadow: 0 0 60px rgba(124,58,237,.25),0 20px 50px rgba(0,0,0,.5); text-align: center; }
.admin-login-icon  { font-size: 56px; margin-bottom: 12px; filter: drop-shadow(0 0 16px rgba(124,58,237,.6)); }
.admin-login-title { font-size: 24px; font-weight: 700; margin: 0 0 8px; background: linear-gradient(135deg,#c4b5fd,#f59e0b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.admin-login-sub   { font-size: 14px; color: #a9b6d4; margin: 0 0 24px; }
.admin-field { text-align: right; margin-bottom: 16px; }
.admin-field label { display: block; font-size: 13px; color: #a9b6d4; margin-bottom: 7px; font-weight: 600; }
.admin-field input { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid rgba(124,58,237,.45); background: rgba(124,58,237,.08); color: #e8eefc; font-size: 16px; outline: none; font-family: inherit; transition: border-color .2s; }
.admin-field input:focus { border-color: rgba(124,58,237,.75); box-shadow: 0 0 0 3px rgba(124,58,237,.15); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-left: 46px; }
.eye-btn { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #a9b6d4; cursor: pointer; font-size: 18px; padding: 4px; line-height: 1; }
.eye-btn:hover { color: #e8eefc; }
.admin-login-btn { width: 100%; padding: 15px; border-radius: 13px; border: none; cursor: pointer; font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 12px; background: linear-gradient(135deg,#7c3aed,#5b21b6); box-shadow: 0 8px 24px rgba(124,58,237,.4); transition: .2s; font-family: inherit; }
.admin-login-btn:hover    { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(124,58,237,.5); }
.admin-login-btn:active   { transform: scale(.98); }
.admin-login-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.admin-back-btn { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid rgba(124,58,237,.3); background: transparent; color: #a9b6d4; cursor: pointer; font-size: 14px; margin-bottom: 16px; transition: .2s; font-family: inherit; }
.admin-back-btn:hover { background: rgba(124,58,237,.1); color: #e9d5ff; }
.admin-login-hint { font-size: 12px; color: rgba(169,182,212,.65); line-height: 1.7; margin: 0; }
.admin-login-hint code { background: rgba(124,58,237,.2); padding: 2px 6px; border-radius: 5px; font-size: 11px; color: #c4b5fd; }

/* Smart List */
.smart-list-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(34,52,87,.75); background: rgba(11,18,32,.45); font-size: 13px; gap: 8px; transition: .2s; }
.smart-list-item.visited { background: rgba(0,200,83,.12); border-color: rgba(0,200,83,.45); opacity: .7; }
.smart-list-item.current { background: rgba(47,107,255,.18); border-color: rgba(47,107,255,.65); box-shadow: 0 0 10px rgba(47,107,255,.25); }
.smart-list-item-name    { flex: 1; font-weight: 600; }
.smart-list-item-price   { color: var(--muted); font-size: 12px; white-space: nowrap; }
.smart-list-item-remove  { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 6px; line-height: 1; }
.smart-list-item-num { width: 20px; height: 20px; border-radius: 50%; background: rgba(47,107,255,.3); border: 1px solid rgba(47,107,255,.6); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.smart-list-item.current .smart-list-item-num { background: rgba(47,107,255,.7); animation: pulse 1.2s ease-in-out infinite; }
.smart-list-item.visited .smart-list-item-num { background: rgba(0,200,83,.5); border-color: rgba(0,200,83,.8); }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }

/* Stats */
.stats-product-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: rgba(124,58,237,.1); border: 1px solid rgba(124,58,237,.3); border-radius: 10px; margin-bottom: 8px; gap: 8px; }
.stats-product-row .rank { font-size: 18px; }
.stats-product-row .name { flex: 1; font-weight: 700; font-size: 13px; }
.stats-product-row .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Offers */
.offer-card { background: linear-gradient(135deg,rgba(245,158,11,.12),rgba(245,158,11,.04)); border: 1px solid rgba(245,158,11,.45); border-radius: 14px; padding: 14px; margin-bottom: 8px; }
.offer-card .offer-title  { font-size: 15px; font-weight: 700; margin: 0 0 6px; }
.offer-card .offer-desc   { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.offer-card .offer-badge  { display: inline-block; background: rgba(245,158,11,.25); border:1px solid rgba(245,158,11,.5); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; color: #fde68a; }
.offer-card .offer-expire { font-size: 11px; color: var(--muted); margin-top: 6px; }
.offer-card-admin { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.3); border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.offer-card-admin .name { font-size: 13px; font-weight: 600; flex: 1; }
.offer-card-admin .del-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 6px; }

/* Bill offer applied */
.bill-offer-row { font-size: 13px; color: #fde68a; padding: 3px 0; display: flex; justify-content: space-between; }
.bill-offer-row .offer-saving { color: #22c55e; font-weight: 700; }

/* Invoice history detailed */
.history-item { background: rgba(47,107,255,.08); border: 1px solid rgba(47,107,255,.25); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.history-item .h-date   { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.history-item .h-total  { font-size: 18px; font-weight: 700; color: var(--success); margin: 0 0 6px; }
.history-item .h-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.history-item .h-count  { font-size: 12px; color: var(--muted); }
.history-item .h-method { display: inline-block; background: rgba(0,200,83,.15); border:1px solid rgba(0,200,83,.35); border-radius: 999px; padding: 2px 10px; font-size: 11px; }
.history-items-detail   { border-top: 1px solid rgba(34,52,87,.5); margin-top: 8px; padding-top: 8px; }
.history-item-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 5px 0; border-bottom: 1px solid rgba(34,52,87,.3); gap: 8px; }
.history-item-row:last-child { border-bottom: none; }
.history-item-row .h-item-name  { flex: 1; color: var(--text); }
.history-item-row .h-item-qty   { color: var(--muted); white-space: nowrap; }
.history-item-row .h-item-price { color: #86efac; font-weight: 700; white-space: nowrap; }

/* App loading */
.appLoading { position: fixed; inset: 0; z-index: 99999; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.appLoadingSpinner { width: 48px; height: 48px; border: 4px solid rgba(47,107,255,.25); border-top-color: #2f6bff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes laserMove  { 0%,100%{top:20%} 50%{top:75%} }
@keyframes laserScan  { 0%,100%{top:0} 50%{top:calc(100% - 3px)} }

/* Quagga video يملأ الحاوية */
#scanVideo video,
#scanVideo canvas { position:absolute!important; inset:0!important; width:100%!important; height:100%!important; object-fit:cover!important; }

/* ── Payment Modal ────────────────────────────────── */
.pay-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border-radius: 12px; border: none;
  font-size: 17px; font-weight: 700; cursor: pointer; margin-bottom: 10px;
  transition: transform .15s, opacity .15s;
}
.pay-btn:active { transform: scale(.97); opacity: .85; }

.apple-pay-btn {
  background: #000; color: #fff;
  -webkit-appearance: -apple-pay-button;
  -apple-pay-button-type: buy;
  -apple-pay-button-style: black;
}
/* Fallback for non-Safari */
@supports not (-webkit-appearance: -apple-pay-button) {
  .apple-pay-btn { background: #000; }
}

.google-pay-btn {
  background: #1a1a2e; color: #fff;
  border: 1px solid rgba(255,255,255,.15);
}

.pay-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0; color: #64748b; font-size: 12px;
}
.pay-divider::before, .pay-divider::after {
  content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.08);
}

.local-pay-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.pay-local-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1); border-radius: 14px;
  color: #e2e8f0; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.pay-local-btn:hover  { background: rgba(47,107,255,.12); border-color: rgba(47,107,255,.4); }
.pay-local-btn:active { transform: scale(.95); }
.pay-local-icon { font-size: 24px; }

/* Misc */
#expiryPhoneInput[readonly] { opacity: .9; cursor: not-allowed; background: rgba(47,107,255,.08); }
.bill-print-header { display: none; }

/* Responsive */
@media (max-width: 768px) {
  .app { padding: 10px; gap: 10px; }
  .brand { flex-direction: column; }
  .brand h1 { font-size: 14px; }
  .nav { position: sticky; top: 0; z-index: 20; background: rgba(11,18,32,.85); padding: 6px; border-radius: 14px; backdrop-filter: blur(8px); }
  .content { padding: 10px; }
  #map { height: calc(100dvh - 260px); min-height: 340px; max-height: none; border-radius: 14px; }
}
@media (max-width: 480px) {
  #map { height: calc(100dvh - 285px); min-height: 320px; }
  .btn { font-size: 13px; padding: 11px; }
  .admin-btn-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 981px) {
  .app { display: grid; grid-template-columns: 360px 1fr; gap: 16px; padding: 16px; min-height: 100vh; min-height: 100dvh; }
  .controls { position: sticky; top: 16px; height: calc(100vh - 32px); overflow: auto; }
  #map { height: calc(100vh - 32px - 56px - 24px); min-height: 560px; }
  .billSummaryBar { flex-direction: row; }
  .summaryItem { flex: 1; }
}

/* Print */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .app { display: block; }
  .controls,.nav,.topbar,.modalBack,.toastContainer,.no-print,.appLoading,.admin-login-page { display: none !important; }
  .main { box-shadow: none; border: none; background: transparent; }
  .page { position: static !important; opacity: 1 !important; pointer-events: auto !important; }
  #pageBill { display: block !important; }
  #pageMap,#pageScan { display: none !important; }
  .bill-print-header { display: block !important; }
  .table { border: 1px solid #333; }
  .table th,.table td { border: 1px solid #999; color: #000 !important; background: transparent !important; }
  .billSummaryBar { background: #f0f0f0 !important; border: 1px solid #ccc; color: #000; flex-direction: column; }
  .summaryLabel,.summaryItem strong,.summaryItem.total strong { color: #000 !important; }
  .card { border: 1px solid #ccc; background: transparent !important; }
  #billPrintHeader { display: block !important; color: #000 !important; }
}
