@import url('/css/tokens.css');

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.boot { flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--ink-2); }

.topbar { display: flex; align-items: center; gap: 8px; padding: 12px 12px 4px; position: sticky; top: 0; background: var(--ground); z-index: 5; }
.topbar h1 { flex: 1; margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 10px; color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--muted); color: var(--ink); }
.step { font-size: 12px; color: var(--ink-2); padding-right: 8px; }
.progress { margin: 4px 20px 0; height: 4px; border-radius: 4px; background: var(--line); }
.progress > div { height: 4px; border-radius: 4px; background: var(--brand); transition: width .3s; }

.content { flex: 1; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.footer { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; z-index: 5; }
.footer-row { display: flex; align-items: center; gap: 14px; }
.footer-row .grow { flex: 1; min-width: 0; }
.price-big { font-family: var(--font-mono); font-weight: 600; font-size: 22px; }

/* Home */
.brandbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.shopcard { margin: 4px 20px 0; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.hero { padding: 24px 20px 0; }
.hero h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 8vw, 36px); line-height: 1.08; letter-spacing: -.5px; }
.hero p { margin: 12px 0 0; color: var(--ink-2); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; gap: 14px; align-items: center; padding: 14px; }
.num { width: 28px; height: 28px; flex: none; border-radius: 999px; background: var(--brand-tint); color: var(--brand); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.install { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; }
.install .btn { background: #fff; color: var(--ink); border-color: #fff; }
.privacy { display: flex; gap: 8px; font-size: 12px; color: var(--ink-2); margin: 0; }
.privacy svg { flex: none; margin-top: 1px; }
.recent { display: flex; flex-direction: column; gap: 8px; }
.recent a { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; text-decoration: none; color: var(--ink); }

/* Upload */
.dropzone { border: 2px dashed #9AA8BC; border-radius: 16px; background: var(--surface); padding: 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; position: relative; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-tint); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.section-label { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .6px; margin: 4px 0 -4px; }
.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.file { padding: 12px; display: flex; gap: 12px; align-items: center; }
.file.err { background: var(--bad-tint); border-color: var(--bad-line); }
.thumb { width: 48px; height: 62px; flex: none; border-radius: 6px; border: 1px solid var(--line); background: var(--muted); object-fit: contain; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.file .meta { flex: 1; min-width: 0; }
.file .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.file .warn { font-size: 12px; color: var(--colour-ink); margin-top: 4px; }
.file .errtext { font-size: 12px; color: var(--bad-ink); margin-top: 2px; }
.file.uploading .sub { color: var(--brand-ink); }
.empty { text-align: center; color: var(--ink-2); font-size: 14px; padding: 12px; }

/* Settings */
.doc-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 20px 2px; margin: 12px -20px 0; scrollbar-width: none; }
.doc-tabs button { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-tabs button[aria-selected=true] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 4px 8px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; text-align: center; }
.seg input:checked + span { border: 2px solid var(--brand); background: var(--brand-tint); color: var(--brand-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.seg small { display: block; font-weight: 500; font-size: 11px; color: var(--ink-2); }
.stepper { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 14px; }
.stepper .ctrl { display: flex; align-items: center; gap: 4px; }
.stepper .ctrl button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: 20px; cursor: pointer; }
.stepper output { min-width: 40px; text-align: center; font-family: var(--font-mono); font-size: 17px; }
details.more { padding: 0 14px; }
details.more summary { min-height: 48px; display: flex; align-items: center; font-weight: 600; font-size: 14px; cursor: pointer; }
details.more .inner { padding-bottom: 14px; display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 20px; height: 20px; }
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 10px; }
.pg { position: relative; border: 2px solid var(--line); border-radius: 8px; background: #fff; padding: 0; cursor: pointer; aspect-ratio: 1 / 1.35; overflow: hidden; }
.pg img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pg .n { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 600; background: rgba(14,23,38,.8); color: #fff; padding: 1px 6px; border-radius: 6px; }
.pg[aria-pressed=true] { border-color: var(--brand); }
.pg[aria-pressed=false] img { opacity: .35; }
.pg[aria-pressed=false] { border-style: dashed; }
.pg .tick { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 999px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; }
.pg[aria-pressed=false] .tick { background: #fff; border: 2px solid var(--line-2); }
.pg .blank { position: absolute; right: 4px; bottom: 4px; font-size: 10px; background: var(--colour-tint); color: var(--colour-ink); padding: 1px 5px; border-radius: 5px; }

/* Summary */
.doc-line { padding: 14px; }
.doc-line .head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.doc-line .head .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; background: var(--muted); padding: 4px 8px; border-radius: 6px; }
.chip.colour { background: var(--colour-tint); color: var(--colour-ink); }
.calc { margin-top: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.totals { padding: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.totals .row { display: flex; justify-content: space-between; gap: 12px; }
.totals .row span:last-child { font-family: var(--font-mono); }
.totals hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.totals .grand { font-weight: 600; align-items: baseline; }
.totals .grand span:last-child { font-size: 24px; font-weight: 600; }

/* Checkout / done */
.order-card { background: var(--ink); color: #fff; border-radius: 16px; padding: 18px; }
.paymethod { padding: 14px; display: flex; align-items: center; gap: 12px; }
.center-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 32px 20px; }
.badge-icon { width: 72px; height: 72px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.center-screen h2 { margin: 0; font-family: var(--font-display); font-size: 28px; }
.pickup { padding: 18px 24px; text-align: center; }
.pickup .code { font-family: var(--font-mono); font-weight: 600; font-size: 40px; letter-spacing: 8px; margin-top: 4px; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(14,23,38,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sheet h2 { margin: 0; font-family: var(--font-display); font-size: 22px; }
.test-banner { background: var(--colour-tint); color: var(--colour-ink); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; }

/* Tracking */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; min-height: 52px; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; }
.timeline .dot { width: 22px; height: 22px; flex: none; border-radius: 999px; border: 2px solid var(--line-2); display: flex; align-items: center; justify-content: center; background: #fff; }
.timeline .dot.done { background: var(--ok); border-color: var(--ok); }
.timeline .dot.now { border: 3px solid var(--brand); }
.timeline .dot.fail { background: var(--bad); border-color: var(--bad); }
.timeline .bar { flex: 1; width: 2px; background: var(--line); }
.timeline .bar.done { background: var(--ok); }
.timeline .t { font-weight: 600; font-size: 14px; }
.timeline .s { font-size: 12px; color: var(--ink-2); padding-bottom: 12px; }
dl.receipt { margin: 12px 0 0; display: grid; grid-template-columns: 1fr auto; row-gap: 8px; column-gap: 12px; font-size: 13px; }
dl.receipt dt { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dl.receipt dd { margin: 0; text-align: right; font-family: var(--font-mono); }
.modal-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border: 1px solid var(--line); background: #fff; }
.banner { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.banner.bad { background: var(--bad-tint); color: var(--bad-ink); border: 1px solid var(--bad-line); }
.banner.info { background: var(--brand-tint); color: var(--brand-ink); }

/* refinements after device check */
.seg span { flex-direction: column; line-height: 1.2; gap: 2px; }
.file.err { flex-wrap: wrap; }
.file.err .meta { flex: 1 1 180px; }
.file .name { white-space: normal; overflow-wrap: anywhere; }
