/* Pavia Helper web app. Plain CSS, no build step.
   Tokens: light by default, dark through prefers-color-scheme. Every text/background pair is checked
   with tools/web-contrast/*.json (python3 ~/.claude/skills/replica-design/contrast.py <file>).
   Logical properties everywhere, so Persian (right-to-left) needs almost no extra rules. */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(/fonts/inter-regular.woff2) format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+2013-2014, U+2018-201D, U+2022, U+2026, U+20AC, U+2190, U+2192; }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(/fonts/inter-medium.woff2) format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+2013-2014, U+2018-201D, U+2022, U+2026, U+20AC, U+2190, U+2192; }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(/fonts/inter-semibold.woff2) format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+2013-2014, U+2018-201D, U+2022, U+2026, U+20AC, U+2190, U+2192; }
@font-face { font-family: "Inter Display"; font-weight: 700; font-display: swap; src: url(/fonts/inter-display-bold.woff2) format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+2013-2014, U+2018-201D, U+2022, U+2026, U+20AC, U+2190, U+2192; }
@font-face { font-family: "Vazirmatn"; font-weight: 100 900; font-display: swap; src: url(/fonts/vazirmatn.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+060C, U+061B, U+061F, U+066A-066C, U+06F0-06F9; }

:root {
  color-scheme: light dark;
  --bg: #FBF6EE;
  --bg-deep: #F3E9DA;
  --surface: #FEFBF7;            /* the glass over the page, as one colour */
  --glass: rgb(255 255 255 / .74);
  --surface-soft: #F7EFE3;
  --text: #231B14;
  --text-muted: #66584A;
  --placeholder: #6F6152;
  --accent: #B04F08;
  --on-accent: #FFFFFF;
  --accent-text: #9A4306;
  --accent-soft: #FBE4CD;
  --on-accent-soft: #3B1E08;
  --deadline-bg: #FDEFC6;
  --deadline-text: #6B4300;
  --official-bg: #DCF0E3;
  --official-text: #14583A;
  --notice-bg: #ECE7F5;
  --notice-text: #43306B;
  --edge: #8D7F6F;               /* borders that identify an input: 3:1 */
  --line: rgb(70 45 20 / .16);   /* quiet decorative borders */
  --line-accent: rgb(176 79 8 / .35);
  --glow-a: rgb(255 190 120 / .50);
  --glow-b: rgb(190 170 255 / .28);
  --shadow: 0 1px 2px rgb(60 35 10 / .06), 0 10px 30px -12px rgb(90 50 15 / .22);
  --focus: #B04F08;
  --overdue: #B42318;

  --orb-hi: #FFEBCB; --orb-mid: #FFC389; --orb-lo: #F2924F;
  --orb-b1: rgb(255 201 60 / .95); --orb-b2: rgb(255 138 76 / .85); --orb-b3: rgb(168 128 255 / .80); --orb-b4: rgb(70 214 180 / .80);
  --orb-halo: rgb(255 170 90 / .55); --orb-shadow: rgb(205 112 40 / .50); --orb-inner: rgb(190 90 20 / .30);
  --blend: normal;

  --font: "Inter", "Vazirmatn", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --display: "Inter Display", "Inter", "Vazirmatn", system-ui, sans-serif;
  --lh: 1.55;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15100C;
    --bg-deep: #1D1611;
    --surface: #221A14;
    --glass: rgb(40 30 22 / .74);
    --surface-soft: #2B2118;
    --text: #F6EEE4;
    --text-muted: #BBAB9B;
    --placeholder: #B0A090;
    --accent: #F0A25A;
    --on-accent: #2A1503;
    --accent-text: #F4B27A;
    --accent-soft: #4A2C14;
    --on-accent-soft: #FBE3C8;
    --deadline-bg: #4A3606;
    --deadline-text: #FBD97A;
    --official-bg: #12392A;
    --official-text: #A8E6C3;
    --notice-bg: #2D2545;
    --notice-text: #D9CCFA;
    --edge: #8A7B6B;
    --line: rgb(255 235 210 / .14);
    --line-accent: rgb(240 162 90 / .40);
    --glow-a: rgb(240 150 70 / .20);
    --glow-b: rgb(150 120 255 / .14);
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 12px 32px -12px rgb(0 0 0 / .6);
    --focus: #F0A25A;
    --overdue: #FF8A80;
    --orb-hi: #FFCB8E; --orb-mid: #E58B42; --orb-lo: #82401A;
    --orb-b1: rgb(255 201 60 / .90); --orb-b2: rgb(255 138 76 / .80); --orb-b3: rgb(168 128 255 / .75); --orb-b4: rgb(70 214 180 / .70);
    --orb-halo: rgb(240 150 70 / .45); --orb-shadow: rgb(240 150 70 / .35); --orb-inner: rgb(60 20 0 / .55);
    --blend: screen;
  }
}
html[lang="fa"] { --lh: 1.8; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/var(--lh) var(--font);
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 10px; }

