:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none; color: #121a38; background: #f4f5f8;
  --navy: #050b45; --lime: #d0ff00; --blue: #2143ff; --muted: #657087; --line: #e0e4ed; --surface: #f4f5f8;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --app-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --content-top: var(--tg-content-safe-area-inset-top, 0px);
  --app-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  --app-left: max(18px, env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px), var(--tg-content-safe-area-inset-left, 0px));
  --app-right: max(18px, env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px), var(--tg-content-safe-area-inset-right, 0px));
}
* { box-sizing: border-box; }
.is-booting, body.is-loading { background: var(--navy); }
body { margin: 0; height: var(--app-height, 100dvh); display: flex; flex-direction: column; overflow: hidden; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 25px; line-height: 1.2; letter-spacing: -.025em; font-weight: 650; text-wrap: balance; }
h2 { font-size: 15px; line-height: 1.4; font-weight: 650; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .55; }
button, .button { transition: transform 130ms var(--ease-out), background-color 150ms ease, color 150ms ease, opacity 150ms ease; }
button:active:not(:disabled), .button:active { transform: scale(.98); }
.keyboard-input button, .keyboard-input .button { transition: none; }
.keyboard-input button:active, .keyboard-input .button:active { transform: none; }
button:focus-visible, a:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid #5471ff; outline-offset: 3px; }
h1:focus { outline: none; }
a { color: var(--blue); text-underline-offset: 3px; }
::selection { background: var(--lime); color: var(--navy); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
time, .count, .stats strong { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
.header { --brand-size: clamp(160px, 45vw, 192px); --brand-height: calc(var(--brand-size) * .475); --header-height: calc(var(--brand-height) + 12px); flex-shrink: 0; height: calc(var(--header-height) + var(--app-top)); padding-top: var(--app-top); display: flex; align-items: center; justify-content: center; background: var(--navy); }
.brand { width: var(--brand-size); height: var(--brand-height); position: relative; overflow: hidden; }
.brand img { position: absolute; top: calc(var(--brand-size) * -.21); left: 0; width: 100%; height: auto; }
.telegram-app:not(.telegram-fullscreen) .header { display: none; }
.telegram-fullscreen .header { height: calc(var(--header-height) + var(--app-top) + var(--content-top)); padding-top: calc(var(--app-top) + var(--content-top)); }
.telegram-app:not(.telegram-fullscreen) .viewport { padding-top: calc(var(--app-top) + var(--content-top)); }
.viewport { flex: 1; min-height: 0; overflow: auto; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: #b4bdcf var(--surface); container-type: size; }
.screen { width: 100%; max-width: 640px; margin: 0 auto; padding: 24px var(--app-right) 28px var(--app-left); }
.heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 23px; }
.heading > div { min-width: 0; }
.heading .muted { display: block; margin-top: 8px; font-size: 12px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; background: transparent; border: 1px solid var(--line); border-radius: 12px; color: #4c5874; }
.connection { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 1.5; }
.connection p { font-weight: 550; }
.connection #heartbeat { margin-left: auto; color: var(--muted); text-align: right; font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #929aaa; flex-shrink: 0; }
.dot.ok { background: #769700; }
.dot.bad { background: #c14432; }
.scope { font-size: 11px; margin: 8px 0 0 15px; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: 1fr 1fr; background: var(--navy); color: white; border-radius: 14px; margin: 20px 0; padding-top: 22px; }
.stat { padding: 0 21px; }
.stat:first-child { border-right: 1px solid #343967; }
.stats p { color: #c4c9e2; font-size: 12px; line-height: 1.4; }
.stat strong { display: block; font-size: 38px; line-height: 1.1; letter-spacing: -.025em; font-weight: 600; color: var(--lime); margin-top: 9px; }
.last { grid-column: 1 / -1; border-top: 1px solid #343967; padding: 15px 21px; margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.last strong { font-size: 12px; font-weight: 550; text-align: right; }
.shortcuts { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.shortcut { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 18px 17px; min-height: 80px; text-align: left; }
.shortcut:last-child { border-bottom: 0; }
.shortcut-label { flex: 1; min-width: 0; }
.shortcut strong { display: block; font-size: 14px; font-weight: 650; }
.shortcut small { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 5px; }
.shortcut svg { width: 17px; color: var(--muted); }
.count { display: inline-block; border-radius: 5px; background: #eef0f6; color: #4c5874; font-size: 11px; line-height: 1.3; padding: 4px 7px; font-weight: 600; }
.report { margin: 25px 2px 0; }
.report h2 { margin-bottom: 7px; }
.report .muted { font-size: 12px; }
.report-line { display: flex; align-items: flex-start; gap: 7px; margin-top: 5px; overflow-wrap: anywhere; }
.report-line svg { width: 16px; height: 18px; color: #718e00; }
.updated-at { margin-top: 24px; color: var(--muted); font-size: 10px; }
.is-setup #dashboard { min-height: 100%; }
.onboarding { width: 100%; max-width: 460px; margin: 0 auto; padding: clamp(32px, 12cqh, 88px) max(24px, var(--app-right)) calc(32px + var(--app-bottom)) max(24px, var(--app-left)); }
.onboarding h1 { font-size: clamp(26px, 7vw, 30px); line-height: 1.2; text-wrap: balance; }
.onboarding > .muted { margin-top: 12px; font-size: 15px; line-height: 1.6; text-wrap: pretty; }
.onboarding > .button { min-height: 52px; margin-top: 24px; border-radius: 12px; font-size: 14px; }
.onboarding-reports { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.onboarding-reports.is-connected { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.onboarding-reports-summary { display: flex; align-items: flex-start; gap: 12px; }
.onboarding-reports-text { min-width: 0; }
.onboarding-reports-status { font-size: 14px; font-weight: 600; line-height: 1.45; }
.onboarding-reports-mark { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: #eef5d8; color: #526b17; }
.onboarding-reports-mark svg { width: 18px; height: 18px; }
.onboarding-reports .muted { margin-top: 6px; font-size: 13px; overflow-wrap: anywhere; }
.onboarding-reports .button { margin-top: 14px; }
.reports-select { display: block; width: 100%; margin-top: 12px; padding: 12px; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; background: white; color: inherit; font: inherit; font-size: 16px; }
.reports-other { display: block; width: fit-content; padding: 13px 0; min-height: 44px; font-size: 12px; }
#onboarding-reports-error { color: #a73a2b; }
@container (max-height: 480px) {
  .onboarding { padding-top: 24px; padding-bottom: max(24px, var(--app-bottom)); }
}
.setup-link { margin-top: 15px; }
.settings-section { scroll-margin-top: 20px; }
#settings-refresh { margin: 0 0 24px; }
.bottom-nav { flex-shrink: 0; background: white; border-top: 1px solid var(--line); padding: 6px var(--app-right) calc(6px + var(--app-bottom)) var(--app-left); }
.nav-inner { max-width: 604px; margin: auto; display: flex; align-items: center; justify-content: center; gap: 50px; position: relative; }
.bottom-nav button { min-width: 92px; min-height: 48px; padding: 4px 8px; border: 0; background: none; color: var(--muted); font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 8px; }
.bottom-nav button[aria-current="page"] { color: var(--blue); font-weight: 600; }
.bottom-nav .nav-back { position: absolute; left: 0; min-width: 44px; width: 44px; }
.has-native-back .nav-back { display: none; }
.availability-note { color: var(--muted); font-size: 12px; line-height: 1.55; margin: -5px 0 18px; max-width: 60ch; }
.tabs { display: flex; gap: 22px; position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); min-height: 48px; padding: 4px 0 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--blue); }
.tabs .count { font-size: 10px; padding: 2px 5px; }
.journal-note { font-size: 10px; padding: 17px 0 12px; }
.messages { border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.message { padding: 17px; border-bottom: 1px solid var(--line); }
.message:last-child { border-bottom: 0; }
.message.pending, .message.failed { background: #f8f9ff; }
.message-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.message-top strong { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.message-top time { font-size: 10px; color: var(--muted); white-space: nowrap; }
.message-text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.message.deleted .message-text { color: #657087; }
.message-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 9px 0 -7px; }
.badge { font-size: 10px; line-height: 1.45; padding: 4px 6px; border-radius: 5px; background: #fbf2df; color: #806021; }
.message.deleted .badge { padding: 0; background: transparent; color: var(--muted); }
.message.failed .badge { background: #fff0ec; color: #a33426; }
.text-button { min-height: 44px; border: 0; padding: 6px 0; background: transparent; color: var(--blue); font-size: 12px; font-weight: 550; text-align: left; }
.message-footer .text-button { flex-shrink: 0; padding-left: 8px; }
.empty { padding: 42px 22px; text-align: center; }
.empty-symbol { display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; width: 44px; height: 44px; color: #63788a; background: #edf2f4; border-radius: 50%; }
.empty strong { display: block; font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.empty p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.source { background: white; padding: 20px; border: 1px solid var(--line); border-radius: 14px; }
.source-meta { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.source-meta strong { font-size: 13px; overflow-wrap: anywhere; }
.source-meta time { font-size: 11px; color: var(--muted); }
.source-text { font-size: 16px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.source > .muted { font-size: 12px; margin-top: 18px; overflow-wrap: anywhere; }
.decision { margin-top: 24px; }
.decision + .decision { padding-top: 24px; border-top: 1px solid var(--line); }
.decision h2 { margin-bottom: 15px; }
.primary, .secondary, .button { width: 100%; display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 12px 16px; border-radius: 9px; font-weight: 600; font-size: 13px; line-height: 1.45; text-decoration: none; }
.primary { background: var(--blue); color: #fff; border: 1px solid var(--blue); }
.secondary { background: #fff; color: #263354; border: 1px solid #d5dae5; }
.help { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 9px 2px 0; }
.notice { background: #fff6e3; color: #71531c; font-size: 13px; line-height: 1.55; padding: 15px 16px; border-radius: 10px; margin-top: 16px; overflow-wrap: anywhere; }
.notice.danger { background: #fff0ec; color: #a33426; }
.notice.success { background: #ebf2d9; color: #41551c; }
.connection-error { max-width: 604px; margin: 16px auto 0; padding: 12px 16px; font-size: 12px; line-height: 1.5; background: #fff0ec; color: #a33426; display: flex; align-items: center; gap: 12px; }
.connection-error span { flex: 1; }
.connection-error button { flex-shrink: 0; }
.settings-section { padding: 23px 0; border-top: 1px solid var(--line); }
.settings-section h2 { margin-bottom: 12px; }
.settings-section p + p { margin-top: 10px; }
.chat-row { padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.chat-row > div { min-width: 0; }
.chat-row strong { font-size: 13px; overflow-wrap: anywhere; }
.chat-row .muted { font-size: 12px; margin-top: 4px; }
.chat-row button { width: auto; flex-shrink: 0; min-height: 44px; font-size: 12px; padding: 8px 12px; }
.rules { color: #404c67; font-size: 13px; line-height: 1.65; margin: 0 0 16px; padding-left: 19px; }
.rules li + li { margin-top: 10px; }
code { font-size: .95em; overflow-wrap: anywhere; }
.login { max-width: 800px; margin: 28px auto; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 16px; }
.login-photo { min-height: 370px; position: relative; background: var(--navy); }
.login-photo img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.access-copy { align-self: center; padding: 32px; }
.access-copy .muted { margin-top: 18px; }
.access-copy .button, .access-copy button { margin-top: 24px; }
.toast { position: fixed; z-index: 20; bottom: calc(82px + var(--app-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(90vw, 540px); border-radius: 10px; background: var(--navy); color: white; padding: 14px 18px; font-size: 13px; line-height: 1.5; box-shadow: 0 6px 24px #050b4526; }
.boot { position: fixed; z-index: 30; inset: 0; background: var(--navy); color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(30px + var(--app-top) + var(--content-top)) 24px calc(30px + var(--app-bottom)); text-align: center; }
.boot-logo { width: min(320px, 78vw); height: auto; max-height: 36dvh; aspect-ratio: 1.6; stroke: none; overflow: hidden; opacity: 0; transition: opacity 160ms ease-out; }
.boot.is-presented .boot-logo { opacity: 1; }
.boot-outline { opacity: .65; }
.boot-fill { transform-box: fill-box; transform-origin: left center; animation: logo-fill 3000ms cubic-bezier(.45, 0, .55, 1) both paused; }
.boot.is-presented .boot-fill { animation-play-state: running; }
.boot-copy { margin-top: 30px; }
.boot:not(.has-error):not(.is-slow) .boot-copy { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.boot-copy p:first-child { font-size: 15px; font-weight: 500; }
.boot-copy p + p { color: #bbc3e1; font-size: 12px; line-height: 1.55; margin-top: 9px; max-width: 32ch; }
.boot-retry { color: var(--lime); border: 1px solid #43496f; border-radius: 9px; min-height: 48px; background: none; padding: 12px 24px; margin-top: 24px; font-size: 13px; }
.boot.has-error .boot-fill { animation-play-state: paused; }
.is-loading > .header, .is-loading > .viewport { visibility: hidden; }
@keyframes logo-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (hover: hover) {
  .shortcut:hover { background: #f8f9ff; }
  .icon-button:hover, .bottom-nav button:hover { background: #e9edf6; }
  .primary:hover:not(:disabled), .button:hover { background: #1737e6; }
  .secondary:hover:not(:disabled) { background: #f0f3fc; }
  .text-button:hover { color: #1328b5; }
}
@media (min-width: 900px) {
  .screen { padding-top: 36px; }
  h1 { font-size: 28px; }
  .stats { margin-top: 24px; }
  .stat strong { font-size: 42px; }
}
@media (max-width: 640px) {
  .login { display: block; margin: 20px var(--app-right) 24px var(--app-left); }
  .login-photo { min-height: 180px; }
  .access-copy { padding: 26px 24px 30px; }
  .connection-error { margin-inline: var(--app-left); margin-right: var(--app-right); border-radius: 10px; }
}
@media (max-width: 350px) {
  :root { --app-left: max(14px, env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px), var(--tg-content-safe-area-inset-left, 0px)); --app-right: max(14px, env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px), var(--tg-content-safe-area-inset-right, 0px)); }
  h1 { font-size: 23px; }
  .tabs { gap: 16px; }
  .nav-inner { gap: 22px; padding-left: 28px; }
  .connection { flex-wrap: wrap; }
  .connection #heartbeat { font-size: 10px; }
  .shortcut { padding-inline: 14px; }
  .shortcut small { font-size: 11px; }
  .chat-row { flex-wrap: wrap; }
}
@media (max-height: 500px) {
  .header { --brand-size: 140px; --brand-height: 64px; --header-height: 78px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button:active:not(:disabled), .button:active { transform: none; }
}

