/* Saraswati Provision Store: crisp red + white, mobile-only frame */
:root {
  --red: #DC2626;
  --red-d: #B91C1C;
  --red-l: #FEE2E2;
  --rose: #FEF2F2;
  --rose-b: #FECACA;
  --green: #16A34A;
  --green-l: #DCFCE7;
  --ink: #111827;
  --muted: #6B7280;
  --line: #F1E1E1;
  --page: #F3F4F6;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--ink); }
body {
  font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Gujarati', 'Noto Sans Devanagari', 'Nirmala UI', sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------- mobile-only frame (max-w-[430px] mx-auto min-h-screen shadow-2xl) ---------- */
.frame {
  position: relative; width: 100%; min-width: 320px; max-width: 430px; margin: 0 auto;
  height: 100vh; height: 100dvh; min-height: 100vh; min-height: 100dvh;
  background: #fff; overflow: hidden;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);
}
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: #fff; }

/* ---------- header ---------- */
.hdr {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: calc(8px + var(--safe-t)) 10px 8px; background: #fff;
  border-bottom: 2px solid var(--red); z-index: 3;
}
.hdr .title { flex: 1; min-width: 0; line-height: 1.2; }
.hdr .title b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr .title .sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; color: var(--muted); }
.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; object-fit: cover; background: var(--rose); border: 2px solid var(--red-l); }
.avatar.sm { width: 36px; height: 36px; }
.initial { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none; background: var(--red-l); color: var(--red-d); font-weight: 700; font-size: 18px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; font-size: 22px; color: var(--red); flex: none; }
.icon-btn:active { background: var(--rose); }
.icon-btn.sm { width: 36px; height: 36px; font-size: 18px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-l); color: var(--green); }
.badge.red { background: var(--red-l); color: var(--red-d); }
.badge.plain::before { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--red); color: #fff; font-weight: 700; text-decoration: none; }
.btn:active { background: var(--red-d); }
.btn[disabled] { opacity: .55; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.btn.green { background: var(--green); }
.btn.light { background: var(--rose); color: var(--red-d); }
.btn-sm { min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.call-btn { min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 15px; }

/* ---------- banners ---------- */
.bar { display: flex; align-items: center; gap: 10px; flex: none; padding: 8px 12px; background: var(--rose); border-bottom: 1px solid var(--rose-b); font-size: 14px; }
.bar > span, .bar .a2hs-text { flex: 1; min-width: 0; }
.bar img { border-radius: 50%; flex: none; }
.a2hs-text b { display: block; }
.a2hs-text span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.25; }
.bar.warn { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.bar.alarm { background: var(--red); color: #fff; border: 0; font-weight: 700; cursor: pointer; animation: pulse 1s infinite; }
@keyframes pulse { 50% { background: var(--red-d); } }

/* ---------- messages ---------- */
.msgs {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 12px 6px;
  background-color: #fff;
  background-image: radial-gradient(#FBE4E4 1.2px, transparent 1.2px); background-size: 20px 20px;
  scroll-behavior: smooth;
}
.day-sep { display: flex; justify-content: center; margin: 12px 0 8px; }
.day-sep span { padding: 3px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--rose-b); color: var(--muted); font-size: 12px; font-weight: 600; }
.row { display: flex; margin: 4px 0; }
.row.me { justify-content: flex-end; }
.row.them { justify-content: flex-start; }
.row.sys { justify-content: center; }
.sys-note { padding: 3px 12px; border-radius: 999px; background: #F3F4F6; color: var(--muted); font-size: 12px; }
.bubble { position: relative; max-width: 82%; padding: 8px 11px 5px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgb(0 0 0 / .05); }
.row.them .bubble { background: var(--rose); border: 1px solid var(--rose-b); border-bottom-left-radius: 4px; }
.row.me .bubble { background: var(--red); color: #fff; border-bottom-right-radius: 4px; }
.bubble .txt { font-size: 15.5px; line-height: 1.38; }
.bubble .cap { margin-top: 5px; }
.bubble .meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 2px; font-size: 11px; opacity: .72; }
.row.me .meta .state.ok { letter-spacing: -2px; }
.bubble .state.failed { color: #FEF08A; font-weight: 700; opacity: 1; cursor: pointer; }
.row.them .bubble .state.failed { color: var(--red); }
.photo { display: block; width: 100%; max-width: 260px; max-height: 320px; object-fit: cover; border-radius: 10px; cursor: zoom-in; background: #eee; }
.bubble audio { display: block; width: 230px; max-width: 100%; height: 40px; }
.auto-tag { font-size: 11px; font-weight: 700; color: var(--red-d); margin-bottom: 2px; }
.bubble-card { padding: 6px 6px 4px; background: #fff !important; color: var(--ink) !important; border: 1.5px solid var(--green) !important; width: 82%; }
.bubble-card .meta { padding: 0 6px; }
.status-card { padding: 6px 8px 4px; }
.st-head { display: flex; align-items: center; gap: 10px; }
.st-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--green-l); font-size: 20px; flex: none; }
.st-title b { display: block; color: var(--green); font-size: 15.5px; line-height: 1.25; }
.st-title small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.st-bill { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--rose); border: 1px dashed var(--red); }
.st-bill span { font-size: 13px; color: var(--muted); }
.st-bill b { font-size: 20px; color: var(--red); }
.st-note { margin-top: 6px; font-size: 13.5px; color: var(--ink); }
.typing { display: flex; gap: 4px; padding: 12px 14px !important; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); opacity: .35; animation: blink 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; } .typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 40% { opacity: 1; transform: translateY(-2px); } }

/* ---------- composer ---------- */
.composer { display: flex; align-items: flex-end; gap: 6px; flex: none; padding: 8px 8px calc(8px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line); }
.composer .field { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--rose); border: 1px solid var(--rose-b); border-radius: 22px; padding: 2px 4px 2px 14px; }
.composer textarea { flex: 1; min-width: 0; max-height: 120px; padding: 9px 0; border: 0; outline: 0; background: transparent; resize: none; line-height: 1.35; font-size: 16px; }
.composer .icon-btn { width: 40px; height: 40px; font-size: 21px; }
.send-btn { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--red); color: #fff; font-size: 20px; box-shadow: 0 2px 6px rgb(220 38 38 / .35); }
.send-btn:active { background: var(--red-d); }
.send-btn[disabled] { opacity: .45; box-shadow: none; }
.quick { display: flex; gap: 6px; flex: none; padding: 8px 8px 0; overflow-x: auto; background: #fff; border-top: 1px solid var(--line); scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; min-height: 38px; padding: 0 13px; border-radius: 999px; border: 1.5px solid var(--red); background: #fff; color: var(--red); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.chip-btn.green { border-color: var(--green); color: var(--green); }
.chip-btn:active { background: var(--rose); }
.rec-bar { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 23px; background: var(--rose); border: 1px solid var(--rose-b); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: pulse2 1s infinite; flex: none; }
@keyframes pulse2 { 50% { transform: scale(.6); opacity: .5; } }
.rec-bar b { font-variant-numeric: tabular-nums; }
.rec-bar small { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- drawer ---------- */
.scrim { position: absolute; inset: 0; background: rgb(17 24 39 / .45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer { position: absolute; top: 0; bottom: 0; left: 0; width: 84%; max-width: 340px; background: #fff; z-index: 21; transform: translateX(-102%); transition: transform .24s ease; display: flex; flex-direction: column; box-shadow: 8px 0 30px rgb(0 0 0 / .18); }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: calc(18px + var(--safe-t)) 16px 16px; background: var(--red); color: #fff; }
.drawer-head .avatar { width: 52px; height: 52px; border-color: #fff; }
.drawer-head b { display: block; font-size: 16px; line-height: 1.25; }
.drawer-head small { opacity: .9; font-size: 12px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 0 calc(16px + var(--safe-b)); }
.sec { padding: 14px 16px 6px; }
.sec h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { min-height: 52px; padding: 4px; border-radius: 12px; border: 1.5px solid var(--rose-b); background: #fff; display: grid; place-items: center; line-height: 1.15; }
.seg button b { font-size: 16px; }
.seg button small { font-size: 11px; color: var(--muted); }
.seg button.on { background: var(--red); border-color: var(--red); color: #fff; }
.seg button.on small { color: #fff; opacity: .85; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14.5px; border-bottom: 1px dashed var(--line); }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; font-weight: 600; }
.note { margin: 8px 0 0; padding: 8px 10px; background: var(--rose); border-radius: 10px; font-size: 13.5px; }
.menu-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 12px; margin: 4px 0; border: 1.5px solid var(--rose-b); border-radius: 12px; background: #fff; font-weight: 600; text-align: left; }
.menu-btn .ico { font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- forms / onboarding ---------- */
.form-screen { overflow-y: auto; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: calc(28px + var(--safe-t)) 24px 12px; }
.hero .avatar { width: 84px; height: 84px; border-width: 3px; }
.hero h1 { margin: 12px 0 4px; font-size: 21px; line-height: 1.25; }
.hero p { margin: 0; color: var(--muted); font-size: 14.5px; }
.hero .tag { margin-top: 8px; color: var(--red); font-weight: 700; font-size: 13px; }
.lang-mini { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.lang-mini button { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--rose-b); background: #fff; font-weight: 600; font-size: 14px; }
.lang-mini button.on { background: var(--red); color: #fff; border-color: var(--red); }
.form { padding: 8px 20px calc(24px + var(--safe-b)); }
.fld { margin: 12px 0; }
.fld label { display: block; margin-bottom: 5px; font-size: 13.5px; font-weight: 700; }
.fld input, .fld textarea, .fld select { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--rose-b); border-radius: 12px; background: #fff; outline: 0; font-size: 16px; }
.fld textarea { min-height: 84px; resize: vertical; }
.fld input:focus, .fld textarea:focus, .fld select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgb(220 38 38 / .12); }
.fld.bad input, .fld.bad textarea { border-color: var(--red); background: var(--rose); }
.fld .err { display: none; margin-top: 4px; color: var(--red); font-size: 13px; }
.fld.bad .err { display: block; }
.fld .pre { position: relative; }
.fld .pre span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.fld .pre input { padding-left: 50px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- bottom sheet ---------- */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 88%; overflow-y: auto; padding: 16px 16px calc(16px + var(--safe-b)); background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 30px rgb(0 0 0 / .2); transform: translateY(105%); transition: transform .22s ease; }
.sheet.open { transform: none; }
.sheet h3 { margin: 0 0 10px; font-size: 17px; }
.sheet .preview { display: block; width: 100%; max-height: 42vh; object-fit: contain; border-radius: 12px; background: #111; }
.sheet .actions { display: flex; gap: 8px; margin-top: 12px; }
.sheet .actions .btn { flex: 1; }
.scrim.sheet-scrim { z-index: 30; }

/* ---------- misc ---------- */
#toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translate(-50%, 20px); max-width: min(90vw, 390px); padding: 10px 16px; border-radius: 12px; background: #111827; color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 99; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.viewer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgb(0 0 0 / .92); }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-x { position: absolute; top: calc(10px + var(--safe-t)); right: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgb(255 255 255 / .18); color: #fff; font-size: 20px; }
.loading { display: grid; place-items: center; flex: 1; color: var(--muted); }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--red-l); border-top-color: var(--red); animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- admin ---------- */
.lock { align-items: center; padding: calc(30px + var(--safe-t)) 24px 24px; text-align: center; overflow-y: auto; }
.lock .avatar { width: 84px; height: 84px; border-width: 3px; }
.lock h1 { margin: 12px 0 2px; font-size: 20px; }
.dots { display: flex; gap: 14px; justify-content: center; margin: 22px 0 6px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--red); }
.dots i.on { background: var(--red); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.pin-err { min-height: 20px; color: var(--red); font-size: 14px; font-weight: 600; }
.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 14px; margin: 14px auto 0; justify-content: center; }
.keypad button { width: 74px; height: 74px; border-radius: 50%; border: 1.5px solid var(--rose-b); background: #fff; font-size: 26px; font-weight: 600; }
.keypad button:active { background: var(--rose); }
.keypad .ghost-k { border: 0; background: transparent; font-size: 22px; color: var(--red); }
.inbox { flex: 1; overflow-y: auto; }
.chat-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.chat-item:active { background: var(--rose); }
.chat-item.unread { background: #FFF7F7; }
.ci-main { flex: 1; min-width: 0; }
.ci-top { display: flex; align-items: center; gap: 6px; }
.ci-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.ci-time { font-size: 12px; color: var(--muted); flex: none; }
.chat-item.unread .ci-time { color: var(--red); font-weight: 700; }
.ci-bot { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.ci-bot .prev { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--muted); }
.chat-item.unread .prev { color: var(--ink); font-weight: 600; }
.lang-tag { flex: none; padding: 1px 7px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.count { flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.ci-call { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--red); color: #fff; text-decoration: none; font-size: 18px; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty .big { font-size: 44px; }
.pill-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px 0 10px; border-radius: 999px; border: 0; font-weight: 800; font-size: 13px; letter-spacing: .03em; }
.pill-toggle.on { background: var(--green-l); color: var(--green); }
.pill-toggle.off { background: var(--red-l); color: var(--red-d); }
.pill-toggle::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.addr { display: flex; gap: 8px; align-items: flex-start; flex: none; padding: 7px 12px; background: var(--rose); border-bottom: 1px solid var(--rose-b); font-size: 13.5px; }
.addr span:last-child { flex: 1; min-width: 0; }
.settings { flex: 1; overflow-y: auto; padding: 4px 16px calc(24px + var(--safe-b)); }
.card { margin: 12px 0; padding: 14px; border: 1.5px solid var(--rose-b); border-radius: 16px; background: #fff; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.sw-row small { display: block; color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 56px; height: 32px; flex: none; border: 0; border-radius: 16px; background: #D1D5DB; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(24px); }
.switch[disabled] { opacity: .5; }
.big-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-radius: 16px; border: 2px solid var(--red); background: var(--rose); }
.big-toggle.on { border-color: var(--green); background: #F0FDF4; }
.big-toggle b { font-size: 18px; }
.big-toggle .switch { width: 68px; height: 38px; }
.big-toggle .switch::after { width: 32px; height: 32px; }
.big-toggle .switch.on::after { transform: translateX(30px); }

/* polish */
#hdrHours { white-space: nowrap; font-size: 11.5px; }
.hdr .title .sub { flex-wrap: nowrap; overflow: hidden; }

.demo-flag { position: absolute; left: 0; right: 0; bottom: 0; z-index: 25; padding: 6px 12px calc(6px + var(--safe-b)); background: #FEF3C7; color: #92400E; border-top: 1px solid #FDE68A; font-size: 12px; font-weight: 600; line-height: 1.3; text-align: center; pointer-events: none; }

/* onboarding: behave like a normal scrolling page so the phone keyboard never makes the layout jump */
.frame.flow { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
.frame.flow .screen.form-screen { position: relative; inset: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }

.menu-btn.danger { background: var(--red-l); color: var(--red-d); }
.btn.danger-btn { background: var(--red-d); }
.sheet p.muted { line-height: 1.45; }
