/* Shared Latin/Cyrillic type, served locally with its open font license. */
@font-face {
  font-family: "Inter UI";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
:root { --muted: #626d63; }
body {
  font-family: "Inter UI", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-optical-sizing: auto;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-weight: 600; letter-spacing: -.035em; }
h1 { line-height: 1.18; }
h2 { line-height: 1.25; }
p { text-wrap: pretty; }
input, textarea, select { font-size: 16px; line-height: 1.5; font-weight: 400; }
label { font-size: 13px; }
button, a, select { touch-action: manipulation; }
button:disabled { cursor: default; }
.button { font-size: 14px; font-weight: 600; min-height: 46px; }
.icon-button { min-width: 44px; min-height: 44px; }
.eyebrow, .small-label { letter-spacing: .12em; line-height: 1.5; }
.brand { font-weight: 650; letter-spacing: -.045em; }
.text-button, .back-button { min-height: 44px; }
.form-error:empty { min-height: 0; margin: 0; }
.form-error:not(:empty) { margin: 12px 0; font-size: 13px; }

/* Auth: real word boundaries, compact copy and one consistent type family. */
.auth-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-story { padding: 40px clamp(28px, 5vw, 80px); }
.story-copy { margin-top: 64px; max-width: 560px; }
.story-copy h1 {
  font-size: clamp(38px, 4vw, 62px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -.045em;
  margin: 16px 0 20px;
  text-wrap: balance;
}
.story-copy h1 > span { display: block; }
.story-copy .story-accent { color: var(--purple); margin-top: .12em; }
.story-copy p { font-size: 16px; line-height: 1.6; max-width: 36ch; margin-bottom: 0; }
.auth-form-area { padding: 40px clamp(24px, 4vw, 64px); align-self: start; }
.auth-form-wrap { width: 380px; }
.auth-form-wrap h2 { font-size: 30px; line-height: 1.22; letter-spacing: -.035em; }
.auth-form-wrap > p { font-size: 14px; line-height: 1.6; }
.auth-language { margin-bottom: 28px; }
.auth-tabs { margin: 24px 0; gap: 28px; }
.auth-tabs button { min-height: 44px; padding-bottom: 10px; font-size: 14px; }
.auth-legal { font-size: 12px !important; line-height: 1.65; }
.auth-legal a { text-underline-offset: 3px; }
.auth-story footer { font-size: 12px; padding-top: 12px; }
.sample-stack { width: min(280px, 85%); margin-top: 36px; }
.sample-note { position: relative; top: auto; left: auto; margin: 24px 0 0; padding: 0; font-size: 12px; max-width: 100%; background: none; color: var(--muted); transform: none; box-shadow: none; }
.sample-note span { font-size: 12px; color: var(--purple); }
.language-control { font-size: 12px; font-weight: 500; gap: 10px; }
.language-control select { min-width: 110px; min-height: 42px; padding: 8px 12px; font-size: 14px; border-radius: 10px; }

/* Main workspace: readable secondary type and predictable component alignment. */
.app-layout { grid-template-columns: 218px minmax(0, 1fr) 340px; }
.sidebar, .ai-panel { height: 100vh; height: 100dvh; }
.sidebar { padding: 28px 20px; }
.workspace-label { font-size: 10px; letter-spacing: .08em; margin-top: 34px; }
.nav-item { font-size: 13px; min-height: 46px; }
.sidebar-note strong, .sidebar-note p { font-size: 12px; line-height: 1.6; }
.sidebar-bottom { padding-top: 24px; }
.profile strong { font-size: 12px; }
.profile small { font-size: 11px; }
.footer-links { flex-wrap: wrap; column-gap: 12px; row-gap: 4px; font-size: 11px; }
.footer-links a, .footer-links button { font-size: 11px; min-height: 30px; display: inline-flex; align-items: center; }
.topbar { padding-inline: 32px; letter-spacing: .1em; }
.topbar > span { color: var(--muted); font-size: 10px; }
.topbar .daily-note { color: var(--muted); font-size: 12px; }
.page-head { align-items: flex-start; }
.page-head > div { min-width: 0; }
.page-head h1 { font-size: 32px; overflow-wrap: anywhere; }
.page-head p { font-size: 14px; line-height: 1.6; }
.date-label { font-size: 12px; padding-top: 8px; }
.hero { padding: 28px; gap: 24px; }
.hero > div:first-child { flex: 1; min-width: 0; }
.hero h2 { max-width: 20ch; font-size: 27px; line-height: 1.22; letter-spacing: -.03em; }
.hero p { font-size: 14px; line-height: 1.6; color: #5b6851; max-width: 40ch; }
.hero .button { font-size: 14px; min-height: 46px; }
.stats-grid { align-items: stretch; }
.stat { padding: 18px 16px; display: grid; grid-template-rows: minmax(2.6em, auto) auto 1fr; gap: 6px; }
.stat > div { display: block; font-size: 12px; line-height: 1.3; color: var(--muted); }
.stat strong { font-size: 30px; line-height: 1.15; margin: 0; font-variant-numeric: tabular-nums; }
.stat small { font-size: 11px; line-height: 1.45; margin-top: 3px; }
.section-heading h2 { font-size: 19px; }
.section-heading .text-button { font-size: 13px; }
.deck-card { min-width: 0; }
.deck-card h3 { font-size: 16px; line-height: 1.4; }
.deck-card p { font-size: 12px; line-height: 1.6; }
.deck-top { gap: 10px; flex-wrap: wrap; }
.deck-bottom { font-size: 12px; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.deck-bottom > span { flex: 1 1 100px; }
.deck-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.deck-bottom strong { font-size: 12px; white-space: nowrap; }
.deck-add { min-height: 210px; padding: 24px; }
.deck-add strong { font-size: 14px; text-align: center; }
.deck-add small { font-size: 12px; }
.pill { font-size: 11px; }
.bottom-note { font-size: 12px; line-height: 1.6; flex-wrap: wrap; align-items: flex-start; }
.bottom-note > span { max-width: none; }
.toolbar { align-items: center; }
.toolbar input { min-height: 46px; font-size: 16px; }
.toolbar .button { font-size: 13px; }
.card-row strong { font-size: 16px; }
.card-row p { font-size: 14px; line-height: 1.6; }
.card-row small { font-size: 12px; display: block; margin-top: 8px; }
.card-row-actions button { min-width: 44px; min-height: 44px; font-size: 13px; }
.badge-ai { font-size: 10px; }
.settings-card h3, .activity-card h3 { font-size: 18px; }
.settings-card p { font-size: 14px; line-height: 1.7; }
.settings-card .danger-text { font-size: 13px; min-height: 44px; }
.week-day { font-size: 12px; }
.activity-row { font-size: 13px; flex-wrap: wrap; }
.activity-row span:last-child { white-space: normal; }
.mobile-nav { display: none; }

/* AI and dialogs keep the same scale and accessible controls. */
.ai-header strong { font-size: 14px; }
.ai-header small { font-size: 12px; }
.ai-intro { font-size: 14px; line-height: 1.65; color: var(--muted); }
.ai-intro h3 { font-size: 21px; }
.prompt-chip { font-size: 13px; line-height: 1.6; color: var(--ink); }
.prompt-chip span { font-size: 12px; }
.ai-intro .ai-tip { font-size: 12px; line-height: 1.6; color: var(--muted); }
.ai-messages { min-height: 0; }
.chat-user, .chat-response { font-size: 14px; line-height: 1.6; }
.proposal-mini, .proposal-mini button { font-size: 12px; }
.proposal-mini button { min-height: 44px; text-align: left; }
.job-working { font-size: 12px; }
.context-select { font-size: 10px; letter-spacing: .08em; }
.context-select select { font-size: 13px; padding-block: 9px; min-height: 40px; }
.ai-compose textarea { font-size: 16px; line-height: 1.5; }
.compose-bottom span, .compose-help { font-size: 11px; color: var(--muted); }
.compose-help { line-height: 1.5; }
.send-button { width: 44px; height: 44px; font-size: 22px; }
.modal-top h2 { font-size: 24px; padding-top: 6px; }
.modal-top { align-items: flex-start; }
.modal-top > div { min-width: 0; }
.proposal-modal > p, .proposal-warning { font-size: 13px; }
.proposal-card p, .proposal-card small { font-size: 14px; }
.confirm-modal p { font-size: 14px; }
.review-top > span:nth-child(2) { font-size: 13px; }
.review-hint { font-size: 13px; }
.rating-button { font-size: 14px; min-height: 64px; }
.rating-button small { font-size: 12px; }
#toast { font-size: 14px; line-height: 1.5; }
.legal-page { font-size: 16px; }

@media (max-width: 1200px) {
  .app-layout { grid-template-columns: 190px minmax(0, 1fr) 300px; }
  .sidebar { padding-inline: 15px; }
  .view-content { padding: 28px 24px; }
  .topbar { padding-inline: 24px; }
  .page-head h1 { font-size: 28px; }
  .hero { padding: 24px; }
  .hero-art { display: none; }
  .hero h2 { font-size: 25px; }

}
@media (max-width: 1000px) {
  .app-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .story-copy h1 { font-size: 40px; }
  .auth-story { padding: 32px; }
  .story-copy { margin-top: 52px; }
  .sample-stack { margin-right: 0; }
  .topbar .daily-note, .topbar .live-dot { display: none; }
}
@media (max-height: 780px) and (min-width: 641px) {
  .sidebar-note { display: none; }
}
@media (max-width: 760px) {
  .auth-layout { display: block; }
  .auth-story { padding: 28px 32px 32px; }
  .story-copy { margin-top: 34px; max-width: 560px; }
  .story-copy h1 { font-size: 38px; max-width: 18ch; }
  .sample-stack, .auth-story footer { display: none; }
  .auth-form-area { padding: 24px 32px 40px; }
  .auth-form-wrap { width: 480px; }
  .auth-language { margin-bottom: 22px; }
}
@media (max-width: 640px) {
  .auth-story { padding: 24px 24px 28px; min-height: 0; }
  .story-copy { margin-top: 30px; }
  .story-copy .eyebrow { font-size: 10px; letter-spacing: .1em; }
  .story-copy h1 { font-size: clamp(30px, 8vw, 38px); letter-spacing: -.035em; line-height: 1.14; margin: 12px 0 16px; max-width: 19ch; }
  .story-copy p { font-size: 14px; line-height: 1.6; max-width: 36ch; }
  .auth-form-area { padding: 20px 24px 36px; }
  .auth-form-wrap { width: 100%; max-width: 480px; }
  .auth-form-wrap .eyebrow { font-size: 10px; letter-spacing: .09em; }
  .auth-form-wrap h2 { font-size: 26px; margin-top: 12px; }
  .auth-language { margin-bottom: 20px; }
  .language-control select { min-width: 102px; font-size: 14px; }
  .auth-tabs { margin-top: 22px; gap: 28px; }
  .app-layout { display: block; padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .topbar { height: auto; min-height: 68px; padding: 12px 20px; gap: 12px; }
  .topbar > span { font-size: 9px; letter-spacing: .08em; max-width: 110px; }
  .topbar > div { gap: 8px; }
  #mobile-menu { display: none; }
  #mobile-ai { margin: 0; min-width: 44px; min-height: 44px; font-size: 13px; padding: 8px 10px; }
  .topbar .language-control select { min-width: 96px; }
  .view-content { padding: 24px 20px; }
  .page-head h1 { font-size: 27px; letter-spacing: -.035em; }
  .page-head p { font-size: 14px; }
  .hero { padding: 24px; }
  .hero h2 { font-size: 26px; max-width: 18ch; }
  .hero p { font-size: 14px; }
  .stats-grid { gap: 10px; }
  .stat { padding: 16px 12px; }
  .stat > div { font-size: 12px; }
  .stat small { font-size: 11px; }
  .stat strong { font-size: 28px; }
  .deck-grid { grid-template-columns: 1fr; gap: 14px; }
  .deck-card { padding: 22px; }
  .deck-add { min-height: 150px; }
  .deck-card h3 { font-size: 17px; }
  .deck-card p { font-size: 13px; margin-bottom: 16px; }
  .deck-bottom { font-size: 13px; }
  .section-heading .text-button { font-size: 13px; }
  .bottom-note { font-size: 12px; gap: 8px; }
  .bottom-note > span { max-width: 100%; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed; bottom: 0; inset-inline: 0; z-index: 10;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); background: var(--white);
    box-shadow: 0 -4px 20px #252b2805;
  }
  .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; padding: 5px 2px; color: var(--muted); border-radius: 10px; font-size: 11px; line-height: 1.25; }
  .mobile-nav button > span:first-child { font-size: 21px; line-height: 1; }
  .mobile-nav button.active { background: var(--purple-soft); color: var(--purple); font-weight: 600; }
  .ai-header { height: 76px; padding-inline: 20px; }
  .ai-header > div:nth-child(2) { flex: 1; }
  .ai-messages { padding: 22px 20px; }
  .ai-compose { padding: 16px 20px max(16px, env(safe-area-inset-bottom)); }
  .card-row { align-items: flex-start; padding: 18px 16px; }
  .card-row-actions { flex-direction: column; }
  .settings-card, .activity-card { padding: 22px; }
  .settings-card .button { font-size: 14px; }
  .modal { padding: 22px; max-height: calc(100dvh - 32px); }
  .modal-actions .button { flex: 1 1 130px; }
  .review-top { padding: 14px 18px; height: auto; min-height: 76px; gap: 12px; flex-wrap: wrap; }
  .review-top > span:nth-child(2) { font-size: 12px; }
  .review-center { margin: 32px auto; padding-inline: 20px; }
  .rating-buttons { gap: 8px; }
  .rating-button { padding: 12px 6px; font-size: 13px; }
  .rating-button small { font-size: 11px; }
  .review-hint { font-size: 12px; line-height: 1.6; }
  #toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
  .auth-story, .auth-form-area { padding-inline: 20px; }
  .story-copy h1 { font-size: 29px; }
  .stat { padding: 14px 9px; }
  .stat > div, .stat small { font-size: 11px; }
  .topbar { padding-inline: 16px; gap: 8px; }
  .topbar > span { max-width: 100px; font-size: 8px; }
  .view-content { padding-inline: 16px; }
}

@media (max-width: 420px) {
  .review-top { display: grid; grid-template-columns: minmax(0, 1fr) 44px; row-gap: 4px; }
  .review-top .brand { grid-column: 1; grid-row: 1; }
  .review-top > .icon-button { grid-column: 2; grid-row: 1; }
  .review-top > span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; padding-bottom: 6px; }
}
@media (max-width: 360px) {
  .rating-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rating-button { font-size: 14px; }
  .rating-button small { font-size: 12px; }
}

/* Stars checkout: explicit terms, a stable invoice and readable receipt history. */
.payment-modal { width: 480px; max-width: calc(100vw - 32px); }
.purchase-price { padding: 20px; background: var(--pale, #f1eefb); border-radius: 14px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.purchase-price strong { font-size: 22px; }
.purchase-price > span { color: var(--purple); font-size: 20px; font-weight: 650; }
.purchase-consent { display: flex; align-items: flex-start; gap: 12px; margin: 22px 0; cursor: pointer; line-height: 1.6; }
.purchase-consent input { width: 20px; height: 20px; flex: 0 0 20px; margin: 2px 0 0; accent-color: var(--purple); }
.purchase-support { margin-top: 24px; font-size: 12px; overflow-wrap: anywhere; }
.payment-history { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 8px; }
.payment-receipt { padding: 16px 0; border-bottom: 1px solid var(--line); }
.payment-receipt > div { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.payment-receipt strong { font-size: 14px; }
.payment-receipt small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.payment-status { color: var(--purple); font-size: 12px; font-weight: 600; }
#payment-checkout > .button { margin: 4px 4px 4px 0; }

/* Persistent conversation and small follow-up controls. */
.chat-toolbar { display:flex; gap:8px; padding:10px 16px; border-bottom:1px solid var(--line); flex-shrink:0; }
.chat-toolbar select { min-width:0; font-size:12px; padding:8px 10px; }
.chat-toolbar .icon-button { flex:0 0 44px; }
.chat-response { white-space:pre-wrap; font-size:14px; line-height:1.65; overflow-wrap:anywhere; }
.chat-user { white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-suggestions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.chat-suggestion { border:1px solid #dcd5f4; background:#f6f3fd; color:#5643c4; padding:9px 11px; border-radius:12px; font-size:12px; text-align:left; }
.older-messages { display:block; margin:0 auto 24px; }
#ai-chat-budget { margin-top:5px; font-size:10px; }

.chat-response code { font-size:.95em; background:#f0edf8; border-radius:4px; padding:2px 4px; }
.proposal-cost { font-size:12px; color:var(--purple); }
