/* AF ShopBook website: the whole site is a chat with AFi. */
:root {
  color-scheme: light dark;
  --wall: #ece5dd;
  --bar: #f7f5f2;
  --card: #ffffff;
  --ink: #111b21;
  --muted: #5f6e78;
  --line: #ddd6cc;
  --in: #ffffff;
  --out: #ffe1c6;
  --pill: rgba(255, 255, 255, .92);
  --notice: #fff3c4;
  --notice-ink: #54451a;
  --brand: #fe790d;
  --navy: #191e29;
  --good: #15803d;
  --bad: #b91c1c;
  --tick: #34a9e0;
  --wa: #d9fdd3;
  --wa-ink: #111b21;
  --wa-btn: #1a8f4c;
  --shadow: 0 1px .5px rgba(11, 20, 26, .14);
  --lift: 0 10px 30px rgba(11, 20, 26, .14);
  --font: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", system-ui, sans-serif;
  --display: "Lalezar", "Segoe UI", Tahoma, sans-serif;
  --hand: "Aref Ruqaa", "Segoe UI", Tahoma, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wall: #0f141d;
    --bar: #18202b;
    --card: #1b2430;
    --ink: #e9edef;
    --muted: #93a1ad;
    --line: #2a3542;
    --in: #1f2a37;
    --out: #5a2f0e;
    --pill: rgba(27, 36, 48, .94);
    --notice: #2a2a1c;
    --notice-ink: #e6d9a3;
    --good: #4ade80;
    --bad: #f87171;
    --wa: #005c4b;
    --wa-ink: #e9edef;
    --shadow: 0 1px .5px rgba(0, 0, 0, .35);
    --lift: 0 14px 40px rgba(0, 0, 0, .45);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1rem/1.6 var(--font);
  background: var(--wall) url("/assets/chat-doodles.svg") 0 0 / 260px 260px;
}
img, svg { max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 99; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 10px; }
.skip:focus { top: 12px; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: 999px; border: 1px solid transparent; font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer; transition: transform .15s ease, filter .15s ease; }
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-main { background: var(--brand); color: var(--navy); box-shadow: 0 6px 18px rgba(254, 121, 13, .35); }
.btn-main:hover { filter: brightness(1.06); }
.btn-wa { background: var(--wa-btn); color: #fff; }
.btn-soft { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: .92rem; }
.btn-lg { min-height: 54px; padding: 12px 26px; font-size: 1.1rem; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 340px minmax(0, 1fr); max-width: 1440px; margin: 0 auto; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bar); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-head img { height: 34px; width: auto; }
.icon-btn.side-close { display: none; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: inline; } }
.side-ask { margin: 10px 12px; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--card); color: var(--muted); border: 1px solid var(--line); text-decoration: none; font-size: .92rem; }
.side-ask svg { width: 18px; height: 18px; }
.chats { list-style: none; margin: 0; padding: 0 0 8px; }
.chats a { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; text-decoration: none; border-bottom: 1px solid var(--line); }
.chats a:hover, .chats a[aria-current="page"] { background: var(--card); }
.chats .av { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 1.45rem; background: var(--card); border: 1px solid var(--line); }
.chats .av img { width: 34px; height: auto; }
.chats .av.brand { background: #0f141d; border-color: #0f141d; }
.chats b { display: block; font-size: .98rem; }
.chats small { display: block; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chats .when { font-size: .72rem; color: var(--muted); text-align: center; }
.chats .badge { display: block; margin: 4px auto 0; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--navy); font-size: .72rem; font-weight: 800; line-height: 20px; }
.side-foot { margin-top: auto; padding: 14px 16px 18px; font-size: .8rem; color: var(--muted); }
.side-foot nav { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; }
.side-foot a { color: var(--muted); }

.chat { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.chat-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; min-height: 62px; padding: 8px 12px; background: var(--bar); border-bottom: 1px solid var(--line); }
.chat-head .who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; text-decoration: none; }
.chat-head .who img, .chat-head .who .av { width: 42px; height: 42px; border-radius: 50%; flex: none; }
.chat-head .who .av { display: grid; place-items: center; font-size: 1.3rem; background: var(--card); border: 1px solid var(--line); }
.chat-head .who b { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .status { display: block; font-size: .8rem; color: var(--good); }
.chat-head .actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--card); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.menu-btn { display: none; }