.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic--inline { width: 18px; height: 18px; vertical-align: -3px; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.ic--fwd { transform: scaleX(-1); }
[dir="rtl"] .ic--fwd { transform: none; }

/* ---------- page frame ---------- */
#app { position: relative; display: flex; flex-direction: column; height: var(--vh, 100dvh); min-height: 0; overflow: hidden; isolation: isolate; }
.backdrop { position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(70% 45% at 85% -5%, var(--glow-a), transparent 70%), radial-gradient(55% 40% at -5% 28%, var(--glow-b), transparent 70%), var(--bg); }
.screen { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.wrap { width: 100%; max-width: 44rem; margin-inline: auto; padding-inline: var(--gutter); }
html:not(.vt) .screen:not([hidden]) { animation: screen-in .28s var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }
::view-transition-group(orb) { animation-duration: .7s; animation-timing-function: var(--ease); }

.topbar { flex: none; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: max(8px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 8px max(var(--gutter), env(safe-area-inset-left)); }
.topbar__title { margin: 0; flex: 1; min-width: 0; font-size: 18px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; outline: none; }
.brand { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark { width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 4px 12px -4px rgb(176 79 8 / .5); }
.brand__name { margin: 0; font-weight: 600; font-size: 17px; letter-spacing: 0; outline: none; }
.icon-btn { position: relative; width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform .15s var(--ease), background .2s; }
.icon-btn:active { transform: scale(.94); }
.icon-btn--small { width: 40px; height: 40px; }
.menu-dot { position: absolute; top: 9px; inset-inline-end: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
#orb-chat { display: none; }
#screen-ask[data-mode="thread"] #orb-chat { display: block; }

/* ---------- the orb ---------- */
#app > .orb { display: none; }
.orb-slot { position: relative; width: var(--orb-size, 160px); height: var(--orb-size, 160px); flex: none; }
.orb-slot--small { --orb-size: 40px; }
.orb { position: relative; width: 100%; height: 100%; view-transition-name: orb; contain: layout style; }
.orb__halo { position: absolute; inset: -22%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, var(--orb-halo), transparent); animation: halo 8s ease-in-out infinite; }
.orb__ring { position: absolute; inset: -6%; border-radius: 50%; pointer-events: none; border: 2px solid var(--accent); opacity: 0; }
.orb__body { position: absolute; inset: 0; overflow: hidden; isolation: isolate; border-radius: 52% 48% 56% 44% / 47% 55% 45% 53%;
  background: radial-gradient(circle at 32% 26%, var(--orb-hi), var(--orb-mid) 55%, var(--orb-lo));
  box-shadow: 0 26px 60px -20px var(--orb-shadow), inset 0 -14px 34px var(--orb-inner), inset 0 8px 24px rgb(255 255 255 / .35);
  animation: morph 16s ease-in-out infinite; transform-origin: 50% 50%; }
.orb__blob { position: absolute; width: 80%; height: 80%; border-radius: 50%; mix-blend-mode: var(--blend); will-change: transform;
  background: radial-gradient(closest-side, var(--b), transparent); }
.orb__blob--1 { --b: var(--orb-b1); inset-inline-start: -14%; top: -10%; animation: drift-1 11s ease-in-out infinite alternate; }
.orb__blob--2 { --b: var(--orb-b2); inset-inline-end: -16%; top: 12%; animation: drift-2 13s ease-in-out infinite alternate; }
.orb__blob--3 { --b: var(--orb-b3); inset-inline-start: 6%; bottom: -22%; animation: drift-3 15s ease-in-out infinite alternate; }
.orb__blob--4 { --b: var(--orb-b4); inset-inline-end: 8%; bottom: -26%; width: 60%; height: 60%; animation: drift-4 12s ease-in-out infinite alternate; }
.orb__sheen { position: absolute; inset: 7% 22% 56% 15%; border-radius: 50%; opacity: .55; filter: blur(2px);
  background: linear-gradient(to bottom, rgb(255 255 255 / .7), transparent); }
@keyframes morph {
  0%, 100% { border-radius: 52% 48% 56% 44% / 47% 55% 45% 53%; }
  33% { border-radius: 46% 54% 47% 53% / 55% 45% 55% 45%; }
  66% { border-radius: 55% 45% 51% 49% / 44% 52% 48% 56%; }
}
@keyframes halo { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes drift-1 { to { transform: translate(34%, 26%) scale(1.15); } }
@keyframes drift-2 { to { transform: translate(-30%, 22%) scale(.9); } }
@keyframes drift-3 { to { transform: translate(28%, -30%) scale(1.1); } }
@keyframes drift-4 { to { transform: translate(-36%, -26%) scale(1.25); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes ripple { 0% { transform: scale(.92); opacity: .55; } 100% { transform: scale(1.32); opacity: 0; } }

/* thinking: a quicker, brighter pulse while the answer streams in */
.orb[data-state="thinking"] .orb__body { animation: morph 6s ease-in-out infinite, breathe 1.5s ease-in-out infinite; }
.orb[data-state="thinking"] .orb__blob { animation-duration: 3.6s; }
.orb[data-state="thinking"] .orb__halo { animation: halo 1.5s ease-in-out infinite; }
.orb[data-state="thinking"] .orb__ring { animation: ripple 1.8s ease-out infinite; }
/* listening: the orb swells with the voice (--level, 0 to 1, set from the microphone) */
.orb[data-state="listening"] .orb__body { animation: morph 8s ease-in-out infinite; transform: scale(calc(1 + var(--level, 0) * .2)); transition: transform .09s linear; }
.orb[data-state="listening"] .orb__blob { animation-duration: 5s; }
.orb[data-state="listening"] .orb__halo { transform: scale(calc(1 + var(--level, 0) * .3)); animation: none; opacity: 1; transition: transform .09s linear; }
.orb[data-state="listening"] .orb__ring { animation: ripple 1.4s ease-out infinite; }

/* ---------- ask: the greeting and three suggestions while the chat is empty ---------- */
.hero { --orb-size: clamp(72px, 12dvh, 104px); display: flex; flex-direction: column; align-items: center; text-align: center; padding: clamp(24px, 6dvh, 56px) 0 clamp(8px, 2dvh, 20px); }
.hero-visual { width: var(--orb-size); height: var(--orb-size); margin-bottom: clamp(18px, 3dvh, 28px); flex: none; }
.hero-visual .orb-slot { width: 100%; height: 100%; }
.hero-visual > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.hero__title { margin: 0; max-width: 16ch; font: 700 clamp(26px, 7.4vw, 34px)/1.15 var(--display); outline: none; text-wrap: balance; }
html[lang="en"] .hero__title { letter-spacing: -.02em; }
html[lang="fa"] .hero__title { font-family: "Vazirmatn", var(--display); font-weight: 700; line-height: 1.4; max-width: 16ch; }
.suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: clamp(18px, 3.4dvh, 28px); }
.suggest__chip { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-accent); background: var(--glass); color: var(--accent-text);
  font-size: 15px; font-weight: 600; line-height: 1.2; transition: transform .15s var(--ease), border-color .2s; }
.suggest__chip:active { transform: scale(.96); }
#screen-ask[data-mode="thread"] .hero, #screen-ask[data-mode="empty"] .messages { display: none; }
.lead { color: var(--text-muted); margin: 4px 0 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; }
.btn--small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn--quiet { background: var(--surface-soft); color: var(--text); border: 1px solid var(--line); }
.link-btn { border: 0; background: none; padding: 8px 4px; font-weight: 600; font-size: 14px; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.link { color: var(--accent-text); font-weight: 600; }

/* ---------- composer ---------- */
.composer { flex: none; padding: 6px 0 8px; background: linear-gradient(to top, var(--bg) 62%, transparent); }
#app[data-tabs="off"] .composer { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
#app:not([data-screen="ask"]) .composer { display: none; }
.box { display: flex; flex-direction: column; gap: 4px; padding: 10px 10px 8px 14px; border-radius: 26px; border: 1.5px solid var(--edge);
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); box-shadow: var(--shadow); }
[dir="rtl"] .box { padding: 10px 14px 8px 10px; }
.box:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent), var(--shadow); }
#input { display: block; width: 100%; min-height: 44px; max-height: 144px; padding: 6px 2px; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); line-height: 1.5; }
#input::placeholder { color: var(--placeholder); opacity: 1; }
.box__row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-soft); color: var(--text); font-size: 14px; font-weight: 600; line-height: 1; transition: transform .15s var(--ease); }
.pill .ic { width: 18px; height: 18px; }
.pill:active, .round:active { transform: scale(.95); }
.round { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-soft); color: var(--text); }
.round--send { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.round.is-on { background: var(--accent); color: var(--on-accent); border-color: transparent; animation: breathe 1.4s ease-in-out infinite; }
.composer:not(.has-text) .round--send:not(.is-stop) { display: none; }
.composer.has-text #btn-mic, .composer.is-busy #btn-mic { display: none; }
.round--send.is-stop { display: grid; }
.recording { display: grid; gap: 12px; padding: 4px 2px 2px; }
.recording__top { display: flex; align-items: center; gap: 14px; }
.orb-slot--rec { --orb-size: 60px; margin: 6px; }
.recording__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recording__text { font-weight: 600; line-height: 1.4; }
.recording__clock { align-self: flex-start; direction: ltr; unicode-bidi: isolate; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--text-muted); }  /* 0:03 / 1:00 reads left to right in Persian too */
.bar--rec { margin-top: 0; height: 8px; background: var(--accent-soft); border: 1px solid var(--line); }
.bar--rec::-webkit-progress-bar { background: var(--accent-soft); }
.recording__actions { display: flex; justify-content: flex-end; gap: 10px; }
.recording__actions .btn { min-width: 112px; }
.box.is-recording #input, .box.is-recording .box__row { display: none; }
.attach { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 6px 12px; border-radius: 14px; background: var(--accent-soft); color: var(--on-accent-soft); font-size: 14px; }
.attach span { flex: 1; min-width: 0; }
.attach .link-btn { color: var(--on-accent-soft); }
.composer__note { margin: 6px 8px 0; text-align: center; font-size: 13px; line-height: 1.4; color: var(--text-muted); }
.composer__note:empty { display: none; }

