/* Графики помощника и страница «Дашборды»: карточки объёмные (неоморфизм), кнопки с крупными иконками. */
html body .fin-chart { display:flex; flex-direction:column; margin:0; padding:20px 24px 22px; border-radius:18px; box-sizing:border-box; width:100%; min-width:0;
  border:1px solid color-mix(in srgb,var(--neo-light-shadow) 42%,var(--line)); background:var(--neo-raised);
  box-shadow:4px 4px 10px var(--neo-dark-shadow),-3px -3px 8px var(--neo-light-shadow),inset 1px 1px 0 color-mix(in srgb,var(--neo-light-shadow) 55%,transparent); }
.fin-chart-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin:0 0 18px; }
.fin-chart-head h4 { margin:0; font-size:19px; line-height:1.25; }
.fin-chart-head small { display:block; margin-top:4px; color:var(--muted); font-size:14px; }
.fin-chart-actions { display:flex; align-items:center; gap:10px; flex:0 0 auto; }
.fin-chart-wrap { position:relative; flex:1 1 auto; min-height:340px; height:340px; }
.fin-chart-wrap > canvas { position:absolute; left:0; top:0; }
.fin-chart-error { margin:0; color:var(--red); font-weight:650; }
html body button.fin-chart-pin { display:inline-flex; align-items:center; gap:9px; padding:9px 16px; font-size:15px; font-weight:700; }
.fin-chart-pin svg { flex:0 0 auto; width:20px; height:20px; }
html body button.fin-chart-pin.is-saved { color:#3bbd84; opacity:.9; cursor:default; }
.fin-dash-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(520px,1fr)); gap:24px; margin-top:24px; }
html body .fin-dash-empty { display:grid; gap:6px; margin:24px 0 0; padding:22px 26px; border-radius:18px; text-align:left;
  border:1px solid color-mix(in srgb,var(--neo-light-shadow) 42%,var(--line)); background:var(--neo-raised);
  box-shadow:4px 4px 10px var(--neo-dark-shadow),-3px -3px 8px var(--neo-light-shadow),inset 1px 1px 0 color-mix(in srgb,var(--neo-light-shadow) 55%,transparent); }
.fin-dash-empty b { font-size:18px; }
.fin-dash-empty span { color:var(--muted); font-size:16px; }
.fin-dash-heading { margin:32px 0 0; font-size:20px; }
.fin-dash-heading-first { margin-top:24px; }
.fin-dash-heading + .fin-dash-grid { margin-top:24px; }
.fin-link-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
@media (max-width:1180px) { .fin-link-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:760px) { .fin-link-grid { grid-template-columns:1fr; } }
.fin-link-foot { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:auto; }
html body .fin-link .fin-link-foot .fin-link-open { margin-top:0; }
html body .fin-link { gap:18px; padding-bottom:18px; }
html body .fin-link .fin-chart-head { margin:0; }
html body .fin-link { display:flex; flex-direction:column; justify-content:space-between; gap:28px; }
html body .fin-link .fin-link-open { align-self:flex-start; text-decoration:none; }
.fin-dash-error { margin:12px 0 0; color:var(--red); font-weight:600; }
.fin-dash-error[hidden] { display:none; }
.assistant-msg.bot .fin-chart { max-width:980px; }
@media (max-width:860px) { .fin-dash-grid { grid-template-columns:1fr; } .fin-chart-wrap { height:280px; } }
html body a.fin-link-open { display:inline-flex; align-items:center; gap:10px; margin-top:8px; padding:11px 20px; border-radius:12px; font-size:16px; font-weight:700; color:var(--blue); cursor:pointer;
  border:1px solid color-mix(in srgb,var(--neo-light-shadow) 42%,var(--line)); background:var(--neo-raised);
  box-shadow:4px 4px 10px var(--neo-dark-shadow),-3px -3px 8px var(--neo-light-shadow),inset 1px 1px 0 color-mix(in srgb,var(--neo-light-shadow) 55%,transparent); transition:transform .15s ease,box-shadow .15s ease; }
html body a.fin-link-open:hover { transform:translateY(-2px); }
.fin-link-open svg { flex:0 0 auto; width:22px; height:22px; }

