/* Tatshan: warm, calm, and quick to understand. No frameworks. */

@font-face {
  font-family: "Tiro";
  src: url("../fonts/tiro-latin.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026, U+2192, U+2713;
}
@font-face {
  font-family: "Tiro";
  src: url("../fonts/tiro-devanagari.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0900-097F, U+200C-200D, U+0964-0965;
}

:root {
  --bg: #faf9f5;
  --surface: #ffffff;
  --surface-2: #f3f0e7;
  --text: #1f1e1d;
  --muted: #6b6962;
  --border: #e7e3d7;
  --accent: #c4552d;
  --accent-hover: #ab4624;
  --accent-ink: #a8431f;
  --accent-soft: #f9e8df;
  --on-accent: #ffffff;
  --ok: #2c7a4b;
  --danger: #b3372b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 30, 29, .04), 0 10px 28px -14px rgba(31, 30, 29, .16);
  --serif: "Tiro", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #262624;
    --surface: #30302e;
    --surface-2: #3a3936;
    --text: #f3f1ea;
    --muted: #aba99f;
    --border: #464540;
    --accent: #e0724a;
    --accent-hover: #ea8460;
    --accent-ink: #ee9272;
    --accent-soft: #46322a;
    --on-accent: #1f1e1d;
    --ok: #6cc08a;
    --danger: #ee7b6e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 28px -14px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
html.lock { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--sans);
  min-height: 100vh;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; padding-bottom: 56px; outline: none; }
[hidden] { display: none !important; }
a { color: inherit; }
code { font: .9em var(--mono); background: var(--surface-2); padding: .1em .35em; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.center { text-align: center; }
.pad { padding: 64px 0; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.view-in { animation: viewIn .35s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── header / logo ── */
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; padding-bottom: 6px; }
.top-link { font-size: 14px; color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; }
.top-link:hover { background: var(--surface-2); color: var(--text); }
.logo { display: inline-flex; flex-direction: column; text-decoration: none; line-height: 1; }
.logo-hi { font: 400 30px/1.1 var(--serif); color: var(--text); letter-spacing: .01em; }
.logo-en { font: 600 10px/1 var(--sans); letter-spacing: .32em; text-transform: uppercase; color: var(--accent-ink); margin-top: 5px; padding-left: 2px; }
.logo--lg .logo-hi { font-size: 64px; }
.logo--lg .logo-en { font-size: 16px; margin-top: 10px; }

.foot { padding-top: 12px; padding-bottom: 28px; text-align: center; font-size: 13px; color: var(--muted); }
.foot p { margin: 0; }
.demo-banner { background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; text-align: center; padding: 8px 16px; }

/* ── type ── */
h1, h2 { margin: 0; font-weight: 400; }
.page-title { font: 400 clamp(28px, 5vw, 38px)/1.15 var(--serif); margin: 8px 0 6px; letter-spacing: -.01em; }
.page-title.small { font-size: 26px; }
.page-title.tight { margin: 2px 0 8px; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 8px; max-width: 34em; }
.lead.small { font-size: 16px; margin-bottom: 20px; }
.eyebrow { margin: 0; font: 600 12px/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.eyebrow[lang="hi"] { font: 400 19px/1.3 var(--serif); letter-spacing: 0; text-transform: none; }
.section-title { font: 400 22px/1.2 var(--serif); margin: 32px 0 12px; }
.section-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.section-row .section-title { margin: 28px 0 12px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.hint.center { text-align: center; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; min-height: 0; }
.error:empty { display: none; }
.back { display: inline-flex; align-items: center; gap: 4px; margin: 14px 0 6px -6px; padding: 6px 10px; font-size: 14px; color: var(--muted); text-decoration: none; border-radius: 999px; }
.back:hover { background: var(--surface-2); color: var(--text); }

/* ── cards, buttons, inputs ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 14px; }
.stack > .or, .stack > .drop { margin-top: 16px; }
.notice { margin-top: 12px; }
.notice > * + * { margin-top: 12px; }
.bubble { display: inline-grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); }
.bubble.soft { background: var(--surface-2); color: var(--text); }
.bubble.xs { width: 26px; height: 26px; border-radius: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: 600 15px/1 var(--sans); cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.small { width: 30px; height: 30px; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.row-gap.center { justify-content: center; }
.row-gap > .input { flex: 1 1 160px; min-width: 0; }

.label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text); font: 16px var(--sans);
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 65%, transparent); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.code-input { font: 600 20px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.bullets { margin: 18px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.bullets li + li { margin-top: 6px; }

.chip { flex: none; display: inline-block; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font: 700 10.5px/1.5 var(--sans); letter-spacing: .05em; }
.avatar { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font: 600 15px var(--sans); color: hsl(var(--h, 20) 45% 28%); background: hsl(var(--h, 20) 60% 90%); }
@media (prefers-color-scheme: dark) { .avatar { color: hsl(var(--h, 20) 70% 85%); background: hsl(var(--h, 20) 28% 28%); } }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
.center .spinner { width: 26px; height: 26px; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── pigeon ── */
.pigeon { display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.hero { position: relative; padding: 26px 0 10px; min-height: 270px; overflow: clip; }
.hero::before { content: ""; position: absolute; z-index: 0; right: -40px; top: -30px; width: 400px; height: 400px; border-radius: 50%; background: radial-gradient(closest-side, var(--accent-soft), transparent 72%); }
.hero-pigeon { position: absolute; z-index: 0; right: -24px; top: -4px; width: min(50vw, 350px); filter: drop-shadow(0 20px 22px rgba(120, 78, 40, .16)); animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-12px) rotate(1deg); } }
.hero-copy { position: relative; z-index: 1; max-width: 430px; }
.hero h1 { font: 400 clamp(36px, 7vw, 52px)/1.06 var(--serif); letter-spacing: -.015em; margin: 10px 0 14px; }
.hero .lead { font-size: 17px; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.action-card { position: relative; display: flex; flex-direction: column; gap: 14px; text-decoration: none; padding: 22px; transition: transform .15s, box-shadow .15s, border-color .15s; }
.action-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.action-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.action-title { font: 400 23px/1.2 var(--serif); }
.action-go { position: absolute; right: 18px; top: 22px; color: var(--muted); transition: transform .15s, color .15s; }
.action-card:hover .action-go, .shop-banner:hover .action-go { transform: translateX(3px); color: var(--accent-ink); }
.shop-banner { position: relative; display: flex; align-items: center; gap: 16px; margin-top: 14px; padding: 18px 48px 18px 18px; border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--radius); text-decoration: none; background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.shop-banner .action-go { top: 50%; margin-top: -10px; }
.shop-banner .action-title { font-size: 19px; }
.shop-banner .muted { font-size: 14px; }
.trust { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; color: var(--muted); font-size: 13.5px; }
.trust li { display: inline-flex; align-items: center; gap: 7px; }
.trust svg { color: var(--accent-ink); }

@media (max-width: 560px) {
  .hero { padding-top: 118px; min-height: 0; }
  .hero-pigeon { width: 210px; right: -12px; top: -8px; }
  .hero::before { width: 300px; height: 300px; right: -70px; top: -50px; }
  .cards { grid-template-columns: 1fr; }
  .action-card { flex-direction: row; align-items: center; padding: 18px 44px 18px 18px; }
  .action-go { top: 50%; margin-top: -10px; right: 16px; }
  .logo-hi { font-size: 27px; }
}

/* ── send ── */
.to-line { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; color: var(--muted); }
.to-line strong { color: var(--text); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; text-align: center; border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 14px; cursor: pointer; transition: background .15s, border-color .15s; font-size: 13.5px; }
.drop:hover, .drop.over { background: var(--accent-soft); border-color: var(--accent); }
.drop .bubble { margin-bottom: 6px; }
.drop-title { font: 400 21px/1.2 var(--serif); }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list:not(:empty) { margin-top: 14px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14.5px; }
.file-item:first-child { border-top: 0; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-block { text-align: center; padding: 18px 0; }
.progress-title { font: 400 22px var(--serif); margin: 0 0 14px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .25s; }
.sent { padding: 12px 0 6px; }
.sent-pigeon { width: 170px; margin: 0 auto 6px; animation: hover 2.4s ease-in-out infinite; }
@keyframes hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.sent-pigeon.fly-away { animation: flyaway 1.3s cubic-bezier(.5, 0, .9, .4) forwards; }
@keyframes flyaway { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(140%, -120%) rotate(-14deg) scale(.7); opacity: 0; } }
.sent-title { font: 400 26px var(--serif); margin: 4px 0 6px; display: flex; justify-content: center; align-items: center; gap: 8px; }
.tick { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: #fff; }
.sent .muted { margin: 0; }
.sent-actions { margin-top: 18px; display: flex; justify-content: center; }
.scan { display: grid; gap: 12px; }
.scan-frame { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: #000; }
.scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-corners { position: absolute; inset: 14%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); }

/* ── receive ── */
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 20px 18px; }
.qr-wrap { width: min(260px, 68vw); aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid var(--border); }
.qr-wrap svg { display: block; width: 100%; height: 100%; }
.code { font: 700 clamp(26px, 7vw, 34px)/1 var(--mono); letter-spacing: .14em; text-align: center; user-select: all; }
.qr-card .muted { margin: 0; max-width: 24em; font-size: 14.5px; }
.qr-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.incoming-list { display: grid; gap: 14px; }
.incoming-head { display: flex; align-items: center; gap: 12px; }
.incoming-who { flex: 1; min-width: 0; }
.incoming-who strong { font-weight: 600; }
.stamp { display: flex; flex-direction: column; align-items: flex-end; font-size: 12.5px; color: var(--muted); line-height: 1.35; white-space: nowrap; }
.incoming .file-list { margin: 12px 0 14px; }
.empty { text-align: center; padding: 30px 12px 10px; }
.empty-pigeon { width: 130px; margin: 0 auto 4px; opacity: .92; animation: float 7s ease-in-out infinite; }
.empty-title { font: 400 21px var(--serif); margin: 8px 0 4px; }
.empty .muted { margin: 0 auto; max-width: 26em; font-size: 14.5px; }

/* ── print shop ── */
.shop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status[data-state="live"] .dot { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: pulse 2s infinite; }
.status[data-state="offline"] .dot { background: var(--danger); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.msg-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.msg-list:empty { display: none; }
.row { display: grid; grid-template-rows: 1fr; }
.row-inner { min-height: 0; overflow: hidden; }
.row + .row .msg { border-top: 1px solid var(--border); }
.row.enter { animation: rowIn .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes rowIn { from { grid-template-rows: 0fr; opacity: 0; } to { grid-template-rows: 1fr; opacity: 1; } }
.msg { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 18px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .12s; }
.msg:hover { background: var(--surface-2); }
.msg:focus-visible { outline-offset: -3px; }
.msg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.msg-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.msg-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-line { color: var(--muted); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file { color: var(--text); }
.more { color: var(--accent-ink); font-weight: 600; margin-left: 6px; }
.msg-state { font-size: 13px; color: var(--muted); }
.msg-state:empty { display: none; }
.msg-state.error { color: var(--danger); }
.msg-state .spinner { margin-right: 7px; width: 13px; height: 13px; }
.msg-time { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.msg-date { font-size: 13px; color: var(--muted); }
.msg-clock { font: 600 15px var(--sans); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .msg { gap: 11px; padding: 13px 14px; } .avatar { width: 40px; height: 40px; } .msg-clock { font-size: 14px; } }

/* ── sheets / dialogs ── */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; background: rgba(20, 19, 18, .46); animation: fade .18s ease; backdrop-filter: blur(2px); }
.overlay.out { opacity: 0; transition: opacity .18s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 18px 20px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .18); animation: sheetIn .25s cubic-bezier(.2, .8, .2, 1); outline: none; }
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 560px) { .overlay { place-items: center; } .sheet { border-radius: 22px; } }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-title { font: 400 24px/1.2 var(--serif); }
.sheet-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.actions-file { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14.5px; word-break: break-word; }
.action-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-pair .btn { min-height: 56px; font-size: 16px; }
.qr-sheet { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.qr-sheet .qr-wrap { width: min(250px, 70vw); }

/* ── preview ── */
.viewer { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--bg); animation: fade .15s; }
.pv-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.pv-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pv-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-count { font-size: 12.5px; color: var(--muted); }
.pv-nav { display: flex; }
.pv-body { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; background: var(--surface-2); overflow: auto; }
.pv-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.pv-fallback { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; text-decoration: none; box-shadow: var(--shadow); }
.pv-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pv-text { align-self: flex-start; width: 100%; margin: 0; padding: 18px; font: 13px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; background: var(--surface); min-height: 100%; }
.pv-media { max-width: 100%; }
.pv-other { text-align: center; max-width: 340px; padding: 24px; }
.pv-other > * + * { margin-top: 10px; }
.pv-other-icon { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); }
.pv-other-name { font-weight: 600; word-break: break-word; margin-bottom: 0; }
.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }

/* ── toasts ── */
#toasts { position: fixed; z-index: 80; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 12px; background: #2a2926; color: #f6f4ee; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); animation: toastIn .25s ease; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ── print poster (counter QR) ── */
#poster { display: none; }
@media print {
  body.printing-poster > *:not(#poster) { display: none !important; }
  body.printing-poster { background: #fff; display: block; }
  #poster { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; min-height: 100vh; padding: 24mm 16mm; text-align: center; color: #1f1e1d; font-family: var(--sans); }
  #poster .logo-hi { color: #1f1e1d; }
  .poster-name { font: 400 40px/1.15 var(--serif); }
  .poster-cta { font: 400 30px var(--serif); margin: 0; }
  #poster .qr-wrap { width: 100mm; border: 3px solid #1f1e1d; border-radius: 6mm; }
  .poster-code { font-size: 15px; margin: 0; }
  .poster-foot { font-size: 14px; color: #555; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ───────────────────────── v2 additions ───────────────────────── */
:root { --blue: #2f6fe4; --blue-soft: #e6eefc; }
@media (prefers-color-scheme: dark) { :root { --blue: #6aa0ff; --blue-soft: #263553; } }

/* ── unread indicator (blue dot) ── */
.unread-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px var(--surface); }
.avatar { position: relative; }
.avatar .unread-dot { position: absolute; top: -2px; right: -2px; }
.msg { position: relative; }
.msg > .unread-dot { position: absolute; left: 5px; top: 50%; margin-top: -5.5px; box-shadow: none; }
.msg.unseen { background: var(--blue-soft); }
.msg.unseen:hover { background: color-mix(in srgb, var(--blue-soft) 80%, var(--surface-2)); }
.msg.unseen .msg-name { font-weight: 700; }
.card.incoming.unseen { border-color: color-mix(in srgb, var(--blue) 45%, var(--border)); }
.msg-state.remote { color: var(--muted); font-style: italic; }

/* ── receiver: QR card folds away when files arrive ── */
.fold { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .38s cubic-bezier(.2, .8, .2, 1), opacity .3s, margin .38s; }
.fold-inner { min-height: 0; overflow: hidden; }
.fold.folded { grid-template-rows: 0fr; opacity: 0; margin: 0; pointer-events: none; }
.qr-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; margin-top: 4px;
  border: 1px dashed var(--border); border-radius: 12px; background: var(--surface); color: var(--muted); font: 600 14px var(--sans); cursor: pointer;
}
.qr-toggle:hover { background: var(--surface-2); color: var(--text); }
@media (prefers-reduced-motion: reduce) { .fold { transition: none; } }

/* ── per-file rows in the shop sheet ── */
.file-actions .file-row { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 8px 10px; padding: 12px 0; }
.file-actions .file-row .file-name { white-space: normal; word-break: break-word; display: flex; flex-direction: column; }
.file-size { font-size: 12.5px; }
.file-btns { grid-column: 1 / 3; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.slim { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.action-pair.all { margin-top: 14px; }
.sheet-pad { padding-top: 4px; }

/* ── preview: file tabs ── */
.pv-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); scrollbar-width: thin; }
.pv-tab { flex: none; display: inline-flex; align-items: center; gap: 8px; max-width: 220px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--muted); font: 500 13.5px var(--sans); cursor: pointer; }
.pv-tab.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.pv-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── sign-in ── */
.auth > * + * { margin-top: 12px; }
.auth .label { margin-bottom: 0; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.linkish { border: 0; background: none; padding: 6px 2px; color: var(--accent-ink); font: 500 14px var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.secure-banner { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px; background: var(--accent-soft); border-color: transparent; box-shadow: none; flex-wrap: wrap; }
.secure-text { flex: 1 1 220px; font-size: 14px; }
.acct { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; font-size: 13.5px; flex-wrap: wrap; }

/* ── admin dashboard ── */
.admin-body { display: grid; gap: 16px; margin-top: 16px; }
.admin-body .card { padding: 18px; }
.small { font-size: 13px; }
.range { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding: 12px 14px; }
.range-dates { display: flex; align-items: center; gap: 8px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--border); background: var(--bg); color: var(--muted); border-radius: 999px; padding: 7px 13px; font: 600 13px var(--sans); cursor: pointer; }
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.input.slim { min-height: 38px; padding: 0 10px; font-size: 14px; width: auto; }
.card-title { margin: 0; font: 400 20px/1.2 var(--serif); }
.hint.tight { margin-top: 2px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpis.small { margin: 14px 0; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.card .kpi { background: var(--surface-2); border-color: transparent; }
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi-value { font: 400 28px/1.15 var(--serif); }
.kpi-sub { font-size: 12px; color: var(--muted); }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-scroll { overflow-x: auto; }
.chart { width: 100%; min-width: 380px; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 11px var(--sans); }
.chart .hit { fill: transparent; }
.chart g:hover .hit { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.bar.s0, .sw.s0 { fill: var(--accent); background: var(--accent); }
.bar.s1, .sw.s1 { fill: var(--ok); background: var(--ok); }
.hbars { display: grid; gap: 10px; margin-top: 12px; }
.hbar { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.hbar-label { text-transform: capitalize; }
.hbar-track { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.hbar-n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.tbl-scroll { overflow-x: auto; margin-top: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl .files-cell { min-width: 200px; word-break: break-word; }
.mono { font-family: var(--mono); font-size: 13px; }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--ok); margin-top: 14px; }
.admin-body .bar { margin-top: 12px; }
.admin-body { grid-template-columns: minmax(0, 1fr); }
.admin-body > *, .kpis > * { min-width: 0; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
.chart-scroll { max-width: 100%; }

/* ── optional sign-in for senders ── */
.auth-optional { margin-top: 8px; }
.auth-optional-wrap { padding: 12px 0 4px; }
.auth-optional-wrap .auth { margin-top: 10px; padding: 16px; background: var(--surface-2); border-radius: 12px; }
.signed-in-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 13.5px; flex-wrap: wrap; }
.linkish.small { font-size: 13px; padding: 2px; }
.muted.small { font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.hint.tight { margin: 2px 0 8px; }