/* ---------- chat ---------- */
.thread { scroll-behavior: smooth; }
.messages { display: flex; flex-direction: column; gap: 16px; padding: 8px 0 28px; }
.msg { max-width: 100%; animation: msg-in .3s var(--ease); }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.msg--user { align-self: flex-end; max-width: 86%; padding: 11px 16px; border-radius: 22px; border-end-end-radius: 6px; background: var(--accent-soft); color: var(--on-accent-soft); }
.msg--bot { align-self: stretch; padding: 16px 16px 14px; border-radius: 22px; border-end-start-radius: 6px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.msg--notice { align-self: stretch; padding: 12px 16px; border-radius: 18px; background: var(--notice-bg); color: var(--notice-text); font-size: 15px; }
.msg--notice .link-btn { color: var(--notice-text); }
.msg__text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.msg--bot .msg__text { white-space: normal; line-height: 1.65; }
html[lang="fa"] .msg--bot .msg__text { line-height: 1.95; }
.msg__p { margin: 0 0 .8em; white-space: pre-line; overflow-wrap: anywhere; }
.msg__p:last-child { margin-bottom: 0; }
.msg__text a { text-underline-offset: 2px; overflow-wrap: anywhere; unicode-bidi: isolate; }
.msg__photo { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 14px; font-weight: 600; }
.typing { display: inline-flex; align-items: center; gap: 10px; color: var(--text-muted); }
.typing__dots { display: inline-flex; gap: 5px; }
.typing__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: dot 1.2s ease-in-out infinite; }
.typing__dots i:nth-child(2) { animation-delay: .15s; }
.typing__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-inline-start: 2px; vertical-align: -3px; background: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
/* under an answer: tags, buttons and the copy button in ONE row, all the same height, copy at the end */
.msg__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.msg__meta > * { flex: none; }
.msg__meta + .msg__meta { margin-top: 10px; padding-top: 0; border-top: 0; }
.tag { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 10px; border-radius: 999px; font-size: 14px; font-weight: 600; line-height: 1; }
.tag .ic { width: 16px; height: 16px; stroke-width: 2; }
.tag--deadline { background: var(--deadline-bg); color: var(--deadline-text); }
.tag--official { background: var(--official-bg); color: var(--official-text); }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-accent);
  background: var(--surface); color: var(--accent-text); font-size: 15px; font-weight: 600; line-height: 1.25; text-decoration: none; transition: transform .15s var(--ease); }