/* Помощь родным: плитки итогов, график и таблица по каждому человеку */
.fh-sub { margin:0 0 4px; font-size:17px; }
.fh-sub b { color:var(--ink); }
.fh-kpis { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; margin:24px 0 24px; }
.fh-head-actions { display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
html body .fh-kpi { display:grid; gap:8px; padding:20px 24px; border-radius:18px;
  border:1px solid color-mix(in srgb,var(--neo-light-shadow) 42%,var(--line)); background:var(--neo-raised);
  box-shadow:4px 4px 10px var(--neo-dark-shadow),-3px -3px 8px var(--neo-light-shadow),inset 1px 1px 0 color-mix(in srgb,var(--neo-light-shadow) 55%,transparent); }
.fh-kpi-label { color:var(--muted); font-size:15px; font-weight:700; }
.fh-kpi-big { font-size:30px; line-height:1.1; font-variant-numeric:tabular-nums; }
.fh-kpi-row { display:flex; justify-content:space-between; gap:12px; font-size:16px; font-weight:650; font-variant-numeric:tabular-nums; }
.fh-kpi-row span:first-child { color:var(--muted); font-weight:600; }
html body .fh-page .fh-person { margin:24px 0 0; }
.fh-grid { display:grid; grid-template-columns:minmax(0,1fr) 540px; gap:24px; align-items:start; margin-top:20px; }
.fh-chart h4 { margin:0; font-size:18px; }
.fh-chart small { display:block; margin:4px 0 14px; color:var(--muted); font-size:14px; }
.fh-chart-wrap { position:relative; height:320px; }
.fh-table-wrap { overflow-x:auto; border-radius:12px; border:1px solid var(--line); }
.fh-table { width:100%; border-collapse:collapse; font-size:16px; font-variant-numeric:tabular-nums; }
.fh-table th,.fh-table td { padding:10px 14px; text-align:left; border-bottom:1px solid color-mix(in srgb,var(--line) 70%,transparent); white-space:nowrap; }
.fh-table th { color:var(--muted); font-size:14px; font-weight:700; background:color-mix(in srgb,var(--ink) 5%,transparent); }
.fh-table .num { text-align:right; }
.fh-table tbody tr:hover { background:color-mix(in srgb,var(--ink) 4%,transparent); }
.fh-table tfoot td { border-bottom:0; font-weight:800; background:color-mix(in srgb,var(--ink) 5%,transparent); }
.fh-note { margin:24px 0 0; color:var(--muted); font-size:15px; line-height:1.5; }
@media (max-width:1280px) { .fh-grid { grid-template-columns:1fr; } }
@media (max-width:860px) { .fh-kpis { grid-template-columns:1fr; } }

/* Счётчик расходов помощника */
.assistant-spend { display:flex; flex-wrap:wrap; align-items:center; gap:12px 28px; margin:24px 0 0; padding:14px 22px; border-radius:16px;
  border:1px solid color-mix(in srgb,var(--neo-light-shadow) 42%,var(--line)); background:var(--neo-raised);
  box-shadow:4px 4px 10px var(--neo-dark-shadow),-3px -3px 8px var(--neo-light-shadow),inset 1px 1px 0 color-mix(in srgb,var(--neo-light-shadow) 55%,transparent); }
.assistant-spend-item { display:grid; gap:2px; }
.assistant-spend-item small { color:var(--muted); font-size:13px; font-weight:650; }
.assistant-spend-item b { font-size:19px; font-variant-numeric:tabular-nums; }
.assistant-spend-limit { flex:0 1 auto; display:grid; gap:7px; min-width:200px; }
.assistant-spend-limit:has(.assistant-spend-bar) { flex:1 1 260px; }
.assistant-spend-limit small { color:var(--muted); font-size:13px; font-weight:650; }
.assistant-spend-bar { height:10px; border-radius:6px; overflow:hidden; background:var(--neo-surface); box-shadow:inset 2px 2px 4px var(--neo-inset-dark),inset -2px -2px 4px var(--neo-inset-light); }
.assistant-spend-bar span { display:block; height:100%; border-radius:6px; background:#3fa972; transition:width .3s ease; }
.assistant-spend-bar span.warn { background:#f0a35b; } .assistant-spend-bar span.over { background:#e2604a; }
html body button.assistant-spend-edit { display:inline-flex; align-items:center; gap:9px; padding:9px 16px; font-size:15px; font-weight:700; }
.assistant-spend-limit:has(.assistant-spend-bar) + .assistant-spend-edit { margin-left:0; }
.assistant-spend-edit svg { flex:0 0 auto; width:20px; height:20px; }

/* Дашборд из нескольких блоков: плитки итогов, графики и таблицы в сетке */
.fin-board { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; margin-top:24px; }
.fin-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:16px; }
/* Плитки итогов выпуклые и раскрашены по кругу — как плитки в «Сводке» автомобиля.
   Так выглядят и KPI-блоки дашбордов, и итоги в «Подписках». */
html body .fin-tile { display:grid; gap:6px; padding:16px 20px; border-radius:16px;
  border:1px solid color-mix(in srgb,var(--neo-light-shadow) 42%,var(--line));
  box-shadow:4px 4px 9px var(--neo-dark-shadow),-3px -3px 7px var(--neo-light-shadow),inset 1px 1px 0 color-mix(in srgb,var(--neo-light-shadow) 48%,transparent); }
html body .fin-tile:nth-child(4n+1) { background:#e7f2fb; border-color:#a6cbe7; }
html body .fin-tile:nth-child(4n+2) { background:#e7f5ed; border-color:#a7d4b8; }
html body .fin-tile:nth-child(4n+3) { background:#fbf0df; border-color:#e5c58f; }
html body .fin-tile:nth-child(4n) { background:#efe9f7; border-color:#c9b8df; }
html body .fin-tile:nth-child(4n+1) b:not(.red-text):not(.green-text) { color:#246b9c; }
html body .fin-tile:nth-child(4n+2) b:not(.red-text):not(.green-text) { color:#287454; }
html body .fin-tile:nth-child(4n+3) b:not(.red-text):not(.green-text) { color:#9a6421; }
html body .fin-tile:nth-child(4n) b:not(.red-text):not(.green-text) { color:#6d518d; }
html[data-theme="dark"] body .fin-tile:nth-child(4n+1) { background:#263e52; border-color:#416784; }
html[data-theme="dark"] body .fin-tile:nth-child(4n+2) { background:#29483c; border-color:#477b65; }
html[data-theme="dark"] body .fin-tile:nth-child(4n+3) { background:#51432c; border-color:#82683f; }
html[data-theme="dark"] body .fin-tile:nth-child(4n) { background:#41384f; border-color:#6d5d82; }
html[data-theme="dark"] body .fin-tile:nth-child(4n+1) b:not(.red-text):not(.green-text) { color:#9bcef0; }
html[data-theme="dark"] body .fin-tile:nth-child(4n+2) b:not(.red-text):not(.green-text) { color:#9bd7b7; }
html[data-theme="dark"] body .fin-tile:nth-child(4n+3) b:not(.red-text):not(.green-text) { color:#f0c985; }
html[data-theme="dark"] body .fin-tile:nth-child(4n) b:not(.red-text):not(.green-text) { color:#d4bced; }
.fin-tile span { color:var(--muted); font-size:14px; font-weight:700; }
.fin-tile b { font-size:22px; line-height:1.15; font-variant-numeric:tabular-nums; }
.fin-board .fh-table-wrap { overflow:visible; border:0; }
.fin-board .fh-table { font-size:15px; }
.fin-board .fh-table th,.fin-board .fh-table td { padding:9px 10px; white-space:normal; }
.fin-board .fh-table td.num { white-space:nowrap; }
.fin-board > .fin-chart.fin-wide { grid-column:1 / -1; }
.fin-board-preview { width:100%; display:grid; gap:16px; }
.fin-board-head { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.fin-board-head h4 { margin:0; font-size:20px; }
.fin-board-head small { color:var(--muted); font-size:14px; }
.fin-board-preview .fin-board { margin-top:0; }
.fin-chart-actions .row-action { display:inline-grid; place-items:center; width:36px; height:36px; padding:0; }
@media (max-width:1100px) { .fin-board { grid-template-columns:1fr; } }

/* Перетаскивание блоков в режиме правки */
.fin-board.is-editing > .fin-chart { cursor:grab; transition:opacity .15s ease,transform .15s ease,outline-color .15s ease; outline:2px solid transparent; outline-offset:5px; }
.fin-board.is-editing > .fin-chart:active { cursor:grabbing; }
.fin-board.is-editing > .fin-chart.is-dragging { opacity:.45; }
.fin-board.is-editing > .fin-chart.is-drop { outline-color:var(--blue); transform:scale(.99); }
.fin-grip { display:inline-grid; place-items:center; width:30px; height:36px; color:var(--muted); }

/* Уточнение сохранённого дашборда в чате */
html body .assistant-refine { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; margin:24px 0 0; padding:14px 22px; border-radius:16px; font-size:16px;
  border:1px solid color-mix(in srgb,var(--blue) 40%,var(--line)); background:color-mix(in srgb,var(--blue) 14%,var(--neo-raised));
  box-shadow:4px 4px 10px var(--neo-dark-shadow),-3px -3px 8px var(--neo-light-shadow); }
.assistant-refine + .assistant-spend,#assistantRefine:not(:empty) + .assistant-spend { margin-top:16px; }
html body .fin-board-head .fin-chart-pin { white-space:nowrap; }
.fin-board-head { gap:12px; }

/* Иерархия категорий: двойное кольцо и легенда-таблица с суммами */
.fin-chart-wrap.is-tree { height:300px; }
.fin-ring { display:grid; grid-template-columns:minmax(0,1fr); gap:18px; min-width:0; }
html body .fin-ring .fin-ring-wrap { width:100%; max-width:380px; min-width:0; margin:0 auto; }
.fin-ring-wrap canvas { max-width:100%; }
.fin-ring .cat-ring-icon { display:grid; place-items:center; width:30px; height:30px; line-height:0; }
.fin-ring .cat-ring-icon svg { display:block; width:28px; height:28px; stroke-width:2.2; }
.fin-tree { border-radius:12px; border:1px solid var(--line); font-variant-numeric:tabular-nums; }
.fin-tree-head,.fin-tree-row { display:grid; grid-template-columns:minmax(0,1fr) 120px 64px; gap:12px; align-items:center; padding:8px 16px; }
.fin-tree-head { color:var(--muted); font-size:14px; font-weight:700; background:var(--neo-raised); border-bottom:1px solid var(--line); }
.fin-tree-head > span:not(:first-child),.fin-tree-row > span:not(:first-child) { text-align:right; white-space:nowrap; }
.fin-tree-row { font-size:15px; border-bottom:1px solid color-mix(in srgb,var(--line) 60%,transparent); }
.fin-tree-row > span:first-child { display:flex; align-items:center; gap:10px; min-width:0; overflow-wrap:anywhere; }
html body .fin-tree .fin-cat-icon { flex:0 0 auto; width:32px; height:32px; border-radius:10px; display:inline-grid; place-items:center; color:#fff; font-size:15px; font-weight:800; }
html body .fin-tree .fin-cat-icon svg { width:23px; height:23px; stroke-width:2; }
.fin-tree-row.is-clickable { cursor:pointer; }
.fin-tree-row.is-clickable:hover { background:color-mix(in srgb,var(--ink) 8%,transparent); }
.fin-tree .cat-back-button { width:calc(100% - 28px); margin:12px 14px; }
.fin-tree-row.is-parent { font-weight:750; background:color-mix(in srgb,var(--ink) 4%,transparent); }
.fin-tree-row.is-child { color:var(--muted); font-weight:600; }
.fin-tree-row.is-child > span:first-child { padding-left:22px; }
.fin-tree-row.is-total { font-weight:800; border-bottom:0; }
.fh-table .fh-parent td { font-weight:750; background:color-mix(in srgb,var(--ink) 4%,transparent); }
.fh-table .fh-child { padding-left:30px; color:var(--muted); }

.fin-tree-row.is-hovered { background:color-mix(in srgb,var(--ink) 9%,transparent); }


/* Кликабельные таблицы и легенды: открывают операции с теми же фильтрами */
.fh-table tr.is-drill > td,.fh-table.is-interactive td.num { cursor:pointer; }
.fh-table.is-interactive tbody tr:hover > td,.fh-table tr.is-drill:hover > td { background:color-mix(in srgb,var(--ink) 6%,transparent); }
.fh-table.is-interactive tbody td.num:hover { background:color-mix(in srgb,var(--blue) 18%,transparent)!important; }

/* Отчёт «Помощь родным»: клик по плиткам и ячейкам открывает операции */
.fh-kpi .is-drill { cursor:pointer; transition:opacity .15s ease; }
.fh-kpi .is-drill:hover { opacity:.7; }
.fh-table.is-interactive tfoot td { cursor:pointer; }
.fh-table.is-interactive tfoot tr:hover > td { background:color-mix(in srgb,var(--ink) 9%,transparent); }

/* Ход работы помощника: пройденные шаги и текущий */
.assistant-steps { display:grid; gap:10px; min-width:280px; }
.assistant-steps > div { display:flex; align-items:center; gap:10px; font-weight:650; }
.assistant-steps .is-done { color:var(--muted); }
.assistant-steps .is-done svg { flex:0 0 auto; color:#3bbd84; }
.assistant-steps .assistant-thinking { color:var(--ink); }

/* Заправки: окна выбора года и сети, график и таблица на всю ширину, логотипы сетей */
.fin-board > .fin-chart.fin-fuel { grid-column:1 / -1; }
.fin-chart-actions { flex-wrap:wrap; justify-content:flex-end; }
.fin-pick { display:inline-flex; margin:0; }
.fin-fuel.is-loading .fin-chart-wrap,.fin-fuel.is-loading .fin-fuel-body { opacity:.45; transition:opacity .15s ease; }
html body .fin-fuel .fin-station .tx-account-icon,html body .fin-fuel .fin-station .fin-logo-gap { flex:0 0 auto; width:30px; height:30px; }
html body .fin-fuel-table td,html body .fin-fuel-table th { vertical-align:middle; }

/* Окно записей по заправкам и расходам на автомобиль */
.vehicle-drill-body .fuel-summary { margin:24px 0; }
.vehicle-drill-body .fuel-summary + .table-wrap { margin-top:0; }
.vehicle-drill-heading { margin:28px 0 0; font-size:19px; }
.vehicle-drill-heading:first-child { margin-top:24px; }