@media (max-width: 999px) {
  .app { display: block; }
  .side { position: fixed; inset: 0; z-index: 60; height: auto; transform: translateX(105%); transition: transform .25s ease; box-shadow: var(--lift); }
  body.side-open .side { transform: none; }
  .icon-btn.side-close, .icon-btn.menu-btn { display: inline-grid; }
}
@media (max-width: 480px) { .chat-head .hide-sm { display: none; } }

/* ---------- Thread ---------- */
.thread { width: 100%; max-width: 860px; margin: 0 auto; padding: 16px 12px 28px; flex: 1; }
.row { display: flex; margin: 3px 0; }
.row.in { justify-content: flex-start; }
.row.out { justify-content: flex-end; }
.row.gap { margin-top: 12px; }
.bubble { position: relative; max-width: min(82%, 580px); padding: 7px 11px 6px; border-radius: 12px; background: var(--in); box-shadow: var(--shadow); font-size: 1.02rem; line-height: 1.6; overflow-wrap: anywhere; }
.out .bubble { background: var(--out); }
.row.first .bubble::before { content: ""; position: absolute; top: 0; width: 10px; height: 12px; background: inherit; }
.row.in.first .bubble { border-start-start-radius: 0; }
.row.out.first .bubble { border-start-end-radius: 0; }
.row.in.first .bubble::before { inset-inline-start: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.row.out.first .bubble::before { inset-inline-end: -8px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.bubble p + p, .bubble p + ul, .bubble ul + p { margin-top: 6px; }
.bubble ul { margin: 6px 0 0; padding-inline-start: 1.1em; }
.bubble li + li { margin-top: 3px; }
.bubble strong { font-weight: 800; }
.bubble a { color: var(--brand); font-weight: 700; }
.bubble a.btn { color: var(--navy); }
.bubble a.btn-soft { color: var(--ink); }
.bubble a.btn-wa { color: #fff; }
.bubble h2, .bubble h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 4px; }
.meta { float: left; margin: 6px 10px 0 0; font-size: .7rem; color: var(--muted); line-height: 1; white-space: nowrap; }
.ticks { color: var(--tick); font-weight: 700; letter-spacing: -2px; margin-inline-start: 3px; }
.bubble.wide { max-width: min(94%, 620px); width: 100%; padding: 6px; }
.pill { display: table; margin: 18px auto 10px; padding: 6px 14px; border-radius: 10px; background: var(--pill); box-shadow: var(--shadow); color: var(--muted); font-size: .85rem; font-weight: 700; text-align: center; }
.notice { max-width: 560px; margin: 10px auto; padding: 8px 14px; border-radius: 10px; background: var(--notice); color: var(--notice-ink); font-size: .84rem; text-align: center; box-shadow: var(--shadow); }
.notice a { color: inherit; font-weight: 700; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: dot 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.msg-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Story reveal: only when JS is running and motion is welcome */
.anim [data-say] { opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .35s ease, transform .35s ease; }
.anim [data-say].shown { opacity: 1; transform: none; }

/* ---------- Profile card (hero) ---------- */
.profile { position: relative; max-width: 680px; margin: 8px auto 16px; padding: 30px 20px 24px; text-align: center; border-radius: 22px; background: var(--card); box-shadow: var(--lift); overflow: hidden; }
.profile::after { content: ""; position: absolute; inset: 0 0 auto; height: 96px; background: linear-gradient(135deg, #191e29, #2b3445); z-index: 0; }
.profile > * { position: relative; z-index: 1; }
.profile .avatar { width: 116px; height: 116px; margin: 22px auto 10px; border-radius: 50%; display: grid; place-items: center; background: #0f141d; border: 5px solid var(--card); box-shadow: 0 0 0 3px var(--brand); }
.profile .avatar img { width: 74px; height: auto; }
.profile .name { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 1.15rem; }
.verified { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--navy); background: var(--brand); padding: 2px 8px; border-radius: 999px; }
.profile h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 6.6vw, 3.2rem); line-height: 1.35; margin: 12px auto 10px; max-width: 16em; }
.mark { background: linear-gradient(transparent 64%, rgba(254, 121, 13, .5) 64%, rgba(254, 121, 13, .5) 90%, transparent 90%); padding: 0 .12em; }
.profile .lead { color: var(--muted); font-size: 1.05rem; max-width: 34em; margin: 0 auto; }
.profile .btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; padding: 0; list-style: none; }
.facts li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--wall); border: 1px solid var(--line); font-size: .88rem; font-weight: 700; }
.stickers { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px 0 2px; }
.sticker { display: inline-block; font-family: var(--display); font-size: 1.15rem; line-height: 1.2; padding: 7px 16px 5px; border-radius: 14px; color: var(--navy); background: #ffd23f; box-shadow: 0 6px 14px rgba(0, 0, 0, .16); transform: rotate(-4deg); }
.sticker:nth-child(2) { background: var(--brand); transform: rotate(3deg); }
.sticker:nth-child(3) { background: #9be7c4; transform: rotate(-2deg); }
.sticker:nth-child(4) { background: #ffffff; transform: rotate(4deg); }
.topic-emoji { font-size: 2.6rem; line-height: 1; }

/* ---------- Kashkool (notebook page) ---------- */
.kashkool { position: relative; margin: 2px; padding: 22px 50px 26px 18px; border-radius: 6px; color: #1d3a8a; background-color: #fffdf3; background-image: repeating-linear-gradient(to bottom, transparent 0 33px, #c3d9f2 33px 34px); background-position: 0 14px; font-family: var(--hand); font-weight: 700; font-size: 1.3rem; line-height: 34px; box-shadow: inset 0 0 0 1px #efe6c8; overflow: hidden; }
.kashkool::before { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 36px; border-inline-start: 2px solid #f2a5a5; }
.kashkool .tape { position: absolute; top: -8px; inset-inline-end: 30px; width: 90px; height: 24px; background: rgba(255, 236, 160, .8); transform: rotate(4deg); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.kashkool .ring { position: absolute; bottom: 14px; inset-inline-end: 18px; width: 92px; height: 92px; border-radius: 50%; border: 9px solid rgba(139, 90, 43, .2); }
.kashkool ul { list-style: none; margin: 0; padding: 0; position: relative; }
.kashkool li:nth-child(odd) { transform: rotate(-.6deg); }
.kashkool li:nth-child(even) { transform: rotate(.5deg); }
.kashkool s { text-decoration-color: #d0302f; text-decoration-thickness: 3px; }
.kashkool .red { color: #c62828; }
.kashkool h3 { font: inherit; font-size: 1.5rem; color: #a31b1b; }

/* ---------- Demos ---------- */
.demo { padding: 12px; }
.demo h3 { font-size: 1.02rem; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { cursor: pointer; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--wall); font-weight: 700; font-size: .9rem; }
.chip:hover { border-color: var(--brand); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.fields label { display: grid; gap: 3px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.fields .wide { grid-column: 1 / -1; }
.fields input { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--wall); font-weight: 700; font-size: 1rem; }
.fields .btn { grid-column: 1 / -1; }

/* Thermal receipt */
.receipt { position: relative; max-width: 340px; margin: 14px auto 16px; padding: 16px 16px 20px; background: #fff; color: #1d1d1d; font-size: .92rem; box-shadow: 0 6px 16px rgba(0, 0, 0, .15); }
.receipt::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px; background: linear-gradient(-45deg, transparent 6px, #fff 0) 0 0 / 12px 10px repeat-x, linear-gradient(45deg, transparent 6px, #fff 0) 0 0 / 12px 10px repeat-x; }
.receipt .r-head { text-align: center; font-weight: 800; border-bottom: 1px dashed #999; padding-bottom: 8px; margin-bottom: 6px; }
.receipt .r-head small { display: block; font-weight: 400; color: #666; font-size: .78rem; }
.receipt ul { list-style: none; margin: 0; padding: 0; }
.receipt li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dotted #ccc; }
.receipt li b { font-family: "Courier New", ui-monospace, monospace; color: #15803d; white-space: nowrap; }
.receipt li b.loss { color: #b91c1c; }
.receipt li.new { animation: print .6s ease; }
@keyframes print { from { opacity: 0; transform: translateY(-8px); background: #fff7d6; } }
.receipt .r-total { display: flex; justify-content: space-between; margin-top: 8px; font-weight: 800; }
.receipt .r-total b { font-family: "Courier New", ui-monospace, monospace; }
.receipt .r-foot { text-align: center; margin-top: 10px; color: #666; font-size: .8rem; }

/* WhatsApp message preview */
.wa-phone { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--wall) url("/assets/chat-doodles.svg") 0 0 / 200px 200px; }
.wa-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #075e54; color: #fff; font-weight: 700; font-size: .95rem; }
@media (prefers-color-scheme: dark) { .wa-top { background: #1f2c34; } }
.wa-top .av { width: 34px; height: 34px; border-radius: 50%; background: #cfd8dc; color: #37474f; display: grid; place-items: center; font-size: 1rem; }
.wa-top small { display: block; font-weight: 400; opacity: .8; font-size: .75rem; }
.wa-body { padding: 14px 12px 16px; display: flex; flex-direction: column; align-items: flex-end; }
.wa-msg { max-width: 92%; background: var(--wa); color: var(--wa-ink); border-radius: 0 12px 12px 12px; padding: 8px 10px 6px; box-shadow: var(--shadow); font-size: .95rem; line-height: 1.65; }
.wa-msg p { white-space: pre-line; }
.wa-msg .ticks { color: #8696a0; transition: color .3s ease; }
.wa-msg .ticks.read { color: var(--tick); }
.wa-status { margin-top: 6px; font-size: .8rem; font-weight: 700; color: var(--muted); min-height: 1.3em; }

/* Calculator */
.calc { padding: 14px; border-radius: 18px; background: linear-gradient(#30353d, #22262c); color: #eef1f4; }
.lcd { border-radius: 10px; padding: 10px 14px; background: linear-gradient(#cfdcae, #b9c993); color: #1d2610; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .35); }
.lcd span { display: block; font-size: .8rem; font-weight: 700; opacity: .75; }
.lcd b { display: block; font-family: "Courier New", ui-monospace, monospace; font-size: clamp(1.7rem, 7vw, 2.3rem); line-height: 1.2; direction: ltr; text-align: right; letter-spacing: 1px; }
.lcd .back { margin-top: 6px; }
.calc label { display: grid; gap: 4px; margin-top: 12px; font-weight: 700; font-size: .92rem; }
.calc output { color: #ffb066; font-weight: 800; }
.calc input[type="range"] { width: 100%; height: 30px; accent-color: var(--brand); }
.calc-verdict { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .08); font-weight: 800; text-align: center; }

/* Repair ticket */
.ticket { position: relative; border-radius: 14px; background: var(--wall); border: 2px dashed var(--line); padding: 14px 14px 12px; }
.ticket::before { content: ""; position: absolute; top: 12px; inset-inline-end: 14px; width: 16px; height: 16px; border-radius: 50%; background: var(--in); box-shadow: inset 0 0 0 2px var(--line); }
.ticket h3 { font-size: 1rem; margin-bottom: 8px; }
.ticket dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; font-size: .92rem; }
.ticket dt { color: var(--muted); font-weight: 700; }
.ticket dd { margin: 0; font-weight: 700; }
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; counter-reset: st; }
.stages li { position: relative; text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); padding-top: 34px; }
.stages li::before { counter-increment: st; content: counter(st); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 2px solid var(--line); color: var(--muted); }
.stages li.done { color: var(--ink); }
.stages li.done::before { content: "✓"; background: var(--good); border-color: var(--good); color: #fff; }
.stages li.now { color: var(--ink); }
.stages li.now::before { background: var(--brand); border-color: var(--brand); color: var(--navy); }
.ticket .wa-msg { margin-top: 10px; }

/* Feature grid (like a chat attachment menu) */
.attach { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 8px; padding: 14px 6px 8px; list-style: none; margin: 0; }
.attach li { text-align: center; font-size: .86rem; font-weight: 700; line-height: 1.35; }
.attach .dot { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 6px; border-radius: 50%; color: #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, .18); }
.attach .dot svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attach small { display: block; color: var(--muted); font-weight: 400; font-size: .76rem; }
.attach a, .bubble .attach a { text-decoration: none; color: inherit; font-weight: 700; }

/* Price tags */
.billing-input { position: absolute; opacity: 0; pointer-events: none; }
.billing { display: flex; justify-content: center; gap: 4px; padding: 4px; margin: 6px auto 14px; width: fit-content; border-radius: 999px; background: var(--wall); border: 1px solid var(--line); }
.billing label { padding: 7px 16px; border-radius: 999px; font-weight: 800; cursor: pointer; color: var(--muted); font-size: .92rem; }
.billing em { font-style: normal; font-size: .78rem; color: var(--good); }
#bill-m:checked ~ .billing label[for="bill-m"], #bill-y:checked ~ .billing label[for="bill-y"] { background: var(--navy); color: #fff; }
#bill-y:checked ~ .billing label[for="bill-y"] em { color: #9be7c4; }
#bill-m:focus-visible ~ .billing label[for="bill-m"], #bill-y:focus-visible ~ .billing label[for="bill-y"] { outline: 3px solid var(--brand); outline-offset: 2px; }
.py { display: none; }
#bill-y:checked ~ .tags .pm { display: none; }
#bill-y:checked ~ .tags .py { display: block; }
.tags { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 22px 4px 6px; }
@media (max-width: 720px) { .tags { grid-template-columns: 1fr; gap: 30px; } }
.tag { position: relative; padding: 30px 16px 16px; border-radius: 16px; background: var(--wall); border: 1px solid var(--line); text-align: center; transform: rotate(-1.5deg); display: flex; flex-direction: column; }
.tag:nth-child(2) { transform: rotate(1.2deg); background: var(--brand); color: var(--navy); border-color: var(--brand); }
.tag:nth-child(3) { transform: rotate(-.8deg); }
.tag::before { content: ""; position: absolute; top: 10px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--in); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25); }
.tag::after { content: ""; position: absolute; top: -20px; left: 50%; width: 2px; height: 32px; background: rgba(120, 120, 120, .6); transform: rotate(18deg); transform-origin: bottom; }
.tag .t-name { font-weight: 800; font-size: 1.1rem; }
.tag .t-for { font-size: .82rem; opacity: .85; }
.tag .t-price { font-family: var(--display); font-size: 2.6rem; line-height: 1.1; margin-top: 6px; }
.tag .t-price small { font-family: var(--font); font-size: .82rem; font-weight: 700; }
.tag .t-usd { font-size: .76rem; opacity: .8; margin-bottom: 8px; }
.tag ul { list-style: none; margin: 0 0 12px; padding: 0; font-size: .86rem; font-weight: 700; display: grid; gap: 4px; }
.tag li::before { content: "✓ "; color: var(--good); }
.tag:nth-child(2) li::before { color: var(--navy); }
.tag .btn { margin-top: auto; }
.tag:nth-child(2) .btn-main { background: var(--navy); color: #fff; box-shadow: none; }
.bubble .tag:nth-child(2) a.btn-main { color: #fff; }
.tag .hot { position: absolute; top: -14px; inset-inline-end: -6px; background: #ffd23f; color: var(--navy); font-family: var(--display); padding: 3px 10px 1px; border-radius: 10px; transform: rotate(8deg); font-size: .95rem; box-shadow: 0 4px 10px rgba(0, 0, 0, .2); }
.pay { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.pay span { padding: 4px 10px; border-radius: 999px; background: var(--wall); border: 1px solid var(--line); font-size: .82rem; font-weight: 700; }

/* Final call to action */
.cta-card { text-align: center; padding: 22px 14px 18px; }
.cta-card .big { font-family: var(--display); font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1.3; }
.cta-card p { color: var(--muted); margin: 6px 0 14px; }
.cta-card .btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* Related chats */
.more-chats { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.more-chats a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--wall); text-decoration: none; color: var(--ink); font-weight: 700; }
.more-chats a span { font-size: 1.3rem; }
.more-chats small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }

/* Long text pages (legal) */
.doc { max-width: 760px; margin: 0 auto; padding: 22px 20px; border-radius: 18px; background: var(--card); box-shadow: var(--lift); }
.doc h1 { font-family: var(--display); font-weight: 400; font-size: clamp(1.8rem, 5vw, 2.4rem); margin-bottom: 8px; }
.doc h2 { font-size: 1.15rem; margin: 22px 0 6px; }
.doc p, .doc li { color: var(--muted); line-height: 1.8; }
.doc ul { padding-inline-start: 1.2em; }
.doc a { color: var(--brand); font-weight: 700; }
.doc .kicker { color: var(--brand); font-weight: 700; font-size: .9rem; }

/* ---------- Composer ---------- */
.composer { position: sticky; bottom: 0; z-index: 15; padding: 6px 10px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--wall) 30%); }
.composer-in { max-width: 860px; margin: 0 auto; }
.quick { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; cursor: pointer; padding: 7px 13px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: .88rem; box-shadow: var(--shadow); }
.quick button:hover { border-color: var(--brand); }
.compose { display: flex; align-items: center; gap: 8px; }
.compose input { flex: 1; min-width: 0; height: 50px; padding: 0 18px; border-radius: 26px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); font-size: 1rem; }
.compose input::placeholder { color: var(--muted); }
.send { flex: none; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; border: 0; cursor: pointer; background: var(--brand); color: var(--navy); box-shadow: 0 6px 16px rgba(254, 121, 13, .4); }
.send svg { width: 22px; height: 22px; transform: scaleX(-1); }
.compose-note { margin-top: 6px; text-align: center; font-size: .72rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .btn, .side { transition: none; }
  .typing i, .receipt li.new { animation: none; }
}
#live .row { scroll-margin-bottom: 170px; }

/* ---------- Download page ---------- */
.dl-box { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 18px; }
.btn.is-off { opacity: .55; cursor: default; box-shadow: none; }
.dl-meta { font-weight: 700; font-size: .92rem; min-height: 1.2em; }
.dl-status { color: var(--muted); font-size: .9rem; }
.how { list-style: none; counter-reset: how; margin: 0; padding: 12px 10px 6px; display: grid; gap: 14px; }
.how li { counter-increment: how; position: relative; padding-inline-start: 52px; min-height: 40px; }
.how li::before { content: counter(how); position: absolute; inset-inline-start: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--navy); font-family: var(--display); font-size: 1.3rem; }
.how b { display: block; font-size: 1.02rem; }
.how span { display: block; color: var(--muted); font-size: .92rem; }
.dl-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 6px 0 10px; font-size: .95rem; }
.dl-facts dt { color: var(--muted); font-weight: 700; }
.dl-facts dd { margin: 0; font-weight: 700; text-align: start; }
.demo details summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.sha { font-family: "Courier New", ui-monospace, monospace; font-size: .8rem; word-break: break-all; padding: 8px 10px; border-radius: 10px; background: var(--wall); margin: 6px 0 8px; }

/* ---------- AF Device Trust ---------- */
.dt-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .dt-form { grid-template-columns: 1fr; } }
.dt-form label { display: grid; gap: 4px; font-size: .88rem; font-weight: 700; color: var(--muted); }
.dt-form label small { font-weight: 400; }
.dt-form .wide, .dt-form fieldset { grid-column: 1 / -1; }
.dt-form input:not([type="checkbox"]), .dt-form select, .dt-form textarea { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--wall); color: var(--ink); font: 600 1rem var(--font); }
.dt-form textarea { resize: vertical; }
.dt-form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 10px; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.dt-form legend { font-size: .88rem; font-weight: 700; color: var(--muted); padding: 0 4px; }
.dt-form .dt-check { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); }
.dt-form fieldset input[name="other"] { flex: 1 1 140px; min-height: 38px; }
.dt-form .dt-declare { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); }
.dt-declare input, .dt-checklist input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--brand); }
.dt-small { font-size: .82rem; color: var(--muted); margin-top: 8px; }
.dt-small a { color: var(--brand); font-weight: 700; }
.dt-hint { font-size: .8rem; min-height: 1em; color: var(--ink); }
.dt-note { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--wall); border-inline-start: 4px solid #0795dc; }
.dt-note b { display: block; }
.dt-note p { margin-top: 2px; font-size: .9rem; color: var(--muted); }
.dt-ok { border-color: var(--good); }
.dt-bad { border-color: var(--bad); }
.dt-warn { border-color: #e3871b; }
.dt-demo-badge { display: inline-block; margin-top: 10px; padding: 3px 10px; border-radius: 999px; background: #ffd23f; color: var(--navy); font-weight: 800; font-size: .8rem; }
.dt-sources { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.dt-sources li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--wall); }
.dt-kind, .dt-sources small { font-size: .78rem; color: var(--muted); }
.dt-outcome { font-weight: 800; }
.dt-outcome.dt-match { color: var(--bad); }
.dt-outcome.dt-no_match { color: var(--good); }
.dt-outcome.dt-failed, .dt-outcome.dt-not_covered { color: #b45309; }
.dt-meta { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.dt-limits { font-size: .82rem; font-weight: 800; margin-top: 6px; }
.dt-demo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: .88rem; font-weight: 700; }
.dt-checklist { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 8px; }
.dt-checklist label { display: flex; gap: 8px; align-items: flex-start; }
.dt-captcha { margin-top: 10px; }

/* Receipt: always light paper, ready to print */
.dt-receipt { margin-top: 14px; }
.dt-paper { position: relative; overflow: hidden; background: #fff; color: #111; border-radius: 12px; padding: 16px; border: 1px solid #ddd; font-size: .95rem; }
.dt-r-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border-bottom: 2px solid #111; padding-bottom: 10px; }
.dt-r-head h3 { font-family: var(--display); font-weight: 400; font-size: 1.4rem; }
.dt-r-head p { color: #444; }
.dt-r-ref { text-align: end; }
.dt-r-ref b { display: block; font-family: "Courier New", ui-monospace, monospace; direction: ltr; }
.dt-r-ref small { color: #555; }
.dt-r-flag { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: #fff3c4; font-weight: 700; font-size: .85rem; }
.dt-r-body { margin-top: 10px; display: grid; gap: 2px; }
.dt-r-row { display: grid; grid-template-columns: 140px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px dotted #bbb; }
.dt-r-row span { color: #555; font-size: .88rem; }
.dt-r-row b { overflow-wrap: anywhere; }
.dt-r-row b[dir="ltr"] { text-align: right; }
.dt-r-declare { margin-top: 12px; padding: 10px; border: 1px solid #111; border-radius: 8px; font-size: .9rem; line-height: 1.8; }
.dt-r-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 30px; }
.dt-r-signs div { border-top: 1px solid #111; padding-top: 6px; text-align: center; font-size: .85rem; }
.dt-r-foot { margin-top: 10px; font-size: .78rem; color: #555; text-align: center; }
.dt-watermark { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 6rem; color: rgba(220, 38, 38, .13); transform: rotate(-20deg); pointer-events: none; }

/* QR codes */
.dt-qr { width: min(260px, 70vw); margin: 10px auto; padding: 8px; border-radius: 12px; background: #fff; }
.dt-qr svg { display: block; width: 100%; height: auto; }
.dt-qr-card { text-align: center; padding: 14px; margin: 10px 0; border: 2px dashed var(--line); border-radius: 16px; }
.dt-qr-card b { font-size: 1.05rem; }
.dt-qr-wrap { text-align: center; }
.dt-src-plain { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--wall); font-weight: 700; }
.dt-src-plain span { font-size: 1.3rem; }
.dt-src-plain small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }

/* Printing copies the receipt or the shop QR into #dt-print-root and prints only that. */
#dt-print-root { display: none; }
@media print {
  body.dt-printing { background: #fff !important; }
  body.dt-printing > *:not(#dt-print-root) { display: none !important; }
  body.dt-printing #dt-print-root { display: block; color: #111; }
  #dt-print-root .dt-paper { border: 0; padding: 0; }
  #dt-print-root .dt-qr-card { border-color: #999; margin-top: 30mm; }
  @page { margin: 12mm; }
}

/* Guides */
.dt-guide h3 { font-size: 1.08rem; margin-bottom: 6px; }
.dt-step { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.dt-step:last-child { border-bottom: 0; }
.dt-step p { line-height: 1.7; }
.dt-src { margin-top: 4px; font-size: .74rem; color: var(--muted); }
.dt-src a { color: var(--brand); font-weight: 700; }

/* Printing any page: content only, no chat chrome */
@media print {
  /* Paper is white even when the phone is in dark mode. */
  :root { --wall: #fff; --bar: #fff; --card: #fff; --ink: #111b21; --muted: #5f6e78; --line: #ccc; --in: #fff; --out: #fff; --pill: #fff; --notice: #fff3c4; --notice-ink: #54451a; --good: #15803d; --bad: #b91c1c; }
  body:not(.dt-printing) { background: #fff !important; color: #111; }
  body:not(.dt-printing) .side, body:not(.dt-printing) .chat-head, body:not(.dt-printing) .composer, body:not(.dt-printing) .skip { display: none !important; }
  body:not(.dt-printing) .app { display: block; }
  body:not(.dt-printing) [data-say] { opacity: 1 !important; transform: none !important; }
  body:not(.dt-printing) .bubble { box-shadow: none; border: 1px solid #ccc; max-width: 100%; }
  body:not(.dt-printing) .btns, body:not(.dt-printing) .msg-actions { display: none !important; }
}

/* AF Device Trust, phase 2: accounts, reports, chat, staff console */
#dt-app { display: grid; gap: 12px; }
.dt-card { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.dt-declare { display: flex; gap: 8px; align-items: flex-start; }
.dt-card > * + * { margin-top: 8px; }
.dt-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.dt-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 800; background: var(--wall); border: 1px solid var(--line); }
.dt-chip-ok { color: var(--good); border-color: var(--good); }
.dt-chip-bad { color: var(--bad); border-color: var(--bad); }
.dt-chip-warn { color: var(--brand); border-color: var(--brand); }
.dt-form .dt-check { font-weight: 600; }
.dt-help { margin-top: 10px; font-size: .9rem; }
.dt-help summary { cursor: pointer; font-weight: 800; color: var(--brand); }
.dt-help ul { margin: 8px 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.dt-recovery h3 { margin-bottom: 4px; }
.dt-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; padding: 10px 28px; margin: 8px 0; border: 1px dashed var(--line); border-radius: 12px; font: 700 1.05rem ui-monospace, Consolas, monospace; text-align: left; }
.dt-facts { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; font-size: .92rem; }
.dt-notes { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 6px; }
.dt-notes li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--wall); }
.dt-notes li.unread { border-inline-start: 4px solid var(--brand); }
.dt-notes small, .dt-msg small { color: var(--muted); font-size: .75rem; }
.dt-notes a { color: var(--ink); font-weight: 700; }
.dt-steps { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .74rem; }
.dt-steps li { padding: 3px 8px; border-radius: 999px; background: var(--wall); color: var(--muted); }
.dt-steps li.done { color: var(--good); }
.dt-steps li.now { background: var(--brand); color: #fff; font-weight: 800; }
.dt-chat { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; padding: 8px; border-radius: 12px; background: var(--wall); }
.dt-msg { max-width: 85%; padding: 7px 10px; border-radius: 12px; background: var(--in); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.dt-msg.mine { justify-self: start; background: var(--out); }
.dt-msg.theirs { justify-self: end; }
.dt-msg p { white-space: pre-wrap; }
.dt-send { grid-template-columns: 1fr auto; align-items: end; }
.dt-chat-notice { font-size: .82rem; }
.dt-back { color: var(--brand); font-weight: 800; text-decoration: none; }
.linklike { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; }
.dt-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-admin-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; font-size: .88rem; }
.dt-admin-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.dt-admin-list li > span { flex: 1 1 220px; }
.dt-admin-list input { width: 90px; min-height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--wall); color: var(--ink); padding: 4px 8px; }
#dt-app textarea { width: 100%; min-height: 60px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--wall); color: var(--ink); font: 600 1rem var(--font); }
.dt-test-banner { margin-bottom: 12px; }
@media (max-width: 560px) { .dt-codes { grid-template-columns: 1fr; } .dt-send { grid-template-columns: 1fr; } }