.chip:active { transform: scale(.96); }
.chip .ic { width: 18px; height: 18px; }
.chip small { font-size: inherit; font-weight: 500; color: var(--text-muted); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip--icon { margin-inline-start: auto; width: 32px; padding: 0; justify-content: center; border-color: transparent; background: transparent; color: var(--text-muted); }
.draft { margin-top: 14px; padding: 12px 14px; border-radius: 16px; border: 1px dashed var(--edge); background: var(--surface-soft); }
.draft__subject { margin: 0 0 6px; font-weight: 600; }
.draft__body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.55; unicode-bidi: plaintext; text-align: start; }
.draft__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- guides ---------- */
.guide-list { display: grid; gap: 10px; padding-bottom: 24px; }
.guide { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: start; border-radius: 20px; border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.guide__emoji { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); font-size: 22px; line-height: 1; }
.guide__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.guide__title { font-weight: 600; line-height: 1.3; }
.guide__sum { font-size: 14px; line-height: 1.4; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.guide-head { padding: 4px 0 12px; }
.guide-head h3 { margin: 0 0 4px; font-size: 24px; line-height: 1.25; }
.guide-head p { margin: 0; color: var(--text-muted); font-size: 15px; }
.sec { margin-bottom: 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.sec summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 16px; font-weight: 600; cursor: pointer; list-style: none; }
.sec summary::-webkit-details-marker { display: none; }
.sec summary::after { content: ""; width: 9px; height: 9px; margin-inline-start: auto; border-inline-end: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .2s var(--ease); }
.sec[open] summary::after { transform: rotate(225deg); }
.sec__body { padding: 0 16px 16px; white-space: pre-line; overflow-wrap: anywhere; }
.sources { margin: 18px 0 8px; }
.sources h4 { margin: 0 0 8px; font-size: 16px; }
.sources ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sources a { display: flex; gap: 8px; align-items: flex-start; min-height: 44px; padding: 8px 0; overflow-wrap: anywhere; }
.sources .ic { width: 18px; height: 18px; margin-top: 3px; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.fineprint { margin: 16px 0; font-size: 14px; color: var(--text-muted); }
.prose { padding-bottom: 32px; }
.facts { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.facts li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass); }
.facts .ic { margin-top: 2px; color: var(--official-text); }
.skeleton { height: 76px; margin-bottom: 10px; border-radius: 20px; background: linear-gradient(100deg, var(--surface-soft) 30%, var(--surface) 50%, var(--surface-soft) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- the personal screens: panels, forms, lists, switches ---------- */
.panel { margin: 0 0 14px; padding: 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 6px; font-size: 18px; line-height: 1.3; }
.panel h4 { margin: 0 0 4px; font-size: 17px; }
.panel h5 { margin: 14px 0 4px; font-size: 15px; }
.panel__lead { margin: 0 0 12px; color: var(--text-muted); font-size: 15px; }
.panel--ok { border-color: var(--line-accent); }
.panel > .btn, .panel > .actions { margin-top: 8px; }
.sec__form { padding: 0 16px 16px; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field__label { font-weight: 600; font-size: 15px; }
.field__input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--edge); background: var(--surface); color: var(--text); font-size: 16px; line-height: 1.4; }
textarea.field__input { resize: vertical; min-height: 96px; }
.field__input:focus { outline: 0; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.field__hint { margin: 0; font-size: 13.5px; color: var(--text-muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.btn[disabled], .icon-btn[disabled], .switch[disabled] { opacity: .55; cursor: progress; }
.btn--danger { background: var(--notice-bg); color: var(--notice-text); border: 1px solid var(--line); }
.status { margin: 10px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--surface-soft); color: var(--text); font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.status--ok { background: var(--official-bg); color: var(--official-text); }
.status--bad { background: var(--notice-bg); color: var(--notice-text); }
.status[hidden] { display: none; }
.items, .notices, .plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.plain li:first-child { border-top: 0; }
.item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item--done .item__text strong { text-decoration: line-through; color: var(--text-muted); }
.item__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item__text strong { font-weight: 600; overflow-wrap: anywhere; }
.item__sub { font-size: 14px; color: var(--text-muted); }
.item__actions { display: flex; gap: 6px; flex: none; }
.tag--origin { align-self: flex-start; background: var(--surface-soft); color: var(--text-muted); border: 1px solid var(--line); min-height: 24px; font-size: 12.5px; }
.check { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 10px; border: 2px solid var(--edge); background: var(--surface); color: transparent; }
.check[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.row { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row__text span { font-size: 14px; color: var(--text-muted); }
.switch { position: relative; width: 52px; height: 32px; flex: none; border-radius: 999px; border: 2px solid var(--edge); background: var(--surface); padding: 0; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--edge); transition: transform .2s var(--ease), background .2s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { background: var(--on-accent); transform: translateX(20px); }
[dir="rtl"] .switch[aria-checked="true"]::after { transform: translateX(-20px); }
.result { margin-top: 12px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-soft); white-space: pre-line; overflow-wrap: anywhere; }
.result h4 { margin: 0; }
.result p { margin: 4px 0 0; }
.result__sub { color: var(--text-muted); font-size: 14px; }
.result__big { margin: 6px 0 0; font-weight: 700; font-size: 20px; }
.bar { display: block; width: 100%; height: 14px; margin-top: 12px; border-radius: 999px; border: 0; overflow: hidden; background: var(--surface); accent-color: var(--accent); }
.bar::-webkit-progress-bar { background: var(--surface); }
.bar::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.bar::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 12px 0 0; }
.stats dt { color: var(--text-muted); }
.stats dd { margin: 0; font-weight: 600; text-align: end; }
.help-text { margin: 0; white-space: pre-line; }
.notice { border-top: 1px solid var(--line); }
.notice:first-child { border-top: 0; }
.notice__main { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 12px 4px; border: 0; background: none; text-align: start; color: var(--text); }
.notice__main span { white-space: pre-line; overflow-wrap: anywhere; font-size: 15px; }
.notice__main small { color: var(--text-muted); }
.notice--new .notice__main strong::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-inline-end: 8px; border-radius: 50%; background: var(--accent); }
.count { margin-inline-start: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 700; line-height: 24px; text-align: center; }
.confirm { display: grid; gap: 4px; margin-top: 14px; padding: 12px 14px; border-radius: 16px; border: 1.5px solid var(--line-accent); background: var(--surface-soft); }
.confirm__text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.confirm .actions { margin-top: 8px; }
.cards-flash { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 14px; }
.flash { display: flex; flex-direction: column; gap: 6px; min-height: 96px; padding: 12px 14px; text-align: start; border-radius: 16px; border: 1px solid var(--line-accent); background: var(--surface); color: var(--text); }
.flash__q { font-weight: 600; }
.flash__a { padding-top: 6px; border-top: 1px dashed var(--edge); }
.flash small { margin-top: auto; color: var(--text-muted); }
.chip--file { background: var(--accent-soft); color: var(--on-accent-soft); }
.chip--file small { color: inherit; opacity: .85; }

/* ---------- the three tabs ---------- */
.tabbar { display: none; flex: none; padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: var(--surface); border-top: 1px solid var(--line); }
#app[data-tabs="on"] .tabbar { display: flex; justify-content: center; }
.tab { flex: 1; max-width: 13rem; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding: 2px 4px; border: 0; background: none; color: var(--text-muted); font-size: 13px; font-weight: 600; line-height: 1.2; }
.tab__icon { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; transition: background .2s; }
.tab[aria-current="page"] { color: var(--accent-text); }
.tab[aria-current="page"] .tab__icon { background: var(--accent-soft); color: var(--on-accent-soft); }
.tab:active .tab__icon { transform: scale(.94); }
.fab { position: absolute; inset-inline-end: max(var(--gutter), env(safe-area-inset-right)); bottom: 16px; z-index: 5; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 24px -8px rgb(90 40 5 / .55); transition: transform .15s var(--ease); }
.fab:active { transform: scale(.94); }
.fab .ic { width: 26px; height: 26px; stroke-width: 2.2; }

/* ---------- my uni: one summary card, each line opens its detail ---------- */
.summary { padding: 6px 4px 4px; }
.summary__head { padding: 12px 14px 8px; }
.summary__head h3 { margin: 0; font-size: 20px; line-height: 1.3; }
.summary__head p { margin: 2px 0 0; color: var(--text-muted); font-size: 14px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-top: 1px solid var(--line); }
.row-btn { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 12px 14px; border: 0; background: none; color: var(--text); text-align: start; }
.row-btn[disabled] { cursor: default; opacity: 1; }
.row-btn__icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 13px; background: var(--accent-soft); color: var(--on-accent-soft); }
.row-btn__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-btn__label { font-size: 14px; color: var(--text-muted); }
.row-btn__main { font-size: 17px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.row--overdue .row-btn__main { color: var(--overdue); }
.row-btn__sub { font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
.row-btn .chev { flex: none; width: 18px; height: 18px; color: var(--text-muted); transition: transform .2s var(--ease); }
.row-btn[aria-expanded="true"] .chev { transform: rotate(-90deg); }
.row-detail { padding: 0 14px 14px; }
.row-detail .result { margin-top: 0; }
.row-note { display: flex; align-items: flex-start; gap: 12px; padding: 14px; }
.row-note p { margin: 0; flex: 1; overflow-wrap: anywhere; }
.row-note--wait { margin: 4px 10px 10px; border-radius: 16px; background: var(--notice-bg); color: var(--notice-text); }
.bar--row { margin-top: 8px; height: 10px; background: var(--accent-soft); }
.bar--row::-webkit-progress-bar { background: var(--accent-soft); }
.summary__foot { display: flex; justify-content: flex-end; padding: 4px 10px 8px; }

/* ---------- reminders: two sections, one + ---------- */
#reminders-body { padding-bottom: 96px; }
.group { margin: 0 0 22px; }
.group > h3 { margin: 4px 2px 8px; font-size: 18px; line-height: 1.3; }
.group .panel { margin: 0; padding: 4px 16px; }
.group__empty { margin: 0; padding: 14px 0; color: var(--text-muted); }
.add-body { padding-top: 14px; }
.add-body .field:last-of-type { margin-bottom: 12px; }
.add-body .panel { padding: 0; border: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; margin: 0; }
.sheet--tall { max-height: min(90dvh, 44rem); overflow-y: auto; }
.sec--plain { margin-top: 14px; border-radius: 16px; }
.panel > .sec--plain { background: var(--surface-soft); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* ---------- sheets, toast ---------- */
.sheet { width: min(100%, 28rem); max-width: 100%; margin: auto auto 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); border: 0; border-radius: 26px 26px 0 0;
  background: var(--surface); color: var(--text); box-shadow: 0 -20px 60px -20px rgb(0 0 0 / .5); }
.sheet[open] { animation: sheet-in .28s var(--ease); }
.sheet::backdrop { background: rgb(20 12 6 / .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 640px) { .sheet { margin: auto; border-radius: 26px; } }
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet__head h2 { margin: 0; font-size: 20px; }
.sheet__group { padding: 8px 0 12px; }
.menu-label { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-weight: 600; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-soft); border: 1px solid var(--line); }
.segmented button { min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.segmented.segmented--3 { grid-template-columns: repeat(3, 1fr); }
.segmented--3 button { padding: 0 4px; font-size: 15px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 8px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); text-align: start; font-weight: 500; text-decoration: none; line-height: 1.35; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 14px; }
.steps li { display: flex; gap: 12px; align-items: center; }
.steps__n { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--on-accent-soft); font-weight: 600; }
.toast { position: fixed; inset-inline: 16px; bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 20; width: fit-content; max-width: 90vw; margin-inline: auto; padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 15px; font-weight: 500; animation: msg-in .25s var(--ease); }

/* ---------- chats: Regenerate, Edit, "Saved to memory" and the history sheet ---------- */
.chip--saved { background: var(--official-bg); color: var(--official-text); border-color: transparent; }
.chip--danger { background: var(--notice-bg); color: var(--notice-text); border-color: var(--line); }
.msg__act--edit { display: flex; align-items: center; gap: 6px; width: fit-content; min-height: 36px; margin-block: 2px -8px; margin-inline-start: auto; padding: 0 4px;
  border: 0; background: none; color: var(--on-accent-soft); font-size: 14px; font-weight: 600; line-height: 1.25; }
.msg__act--edit .ic { width: 16px; height: 16px; }
.msg__act--edit:active { transform: scale(.96); }
.chats__new { width: 100%; margin: 4px 0 10px; }
.chats__search { -webkit-appearance: none; appearance: none; margin-bottom: 4px; }
.chats__group { margin-top: 14px; }
.chats__label { margin: 0 4px 4px; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.chats__rows { list-style: none; margin: 0; padding: 0; }
.chats__item { border-top: 1px solid var(--line); border-radius: 14px; }
.chats__item:first-child { border-top-color: transparent; }
.chats__item.is-current { background: var(--accent-soft); color: var(--on-accent-soft); border-top-color: transparent; }
.chats__item.is-current + .chats__item { border-top-color: transparent; }
.chats__line { display: flex; align-items: center; gap: 4px; }
.chats__open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px; border: 0; border-radius: 14px; background: none; color: inherit; text-align: start; }
.chats__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; text-align: start; }
.chats__time { flex: none; font-size: 14px; color: var(--text-muted); }
.chats__pin { width: 18px; height: 18px; flex: none; color: var(--accent-text); }
.chats__item.is-current .chats__time, .chats__item.is-current .chats__pin, .chats__item.is-current .chats__more { color: var(--on-accent-soft); }
.chats__more { border-color: transparent; background: transparent; color: var(--text-muted); backdrop-filter: none; -webkit-backdrop-filter: none; }
.chats__rename { flex: 1; min-width: 0; min-height: 44px; margin-block: 4px; margin-inline-start: 8px; }
.chats__actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 8px 12px; }
.chats__actions[hidden] { display: none; }
.chats__all { display: block; margin: 14px auto 0; }

/* ---------- wide screens: keep the phone proportions, centred ---------- */
@media (min-width: 900px) { .wrap { max-width: 44rem; } }
@media (max-height: 560px) { .hero { --orb-size: 64px; } }
/* the keyboard is open: the tabs get out of the way (the app sets data-tabs="off") and the page below the bar needs no extra room */
#app[data-tabs="off"] .screen:not(#screen-ask) .scroll { padding-bottom: env(safe-area-inset-bottom); }

/* ---------- less motion: nothing moves by itself, states stay visible ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .orb[data-state="thinking"] .orb__body { filter: saturate(1.35) brightness(1.06); }
  .orb[data-state="thinking"] .orb__ring, .orb[data-state="listening"] .orb__ring { opacity: .8; }
  .orb[data-state="listening"] .orb__body { transform: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
