/* DataPilot 3.11 — единая палитра в токенах: светлая и тёмная тема живут в одном месте,
   компоненты знают только имена переменных. Акцент — фирменный зелёный, нейтрали уведены
   в его сторону, чтобы серый не выглядел случайным. */
:root {
  --bg: #EEF2F0; --surface: #FFFFFF; --surface-2: #F5F8F6; --surface-3: #EAEFEC;
  --ink: #101D18; --ink-2: #35443D; --muted: #6B7A73;
  --line: #DEE5E1; --line-2: #C7D2CC;
  --accent: #167557; --accent-hover: #12634A; --accent-ink: #FFFFFF; --accent-soft: #E3F1EA; --accent-line: #B7D8C8;
  --warn: #96610F; --warn-soft: #FBF1DC; --warn-line: #E8CE97;
  --danger: #A93B31; --danger-soft: #FCEDEA; --danger-line: #EDC3BC;
  --ok: #1B7A52;
  --code-bg: #0F1A17; --code-ink: #D6E2DC;
  --r-sm: 8px; --r: 11px; --r-lg: 16px; --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(16, 29, 24, .04), 0 8px 24px -18px rgba(16, 29, 24, .35);
  --shadow-2: 0 24px 60px -28px rgba(16, 29, 24, .42);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--bg); font-synthesis: none; color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
h1, h2, h3 { text-wrap: balance; }

/* Вход */
.auth-view { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 30% 18%, var(--accent-soft) 0, transparent 42%), var(--bg); }
.auth-card { width: min(410px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 30px; box-shadow: var(--shadow-2); }
.auth-card h1 { margin: 18px 0 4px; font-size: 27px; letter-spacing: -.02em; }
.auth-card p { color: var(--muted); margin: 0 0 26px; }
.logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 850; font-size: 12px; letter-spacing: -.3px; flex: none; }
.logo.large { width: 50px; height: 50px; border-radius: 15px; font-size: 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
label { font-size: 12px; font-weight: 700; color: var(--ink-2); display: flex; flex-direction: column; gap: 7px; }
input, textarea, select { border: 1px solid var(--line-2); border-radius: var(--r); padding: 11px 12px; outline: none; background: var(--surface); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.primary, .small-primary { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: var(--r); font-weight: 700; }
.primary { padding: 12px 16px; }
.primary:hover, .small-primary:hover { background: var(--accent-hover); }
.small-primary { padding: 8px 10px; font-size: 12px; }
.secondary, .nav-button, .icon-button, .danger-ghost { border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-sm); color: var(--ink-2); }
.secondary { padding: 8px 11px; font-size: 12px; }
.secondary:hover, .nav-button:hover, .icon-button:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; font-size: 16px; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 9px 11px; border-radius: 9px; font-size: 12px; }

