:root {
  color-scheme: light;
  --ink: #202225;
  --muted: #70747a;
  --subtle: #9a9da1;
  --line: #e5e3dd;
  --canvas: #f3f2ee;
  --paper: #fffefa;
  --paper-soft: #f8f7f3;
  --charcoal: #25282b;
  --accent: #e95e36;
  --accent-dark: #c94c29;
  --green: #287653;
  --green-soft: #edf4ef;
  --red: #ad463b;
  --red-soft: #fbefed;
  --radius: 19px;
  font-family: Inter, "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100dvh; background: var(--canvas); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .48; }
.hidden { display: none !important; }
.app-shell { width: 100%; max-width: 620px; min-height: 100dvh; margin: 0 auto; background: var(--canvas); }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid rgba(35,38,40,.07); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; position: relative; display: grid; place-items: center; border-radius: 12px; background: var(--charcoal); color: #fff; overflow: hidden; }
.brand-mark b { position: relative; z-index: 1; font-size: 14px; font-weight: 900; letter-spacing: -.7px; }
.brand-mark i { position: absolute; width: 33px; height: 4px; right: -7px; bottom: 8px; transform: rotate(-42deg); border-radius: 5px; background: var(--accent); }
.brand-copy { display: flex; flex-direction: column; gap: 3px; }
.brand-copy strong { font-size: 13px; font-weight: 850; letter-spacing: 1.05px; }
.brand-copy small { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.45px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.service-indicator { display: inline-flex; align-items: center; gap: 7px; color: #68766c; font-size: 10px; font-weight: 750; letter-spacing: .65px; white-space: nowrap; }
.service-indicator i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #31885d; }
.install-btn { min-height: 36px; padding: 0 13px; border: 1px solid #dedbd3; border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 700; }
main { padding: 27px 20px 0; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 0 2px 23px; }
.eyebrow { margin: 0 0 8px; color: var(--subtle); font-size: 10px; font-weight: 800; letter-spacing: 1.6px; }
.intro h1 { margin: 0; color: var(--ink); font-size: clamp(31px, 8vw, 39px); line-height: 1.02; letter-spacing: -1.8px; font-weight: 800; }
.subcopy { max-width: 360px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.intro-index { display: flex; align-items: center; gap: 7px; padding-bottom: 3px; color: #898b8b; font-size: 9px; font-weight: 800; letter-spacing: 1.1px; white-space: nowrap; }
.intro-index span:first-child { color: var(--accent); font-size: 12px; }
.intro-index i { width: 24px; height: 1px; background: #c9c6bd; }
.scanner-panel, .manual-panel, .history-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 4px 18px rgba(27,29,30,.025); }
.scanner-panel { padding: 18px; margin-bottom: 13px; }
.panel-head, .history-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-title-wrap { display: flex; align-items: center; gap: 11px; }
.section-index { width: 29px; height: 29px; display: grid; place-items: center; flex: none; border: 1px solid #e8e4dc; border-radius: 9px; color: var(--accent); font-size: 11px; font-weight: 850; }
.panel-title-wrap h2, .history-heading h2 { margin: 0; font-size: 16px; font-weight: 780; letter-spacing: -.35px; }
.panel-title-wrap p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.camera-state { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 99px; background: #f1f0ec; color: #747873; font-size: 10px; font-weight: 700; white-space: nowrap; }
.camera-state i { width: 6px; height: 6px; border-radius: 50%; background: #a2a49f; }
.camera-state.live { background: var(--green-soft); color: var(--green); }
.camera-state.live i { background: #31885d; box-shadow: 0 0 0 3px rgba(49,136,93,.12); }
.video-wrap { position: relative; display: grid; place-items: center; isolation: isolate; overflow: hidden; width: 100%; aspect-ratio: 4 / 3; max-height: 410px; margin-top: 17px; border-radius: 14px; background: #191d20; }
video { display: none; width: 100%; height: 100%; object-fit: cover; background: #191d20; }
.video-wrap.active video { display: block; }
.camera-placeholder { position: absolute; z-index: 1; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; padding: 22px; text-align: center; color: #f7f6f2; background: radial-gradient(ellipse at 50% 42%, #34383a 0, #272b2d 55%, #1c2022 100%); }
.video-wrap.active .camera-placeholder { display: none; }
.camera-placeholder strong { font-size: 15px; font-weight: 720; letter-spacing: -.2px; }
.camera-placeholder small { max-width: 245px; color: #b6b8b4; font-size: 12px; line-height: 1.5; }
.placeholder-symbol { position: relative; width: 94px; height: 64px; display: flex; justify-content: center; align-items: center; gap: 4px; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; background: rgba(255,255,255,.035); }
.placeholder-symbol span { display: block; height: 30px; background: #dddcd5; opacity: .9; }
.placeholder-symbol span:nth-child(1) { width: 3px; }.placeholder-symbol span:nth-child(2) { width: 7px; }.placeholder-symbol span:nth-child(3) { width: 2px; }.placeholder-symbol span:nth-child(4) { width: 5px; }
.placeholder-symbol b { position: absolute; width: 100%; height: 1px; background: var(--accent); opacity: .8; }
.scan-overlay { position: absolute; z-index: 2; left: 9%; right: 9%; top: 35%; height: 30%; border: 1px solid rgba(255,255,255,.48); border-radius: 7px; pointer-events: none; opacity: .88; }
.scan-corner { position: absolute; width: 18px; height: 18px; border-color: #fff; border-style: solid; }
.scan-corner.tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 6px 0 0; }
.scan-corner.tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 6px 0 0; }
.scan-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 6px; }
.scan-corner.br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 6px; }
.scan-beam { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(238,111,72,.95); box-shadow: 0 0 9px rgba(238,111,72,.5); opacity: .8; }
.video-wrap.active .scan-beam { animation: beam 1.65s ease-in-out infinite alternate; }
@keyframes beam { from { transform: translateY(-28px); opacity: .3; } to { transform: translateY(28px); opacity: 1; } }
.camera-caption { position: absolute; z-index: 3; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.16); border-radius: 7px; background: rgba(20,23,24,.58); color: #f1f1eb; font-size: 9px; font-weight: 750; letter-spacing: 1px; pointer-events: none; }
.camera-caption i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.camera-actions { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; gap: 8px; margin-top: 13px; }
.primary-btn, .text-btn, .icon-btn { min-height: 47px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; font-size: 12px; font-weight: 750; }
.primary-btn { padding: 0 16px; background: var(--charcoal); color: #fff; transition: background .15s, transform .15s; }
.primary-btn:active { background: #111416; transform: translateY(1px); }
.primary-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.text-btn { padding: 0 12px; background: #f2f1ed; color: #4f5356; }
.stop-btn { border: 1px solid #e8e5dd; background: transparent; }
.icon-btn { width: 47px; padding: 0; border: 1px solid #e7e3d9; background: #f8f7f2; color: #505453; }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.torch-btn.on { background: #fff1d7; color: #8a5c1e; border-color: #ecd7aa; }
.scanner-hint { min-height: 18px; margin: 11px 2px 0; color: #858981; font-size: 11px; line-height: 1.5; }
.manual-panel { padding: 16px 17px; margin-bottom: 13px; }
.manual-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.manual-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border: 1px solid #e9e5dc; border-radius: 10px; color: #686d68; }
.manual-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.manual-heading strong { display: block; font-size: 13px; font-weight: 760; }
.manual-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.manual-panel form { display: flex; gap: 8px; }
.input-wrap { min-width: 0; flex: 1; display: flex; align-items: center; padding: 0 12px; border: 1px solid #e6e3dc; border-radius: 10px; background: #fbfaf7; transition: border-color .15s, box-shadow .15s; }
.input-wrap:focus-within { border-color: #dca08b; box-shadow: 0 0 0 3px rgba(233,94,54,.08); }
.input-wrap input { width: 100%; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; letter-spacing: .1px; }
.input-wrap input::placeholder { color: #a5a69f; font-weight: 450; }
.manual-submit { min-width: 88px; padding: 0 15px; border: 0; border-radius: 10px; background: #ebe9e2; color: #343836; font-size: 12px; font-weight: 760; }
.manual-submit:active { background: #dedbd2; }
.history-section { padding: 17px 18px 10px; margin-bottom: 13px; }
.history-heading { margin-bottom: 13px; }
.history-heading .eyebrow { margin-bottom: 5px; }
.history-heading h2 { font-size: 15px; }
.count-pill { display: inline-grid; min-width: 22px; height: 22px; place-items: center; margin-left: 4px; padding: 0 6px; border-radius: 7px; background: #f0eee8; color: #60645e; font-size: 11px; vertical-align: 1px; }
.clear-btn { padding: 7px 0 7px 8px; border: 0; background: transparent; color: #8b8d87; font-size: 11px; font-weight: 650; }
.clear-btn:disabled { opacity: .35; }
.empty-state { min-height: 65px; display: flex; align-items: center; justify-content: center; gap: 9px; border-top: 1px solid #eeece6; color: #969891; font-size: 12px; }
.empty-icon { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; background: #f2f1ec; color: #8b8e87; }
.empty-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.results-list { display: flex; flex-direction: column; }
.history-row { min-height: 62px; display: grid; grid-template-columns: 31px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #eeece6; }
.history-marker { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; background: #f1f0eb; color: #747770; font-size: 12px; font-weight: 800; }
.history-marker.cod { background: var(--green-soft); color: var(--green); }
.history-marker.missing, .history-marker.error { background: var(--red-soft); color: var(--red); }
.history-marker.pending { background: #f3f2ee; color: #8c8e88; }
.history-details { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.history-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 740; letter-spacing: .05px; }
.history-details span { color: #8f928b; font-size: 10px; }
.history-value { color: #777b74; font-size: 11px; font-weight: 760; white-space: nowrap; }
.history-value.cod { color: var(--green); font-variant-numeric: tabular-nums; }
.history-value.missing, .history-value.error { color: #9a9b96; }
.app-footer { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 4px calc(17px + env(safe-area-inset-bottom)); color: #969891; font-size: 10px; }
.footer-mark { color: #656a64; font-size: 10px; font-weight: 850; letter-spacing: .9px; }
.result-dialog { width: min(100% - 18px, 450px); max-width: 450px; max-height: min(90dvh, 720px); margin: auto auto 0; padding: 0; overflow: auto; border: 1px solid rgba(35,38,40,.08); border-radius: 25px 25px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -16px 55px rgba(18,21,22,.18); }
.result-dialog::backdrop { background: rgba(19,22,22,.48); backdrop-filter: blur(4px); }
.dialog-grabber { width: 38px; height: 4px; margin: 11px auto 3px; border-radius: 99px; background: #d8d6cf; }
.dialog-content { position: relative; padding: 22px 23px calc(24px + env(safe-area-inset-bottom)); text-align: center; }
.modal-close { position: absolute; top: 13px; right: 15px; width: 34px; height: 34px; border: 1px solid #e8e5de; border-radius: 50%; background: transparent; color: #737670; font-size: 22px; line-height: 1; }
.modal-icon { width: 55px; height: 55px; display: grid; place-items: center; margin: 2px auto 15px; border-radius: 17px; background: #f1f0eb; color: #747771; font-size: 24px; font-weight: 700; }
.modal-icon.cod { background: var(--green-soft); color: var(--green); }
.modal-icon.non { background: #f0efea; color: #6d716b; }
.modal-icon.missing, .modal-icon.error { background: var(--red-soft); color: var(--red); }
.modal-icon.loading { background: #f7efeb; }
.modal-spinner { width: 23px; height: 23px; border: 2px solid #e9d8d0; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-eyebrow { margin: 0 0 7px; color: #96978f; font-size: 10px; font-weight: 780; letter-spacing: 1.4px; }
.dialog-content h2 { margin: 0; font-size: 25px; line-height: 1.15; letter-spacing: -.8px; font-weight: 790; }
.modal-message { max-width: 320px; margin: 9px auto 19px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.modal-resi-block { padding: 13px 14px; border: 1px solid #ebe8e1; border-radius: 12px; background: #f8f7f3; text-align: left; }
.modal-resi-block span, .modal-amount-panel span { display: block; margin-bottom: 7px; color: #969890; font-size: 9px; font-weight: 780; letter-spacing: 1.2px; }
.modal-resi-block strong { display: block; overflow-wrap: anywhere; font-size: 13px; font-weight: 760; letter-spacing: .1px; }
.modal-amount-panel { padding: 19px 13px 21px; margin-top: 10px; border: 1px solid #e1e9df; border-radius: 14px; background: #f1f6ef; text-align: center; }
.modal-amount-panel span { color: #6d8f75; }
.modal-amount-panel strong { display: block; color: var(--green); font-size: clamp(35px, 9vw, 42px); line-height: 1.1; letter-spacing: -1.3px; font-weight: 820; font-variant-numeric: tabular-nums; }
.modal-continue { width: 100%; min-height: 49px; margin-top: 15px; border: 0; border-radius: 11px; background: var(--charcoal); color: #fff; font-size: 13px; font-weight: 760; }
.modal-footnote { margin: 11px 0 0; color: #a0a199; font-size: 10px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(17px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); padding: 12px 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; background: #282c2c; color: #fff; font-size: 12px; font-weight: 650; text-align: center; box-shadow: 0 9px 28px rgba(0,0,0,.17); opacity: 0; transform: translate(-50%,12px); pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
@media (min-width: 700px) {
  body { padding: 25px 0; }
  .app-shell { min-height: calc(100dvh - 50px); border: 1px solid #e8e6df; border-radius: 24px; overflow: hidden; box-shadow: 0 16px 55px rgba(28,30,30,.07); }
  .result-dialog { margin: auto; border-radius: 25px; }
  .dialog-grabber { display: none; }
  .dialog-content { padding-top: 28px; }
}
@media (max-width: 390px) {
  .topbar { height: 69px; padding: 0 16px; }
  main { padding: 22px 13px 0; }
  .intro { padding-bottom: 17px; }
  .intro h1 { font-size: 32px; }
  .subcopy { font-size: 13px; }
  .scanner-panel { padding: 13px; }
  .panel-title-wrap h2 { font-size: 15px; }
  .panel-title-wrap p { font-size: 10px; }
  .camera-actions { gap: 6px; }
  .primary-btn { padding: 0 10px; font-size: 11px; }
  .text-btn { padding: 0 9px; font-size: 10px; }
  .icon-btn { width: 42px; }
  .manual-panel, .history-section { padding-left: 13px; padding-right: 13px; }
  .history-details strong { font-size: 11px; }
  .history-value { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
