/* App screens (auth, dashboard, admin, cashier, display) */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 32px 16px 60px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .head { padding: 28px 28px 18px; }
.auth-card .head h1 { font-size: 30px; font-weight: 900; }
.auth-card .head p { color: var(--muted); margin-top: 6px; }
.auth-card form { padding: 24px 28px 28px; }
.auth-card .alt { text-align: center; margin-top: 14px; font-size: 15px; color: var(--muted); }

/* dashboard */
.dash { padding: 28px 0 80px; }
.tabs { display: flex; gap: 6px; margin-bottom: 26px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 10px 16px; border-radius: 14px; font-weight: 600; font-size: 16px; color: var(--muted); cursor: pointer; white-space: nowrap; flex: none; }
.tabs button:hover { background: rgba(22,32,27,.06); color: var(--ink); }
.tabs button[aria-selected=true] { background: var(--lime); color: var(--ink); }
.ico { width: 22px; height: 22px; flex: none; display: inline-block; }
.tabs .ico { width: 21px; height: 21px; }
.pane { display: none; } .pane.on { display: block; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.panel h2 { font-size: 20px; font-weight: 800; margin-bottom: 14px; }
.panel + .panel { margin-top: 20px; }
.banner { border-radius: 14px; padding: 14px 18px; margin-bottom: 22px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.banner.warn { background: var(--amber-bg); color: #5C3C00; }
.banner.ok { background: var(--green-bg); color: var(--green-d); }
.banner.test { background: var(--paper-2); color: var(--ink-2); font-size: 15px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: #fff; border: 1px solid var(--line); border-radius: 18px; margin-bottom: 22px; }
.kpi { padding: 20px 22px; }
.kpi + .kpi { border-inline-start: 2px dashed var(--line); }
.kpi b { display: block; font-family: var(--font-display); font-size: 38px; font-weight: 900; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 14px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 120px; margin-top: 8px; }
.bars div { flex: 1; display: grid; gap: 6px; justify-items: center; align-content: end; height: 100%; font-size: 12px; color: var(--muted); }
.bars i { display: block; width: 100%; background: var(--lime-d); border-radius: 6px 6px 0 0; min-height: 3px; }
.dist { display: grid; gap: 6px; }
.dist div { display: grid; grid-template-columns: 22px 1fr 34px; gap: 10px; align-items: center; font-size: 14px; }
.dist i { display: block; height: 10px; border-radius: 6px; background: var(--amber); min-width: 2px; }
.stars { color: var(--amber); letter-spacing: 2px; white-space: nowrap; }
.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.comments li { border-top: 1px solid var(--line); padding-top: 12px; }

.linkrow { display: grid; gap: 8px; margin-bottom: 20px; }
.linkrow .box { display: flex; gap: 8px; align-items: stretch; }
.linkrow input { direction: ltr; text-align: left; font-size: 14px; background: var(--paper); }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.logo-prev { width: 84px; height: 84px; border-radius: 20px; border: 2px dashed var(--line); background: var(--paper); display: grid; place-items: center; overflow: hidden; font-family: var(--font-display); font-weight: 900; font-size: 34px; color: var(--muted); }
.logo-prev img { width: 100%; height: 100%; object-fit: cover; }

/* poster: 3 fixed designs (classic / bold / card), one accent colour chosen by the owner. The QR is always black on white. */
.poster-stage { display: grid; justify-items: center; gap: 18px; width: 100%; }
.poster-opts { width: 100%; max-width: 560px; display: grid; gap: 14px; }
.poster-opts .seg { justify-content: flex-start; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; padding: 0; }
.swatches button.sel { box-shadow: 0 0 0 3px var(--ink); }
.poster { --pc: #16201B; width: 100%; max-width: 420px; aspect-ratio: 210 / 297; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 34px 30px; display: grid; grid-template-rows: auto auto 1fr auto; justify-items: center; text-align: center; gap: 14px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.poster .pl { width: 76px; height: 76px; border-radius: 20px; overflow: hidden; background: var(--pc); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 900; font-size: 36px; }
.poster .pl img { width: 100%; height: 100%; object-fit: cover; }
.poster h3 { font-size: 28px; font-weight: 900; color: var(--pc); }
.poster .qr { width: 86%; align-self: center; background: #fff; }
.poster .qr img { width: 100%; display: block; image-rendering: pixelated; }
.poster .ask { font-family: var(--font-display); font-size: 30px; font-weight: 900; line-height: 1.25; }
.poster .sub { color: var(--muted); font-size: 15px; }
.poster .pw { font-size: 12px; color: var(--muted); }
.poster.no-name h3 { display: none; }
.poster.no-name:not(.has-logo) .pl { display: none; }
.poster:not(.p-card).no-name { grid-template-rows: auto 1fr auto; }
.poster:not(.p-card).no-name:not(.has-logo) { grid-template-rows: 1fr auto; }
/* classic: white sheet, colour bar on top */
.poster.p-classic { border-top: 14px solid var(--pc); }
.poster.p-classic .ask { color: var(--pc); }
/* bold: the whole sheet is the shop colour, code in a white box */
.poster.p-bold { background: var(--pc); border-color: var(--pc); color: #fff; }
.poster.p-bold h3, .poster.p-bold .ask, .poster.p-bold .sub, .poster.p-bold .pw { color: #fff; }
.poster.p-bold .sub, .poster.p-bold .pw { opacity: .85; }
.poster.p-bold .pl { background: #fff; color: var(--pc); }
.poster.p-bold .qr { background: #fff; padding: 14px; border-radius: 18px; width: 80%; }
.poster.p-bold .ask { font-size: 34px; }
/* card: small landscape card for counters and tables */
.poster.p-card { aspect-ratio: 100 / 62; max-width: 520px; padding: 16px 20px; grid-template-columns: 38% auto 1fr; grid-template-rows: auto 1fr; justify-items: center; align-items: center; gap: 6px 14px; border: 3px solid var(--pc); border-radius: 18px; }
.poster.p-card .qr { grid-column: 1; grid-row: 1 / 3; width: 100%; }
.poster.p-card .pl { grid-column: 2; grid-row: 1; width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }
.poster.p-card:not(.has-logo) .pl { display: none; }
.poster.p-card h3 { grid-column: 3; grid-row: 1; font-size: 19px; justify-self: start; }
.poster.p-card > div:last-child { grid-column: 2 / 4; grid-row: 2; align-self: start; }
.poster.p-card .ask { font-size: 22px; color: var(--pc); }
.poster.p-card .sub { font-size: 12px; }
.poster.p-card .pw { margin-top: 6px !important; }

@media print {
  body { background: #fff; }
  .nav, .tabs, #loading, #banner, #app > *:not(#panes), #panes > .pane:not(#pane-poster), .no-print, .toast-host, #support-fab { display: none !important; }
  #app, #app > #panes, #pane-poster, #pane-poster .poster-stage { display: block !important; }
  .poster { max-width: none; width: 190mm; height: 275mm; margin: 0 auto; border-radius: 0; page-break-inside: avoid; }
  .poster.p-card { width: 150mm; height: 93mm; aspect-ratio: auto; margin: 0 auto; }
  .poster-opts { display: none !important; }
  .dash { padding: 0; }
}

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-inline-start: 0; }
  .kpi:nth-child(n+3) { border-top: 2px dashed var(--line); }
}

/* plan cards in dashboard */
.plan-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.plan-opt { border: 2px solid var(--line); border-radius: 16px; padding: 18px; background: #fff; cursor: pointer; text-align: start; display: grid; gap: 4px; }
.plan-opt:hover { border-color: var(--ink); }
.plan-opt.sel { border-color: var(--electric); box-shadow: 0 0 0 3px rgba(141,181,31,.28); }
.plan-opt b { font-family: var(--font-display); font-size: 32px; font-weight: 900; }
.plan-opt small { color: var(--green-d); font-weight: 600; }
@media (max-width: 640px) { .plan-pick { grid-template-columns: 1fr; } }

/* tables (admin) */
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: start; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-family: var(--font-display); font-weight: 700; background: var(--paper); font-size: 14px; color: var(--ink-2); }
tr:last-child td { border-bottom: 0; }

/* dashboard Phase 2 */
.kpis.k3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.bars i.cx, .dist i.cx { background: var(--coral); border-radius: 6px 6px 0 0; }
.dist i.cx { border-radius: 6px; height: 10px; }
.bars div { gap: 3px; }
.check.sw { align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.check.sw:first-of-type { border-top: 0; }
.subbox { margin-top: 10px; padding: 16px; background: var(--paper); border-radius: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.lay-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lay-pick button, .seg button { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 14px 10px; font: inherit; font-weight: 600; cursor: pointer; }
.lay-pick button.sel, .seg button.sel { border-color: var(--electric); background: color-mix(in srgb, var(--electric) 8%, #fff); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.seg button { padding: 8px 14px; border-radius: 999px; font-size: 14px; }
.phone-wrap { position: sticky; top: 16px; display: grid; gap: 14px; justify-items: center; }
.phone { width: 300px; height: 600px; border: 8px solid var(--ink); border-radius: 36px; overflow: hidden; background: #fff; }
.phone-frame { width: 100%; height: 100%; border: 0; }
.pbtn { cursor: pointer; border: 0; font: inherit; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.code { position: relative; background: var(--ink); color: #E8EFE0; border-radius: 12px; padding: 14px; margin: 8px 0 0; overflow-x: auto; font-size: 13px; text-align: left; }
.code .btn { position: absolute; top: 8px; right: 8px; color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.35); }
.code code { white-space: pre; padding-right: 60px; display: block; }
.keyrow { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } .kpis.k3 { grid-template-columns: 1fr; } .phone-wrap { position: static; } }

/* subscription */
.days { display: flex; align-items: baseline; gap: 10px; margin: 10px 0 8px; } .days b { font-family: var(--font-display); font-size: 54px; line-height: 1; font-weight: 900; } .days span { color: var(--muted); }
.meter { height: 10px; border-radius: 6px; background: var(--paper-2, #E4E8F6); overflow: hidden; } .meter i { display: block; height: 100%; background: var(--green); border-radius: 6px; } .meter.warn i { background: var(--amber); }
.payinfo { background: var(--paper); border: 1px dashed var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; } .payinfo pre { margin: 6px 0 0; white-space: pre-wrap; font: inherit; }
.tablewrap { overflow-x: auto; }
.k-modal { position: fixed; inset: 0; z-index: 40; background: rgba(14,20,16,.6); display: grid; place-items: center; padding: 12px; }
.k-sheet { background: #fff; border-radius: 22px; padding: 22px; width: min(460px, 100%); display: grid; gap: 12px; max-height: 92vh; overflow: auto; }
.k-sheet.wide { width: min(620px, 100%); } .k-sheet h2 { font-size: 20px; font-weight: 800; } .k-opts { display: grid; gap: 12px; }
.kpis.hk { grid-template-columns: repeat(4, minmax(0,1fr)); } .kpi.bad b { color: var(--coral-d); }
@media (max-width: 860px) { .kpis, .kpis.hk { grid-template-columns: repeat(2, minmax(0,1fr)); } .kpi + .kpi { border-inline-start: 0; } }

/* ---------- phones: bottom tab bar, card rows, bottom sheets ---------- */
@media (max-width: 720px) {
  .dash { padding: 16px 0 120px; }
  .tabs { position: fixed; inset-inline: 0; bottom: 0; margin: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); gap: 2px; box-shadow: 0 -10px 28px rgba(22,32,27,.08); border-radius: 0; }
  .tabs button { flex: 1 0 auto; flex-direction: column; gap: 3px; padding: 4px 2px; min-width: 66px; font-size: 11.5px; line-height: 1.25; border-radius: 14px; white-space: normal; text-align: center; font-weight: 600; }
  .tabs button:hover { background: none; }
  .tabs button[aria-selected=true] { background: none; }
  .tabs .ico { box-sizing: content-box; width: 24px; height: 24px; padding: 4px 16px; border-radius: 999px; transition: background .15s; }
  .tabs button[aria-selected=true] .ico { background: var(--lime); }
  .nav .wrap { gap: 10px; }
  #who { display: none; }
  .panel { padding: 18px; border-radius: 16px; }
  .btn.sm { min-height: 40px; }
  .tablewrap { border: 0; background: none; overflow: visible; }
  .tablewrap table, .tablewrap tbody { display: block; }
  .tablewrap thead { display: none; }
  .tablewrap tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 6px 14px; margin-bottom: 12px; }
  .tablewrap td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--line); white-space: normal; text-align: end; }
  .tablewrap td:last-child { border-bottom: 0; }
  .tablewrap td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 600; text-align: start; flex: none; }
  .tablewrap td[data-label=""]::before { display: none; }
  .tablewrap td[colspan] { display: block; text-align: center; }
  .k-modal { align-items: end; padding: 0; }
  .k-sheet, .k-sheet.wide { width: 100%; border-radius: 26px 26px 0 0; max-height: 90vh; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
  .toast-host { bottom: 96px; }
}

@media (max-width: 720px) {
  .nav .chip { white-space: nowrap; font-size: 12px; padding: 2px 10px; }
  .nav .wrap { flex-wrap: nowrap; }
  .nav .lang-btn { padding: 2px 12px; flex: none; }
  #logout { padding: 4px 10px; min-width: 0; }
  #logout span { display: none; }
}
.mhead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msec { border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.msec > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 700; font-family: var(--font-display); font-size: 17px; cursor: pointer; }
.msec > summary::-webkit-details-marker { display: none; }
.msec > summary::after { content: '+'; margin-inline-start: auto; font-size: 22px; color: var(--muted); line-height: 1; }
.msec[open] > summary::after { content: '−'; }
.msec[open] > summary { border-bottom: 1px solid var(--line); }
.msec-b { padding: 14px 16px 16px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
input[type=date] { width: 100%; min-height: 48px; padding: 9px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }

/* shop management sheet: collapsible sections */
.mg-sec { border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.mg-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.mg-sec > summary::-webkit-details-marker { display: none; }
.mg-sec > summary::after { content: ''; margin-inline-start: auto; width: 9px; height: 9px; border-inline-end: 2.5px solid var(--muted); border-bottom: 2.5px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.mg-sec[open] > summary::after { transform: rotate(-135deg); }
.mg-sec .mg-body { padding: 4px 16px 16px; display: grid; gap: 10px; }
.mg-sec .mg-body hr { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 4px 0; }
.mg-sec .field { margin-bottom: 6px; }
.sumrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
input[type=date] { width: 100%; min-height: 48px; padding: 9px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }

.notice { background: #E6F3E1; color: #1F5A2E; border: 1px solid #BFE0B7; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: .95rem; line-height: 1.6; }
.auth-card select { width: 100%; }
#root .panel > .check, #root .panel > .field, #root .panel > p.hint, #root .panel > input { margin-top: 12px; } #root .panel > .btnrow { margin-top: 16px; }

/* legal pages */
.legal { padding: 40px 0 70px; }
.legal h1 { font-family: var(--font-display); font-size: 34px; font-weight: 900; margin: 0 0 6px; }
.legal h2 { font-family: var(--font-display); font-size: 21px; font-weight: 800; margin: 30px 0 8px; }
.legal h3 { font-size: 17px; font-weight: 700; margin: 16px 0 6px; }
.legal p, .legal li { line-height: 2; max-width: 70ch; }
.legal ul { padding-inline-start: 22px; margin: 6px 0; }
.legal-end { margin-top: 36px; padding-top: 18px; border-top: 1px dashed var(--line); }
.legal .narrow { max-width: 780px; margin-inline: auto; padding-inline: 20px; }

/* developers page */
.legal.dev .narrow.wide { max-width: 940px; }
.dev-kicker { margin: 0 0 4px; color: var(--green-d); font-weight: 700; }
.legal.dev .lead { font-size: 19px; max-width: 62ch; color: var(--ink-2); }
.dev-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 8px; }
.dev-toc a { text-decoration: none; padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 600; }
.dev-toc a:hover { border-color: var(--ink); }
.dev-steps { padding-inline-start: 24px; margin: 8px 0; } .dev-steps li { margin-bottom: 6px; }
.legal.dev code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .88em; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; direction: ltr; unicode-bidi: isolate; }
.legal.dev .code code { background: transparent; border: 0; padding: 0 60px 0 0; font-size: 13px; line-height: 1.7; }
.legal.dev .code { margin: 8px 0 14px; }
.dev-table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 15px; display: block; overflow-x: auto; }
.dev-table th, .dev-table td { text-align: start; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.9; }
.dev-table th { background: var(--paper-2); font-family: var(--font-display); font-weight: 800; white-space: nowrap; }
.dev-table tr:last-child td { border-bottom: 0; }
.m { display: inline-block; min-width: 52px; text-align: center; font-size: 12px; font-weight: 800; border-radius: 6px; padding: 0 6px; color: #fff; direction: ltr; }
.m.get { background: #1F5FBF; } .m.post { background: var(--green); }
.dev-note { margin: 14px 0; padding: 12px 16px; border-radius: 12px; background: var(--amber-bg); color: var(--amber-d); border: 1px solid #F2D58A; line-height: 1.9; }
.dev-help { margin-top: 34px; padding: 20px; border-radius: 18px; background: var(--ink); color: #fff; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.dev-help .btn { background: var(--lime); color: var(--ink); }
.legal.dev p, .legal.dev li { max-width: none; } .legal.dev .lead { max-width: 62ch; }
.legal.dev { overflow-x: clip; } .legal.dev pre, .legal.dev .code { max-width: 100%; }
.legal.dev .code .btn { right: 8px; left: auto; }
.dev-table td code { white-space: normal; overflow-wrap: normal; }
.dev-table td:first-child, .dev-table th:first-child { white-space: nowrap; }
.dev-table td:first-child code { white-space: nowrap; }
.legal.dev .code .btn { color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.35); }

/* english developers page: left-to-right */
.dev-en .legal.dev, body.dev-en { direction: ltr; text-align: left; }
.dev-en .dev-table th, .dev-en .dev-table td { text-align: left; }
.dev-en .code .btn { right: 8px; }
.dev-en .nav .wrap { direction: ltr; }
.dev-en .dev-steps { padding-inline-start: 26px; }
.dev-table { display: table; width: 100%; overflow: visible; }
.dev-table td, .dev-table th { word-break: normal; }
@media (max-width: 720px) { .dev-table { display: block; overflow-x: auto; } }
.dev-table td { white-space: normal; } .dev-table td:first-child { white-space: nowrap; }
@media (max-width: 720px) { .dev-table td:first-child { white-space: normal; } }
