/* ============ Анализатор ============ */
.app-main { min-height: calc(100vh - 70px); position: relative; }
.app-bg { position: absolute; inset: 0 0 auto 0; height: 520px; pointer-events: none; overflow: hidden; z-index: 0; }
.app-bg::before { content: ""; position: absolute; left: 50%; top: -340px; width: 900px; height: 600px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse, rgba(246,111,20,.32), transparent 65%); filter: blur(40px); }
.app-main > .container { position: relative; z-index: 1; }
[hidden] { display: none !important; }

/* ---------- Загрузка ---------- */
.upload { padding-top: 72px; padding-bottom: 96px; text-align: center; }
.upload h1 { font-size: clamp(34px, 6vw, 56px); margin-bottom: 16px; }
.upload > p { max-width: 560px; margin: 0 auto 40px; font-size: 17px; }
.drop {
  max-width: 760px; margin: 0 auto; padding: 56px 28px; border-radius: 26px; cursor: pointer;
  border: 1.5px dashed rgba(246, 111, 20, .45);
  background: radial-gradient(ellipse at 50% 0%, rgba(246,111,20,.12), transparent 60%), rgba(255,255,255,.02);
  transition: border-color .2s, background-color .2s, transform .2s;
}
.drop:hover, .drop.over { border-color: var(--accent); background-color: rgba(246,111,20,.06); }
.drop.over { transform: scale(1.01); }
.drop-ico { width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); border: 1px solid rgba(246,111,20,.4); color: var(--accent-2); box-shadow: 0 0 40px rgba(246,111,20,.3); }
.drop-ico svg { width: 30px; height: 30px; }
.drop h2 { font-size: 24px; margin-bottom: 8px; }
.drop p { font-size: 15px; margin-bottom: 26px; }
.drop .hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.upload-meta { display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; margin-top: 28px; font-size: 14px; color: var(--muted); }
.upload-meta span { display: inline-flex; align-items: center; gap: 8px; }
.upload-meta svg { width: 16px; height: 16px; color: var(--accent-2); }

