:root { color-scheme: dark; --bg: var(--tg-theme-bg-color, #0d1924); --surface: var(--tg-theme-secondary-bg-color, #152534); --surface-2: var(--tg-theme-section-bg-color, #1b2d3d); --text: var(--tg-theme-text-color, #f4f7fb); --muted: var(--tg-theme-hint-color, #8da6be); --blue: var(--tg-theme-button-color, #42aef5); --button-text: var(--tg-theme-button-text-color, #fff); --line: color-mix(in srgb, var(--muted) 23%, transparent); --green: #59df92; --red: #ff676d; --yellow: #f5b94e; }
* { box-sizing: border-box; }
.icon { width: 1em; height: 1em; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 50% -20%, color-mix(in srgb, var(--blue) 8%, transparent), transparent 48%), var(--bg); color: var(--text); }
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled, input:disabled { cursor: default; opacity: .48; }
.hidden { display: none !important; }
.app-shell { width: min(100%, 680px); min-height: 100vh; margin: 0 auto; padding: max(24px, calc(env(safe-area-inset-top) + 14px)) 16px calc(100px + env(safe-area-inset-bottom)); }
.view { display: none; animation: appear 160ms ease-out; }
.view.active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(3px); } }
.topbar, .detail-topbar, .section-heading, .sheet-head { display: flex; align-items: center; justify-content: space-between; }
.topbar { min-height: 58px; margin-bottom: 20px; }
.topbar h1, .detail-topbar h1 { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: -.035em; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.detail-topbar { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; gap: 8px; margin: 0 -5px 22px; }
.detail-topbar h1 { overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; font-size: 21px; }
.round-button, .icon-button { display: grid; place-items: center; border: 0; }
.round-button { width: 46px; height: 46px; border-radius: 50%; background: var(--blue); color: var(--button-text); font-size: 27px; box-shadow: 0 7px 22px color-mix(in srgb, var(--blue) 23%, transparent); }
.icon-button { width: 42px; height: 42px; border-radius: 12px; background: transparent; color: var(--muted); font-size: 28px; }
.card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: 0 8px 26px rgba(0, 0, 0, .08); }
.section-heading { margin: 25px 3px 11px; }
.section-heading h2 { margin: 0; color: var(--muted); font-size: 16px; font-weight: 650; letter-spacing: .01em; }
.muted, .section-note { color: var(--muted); font-size: 13px; }
.centered { text-align: center; }
.search-field { display: grid; grid-template-columns: 30px 1fr; align-items: center; height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--muted); }
.search-field > .icon { width: 21px; height: 21px; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; }
.search-field input::placeholder { color: var(--muted); }
.thread-section { margin-top: 25px; }
.thread-section .section-heading { margin-top: 0; }
.list-card:empty::after { content: "Пока пусто"; display: block; padding: 24px; color: var(--muted); text-align: center; }
.thread-row, .session-row, .file-row, .command-row, .setting-row, .wide-row, .action-row, .model-option, .topic-option { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.thread-row:last-child, .session-row:last-child, .file-row:last-child, .command-row:last-child, .setting-row:last-child, .action-row:last-child, .model-option:last-child, .topic-option:last-child { border-bottom: 0; }
.thread-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; min-height: 72px; gap: 11px; padding: 10px 14px; }
.general-row { background: color-mix(in srgb, var(--blue) 10%, transparent); }
.general-row .row-copy strong { color: var(--blue); }
.general-badge { color: var(--blue); font-size: 12px; font-weight: 700; }
.thread-status, .file-icon, .session-icon { position: relative; display: grid; place-items: center; width: 36px; height: 36px; color: #bcd0e3; font-size: 22px; }
.thread-status .status-dot { width: 9px; height: 9px; }
.session-icon .status-dot { position: absolute; right: -1px; bottom: -1px; width: 8px; height: 8px; border: 2px solid var(--surface); }
.session-icon .status-dot.current { background: var(--blue); }
.directory-icon { color: color-mix(in srgb, var(--blue) 72%, white); }
.row-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-copy strong, .wide-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.row-copy small, .wide-row small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.row-copy small.active-copy { color: var(--blue); }
.chevron { color: var(--muted); font-size: 20px; }
.pin { color: var(--blue); font-size: 20px; }
.status-dot { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--muted); }
.status-dot.active { background: var(--green); box-shadow: 0 0 0 5px color-mix(in srgb, var(--green) 14%, transparent); }
.quiet-note { margin: 34px 0; color: var(--muted); text-align: center; font-size: 14px; }
.primary-button, .outline-button, .secondary-button, .danger-fill-button { width: 100%; min-height: 48px; display: grid; place-items: center; border-radius: 13px; font-weight: 650; }
.primary-button { border: 0; background: var(--blue); color: var(--button-text); }
.outline-button { margin-top: 12px; border: 1px solid var(--blue); background: transparent; color: var(--blue); }
.secondary-button { margin-top: 10px; border: 0; background: var(--surface-2); color: var(--text); }
.danger-fill-button { border: 0; background: var(--red); color: #fff; }
.run-card { padding: 16px; }
.run-head { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 12px; }
.run-head strong { display: block; font-size: 17px; }
.run-head small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.35; }
.run-meta { display: flex; flex-wrap: wrap; gap: 8px 15px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.stop-button { margin-left: auto; border: 1px solid var(--red); border-radius: 10px; background: transparent; padding: 7px 12px; color: var(--red); }
.settings-card { overflow: hidden; }
.setting-row { min-height: 62px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 14px; }
.setting-row.model-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.setting-row.verbose-row { grid-template-columns: minmax(0, 1fr) auto; }
.setting-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.setting-copy strong { font-size: 15px; }
.setting-copy small { color: var(--muted); font-size: 12px; }
.model-badge { max-width: none !important; border: 1px solid var(--line); border-radius: 99px; padding: 6px 10px; color: var(--text) !important; }
.setting-row > strong { max-width: 150px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.setting-icon { display: grid; place-items: center; width: 28px; color: #b9cee2; font-size: 20px; }
input[role="switch"] { appearance: none; width: 44px; height: 26px; margin: 0; border-radius: 99px; background: #526576; transition: background 160ms; }
input[role="switch"]::after { content: ""; display: block; width: 22px; height: 22px; margin: 2px; border-radius: 50%; background: white; transition: transform 160ms; }
input[role="switch"]:checked { background: var(--blue); }
input[role="switch"]:checked::after { transform: translateX(18px); }
.wide-row { min-height: 70px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 15px; padding: 12px 15px; }
.wide-row > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.session-row, .file-row { min-height: 66px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 14px; }
.current-badge { border-radius: 99px; background: color-mix(in srgb, var(--blue) 18%, transparent); padding: 6px 9px; color: var(--blue); font-size: 12px; }
.session-ready { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; margin-top: 12px; padding: 13px 14px; border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); }
.session-ready > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.session-ready strong { font-size: 14px; }
.session-ready small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.session-ready .small-button { white-space: nowrap; }
.topic-picker { width: 100%; min-height: 64px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 14px; text-align: left; }
.topic-picker:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.topic-picker .row-copy { flex-direction: column-reverse; }
.topic-picker .row-copy strong { font-size: 16px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 14px 0; padding: 3px; border-radius: 12px; background: var(--surface); }
.segmented button { min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; }
.segmented button.active { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.16); }
.breadcrumbs { display: flex; gap: 4px; overflow-x: auto; margin: 5px 2px 12px; scrollbar-width: none; }
.breadcrumbs button { flex: none; border: 0; background: transparent; padding: 7px 3px; color: var(--blue); }
.breadcrumbs button + button::before { content: "›"; margin-right: 8px; color: var(--muted); }
.files-list { min-height: 80px; }
.files-list.loading:empty::after { display: none; }
.file-skeleton { min-height: 66px; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.file-skeleton:last-child { border-bottom: 0; }
.file-skeleton > span, .file-skeleton i { display: block; overflow: hidden; position: relative; border-radius: 7px; background: color-mix(in srgb, var(--muted) 13%, transparent); }
.file-skeleton > span { width: 32px; height: 32px; border-radius: 10px; }
.file-skeleton > div { display: flex; flex-direction: column; gap: 8px; }
.file-skeleton i { width: min(62%, 240px); height: 12px; }
.file-skeleton i:last-child { width: min(38%, 150px); height: 9px; }
.file-skeleton > span::after, .file-skeleton i::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 9%, transparent), transparent); animation: skeleton-shimmer 1.25s ease-in-out infinite; }
@keyframes skeleton-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .file-skeleton > span::after, .file-skeleton i::after { animation: none; } }
.file-row.loading { pointer-events: none; opacity: .6; }
.file-kind { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.notice { margin: 12px 0; padding: 13px 14px; border: 1px solid color-mix(in srgb, var(--yellow) 32%, transparent); border-radius: 13px; background: color-mix(in srgb, var(--yellow) 9%, transparent); color: #f5cc7d; font-size: 13px; line-height: 1.4; }
.notice.error { border-color: color-mix(in srgb, var(--red) 35%, transparent); background: color-mix(in srgb, var(--red) 9%, transparent); color: #ff9b9f; }
.notice button { margin-left: 6px; border: 0; background: none; color: var(--blue); }
.auth-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 16px; }
.auth-card h2 { margin: 0; font-size: 16px; }
.auth-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.small-button { border: 0; border-radius: 9px; background: color-mix(in srgb, var(--blue) 15%, transparent); padding: 8px 10px; color: var(--blue); font-size: 12px; }
.chip { border-radius: 99px; background: var(--surface); padding: 7px 10px; color: var(--muted); font-size: 12px; }
.chip.success { color: var(--green); }
.chip.warning { color: var(--yellow); }
.limits-card { padding: 5px 15px; }
.limit { padding: 13px 0; border-bottom: 1px solid var(--line); }
.limit:last-child { border-bottom: 0; }
.limit-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 13px; }
.limit-head span:last-child { color: var(--muted); }
.progress { height: 6px; overflow: hidden; border-radius: 99px; background: color-mix(in srgb, var(--muted) 19%, transparent); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--blue); transition: width 200ms; }
.command-groups { margin-top: 13px; }
.command-group h3 { margin: 16px 3px 8px; color: var(--muted); font-size: 13px; }
.command-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; min-height: 56px; padding: 9px 14px; }
.command-row code { color: var(--blue); font-size: 13px; }
.danger-heading h2, .danger-text { color: var(--red); }
.danger-setting { width: 100%; display: flex; align-items: center; justify-content: space-between; border-color: color-mix(in srgb, var(--red) 28%, transparent); padding: 16px; text-align: left; }
.danger-setting span:first-child { display: flex; flex-direction: column; gap: 4px; }
.danger-setting strong { color: var(--red); }
.danger-setting small { color: var(--muted); }
.bottom-nav { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: flex; justify-content: center; gap: clamp(30px, 13vw, 100px); padding: 9px 14px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 93%, transparent); backdrop-filter: blur(18px); }
.bottom-nav button { min-width: 62px; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.bottom-nav button span { font-size: 22px; }
.bottom-nav button span .icon { width: 24px; height: 24px; }
.bottom-nav button.active { color: var(--blue); }
dialog { color: var(--text); }
.sheet { width: min(calc(100% - 16px), 660px); max-height: 82vh; position: fixed; inset: auto 8px max(8px, env(safe-area-inset-bottom)); margin: 0 auto; overflow-y: auto; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); padding: 12px 16px 16px; }
dialog::backdrop { background: rgba(0, 0, 0, .56); backdrop-filter: blur(2px); }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 12px; border-radius: 99px; background: #526779; }
.sheet h2 { margin: 7px 0 13px; font-size: 19px; }
.sheet-head button { border: 0; background: none; color: var(--blue); }
.field-label { display: flex; flex-direction: column; gap: 7px; margin: 12px 0 16px; color: var(--muted); font-size: 13px; }
.field-label input { height: 48px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: var(--bg); padding: 0 12px; color: var(--text); font-size: 16px; }
.field-label input:focus { border-color: var(--blue); }
.action-row, .model-option { min-height: 54px; padding: 12px 6px; font-size: 16px; }
.model-option { display: flex; justify-content: space-between; }
.topic-picker-sheet[open] { max-height: min(82dvh, 720px); display: grid; grid-template-rows: auto auto auto auto minmax(96px, 1fr); overflow: hidden; }
.topic-picker-search { flex: none; background: var(--bg); }
.picker-count { min-height: 30px; padding: 10px 3px 5px; color: var(--muted); font-size: 12px; }
.topic-picker-results { min-height: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 15px; background: color-mix(in srgb, var(--bg) 40%, transparent); scrollbar-width: thin; }
.topic-picker-group + .topic-picker-group { border-top: 8px solid var(--surface); }
.topic-picker-group h3 { position: sticky; z-index: 1; top: 0; margin: 0; padding: 9px 14px 7px; background: color-mix(in srgb, var(--surface) 96%, transparent); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.topic-option { min-height: 62px; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px 13px; }
.topic-option[aria-checked="true"] { background: color-mix(in srgb, var(--blue) 10%, transparent); }
.topic-choice-mark { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: transparent; font-size: 14px; font-weight: 800; }
.topic-option[aria-checked="true"] .topic-choice-mark { border-color: var(--blue); background: var(--blue); color: var(--button-text); }
.topic-option .row-copy strong { font-size: 15px; }
.topic-option-empty { padding: 32px 18px; color: var(--muted); text-align: center; font-size: 14px; }
.dialog-copy { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.preview-dialog { width: min(100%, 680px); max-width: none; height: 100dvh; max-height: none; margin: 0 auto; border: 0; background: var(--bg); padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.preview-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.preview-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.preview-dialog header div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.preview-dialog header strong, .preview-dialog header small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-dialog header small { color: var(--muted); }
.preview-dialog header button { border: 0; background: transparent; color: var(--muted); font-size: 30px; }
.preview-body { overflow: auto; padding: 18px 1px; line-height: 1.55; }
.preview-body pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #d8e4ef; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.preview-body h1 { font-size: 25px; }
.preview-body h2 { margin-top: 25px; font-size: 20px; }
.preview-body h3 { font-size: 17px; }
.preview-body ul, .preview-body ol { padding-left: 23px; }
.preview-body table { width: 100%; border-collapse: collapse; font-size: 13px; }
.preview-body th, .preview-body td { border: 1px solid var(--line); padding: 8px; text-align: left; }
.preview-body img { display: block; width: 100%; height: 100%; min-height: 60vh; object-fit: contain; }
.pdf-viewer { min-height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; }
.pdf-toolbar { position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 5px; text-align: center; }
.pdf-toolbar button { width: 38px; height: 38px; border: 0; border-radius: 9px; background: var(--surface-2); color: var(--text); font-size: 24px; }
.pdf-toolbar span { color: var(--muted); font-size: 13px; }
.pdf-canvas-wrap { min-height: 45vh; overflow: auto; display: flex; align-items: flex-start; justify-content: center; }
.pdf-canvas-wrap canvas { max-width: 100%; background: white; box-shadow: 0 5px 24px rgba(0, 0, 0, .28); }
.pdf-fallback { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.preview-body .preview-fallback { display: grid; place-items: center; min-height: 45vh; color: var(--muted); text-align: center; }
.preview-dialog footer { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.text-link { padding: 7px; color: var(--blue); text-align: center; text-decoration: none; }
.toast { position: fixed; z-index: 100; bottom: calc(86px + env(safe-area-inset-bottom)); left: 50%; max-width: calc(100% - 32px); transform: translate(-50%, 16px); border-radius: 10px; background: #e9f1f8; padding: 10px 14px; color: #0d1924; opacity: 0; pointer-events: none; transition: 180ms; font-size: 13px; box-shadow: 0 10px 34px rgba(0,0,0,.3); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.demo-badge { position: fixed; z-index: 90; top: max(7px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); border-radius: 99px; background: var(--yellow); padding: 3px 8px; color: #3a2b0b; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (min-width: 700px) { .app-shell { padding-inline: 24px; } .card { border-radius: 18px; } }
