/* Glosai web demo. Layout: one centred column, cards on a quiet grey ground,
   colour reserved for the two request routes and for money states. */
:root {
  --bg: #f4f5f8; --surface: #ffffff; --line: #dde1e9; --text: #1b2232; --muted: #5a6376;
  --public: #0f6f67; --public-soft: #e1f3f0;
  --direct: #5a3db0; --direct-soft: #eee9fb;
  --ok: #17734a; --ok-soft: #e2f4ea;
  --warn: #7c5200; --warn-soft: #fff2d4;
  --danger: #b0251a; --danger-soft: #fde9e6;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font-body); word-break: keep-all; overflow-wrap: anywhere; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); line-height: 1.25; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 1.2rem; line-height: 1.35; letter-spacing: -0.01em; text-wrap: balance; }
h3 { font-size: 1.02rem; line-height: 1.4; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }
code { font: 0.85em ui-monospace, Consolas, monospace; background: #eef0f4; padding: 1px 5px; border-radius: 5px; }
small { font-size: 0.82rem; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.fineprint, .hint { color: var(--muted); font-size: 0.85rem; }
.note { color: var(--muted); font-size: 0.92rem; border-left: 3px solid var(--line); padding-left: 12px; }

/* demo bar + header */
.demo-bar { background: var(--ink); color: #dfe4f2; font-size: 0.82rem; padding: 6px 16px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; align-items: center; }
.demo-bar a { color: #fff; }
.demo-bar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; gap: 8px 22px; flex-wrap: wrap; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand svg { display: block; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.03em; color: var(--ink); }
.brand-ko { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; }
.nav a:hover { background: var(--bg); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }
.header-tools { display: flex; gap: 14px; align-items: center; font-size: 0.88rem; flex-wrap: wrap; }
.header-tools a { color: var(--muted); text-decoration: none; }
.header-tools a:hover { color: var(--text); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--on-brand); font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lang-switch { border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; }

.main { padding-block: 28px 64px; display: flex; flex-direction: column; gap: 28px; }
.flash { padding: 12px 16px; border-radius: 10px; font-weight: 600; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger); }

/* building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.section { display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-lead { color: var(--muted); max-width: 62ch; }
.page-head { display: flex; flex-direction: column; gap: 8px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-grid > * { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.profile-grid > .card { gap: 12px; }
.sticky { position: sticky; top: 76px; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: 1fr; } .sticky { position: static; } }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.empty { align-items: flex-start; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 12px; }
.list-row { flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.list-row > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.list-row h2 { font-size: 1.02rem; }
.list-row h2 a { color: var(--text); text-decoration: none; }
.list-row h2 a:hover { color: var(--brand); text-decoration: underline; }
.list-row.bordered { display: flex; padding: 12px 0; border-top: 1px solid var(--line); }
.list-row.unread { border-left: 4px solid var(--brand); }
.row-side { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.plain-list { display: flex; flex-direction: column; gap: 6px; }
.issues { display: flex; flex-direction: column; gap: 4px; color: var(--danger); font-size: 0.92rem; }
.issues li::before { content: '• '; }
.ticks { display: flex; flex-direction: column; gap: 8px; font-size: 0.94rem; }
.ticks li { padding-left: 22px; position: relative; }
.ticks li::before { content: ''; position: absolute; left: 2px; top: 0.5em; width: 9px; height: 5px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; font-size: 0.95rem; line-height: 1.2; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.btn.ghost { background: var(--surface); color: var(--brand-strong); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand); background: var(--brand-soft); }
.btn.large { font-size: 1.02rem; padding: 13px 22px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* labels: route badges and state pills */
.badge { align-self: flex-start; display: inline-block; font-size: 0.76rem; font-weight: 800; letter-spacing: 0.02em; padding: 3px 9px; border-radius: 6px; }
.badge.public { background: var(--public-soft); color: var(--public); }
.badge.direct { background: var(--direct-soft); color: var(--direct); }
.pill { display: inline-block; font-size: 0.76rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #eceff4; color: var(--muted); white-space: nowrap; }
.pill.ok, .pill.read, .pill.open, .pill.ledger-top_up, .pill.ledger-bonus_grant, .pill.ledger-release, .pill.ledger-credit_refund { background: var(--ok-soft); color: var(--ok); }
.pill.warn, .pill.attention, .pill.pending_read, .pill.ledger-hold { background: var(--warn-soft); color: var(--warn); }
.pill.ledger-spend { background: var(--brand-soft); color: var(--brand-strong); }
.pill.off { background: #eceff4; color: var(--muted); }
.chip { display: inline-block; font-size: 0.82rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); margin: 0 4px 4px 0; }
.chip.solid { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); font-weight: 700; }
.chip.struck { color: var(--muted); text-decoration: line-through; }

/* home */
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: clamp(24px, 5vw, 52px); display: flex; flex-direction: column; gap: 16px; }
.hero h1 { font-size: clamp(1.7rem, 1rem + 3.4vw, 3rem); max-width: 16ch; }
.eyebrow { font-size: 0.8rem; font-weight: 800; color: var(--accent-strong); letter-spacing: 0.02em; }
.lead { font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem); color: var(--muted); max-width: 46ch; }
.lang-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lang-strip a { display: inline-block; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 0.9rem; }
.lang-strip a:hover { border-color: var(--brand); color: var(--brand); }
.route { align-items: flex-start; }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
.steps li { counter-increment: s; padding-left: 34px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; }
.big-number { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }

/* tutors */
.tutor-head { display: flex; gap: 12px; align-items: center; }
.tutor-head > div:nth-child(2) { flex: 1; min-width: 0; }
.tutor-head h3 a { color: var(--text); text-decoration: none; }
.tutor-head h3 a:hover { color: var(--brand); }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.rate { text-align: right; white-space: nowrap; line-height: 1.2; }
.rate strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.rate span { color: var(--muted); font-size: 0.82rem; }
.rate-line { font-size: 0.95rem; }
.facts { display: flex; flex-direction: column; gap: 8px; }
.facts dt, .fields dt { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.bio { font-size: 0.94rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badges li { font-size: 0.75rem; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 2px 8px; border-radius: 6px; cursor: help; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.lang-native { font-size: 1.5rem; font-weight: 800; color: var(--ink); }
.lang-card h2 { font-size: 1rem; }
.filters { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 700; color: var(--muted); flex: 1 1 150px; }
.slot-list { display: flex; flex-direction: column; gap: 4px; }
.direct-target { flex-direction: row; align-items: center; border-color: var(--direct); background: var(--direct-soft); }

/* forms */
input[type="text"], select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid #c5cbd6; border-radius: 10px; padding: 9px 12px; width: 100%; max-width: 100%; }
textarea { resize: vertical; min-height: 5.5em; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.card { border: 1px solid var(--line); padding: 20px; }
fieldset.plain { display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 800; font-size: 1.1rem; padding: 0; margin-bottom: 6px; float: left; width: 100%; }
legend + * { clear: both; }
.q { margin-top: 10px; font-size: 1.02rem; }
.req, .opt { font-size: 0.72rem; font-weight: 800; padding: 2px 7px; border-radius: 5px; vertical-align: middle; }
.req { background: var(--accent-soft); color: var(--accent-strong); }
.opt { background: #eceff4; color: var(--muted); }
legend small, .q small { font-weight: 500; color: var(--muted); font-size: 0.8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-input { position: relative; display: inline-flex; cursor: pointer; }
.chip-input input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip-input span { display: inline-block; padding: 9px 15px; border-radius: 999px; border: 1px solid #c5cbd6; background: var(--surface); font-weight: 600; font-size: 0.95rem; }
.chip-input:hover span { border-color: var(--brand); }
.chip-input input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip-input input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.inline-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; color: var(--muted); max-width: 420px; }
.field-error, .wizard-error { color: var(--danger); font-weight: 700; font-size: 0.9rem; }
.budget-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.budget-fields label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); flex: 1 1 160px; max-width: 220px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.94rem; flex-wrap: wrap; }
.check input[type="checkbox"], .check input[type="radio"] { margin-top: 0.3em; width: 17px; height: 17px; flex: none; accent-color: var(--brand); }
.check input[type="text"] { flex: 1 1 140px; max-width: 180px; padding: 5px 10px; }
.check.adult { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-weight: 600; }
.wizard { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.progress { display: flex; gap: 6px; flex-wrap: wrap; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.progress li { flex: 1 1 90px; padding-top: 8px; border-top: 4px solid var(--line); }
.progress li.done { border-color: var(--brand-soft); color: var(--brand-strong); }
.progress li.now { border-color: var(--accent); color: var(--text); }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wizard-nav[hidden] { display: none; }
.wizard.js .step { display: none; }
.wizard.js .step.active { display: flex; }
.gate { border-color: var(--warn); background: var(--warn-soft); align-items: flex-start; }
.fields { display: flex; flex-direction: column; gap: 10px; }
.fields > div { display: grid; grid-template-columns: minmax(84px, 0.34fr) 1fr; gap: 10px; align-items: baseline; }
.fields dd { font-size: 0.95rem; }

/* introductions and opportunities */
.intro-head { display: flex; gap: 12px; align-items: center; }
.intro-head > div:nth-child(2) { flex: 1; min-width: 0; }
.intro-head h3 a { color: var(--text); text-decoration: none; }
.intro.intro-pending_read { border-color: var(--warn); }
.intro.intro-expired, .intro.intro-cancelled { background: #fafbfc; }
.teaser { background: var(--bg); border-radius: 10px; padding: 10px 14px; color: var(--muted); font-style: italic; }
.intro-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.body { white-space: normal; }
.opp h3 a { color: var(--text); text-decoration: none; }
.opp h3 a:hover { color: var(--brand); text-decoration: underline; }
.opp.opp-direct { border-color: var(--direct); border-left-width: 5px; }
.opp-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.fee { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.fee-box { border-color: var(--brand); }
.balance-strip { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: 0.92rem; }
.balance-strip strong { font-variant-numeric: tabular-nums; }

/* wallet and tables */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile.hold { border-color: var(--warn); background: var(--warn-soft); }
.tile-label { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.tile-value { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.topup { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.76rem; color: var(--muted); font-weight: 800; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num.neg { color: var(--danger); }
.num.pos { color: var(--ok); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1 1 320px; }
.inline-form input { flex: 1 1 180px; }

/* chat */
.thread { flex-direction: row !important; align-items: center; gap: 12px !important; }
.messages { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.msg { max-width: min(84%, 560px); padding: 10px 14px; border-radius: 14px; background: var(--bg); align-self: flex-start; display: flex; flex-direction: column; gap: 4px; }
.msg.mine { align-self: flex-end; background: var(--brand-soft); }
.msg time { font-size: 0.72rem; color: var(--muted); }
.msg-tag { font-size: 0.72rem; font-weight: 800; color: var(--accent-strong); }
.translation { font-size: 0.86rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 4px; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 2.8em; }

/* misc */
.account.current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.prose { max-width: 70ch; }
.error-page { align-items: flex-start; }
.detail { background: var(--bg); padding: 10px; border-radius: 8px; font-size: 0.8rem; overflow-x: auto; max-width: 100%; }
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding-block: 28px; font-size: 0.85rem; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 24px; }
.footer-grid > div { display: flex; flex-direction: column; gap: 8px; }
.footer-brand, .footer-head { font-weight: 800; color: var(--text); }
.footer-grid ul { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
@media (prefers-reduced-motion: no-preference) { .btn, .chip-input span, .nav a { transition: background-color 0.12s, border-color 0.12s; } }

/* landing page: hero card, shortcuts, feeds */
.hero-card { background: var(--ink); background-image: radial-gradient(120% 150% at 100% 0%, color-mix(in srgb, var(--accent) 34%, var(--ink)) 0%, var(--ink) 60%); color: #fff; border-radius: 24px; padding: clamp(22px, 4.5vw, 48px); overflow: hidden; }
.hero-copy { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hero-card h1 { font-size: clamp(1.6rem, 1rem + 2.4vw, 2.4rem); color: #fff; }
.hero-card .eyebrow { color: var(--accent-on-dark); }
.hero-card .lead { color: #d5dbee; }
.hero-search { display: flex; gap: 8px; background: #fff; border-radius: 14px; padding: 6px; max-width: 520px; }
.hero-search input { border: 0; flex: 1; min-width: 0; padding: 10px 12px; font-size: 1rem; }
.hero-search input:focus-visible { outline: 0; }
.hero-search:focus-within { box-shadow: 0 0 0 3px var(--accent-on-dark); }
.hero-search .btn { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.hero-search .btn:hover { background: var(--accent-on-dark); border-color: var(--accent-on-dark); color: var(--ink); }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.quick-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); font-weight: 700; }
.quick-tile:hover { border-color: var(--brand); color: var(--brand-strong); }
.quick-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; }
.quick-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.lang-strip small { color: var(--muted); }
.home-feeds { align-items: start; gap: 24px; }
.list.compact { gap: 8px; }
.feed-row { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
.feed-row > div:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.feed-row h3 { font-size: 0.98rem; }
.feed-row h3 a { color: var(--text); text-decoration: none; }
.feed-row h3 a:hover { color: var(--brand); text-decoration: underline; }
.feed-row p { font-size: 0.86rem; }
.feed-native { color: var(--brand-strong); font-weight: 700; }
.feed-glyph { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--public-soft); color: var(--public); display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; }
.feed-age { font-size: 0.8rem; white-space: nowrap; }