/* Каркас: боковая панель + рабочая область */
.app { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); transition: grid-template-columns .18s ease; }
.app.history-collapsed { grid-template-columns: 62px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; gap: 10px; min-height: 0; height: 100vh; padding: 14px 12px; background: var(--surface-2); border-right: 1px solid var(--line); overflow: hidden; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar .brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sidebar .brand strong { font-size: 14px; letter-spacing: -.01em; }
.new-chat-button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--accent); border-radius: var(--r); background: var(--accent); color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.new-chat-button:hover { background: var(--accent-hover); }
.new-chat-button b { font-size: 13px; line-height: 1; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 9px; padding: 6px 9px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); font-size: 12.5px; text-align: left; }
.side-link::before { content: attr(data-icon); width: 16px; flex: none; text-align: center; color: var(--muted); font-size: 11.5px; }
.side-link:hover { background: var(--surface-3); color: var(--ink); }
.side-link.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.side-link.active::before { color: var(--accent); }
.side-group { display: flex; flex-direction: column; gap: 5px; min-height: 0; }
.recent-group { flex: 1; min-height: 0; }
.side-caption { font-size: 9.5px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 4px; }
.history-search { width: 100%; padding: 6px 9px; font-size: 11.5px; border-radius: var(--r-sm); background: var(--surface); }
.chat-list { display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow-y: auto; padding-right: 3px; }
.chat-row { border: 1px solid transparent; border-radius: var(--r-sm); padding: 7px 9px; background: transparent; text-align: left; color: var(--ink-2); }
.chat-row:hover { background: var(--surface-3); }
.chat-row.active { background: var(--surface); border-color: var(--line-2); color: var(--ink); box-shadow: var(--shadow-1); }
.chat-row strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 600; }
.chat-row span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.usage-card { padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.usage-card > div:not(.progress) { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.usage-card strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.usage-card .token-split { display: flex; gap: 10px; justify-content: flex-start; margin-top: 4px; }
.usage-card .token-split span { display: inline-flex; gap: 4px; }
.usage-card .token-split b { color: var(--ink-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.progress { height: 5px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin: 6px 0 10px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; }
.sidebar-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.sidebar-user-actions { display: flex; gap: 5px; }
.sidebar-user .icon-button { width: 30px; height: 30px; font-size: 14px; }
.user-chip { display: flex; flex-direction: column; min-width: 0; }
.user-chip span { font-size: 12px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip small { color: var(--muted); font-size: 10px; }

/* Свёрнутая панель — только иконки */
.app.history-collapsed .sidebar { padding-inline: 8px; }
.app.history-collapsed .sidebar .brand strong,
.app.history-collapsed .new-chat-button span,
.app.history-collapsed .side-link span,
.app.history-collapsed .side-caption,
.app.history-collapsed .history-search,
.app.history-collapsed .usage-card,
.app.history-collapsed .user-chip,
.app.history-collapsed .chat-row strong,
.app.history-collapsed .chat-row span { display: none; }
.app.history-collapsed .sidebar-head { flex-direction: column; gap: 10px; }
.app.history-collapsed .new-chat-button { justify-content: center; padding: 9px 0; }
.app.history-collapsed .side-link { justify-content: center; padding: 9px 0; }
.app.history-collapsed .side-link::before { width: auto; font-size: 15px; }
.app.history-collapsed .recent-group { border-top: 1px solid var(--line); padding-top: 9px; }
.app.history-collapsed .chat-row { min-height: 34px; display: grid; place-items: center; padding: 6px; }
.app.history-collapsed .chat-row::before { content: '◫'; color: var(--muted); }
.app.history-collapsed .sidebar-user { justify-content: center; }

/* Верхняя строка и рабочая область */
.main-area { display: grid; grid-template-rows: 60px minmax(0, 1fr); min-width: 0; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 0 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 30; }
.topbar-title { min-width: 0; }
.topbar-title strong { display: block; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.nav-button { padding: 7px 11px; font-size: 12px; }
.nav-button.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.badge { padding: 1px 6px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 10px; font-variant-numeric: tabular-nums; }
.mobile-only { display: none; }
.workspace { position: relative; min-height: 0; overflow: hidden; }
.chat-column { background: var(--surface); min-width: 0; min-height: 0; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
/* Пустой экран: приветствие, подсказки и поле ввода стоят одной группой по центру,
   а не разъезжаются по краям высокого экрана. */
.chat-column:has(#emptyChat:not(.hidden)) { grid-template-rows: auto auto; align-content: center; gap: 6px; }
.chat-column:has(#emptyChat:not(.hidden)) .composer { border-top: 0; }

/* Пустой экран: приветствие, подсказки и то же поле ввода */
.empty-chat { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 40px 24px 10px; }
.empty-chat h2 { margin: 0; font-size: clamp(22px, 1.2rem + 1.3vw, 30px); letter-spacing: -.02em; }
.empty-chat p { margin: 0; max-width: 62ch; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.start-prompts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 700px; }
.start-prompts button { border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink-2); padding: 8px 14px; font-size: 12.5px; }
.start-prompts button:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.active-chat { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.chat-header { padding: 10px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
/* Название анализа уже стоит в верхней строке — в шапке диалога остаётся только контекст. */
.chat-header h2 { display: none; }
.chat-header span { font-size: 10.5px; color: var(--muted); }
.inline-actions { display: flex; gap: 7px; }
.inline-actions select { padding: 7px 10px; font-size: 11px; }
.danger-ghost { padding: 7px 10px; color: var(--danger); font-size: 11px; }
.danger-ghost:hover { border-color: var(--danger-line); background: var(--danger-soft); }
.message-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px max(20px, 6vw); }
.welcome-prompts { max-width: 650px; margin: 6vh auto 0; text-align: center; }
.welcome-prompts h3 { font-size: 18px; letter-spacing: -.01em; }
.welcome-prompts p { max-width: 540px; margin: -7px auto 14px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.welcome-prompts button { display: inline-block; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); padding: 8px 13px; margin: 4px; font-size: 12px; color: var(--ink-2); }
.welcome-prompts button:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.message { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; max-width: 1050px; margin: 0 auto 20px; }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); font-size: 10px; font-weight: 800; color: var(--ink-2); }
.message.assistant .avatar { background: var(--accent-soft); color: var(--accent); }
.message-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.message-meta strong { font-size: 11.5px; }
.message-meta span { font-size: 9.5px; color: var(--muted); }
.message-text { font-size: 13.5px; line-height: 1.65; color: var(--ink-2); white-space: pre-wrap; }
.message-text code { background: var(--surface-3); padding: 1px 4px; border-radius: 4px; font-family: var(--mono); font-size: 12px; }
.message-text.analysis-error { border-left: 3px solid var(--danger); padding-left: 12px; }
.pending { color: var(--muted); }
.message-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.message-actions button { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--muted); padding: 5px 9px; font-size: 10.5px; }
.message-actions button:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.message-actions .retry-analysis { font-weight: 600; }

/* Композер: поле и все действия в одной рамке */
.composer { padding: 10px max(20px, 6vw) 16px; background: var(--surface); border-top: 1px solid var(--line); }
.composer-shell { max-width: 1050px; margin: 0 auto; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); transition: border-color .15s ease, box-shadow .15s ease; }
.composer-shell:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.composer-shell textarea { width: 100%; resize: none; min-height: 64px; max-height: 220px; border: 0; background: transparent; padding: 13px 14px 4px; font-size: 14px; line-height: 1.55; }
.composer-shell textarea:focus { box-shadow: none; }
.composer-bar { display: flex; align-items: center; gap: 7px; padding: 8px 10px 10px; flex-wrap: wrap; }
.attach-button { width: 30px; height: 30px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); color: var(--accent); display: grid; place-items: center; font-size: 15px; flex: none; }
.attach-button:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.send-button { margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 16px; flex: none; }
.send-button:hover:not(:disabled) { background: var(--accent-hover); }
.composer-footer { max-width: 1050px; margin: 7px auto 0; display: flex; justify-content: space-between; gap: 14px; }
.composer-footer span { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-picker-wrap { position: relative; flex: 0 0 auto; }
.table-picker-button { border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-2); color: var(--ink-2); padding: 6px 12px; font-size: 12px; }
.table-picker-button:hover, .table-picker-button[aria-expanded="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.table-picker-panel { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 60; width: min(430px, calc(100vw - 40px)); max-height: min(590px, 70vh); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 12px; }
.table-picker-panel > header { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 2px 2px 10px; border-bottom: 1px solid var(--line); }
.table-picker-panel > header div { display: flex; flex-direction: column; gap: 3px; }
.table-picker-panel > header strong { font-size: 12.5px; }
.table-picker-panel > header span { color: var(--muted); font-size: 10px; }
.table-picker-panel .icon-button { width: 28px; height: 28px; }
.selection-mode { display: grid; grid-template-columns: 18px minmax(0,1fr); align-items: start; gap: 8px; padding: 9px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.selection-mode input, .table-option input { width: auto; margin: 2px 0 0; accent-color: var(--accent); }
.selection-mode span { display: flex; flex-direction: column; gap: 3px; }
.selection-mode b { font-size: 11.5px; color: var(--ink); }
.selection-mode small { font-size: 10px; line-height: 1.4; color: var(--muted); font-weight: 500; }
.table-option-list { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; }
.table-option-group { padding: 5px 4px 1px; color: var(--muted); font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.table-option { position: relative; display: grid; grid-template-columns: 18px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; }
.table-option:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.table-option span { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.table-option b { color: var(--ink-2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-option small { color: var(--muted); font-size: 9.5px; font-weight: 500; }
.table-option-download { border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-sm); width: 26px; height: 26px; display: grid; place-items: center; color: var(--accent); font-size: 13px; flex: none; }
.table-option-download:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.table-option-download:disabled { opacity: .5; }
.toggle-option { flex-direction: row; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.toggle-option input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-option > i { width: 30px; height: 17px; border-radius: 999px; background: var(--line-2); position: relative; transition: .15s; }
.toggle-option > i::after { content: ''; position: absolute; width: 13px; height: 13px; left: 2px; top: 2px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .15s; }
.toggle-option input:checked + i { background: var(--accent); }
.toggle-option input:checked + i::after { transform: translateX(13px); }
.toggle-option input:disabled + i { opacity: .5; }
.toggle-with-help { display: flex; align-items: center; gap: 4px; }
.help-dot { width: 18px; height: 18px; padding: 0 !important; border: 1px solid var(--line-2); border-radius: 50%; background: var(--surface); color: var(--muted); display: grid; place-items: center; font-size: 10px !important; }

/* Панель данных */
.data-drawer { position: absolute; z-index: 42; top: 0; right: 0; bottom: 0; width: min(430px, 42vw); background: var(--surface-2); border-left: 1px solid var(--line); box-shadow: -24px 0 60px -40px rgba(8, 20, 16, .6); transform: translateX(102%); transition: transform .2s ease; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); padding: 14px; gap: 0; }
.data-drawer.open { transform: translateX(0); }
.drawer-backdrop { position: absolute; z-index: 41; inset: 0; background: color-mix(in srgb, var(--ink) 14%, transparent); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.panel-head > div { display: flex; flex-direction: column; gap: 3px; }
.panel-head strong { font-size: 13px; }
.panel-head span { color: var(--muted); font-size: 11px; }
.data-tabs { display: flex; gap: 5px; margin-bottom: 10px; }
.data-tabs button { flex: 1; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 7px; color: var(--muted); font-size: 11px; }
.data-tabs button.active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); font-weight: 650; }
.data-tab-panel { padding: 4px 0 16px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.data-tab-empty { margin: 12px 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.dropzone { width: 100%; min-height: 104px; border: 1.5px dashed var(--line-2); border-radius: var(--r); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; background: var(--surface); color: inherit; font-family: inherit; cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone b { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 19px; }
.dropzone strong { font-size: 12.5px; }
.dropzone span { font-size: 10.5px; color: var(--muted); }
.dropzone.uploading { pointer-events: none; opacity: .78; border-style: solid; }
.dropzone.uploading::after { content: attr(data-progress); font-weight: 700; color: var(--accent); }
.file-panel-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 3px; scrollbar-gutter: stable; }
.file-panel-scroll .file-list { overflow: visible; padding-right: 0; }
.file-list { display: flex; flex-direction: column; gap: 7px; margin-top: 11px; min-height: 0; overflow-y: auto; padding-right: 3px; align-content: start; }
.file-list.empty { font-size: 11.5px; color: var(--muted); text-align: center; padding: 16px 4px; }
.file-row { display: grid; grid-template-columns: 34px minmax(0,1fr) 28px; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 9px; }
.file-row[data-dataset-id] { cursor: pointer; }
.file-row:hover { border-color: var(--accent-line); box-shadow: var(--shadow-1); }
.file-icon { height: 34px; border-radius: var(--r-sm); background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); font-size: 9px; font-weight: 800; }
.file-meta { min-width: 0; }
.file-meta strong { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta span { font-size: 10px; color: var(--muted); }
.file-meta small { display: block; margin-top: 3px; color: var(--muted); font-size: 9.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-row .row-action { border: 1px solid transparent; border-radius: 7px; color: var(--accent); font-size: 14px; width: 26px; height: 26px; display: grid; place-items: center; background: transparent; }
.file-row .row-action:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.file-row button { border: 0; background: transparent; color: var(--danger); font-size: 16px; }
.file-row button.row-action { border: 1px solid transparent; color: var(--accent); font-size: 14px; }
.file-row.dataset-error { border-color: var(--danger-line); background: var(--danger-soft); }
.file-row.dataset-warning { border-color: var(--warn-line); background: var(--warn-soft); }
.quality-warning { color: var(--warn) !important; }
.quality-error, .error-text { color: var(--danger) !important; }
.download-row { cursor: pointer; }
.generated-block { margin-top: 14px; min-height: 0; display: flex; flex-direction: column; }
.generated-block .file-list { flex: 1; }
.data-summary-button { border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); border-radius: var(--r-sm); padding: 7px 12px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.data-summary-button:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.data-summary-button.warning { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.data-summary-button.processing::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border: 2px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Разделы в разработке */
.stub-view { min-height: 0; overflow-y: auto; display: grid; place-items: center; padding: 40px 24px; }
.stub-card { width: min(560px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); padding: 40px 32px; box-shadow: var(--shadow-1); }
.stub-icon { width: 56px; height: 56px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 25px; }
.stub-status { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: 999px; padding: 3px 10px; }
.stub-card h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.stub-card > p { margin: 0; max-width: 46ch; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.stub-list { list-style: none; margin: 4px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 7px; width: 100%; max-width: 420px; text-align: left; }
.stub-list li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 9px; font-size: 12.5px; color: var(--ink-2); }
.stub-list li::before { content: '—'; color: var(--accent); }

/* Карточка результата */
.analysis-result-card { margin-top: 14px; max-width: none; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); overflow: hidden; }
.analysis-result-card > header { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.analysis-result-card > header div { display: flex; flex-direction: column; gap: 3px; }
.analysis-result-card > header strong { font-size: 13px; }
.analysis-result-card > header span { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.analysis-result-card > header code { color: var(--muted); font-family: var(--mono); font-size: 9px; }
.analysis-result-card > footer { display: flex; gap: 7px; flex-wrap: wrap; padding: 10px 13px; border-top: 1px solid var(--line); }
.analysis-result-card > footer .secondary { border-radius: var(--r-sm); }
.technical-log-plaque { flex: 1 1 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); overflow: hidden; }
.technical-log-plaque summary { cursor: pointer; padding: 8px 10px; font-size: 10.5px; font-weight: 650; color: var(--muted); }
.technical-log-plaque > div { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.technical-log-plaque span { color: var(--muted); font-size: 10px; }
.result-table-wrap { width: 100%; max-height: 310px; overflow: auto; background: var(--surface); padding: 4px 10px 10px; }
.result-table-wrap table { min-width: 540px; }
.result-chart { width: 100%; padding: 12px 14px 2px; background: var(--surface); border-bottom: 1px solid var(--line); }
.result-chart > strong { display: block; margin-bottom: 4px; font-size: 11.5px; }
.result-chart svg { width: 100%; max-height: 210px; overflow: visible; }
.chart-labels text { fill: var(--muted); font-size: 8px; }


/* Разбор под таблицей: свёрнут по умолчанию, потому что главная ценность — сам результат */
.answer-blocks { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.answer-block { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.answer-block > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 11px; font-size: 12.5px; color: var(--ink-2); }
.answer-block > summary::-webkit-details-marker { display: none; }
.answer-block > summary::before { content: '▸'; font-size: 10px; color: var(--muted); }
.answer-block[open] > summary::before { content: '▾'; }
.answer-block > summary i { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.answer-block > summary:hover { color: var(--accent); }
.answer-block ul { margin: 0; padding: 0 12px 11px 30px; display: flex; flex-direction: column; gap: 5px; }
.answer-block li { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.answer-block li::marker { color: var(--accent); }
/* Первый экран принадлежит таблице: заголовок ответа крупнее, отступ до карточки меньше */
.message-text + .analysis-result-card { margin-top: 10px; }

/* Обзор данных */
.data-overview-card { max-width: 1050px; margin: 0 auto 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 17px; }
.data-overview-card > header { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.data-overview-card h3 { margin: 0 0 5px; font-size: 16px; color: var(--ink); letter-spacing: -.01em; }
.data-overview-card header p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.overview-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.overview-stats span { border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); padding: 5px 9px; color: var(--ink-2); font-size: 9.5px; white-space: nowrap; }
.overview-grid { display: grid; grid-template-columns: 1fr; gap: 11px; margin-top: 14px; }
.overview-grid.single { grid-template-columns: 1fr; }
.overview-section { border-top: 1px solid var(--line); padding-top: 10px; min-width: 0; max-width: 780px; }
.overview-section strong { display: block; margin-bottom: 6px; font-size: 10px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.overview-section ul { margin: 0; padding-left: 17px; color: var(--ink-2); font-size: 11.5px; line-height: 1.55; }
.overview-section.issues li { color: var(--warn); }
.overview-questions { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 6px; }
.overview-questions button { border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-2); padding: 8px 11px; font-size: 11px; text-align: left; }
.overview-questions button:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.overview-note { display: block; margin-top: 10px; color: var(--muted); font-size: 9.5px; }
.overview-empty { margin: 12px 0 4px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.overview-toggle { border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-sm); padding: 6px 10px; color: var(--accent); font-size: 11px; white-space: nowrap; }
.overview-tabs { display: flex; gap: 5px; margin-top: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.overview-tabs button { border: 0; border-radius: var(--r-sm); background: var(--surface-2); padding: 7px 10px; color: var(--muted); font-size: 11px; }
.overview-tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.compact-overview { padding: 0; }
.compact-overview > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; }
.compact-overview > summary::-webkit-details-marker { display: none; }
.compact-overview > summary span { display: flex; flex-direction: column; gap: 2px; }
.compact-overview > summary b { color: var(--accent); font-size: 11.5px; }
.compact-overview > summary small { color: var(--muted); font-size: 9.5px; }
.compact-overview > summary em { color: var(--ink-2); font-size: 9.5px; font-style: normal; }
.compact-overview[open] > summary { border-bottom: 1px solid var(--line); }
.compact-overview-body { padding: 14px 16px 16px; }
.compact-overview-body > header h3 { display: none; }
/* Свёрнутый вид больше не обрезается по высоте: он несёт вопросы и строки-действия,
   ради которых и существует. Жёсткий max-height прятал бы их наполовину. */
.data-overview-card.compact { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.overview-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.overview-line strong { font-size: 13px; }
.overview-ok { color: var(--accent); font-weight: 800; }
.overview-sep { color: var(--line-2); }
.overview-line .overview-toggle { margin-left: auto; }
.overview-desc { margin: 0; color: var(--muted); font-size: 12px; max-width: 78ch; }
.overview-actions { display: flex; flex-direction: column; gap: 6px; }
.overview-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--warn-line); background: var(--warn-soft);
  color: var(--warn); font-size: 12px; }
.overview-action-danger { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.overview-action button { border: 1px solid currentColor; border-radius: var(--r-sm); background: var(--surface);
  color: inherit; padding: 5px 11px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.overview-action button:hover { background: var(--surface-2); }
.overview-more { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--muted);
  font-size: 11.5px; text-decoration: underline; text-underline-offset: 2px; }
.overview-more:hover { color: var(--ink-2); }
.data-overview-card.compact.has-issues { border-color: var(--warn-line); }
.data-overview-card.compact .overview-grid, .data-overview-card.compact .overview-note { display: none; }
.data-overview-card.compact .overview-questions button:nth-child(n+4) { display: none; }

/* Ход анализа и технический трейс */
.analysis-progress-card { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: 12px; }
.analysis-progress-card > strong { display: block; margin-bottom: 9px; font-size: 11.5px; color: var(--ink-2); }
.friendly-progress { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.friendly-progress li { display: grid; grid-template-columns: 18px minmax(0,1fr); align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.friendly-progress li i { width: 16px; height: 16px; border: 1px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; font-style: normal; }
.friendly-progress li.done { color: var(--ink-2); }
.friendly-progress li.done i { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.friendly-progress li.done i::after { content: '✓'; font-size: 9px; }
.friendly-progress li.active { color: var(--accent); font-weight: 700; }
.friendly-progress li.active i { border-color: var(--accent); border-top-color: transparent; animation: upload-spinner .8s linear infinite; }
.analysis-progress-card > small { display: block; margin: 9px 0 0 26px; color: var(--muted); font-size: 9.5px; }
.technical-progress-details { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 8px; }
.technical-progress-details > summary { cursor: pointer; color: var(--muted); font-size: 10px; font-weight: 650; }
.technical-progress-details .trace-events { margin-top: 7px; border: 1px solid var(--line); border-radius: 9px; }
.analysis-trace { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); overflow: hidden; }
.analysis-trace > summary { cursor: pointer; list-style: none; padding: 9px 11px; color: var(--muted); font-size: 10.5px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.analysis-trace > summary::-webkit-details-marker { display: none; }
.analysis-trace > summary::before { content: '›'; font-size: 16px; line-height: 1; transition: transform .15s; }
.analysis-trace[open] > summary::before { transform: rotate(90deg); }
.trace-events { border-top: 1px solid var(--line); padding: 5px 10px 9px; }
.trace-event { display: grid; grid-template-columns: 8px minmax(0,1fr); gap: 9px; padding: 6px 0; }
.trace-event i { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--muted); }
.trace-event.success i { background: var(--ok); }
.trace-event.warning i { background: var(--warn); }
.trace-event.error i { background: var(--danger); }
.trace-event div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trace-event strong { color: var(--ink-2); font-size: 10.5px; }
.trace-event span { color: var(--muted); font-size: 10px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.trace-loading { padding: 10px; color: var(--muted); font-size: 10.5px; }

/* Админка */
.admin-view { min-height: 0; display: grid; grid-template-columns: 214px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.admin-nav { padding: 16px; background: var(--surface-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; }
.admin-nav button { border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; padding: 9px 12px; color: var(--ink-2); font-size: 12.5px; }
.admin-nav button:hover { background: var(--surface-3); }
.admin-nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.admin-content { padding: 22px; min-height: 0; overflow-y: auto; overflow-x: hidden; background: var(--bg); }
.admin-tab h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.02em; }
.admin-tab > p { margin: 0 0 20px; color: var(--muted); font-size: 12.5px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.metric-grid.compact { grid-template-columns: repeat(3, minmax(110px, 1fr)); margin: 12px 0; }
.metric-grid.compact .metric strong { font-size: 15px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px; }
.metric span { font-size: 10.5px; color: var(--muted); }
.metric strong { display: block; margin-top: 8px; font-size: 22px; font-variant-numeric: tabular-nums; }
.admin-card { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px; overflow: auto; }
.admin-card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.admin-card h3 { font-size: 13px; margin: 0; }
.admin-card details pre { max-width: 520px; max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: 9.5px; }
table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
th { text-align: left; color: var(--muted); font-weight: 650; border-bottom: 1px solid var(--line); padding: 8px; white-space: nowrap; }
td { border-bottom: 1px solid var(--line); padding: 9px 8px; vertical-align: top; }
.status-pill { display: inline-flex; border-radius: 999px; padding: 3px 8px; font-size: 9.5px; background: var(--surface-3); color: var(--ink-2); }
.status-pill.ok { color: var(--ok); background: var(--accent-soft); }
.status-pill.error { color: var(--danger); background: var(--danger-soft); }
.table-actions { display: flex; gap: 5px; }
.table-actions button { border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); padding: 5px 8px; font-size: 9.5px; }
.bar-chart { display: flex; gap: 7px; align-items: end; height: 170px; padding-top: 12px; }
.bar-item { flex: 1; min-width: 12px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.bar-item i { display: block; width: 100%; max-width: 28px; min-height: 2px; background: var(--accent); border-radius: 5px 5px 2px 2px; }
.bar-item span { font-size: 8.5px; color: var(--muted); transform: rotate(-45deg); margin-bottom: 8px; }
.prompt-editor-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.prompt-editor { margin-top: 0; display: flex; flex-direction: column; min-width: 0; }
.prompt-editor header > div { min-width: 0; }
.prompt-editor header small { display: block; margin-top: 4px; color: var(--muted); font-size: 9.5px; line-height: 1.35; }
.prompt-editor textarea { width: 100%; min-height: 230px; resize: vertical; font: 10.5px/1.5 var(--mono); }
.prompt-editor footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.prompt-editor footer > small { color: var(--muted); font-size: 9.5px; }
.prompt-editor footer > div { display: flex; gap: 7px; }
.log-filters { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.log-filters select { padding: 7px 9px; font-size: 10.5px; max-width: 270px; }
.human-log-table td:nth-child(3) span { display: block; margin-top: 3px; max-width: 520px; color: var(--muted); font-size: 10px; line-height: 1.4; white-space: pre-wrap; }
.compact-details summary { cursor: pointer; color: var(--muted); font-size: 10px; font-weight: 650; }
.compact-details pre { max-width: 440px !important; }

/* Воронка беты */
.funnel { display: flex; flex-direction: column; gap: 9px; }
.funnel-step { display: grid; grid-template-columns: 190px minmax(0, 1fr) 70px 150px; align-items: center; gap: 12px; }
.funnel-step > span { font-size: 12.5px; color: var(--ink-2); }
.funnel-bar { display: block; height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.funnel-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.funnel-step strong { font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
.funnel-step small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { .funnel-step { grid-template-columns: minmax(0, 1fr) 60px; } .funnel-bar, .funnel-step small { display: none; } }

/* Админка как отдельная страница: боковая панель диалогов здесь только мешает */
.app.admin-mode { grid-template-columns: minmax(0, 1fr); }
.app.admin-mode .sidebar { display: none; }
.app.admin-mode .top-actions .data-summary-button, .app.admin-mode #exportsButton { display: none; }
#backToWorkspace { display: none; }
.app.admin-mode #backToWorkspace { display: inline-flex; align-items: center; gap: 6px; }

/* Модальные окна */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: color-mix(in srgb, var(--ink) 45%, transparent); display: grid; place-items: center; padding: 18px; backdrop-filter: blur(2px); }
.logs-modal, .form-modal, .upload-modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-2); overflow: hidden; }
.logs-modal { width: min(1050px, 96vw); height: min(760px, 90vh); display: grid; grid-template-rows: auto 1fr; }
.logs-modal header, .form-modal header, .upload-modal header { padding: 15px 17px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.logs-modal header h2, .form-modal header h2, .upload-modal header h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.logs-modal header p, .upload-modal header p { margin: 3px 0 0; font-size: 10.5px; color: var(--muted); }
.logs-modal header > div:last-child { display: flex; gap: 7px; }
.logs-body { overflow-y: auto; background: var(--code-bg); padding: 13px; color: var(--code-ink); }
.log-entry { border-left: 3px solid var(--line-2); padding: 8px 10px; margin-bottom: 7px; background: color-mix(in srgb, var(--code-ink) 6%, transparent); border-radius: 4px 9px 9px 4px; }
.log-entry.reasoning { border-color: #9a78df; }
.log-entry.code { border-color: #56a5d8; }
.log-entry.output { border-color: #d5a84d; }
.log-entry.success { border-color: var(--ok); }
.log-entry.error { border-color: var(--danger); }
.log-entry .log-head { display: flex; gap: 9px; font-size: 10.5px; }
.log-entry .log-head time { color: var(--muted); }
.log-entry pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.5 var(--mono); color: var(--code-ink); }
.empty-state { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 12px; }
.empty-state.compact { min-height: 90px; }
.form-modal { width: min(620px, 96vw); max-height: 90vh; }
.form-modal:has(.dataset-profile), .form-modal:has(.run-details), .form-modal:has(.technical-tail) { width: min(1100px, 96vw); }
.form-modal:has(.table-browser) { width: min(1380px, 98vw); height: min(860px, 94vh); display: grid; grid-template-rows: auto minmax(0,1fr); }
.form-modal:has(.table-browser) #dialogBody { max-height: none; min-height: 0; overflow: hidden; }
.form-modal #dialogBody { padding: 16px; max-height: 75vh; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.check-list { border: 1px solid var(--line); border-radius: var(--r); padding: 8px; max-height: 160px; overflow-y: auto; }
.check-list label { flex-direction: row; align-items: center; font-weight: 500; }
.check-list input { width: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dataset-profile > p { color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.dataset-profile .admin-card p { font-size: 11.5px; color: var(--ink-2); }
.profile-sheet-card { scroll-margin-top: 8px; }
.quality-panel { margin: 12px 0; border: 1px solid var(--warn-line); border-radius: var(--r); background: var(--warn-soft); padding: 12px; }
.quality-panel.error { border-color: var(--danger-line); background: var(--danger-soft); }
.quality-panel > header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.quality-panel > header strong { font-size: 12px; }
.quality-panel > header span { color: var(--warn); font-size: 9.5px; }
.quality-issue { display: flex; flex-direction: column; gap: 2px; padding: 7px 0; border-top: 1px solid color-mix(in srgb, var(--warn) 22%, transparent); }
.quality-issue b { font-size: 11px; }
.quality-issue span { color: var(--ink-2); font-size: 10px; line-height: 1.4; }
.quality-issue.error b { color: var(--danger); }
.quality-panel details { margin-top: 7px; font-size: 10.5px; }
.quality-panel summary { cursor: pointer; font-weight: 650; }
.quality-panel ul { margin: 7px 0 0; padding-left: 18px; color: var(--ink-2); }
.run-details ol { font-size: 12.5px; line-height: 1.6; }
.run-details details { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin: 7px 0; }
.run-details summary { cursor: pointer; font-size: 11.5px; font-weight: 650; }
.run-details pre, .technical-tail { max-height: 520px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--code-bg); color: var(--code-ink); border-radius: var(--r-sm); padding: 12px; font: 10.5px/1.5 var(--mono); }
.semantic-table tr.column-hidden { opacity: .58; background: var(--surface-2); }
.table-preview-shell th.column-hidden, .table-preview-shell td.column-hidden { opacity: .55; background: var(--surface-2); }
.semantic-table td.description-cell { min-width: 230px; }
.semantic-table .manual-badge { display: inline-flex; margin-top: 4px; border-radius: 999px; padding: 2px 7px; background: var(--accent-soft); color: var(--accent); font-size: 8.5px; }
.semantic-actions { display: flex; gap: 5px; white-space: nowrap; }
.semantic-actions button { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink-2); padding: 5px 8px; font-size: 9.5px; }
.semantic-actions button:hover { border-color: var(--accent-line); color: var(--accent); }
.hidden-column-note { color: var(--muted); font-size: 9.5px; }
.show-hidden-toggle { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 9.5px; font-weight: 650; }
.show-hidden-toggle input { width: auto; }
.exports-center { display: grid; gap: 8px; }
.exports-summary { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 10.5px; }
.export-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--r); padding: 9px; }
.export-row .file-icon { height: 36px; }
.export-row strong { display: block; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.export-row span { display: block; color: var(--muted); font-size: 9.5px; margin-top: 3px; }
.chart-form .check-list { max-height: 220px; }
.chart-form .check-list label { padding: 5px; }
.table-browser { height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr) auto; gap: 12px; }
.table-browser-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.table-browser-toolbar > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.table-browser-toolbar strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-browser-toolbar span { color: var(--muted); font-size: 10px; }
.table-browser-toolbar select { max-width: 330px; padding: 8px 10px; font-size: 10.5px; }
.table-browser-tabs { display: flex; flex-direction: row !important; gap: 5px; }
.table-browser-tabs button { border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-2); padding: 7px 11px; font-size: 10.5px; }
.table-browser-tabs button.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.table-preview-shell { min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.table-preview-shell table { min-width: max-content; }
.table-preview-shell th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); }
.table-preview-shell th span { display: block; }
.table-preview-shell th small { display: block; max-width: 220px; margin-top: 3px; color: var(--muted); font-size: 8.5px; font-weight: 500; white-space: normal; line-height: 1.25; }
.table-preview-shell td { max-width: 320px; min-width: 110px; white-space: pre-wrap; overflow-wrap: anywhere; }
.table-preview-shell.profile-scroll { padding: 0 14px 14px; overflow-y: auto; }
.table-preview-empty { height: 100%; min-height: 240px; display: grid; place-items: center; color: var(--muted); font-size: 11.5px; }
.table-browser-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.table-browser-footer > span { color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.table-browser-footer > div { display: flex; gap: 7px; flex-wrap: wrap; }

/* Загрузка файлов */
.upload-modal { width: min(700px, 96vw); max-height: 92vh; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.upload-body { padding: 18px; overflow-y: auto; }
.upload-drop-area { min-height: 220px; border: 2px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface-2); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 7px; padding: 24px; outline: none; transition: .15s ease; }
.upload-drop-area:hover, .upload-drop-area:focus, .upload-drop-area.dragging { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); }
.upload-drop-area.uploading { pointer-events: none; opacity: .76; border-style: solid; }
.upload-drop-area.uploading::after { content: 'Загрузка ' attr(data-progress); color: var(--accent); font-size: 12px; font-weight: 800; }
.upload-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--r-lg); background: var(--accent-soft); color: var(--accent); font-size: 28px; }
.upload-drop-area strong { font-size: 15px; }
.upload-drop-area > span { color: var(--muted); font-size: 12px; }
.upload-drop-area small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.upload-drop-area .secondary { margin-top: 6px; color: var(--accent); border-color: var(--accent-line); }
.upload-selection { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.upload-selection.empty { padding: 12px; border: 1px solid var(--line); border-radius: var(--r); color: var(--muted); text-align: center; font-size: 11.5px; }
.upload-progress-card { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: 10px 12px; }
.upload-progress-card > div:first-child { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.upload-progress-card strong { font-size: 11.5px; }
.upload-progress-card span { color: var(--accent); font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.upload-progress-card .progress { margin: 8px 0 6px; }
.upload-progress-card small { color: var(--muted); font-size: 9.5px; line-height: 1.4; }
.upload-progress-card .progress i.indeterminate { width: 36%; animation: upload-processing 1.25s ease-in-out infinite alternate; }
@keyframes upload-processing { from { transform: translateX(-15%); } to { transform: translateX(185%); } }
.upload-stage-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 7px; }
.upload-stage-list li { display: grid; grid-template-columns: 18px minmax(0,1fr); align-items: center; gap: 8px; color: var(--muted); font-size: 10.5px; }
.upload-stage-list li > i { width: 16px; height: 16px; border: 1px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; background: var(--surface); }
.upload-stage-list li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.upload-stage-list li.active { color: var(--accent); font-weight: 750; }
.upload-stage-list li.active > i { border-color: var(--accent); border-top-color: transparent; animation: upload-spinner .8s linear infinite; }
.upload-stage-list li.done { color: var(--ink-2); }
.upload-stage-list li.done > i { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.upload-stage-list li.done > i::after { content: '✓'; font-style: normal; font-size: 10px; }
.upload-stage-list .stage-track { display: block; height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.upload-stage-list .stage-track em { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
.upload-stage-list li.done .stage-track em { background: color-mix(in srgb, var(--accent) 60%, var(--surface)); }
.upload-stage-list .stage-track em.pulsing { animation: stage-pulse 1.4s ease-in-out infinite; }
.upload-stage-list li small { font-size: 9.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes stage-pulse { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
@keyframes upload-spinner { to { transform: rotate(360deg); } }
.pending-file-row { display: grid; grid-template-columns: 38px minmax(0,1fr) 30px; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; background: var(--surface); }
.pending-file-row button { border: 0; background: transparent; color: var(--danger); font-size: 17px; }
.upload-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.global-drop-overlay { position: fixed; inset: 0; z-index: 180; display: grid; place-items: center; background: color-mix(in srgb, var(--accent-soft) 88%, transparent); backdrop-filter: blur(5px); pointer-events: none; }
.global-drop-overlay > div { width: min(520px, calc(100vw - 40px)); min-height: 240px; border: 3px dashed var(--accent); border-radius: var(--r-xl); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--shadow-2); }
.global-drop-overlay b { width: 54px; height: 54px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 30px; }
.global-drop-overlay strong { font-size: 20px; }
.global-drop-overlay span { color: var(--muted); font-size: 12px; }

/* Связи и качество */
.relation-row, .quality-row { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 11px 12px; }
.relation-pair { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; font-size: 11.5px; }
.relation-pair strong { font-size: 11.5px; }
.relation-pair code { font-family: var(--mono); font-size: 10px; color: var(--ink-2); background: var(--surface-3); border-radius: 5px; padding: 1px 5px; }
.relation-arrow { color: var(--muted); }
.relation-row p { margin: 6px 0 0; font-size: 11px; color: var(--muted); line-height: 1.45; }
.relation-confidence { display: inline-block; margin-top: 7px; font-size: 9.5px; border-radius: 999px; padding: 2px 8px; }
.relation-confidence.high { background: var(--accent-soft); color: var(--accent); }
.relation-confidence.medium { background: var(--warn-soft); color: var(--warn); }
.relation-confidence.low { background: var(--surface-3); color: var(--muted); }
.relation-row.manual { border-color: var(--accent-line); background: var(--surface-2); position: relative; padding-right: 34px; }
.relation-remove { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border: 1px solid transparent; background: transparent; border-radius: 6px; color: var(--danger); font-size: 15px; line-height: 1; }
.relation-remove:hover { border-color: var(--danger-line); background: var(--danger-soft); }
.relation-form { display: flex; flex-direction: column; gap: 7px; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--surface); padding: 12px; }
.relation-form strong { font-size: 11.5px; }
.relation-form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.relation-form select, .relation-form input { font-size: 11.5px; padding: 7px 8px; border-radius: 9px; min-width: 0; }
.relation-form-arrow { text-align: center; color: var(--muted); font-size: 12px; }
.relation-form button { align-self: flex-start; }
.quality-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.quality-head strong { font-size: 11.5px; }
.quality-badge { font-size: 9.5px; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.quality-badge.quality-ok { background: var(--accent-soft); color: var(--accent); }
.quality-badge.quality-warning { background: var(--warn-soft); color: var(--warn); }
.quality-badge.quality-error { background: var(--danger-soft); color: var(--danger); }
.quality-row > small { display: block; margin-top: 4px; color: var(--muted); font-size: 9.5px; }
.quality-row ul { margin: 8px 0 0; padding-left: 16px; }
.quality-row li { font-size: 11px; color: var(--ink-2); line-height: 1.5; margin-bottom: 3px; }

/* Тосты */
/* Уведомления в стиле macOS: матовое стекло в правом верхнем углу, новые сверху,
   въезд справа с лёгким отскоком, плавное схлопывание при уходе. Отступ между
   карточками living на margin-bottom, а не на gap стека: иначе зазор не схлопнуть
   вместе с уходящей карточкой и стопка дёргается. */
.toast-stack { position: fixed; right: 16px; top: 72px; z-index: 250; width: min(360px, calc(100vw - 28px)); display: flex; flex-direction: column; pointer-events: none; }
.toast { pointer-events: auto; display: grid; grid-template-columns: 34px minmax(0,1fr) 22px; gap: 11px; align-items: center; margin-bottom: 10px; border: 1px solid color-mix(in srgb, var(--line) 55%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--surface) 76%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.7); backdrop-filter: blur(18px) saturate(1.7); box-shadow: 0 12px 34px rgba(16, 34, 27, .16), inset 0 1px 0 rgba(255, 255, 255, .55); padding: 11px 12px; max-height: 220px; overflow: hidden; animation: toast-in .34s cubic-bezier(.21, 1.02, .55, 1.01); transition: opacity .22s ease, transform .22s ease, max-height .26s ease, margin-bottom .26s ease, padding .26s ease; }
.toast.leaving { opacity: 0; transform: translateX(46px) scale(.96); max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
.toast .toast-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--muted) 82%, #fff), var(--muted)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.toast.info .toast-icon { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 72%, #fff), var(--accent)); }
.toast.success .toast-icon { background: linear-gradient(135deg, color-mix(in srgb, var(--ok) 72%, #fff), var(--ok)); }
.toast.warning .toast-icon { background: linear-gradient(135deg, color-mix(in srgb, var(--warn) 70%, #fff), var(--warn)); }
.toast.error .toast-icon { background: linear-gradient(135deg, color-mix(in srgb, var(--danger) 72%, #fff), var(--danger)); }
.toast strong { display: block; color: var(--ink); font-size: 12px; }
.toast p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; white-space: pre-wrap; }
.toast button { border: 0; background: transparent; color: var(--muted); padding: 0; font-size: 16px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s ease; align-self: start; }
.toast:hover button { opacity: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateX(110%); } 62% { opacity: 1; transform: translateX(-5px); } to { opacity: 1; transform: translateX(0); } }
@media (max-width: 767px) { .toast-stack { top: 64px; right: 14px; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; transition: opacity .15s ease; } .toast.leaving { transform: none; } }

/* Прокрутка */
.chat-list, .file-panel-scroll, .file-list, .message-list, .table-picker-panel, .table-preview-shell, .admin-content, .logs-body, .upload-body, .empty-chat, .stub-view {
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; overscroll-behavior: contain;
}
.chat-list::-webkit-scrollbar, .file-panel-scroll::-webkit-scrollbar, .file-list::-webkit-scrollbar, .message-list::-webkit-scrollbar, .table-picker-panel::-webkit-scrollbar, .table-preview-shell::-webkit-scrollbar, .admin-content::-webkit-scrollbar, .logs-body::-webkit-scrollbar, .upload-body::-webkit-scrollbar { width: 7px; height: 7px; }
.chat-list::-webkit-scrollbar-thumb, .file-panel-scroll::-webkit-scrollbar-thumb, .file-list::-webkit-scrollbar-thumb, .message-list::-webkit-scrollbar-thumb, .table-picker-panel::-webkit-scrollbar-thumb, .table-preview-shell::-webkit-scrollbar-thumb, .admin-content::-webkit-scrollbar-thumb, .logs-body::-webkit-scrollbar-thumb, .upload-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }

/* Адаптив */
/* Ширина экрана задаёт только состояние по умолчанию — свёрнутый вид вешает скрипт классом
   history-collapsed. Держать здесь ещё и безусловное сворачивание нельзя: CSS перебивал бы
   выбор пользователя, и кнопка разворота выглядела бы сломанной на любом окне уже 1440 px. */
@media (max-width: 1439px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1099px) {
  .app, .app.history-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 94; top: 0; bottom: 0; left: 0; width: min(290px, 86vw); padding: 14px 12px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-2); }
  .sidebar.open-mobile { transform: translateX(0); }
  .sidebar .brand strong, .new-chat-button span, .side-link span, .side-caption,
  .history-search, .usage-card, .user-chip, .chat-row strong, .chat-row span { display: initial; }
  .sidebar-head { flex-direction: row; }
  .new-chat-button, .side-link { justify-content: flex-start; padding-inline: 11px; }
  .side-link::before { width: 18px; font-size: 13px; }
  .chat-row { display: block; padding: 8px 10px; }
  .chat-row::before { display: none; }
  .sidebar-user { justify-content: space-between; }
  .mobile-only { display: grid; }
  .data-drawer { width: min(430px, 92vw); }
}
@media (max-width: 820px) {
  .admin-view { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .admin-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .top-actions .nav-button { display: none; }
  .composer { padding-inline: 14px; }
  .composer-bar { gap: 6px; }
  .table-picker-panel { position: fixed; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 78vh; }
  .table-browser-toolbar, .table-browser-footer { align-items: stretch; flex-direction: column; }
  .table-browser-toolbar select { max-width: none; }
  .upload-modal { width: 100%; max-height: 96vh; }
  .upload-drop-area { min-height: 185px; }
  .composer-footer { flex-direction: column; gap: 4px; }
  .prompt-editor-list { grid-template-columns: 1fr; }
  .data-overview-card > header { flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .topbar { padding-inline: 10px; }
  .topbar-title { display: none; }
  .data-drawer { width: 100vw; }
  .message-list { padding-inline: 12px; }
  .message { grid-template-columns: 28px minmax(0,1fr); }
  .empty-chat { padding-inline: 16px; }
  .toggle-with-help { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .app, .sidebar, .data-drawer, .toggle-option > i, .toggle-option > i::after, .composer-shell { transition: none !important; }
  .data-summary-button.processing::before, .upload-stage-list .stage-track em.pulsing { animation: none; }
}

/* Переключатель заголовков выгрузки: в таблице колонки называются служебно
   (fio, propuski), и человеку в отчёт чаще нужны их описания. */
.export-headers.on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
/* Переключатель имён полей стоит в шапке карточки: меняет и таблицу, и выгрузку. */
.analysis-result-card header .header-mode { border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--muted); font-size: 11px; padding: 4px 9px; white-space: nowrap; }
.analysis-result-card header .header-mode[aria-pressed="true"] { border-color: var(--accent-line);
  background: var(--accent-soft); color: var(--accent); }
.analysis-result-card header .header-mode:hover { color: var(--ink-2); }
/* Разделы разбора открывают по отдельности, поэтому у каждого свой складень;
   технические детали сведены в один — раньше их было два. */
.analysis-trace.answer-block > summary { color: var(--muted); }
.analysis-trace.answer-block button { margin-top: 10px; }

/* Модалка «Данные»: вкладки и список загруженного */
.data-dialog-tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.data-dialog-tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 16px; margin-bottom: -1px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.data-dialog-tab:hover { color: inherit; }
.data-dialog-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.data-your-pane { display: flex; flex-direction: column; gap: 12px; }
.data-search { display: flex; flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 12px; color: var(--muted); }
.data-search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; color: inherit; }
.data-your-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; }
.data-file-row { display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--r-sm); cursor: pointer; }
.data-file-row:hover { background: var(--accent-soft); }
.data-file-row input[type="checkbox"] { accent-color: var(--accent); }
.data-file-meta { display: flex; flex-direction: column; min-width: 0; }
.data-file-meta small { color: var(--muted); }
.data-file-name { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-file-name:hover { text-decoration: underline; }
.data-file-disabled { opacity: .55; }
.upload-note { color: var(--muted); margin: 0 0 4px; }

/* «Все мои данные»: переключатель охвата и строки библиотеки */
.data-scope { display: flex; flex-direction: row; gap: 5px; }
.data-scope button { flex: 1; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 7px; color: var(--muted); font-size: 12px; cursor: pointer; }
.data-scope button.active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); font-weight: 650; }
.data-group-title { margin: 10px 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.data-attach { border: 1px solid var(--accent-line); border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); padding: 5px 10px; font-size: 12px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.data-attach:hover { background: var(--accent); color: #fff; }
.data-in-chat { color: var(--muted); font-size: 12px; white-space: nowrap; }
.data-file-row .data-file-meta { flex: 1; }

/* Раздел «Мои данные»: одноколоночный, в отличие от admin-view с его сеткой под навигацию */
.mydata-view { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.mydata-content { max-width: 920px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.mydata-summary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.mydata-stat { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mydata-stat strong { font-size: 16px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mydata-stat span { color: var(--muted); font-size: 11px; }
.mydata-block { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.mydata-retention { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.mydata-retention label { display: flex; flex-direction: column; gap: 6px; font-weight: 650; max-width: 340px; }
.mydata-retention small { color: var(--muted); font-weight: 400; }
.mydata-library { max-height: 460px; }
.mydata-library .data-file-row { padding: 8px 6px; border-radius: var(--r-sm); }
.mydata-library .data-file-row + .data-file-row { border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent); border-top-left-radius: 0; border-top-right-radius: 0; }
.mydata-library .data-file-name { font-size: 12.5px; }
.mydata-library .data-file-meta small { font-size: 10.5px; }
.mydata-library .file-icon { width: 30px; height: 30px; font-size: 9px; }
/* Крестик не кричит из каждой строки: появляется у строки под курсором */
.mydata-library [data-delete-dataset], .mydata-library [data-delete-result] { opacity: 0; border: 0; background: transparent; color: var(--muted); font-size: 15px; padding: 4px 8px; transition: opacity .12s ease, color .12s ease; }
.mydata-library .data-file-row:hover [data-delete-dataset], .mydata-library .data-file-row:hover [data-delete-result] { opacity: 1; }
.mydata-library [data-delete-dataset]:hover, .mydata-library [data-delete-result]:hover { color: var(--danger); }
.mydata-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.mydata-danger p { margin: 0; color: var(--muted); }
.mydata-danger button { align-self: flex-start; }
@media (max-width: 1099px) { .mydata-summary { grid-template-columns: repeat(3, 1fr); } }