/* ---------- Загрузка (оверлей) ---------- */
.loading { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(6,9,16,.78); backdrop-filter: blur(6px); }
.loading-box { text-align: center; }
.spinner { width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 50%; border: 3px solid rgba(255,255,255,.08); border-top-color: var(--accent); box-shadow: 0 0 30px rgba(246,111,20,.35); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-box p { color: #ddd; }

/* ---------- Шапка результатов ---------- */
.results { padding-top: 36px; padding-bottom: 80px; }
.res-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.res-title h1 { font-size: clamp(26px, 4vw, 36px); margin-bottom: 8px; word-break: break-word; }
.res-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 14px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: rgba(255,255,255,.05); border: 1px solid var(--border); font-size: 13px; color: #ddd; }
.res-actions { display: flex; gap: 10px; flex-wrap: wrap; }
select.input, input.input {
  background: rgba(255,255,255,.04); border: 1px solid var(--border-strong); color: #fff; border-radius: 11px; padding: 8px 12px; font: inherit; font-size: 14px;
}
select.input option { background: #111520; }
input.input:focus, select.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(246,111,20,.18); }

/* ---------- Вкладки ---------- */
.tabs { position: relative; display: flex; gap: 4px; padding: 5px; border-radius: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--border); margin-bottom: 26px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; background: none; border: 0; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; color: #bdbdbd; display: inline-flex; align-items: center; gap: 8px; transition: background-color .2s, color .2s; }
.tab:hover { color: #fff; background: rgba(255,255,255,.04); }
.tab.active { color: #fff; background-color: var(--accent); background-image: radial-gradient(circle at 50% 100%, var(--accent-2), rgba(246,111,20,0) 79%); box-shadow: 0 0 22px rgba(242,147,84,.4); }
.tab .cnt { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.12); }

/* ---------- Обзор ---------- */
.ov-grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; }
.ov-score { padding: 26px; text-align: center; }
.ov-score .ring { --p: 0; --c: var(--accent); width: 170px; height: 170px; border-radius: 50%; margin: 6px auto 16px; display: grid; place-items: center; position: relative; background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255,255,255,.07) 0); box-shadow: 0 0 50px -10px var(--c); }
.ov-score .ring::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: #0b0f19; }
.ov-score .ring b { position: relative; font-family: var(--font-head); font-size: 50px; font-weight: 600; line-height: 1; }
.ov-score .ring small { display: block; font-size: 13px; color: var(--muted); font-family: var(--font-body); font-weight: 400; margin-top: 4px; }
.ov-score h3 { font-size: 18px; margin-bottom: 6px; }
.ov-score p { font-size: 14px; }
.ov-right { display: grid; gap: 18px; align-content: start; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 18px 20px; }
.kpi .v { font-family: var(--font-head); font-size: 30px; font-weight: 600; line-height: 1.1; }
.kpi .l { font-size: 13px; color: var(--muted); margin-top: 4px; }
.kpi.k-critical .v { color: var(--danger); } .kpi.k-warning .v { color: var(--warn); } .kpi.k-info .v { color: var(--info); }
.insights { padding: 24px; }
.insights h3, .panel-title { font-size: 19px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.insights h3 svg { width: 20px; height: 20px; color: var(--accent-2); }
.insights ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.insights li { display: flex; gap: 12px; font-size: 15px; line-height: 1.55; color: #d9d9d9; }
.insights li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: var(--c, var(--muted-2)); box-shadow: 0 0 10px var(--c, transparent); }
.insights li.s-critical { --c: var(--danger); } .insights li.s-warning { --c: var(--warn); } .insights li.s-info { --c: var(--info); } .insights li.s-ok { --c: var(--ok); } .insights li.s-neutral { --c: var(--accent-2); }
.cols-card { grid-column: 1 / -1; padding: 24px; }
.cols-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cols-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
.cols-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: #ddd; }
.cols-table tr:last-child td { border-bottom: 0; }
.cols-table tr.clickable { cursor: pointer; } .cols-table tr.clickable:hover td { background: rgba(255,255,255,.025); }
.fillbar { width: 120px; height: 6px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.fillbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.type-badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--border); color: #ccc; white-space: nowrap; }
.type-badge.t-number { color: #8fd3ff; } .type-badge.t-date { color: #c7a8ff; } .type-badge.t-category { color: var(--accent-2); }
.sev-dots { display: inline-flex; gap: 6px; }
.sev-dot { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #ccc; }
.sev-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.sev-dot.critical { --c: var(--danger); } .sev-dot.warning { --c: var(--warn); } .sev-dot.info { --c: var(--info); }
@media (max-width: 980px) { .ov-grid { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cols-table .hide-sm { display: none; } .fillbar { width: 60px; } }

/* ---------- Проблемы ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.fchip { background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; font-size: 14px; color: #ccc; }
.fchip.active { border-color: var(--accent); color: #fff; background: var(--accent-soft); }
.issue { padding: 20px 22px; margin-bottom: 12px; border-left: 3px solid var(--c); }
.issue.critical { --c: var(--danger); } .issue.warning { --c: var(--warn); } .issue.info { --c: var(--info); }
.issue-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.sev-tag { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.issue h3 { font-size: 17px; font-family: var(--font-head); }
.issue p { font-size: 14px; margin-bottom: 12px; }
.cells { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cell-link { font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 3px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-2); border: 1px solid rgba(246,111,20,.25); }
.cell-link:hover { background: rgba(246,111,20,.25); color: #fff; }
.cells .more { font-size: 13px; color: var(--muted); }
.issue-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .big { font-size: 46px; margin-bottom: 10px; }
.empty-state h3 { font-size: 22px; margin-bottom: 8px; }

/* ---------- Статистика ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.stat-col { padding: 20px; display: flex; flex-direction: column; }
.stat-col header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.stat-col h3 { font-size: 17px; word-break: break-word; }
.stat-col .letter { font-family: ui-monospace, Consolas, monospace; color: var(--muted-2); font-size: 12px; margin-right: 6px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; margin: 0 0 16px; }
.metrics div { min-width: 0; }
.metrics dt { font-size: 12px; color: var(--muted); }
.metrics dd { margin: 2px 0 0; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-box { position: relative; height: 190px; margin-top: auto; }
.chart-note { font-size: 13px; color: var(--muted); margin-top: auto; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.03); text-align: center; }
@media (max-width: 400px) { .stats-grid { grid-template-columns: 1fr; } }

/* ---------- Данные ---------- */
.data-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.data-tools .input { min-width: 220px; flex: 1; max-width: 360px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #ccc; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.data-info { margin-left: auto; font-size: 13px; color: var(--muted); }
.table-wrap { border: 1px solid var(--border); border-radius: 16px; overflow: auto; max-height: 68vh; background: rgba(255,255,255,.015); }
table.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
table.grid th, table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--border); border-right: 1px solid rgba(255,255,255,.04); white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
table.grid thead th { position: sticky; top: 0; z-index: 2; background: #0e1320; font-weight: 500; color: #fff; cursor: pointer; user-select: none; }
table.grid thead th .l { display: block; font-size: 11px; color: var(--muted-2); font-family: ui-monospace, Consolas, monospace; font-weight: 400; }
table.grid thead th .arrow { color: var(--accent-2); margin-left: 4px; }
table.grid th.rn, table.grid td.rn { position: sticky; left: 0; z-index: 1; background: #0e1320; color: var(--muted-2); text-align: right; font-family: ui-monospace, Consolas, monospace; font-size: 12px; min-width: 52px; cursor: default; }
table.grid thead th.rn { z-index: 3; }
table.grid tbody td.rn { background: #0e1320 !important; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tbody tr:hover td { background: rgba(255,255,255,.025); }
table.grid td.c-critical { background: rgba(255, 90, 90, .16); box-shadow: inset 0 0 0 1px rgba(255,90,90,.45); }
table.grid td.c-warning { background: rgba(255, 181, 71, .13); box-shadow: inset 0 0 0 1px rgba(255,181,71,.38); }
table.grid td.c-info { background: rgba(108, 180, 255, .1); }
table.grid tr.r-critical td { background: rgba(255, 90, 90, .09); }
table.grid tr.r-warning td, table.grid tr.r-info td { background: rgba(108, 180, 255, .06); }
table.grid tr.r-critical td.rn { color: var(--danger); }
table.grid th.h-warning, table.grid th.h-critical { box-shadow: inset 0 -2px 0 var(--warn); }
table.grid td.empty-cell { color: var(--muted-2); }
table.grid td.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: inset 0 0 0 2px var(--accent), 0 0 18px var(--accent); background: rgba(246,111,20,.35); } }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }

/* ---------- Утилиты ---------- */
.tools-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.fix-list { display: grid; gap: 10px; }
.fix { display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; cursor: pointer; transition: border-color .2s; }
.fix:hover { border-color: var(--border-strong); }
.fix.on { border-color: rgba(246,111,20,.6); background: linear-gradient(180deg, rgba(246,111,20,.08), rgba(246,111,20,.02)); }
.fix.disabled { opacity: .5; cursor: default; }
.fix input { margin-top: 3px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.fix h4 { font-size: 16px; margin-bottom: 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fix p { font-size: 14px; }
.fix .count { font-size: 12px; font-family: var(--font-body); font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); }
.fix .count.zero { background: rgba(255,255,255,.06); color: var(--muted); }
.tools-side { padding: 22px; position: sticky; top: 90px; }
.tools-side .btn { width: 100%; margin-bottom: 10px; white-space: normal; }
.tools-side .hint { font-size: 12px; color: var(--muted-2); margin: -4px 0 12px; }
.history { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; font-size: 13px; color: #ccc; border-top: 1px solid var(--border); padding-top: 16px; }
.history li { display: flex; gap: 8px; } .history li::before { content: "✓"; color: var(--ok); }
@media (max-width: 920px) { .tools-grid { grid-template-columns: 1fr; } .tools-side { position: static; } }

/* ---------- Выгрузка ---------- */
.export-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.export-card { padding: 26px; display: flex; flex-direction: column; gap: 10px; }
.export-card .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); border: 1px solid rgba(246,111,20,.35); margin-bottom: 6px; }
.export-card .ico svg { width: 22px; height: 22px; }
.export-card h3 { font-size: 19px; }
.export-card p { font-size: 14px; flex: 1; }
.export-card .btn { align-self: flex-start; margin-top: 8px; }
.note { font-size: 13px; color: var(--muted); margin-top: 18px; }
@media (max-width: 760px) { .export-grid { grid-template-columns: 1fr; } }

/* ---------- Уведомления ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; max-width: min(400px, calc(100vw - 32px)); }
.toast { padding: 14px 18px; border-radius: 14px; background: #121826; border: 1px solid var(--border-strong); box-shadow: 0 20px 50px rgba(0,0,0,.5); font-size: 14px; color: #eee; border-left: 3px solid var(--c, var(--accent)); animation: toastIn .3s ease; }
.toast.error { --c: var(--danger); } .toast.ok { --c: var(--ok); } .toast.warn { --c: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 600px) { .toasts { right: 16px; left: 16px; bottom: 16px; } }

/* ---------- Печать отчёта ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; }
  .nav, .tabs, .res-actions, .upload, .toasts, .app-bg, .loading, .issue-actions, .cells, .filters, footer { display: none !important; }
  .print-only { display: block; }
  .card { background: #fff !important; border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; }
  .card::before { display: none !important; }
  p, .insights li, .cols-table td, .res-meta, .chip { color: #222 !important; }
  .grad-text { color: #000 !important; background: none !important; -webkit-text-fill-color: #000; }
  .tab-panel { display: none !important; }
  .tab-panel[data-panel="overview"], .tab-panel[data-panel="issues"] { display: block !important; margin-bottom: 24px; }
  .ov-score .ring::before { background: #fff; }
  .kpi .v { color: #000 !important; }
  .ov-grid { grid-template-columns: 220px 1fr; }
}
