/* New day — під логотип (рішення власника 2026-11-09): темна тема «Термінал» (#0b0e14, помаранчевий акцент), світла — Electric Blue (#0297de) —
   акценти, обводки, ефекти; помаранчевий (#f97316, сонце з логотипа) — головний заклик. Світла тема — за вибором.
   Заголовки Inter Tight, текст і цифри Inter; анімації — лише поява. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/inter-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter Tight'; font-style: normal; font-weight: 600 700; font-display: swap; src: url(fonts/inter-tight-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter Tight'; font-style: normal; font-weight: 600 700; font-display: swap; src: url(fonts/inter-tight-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f5f7fb;
  --bg-soft: rgba(10, 20, 48, .05);
  --card: #ffffff;
  --text: #0a1430;
  --muted: #4f5d7e;
  --line: rgba(10, 20, 48, .1);
  --line-strong: rgba(10, 20, 48, .2);
  --accent: #0287c9;
  --accent-hover: #0297de;
  --accent-pressed: #026fa6;
  --accent-text: #ffffff;
  --accent-soft: rgba(2, 151, 222, .1);
  --focus-ring: rgba(2, 151, 222, .25);
  --ink: #0a1430;
  --ink-text: #ffffff;
  --cta: #f97316;
  --cta-hover: #fb8534;
  --cta-text: #0a1430;
  --logo-ink: #0f1e45;
  --up: #12994a;
  --up-soft: rgba(18, 153, 74, .1);
  --down: #e5484d;
  --down-soft: rgba(229, 72, 77, .1);
  --flat: #8a94ad;
  --c1: #0297de; --c2: #f97316; --c3: #14b8a6; --c4: #ec4899; --c5: #8b5cf6; --c6: #f59e0b; --c7: #84cc16; --c8: #a3acc2;
  --flat-soft: rgba(10, 20, 48, .05);
  --shadow: 0 1px 2px rgba(10, 20, 48, .04), 0 10px 30px -18px rgba(10, 20, 48, .18);
  --bar-shadow: 0 1px 2px rgba(10, 20, 48, .05), 0 12px 32px -12px rgba(10, 20, 48, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --display: "Inter Tight", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --nav-h: 64px;
  color-scheme: light;
}

[data-theme="dark"] {
  /* «Термінал» (рішення власника 2026-11-10): майже чорний фон, графітові блоки, помаранчевий акцент */
  --bg: #0b0e14;
  --bg-soft: rgba(255, 255, 255, .05);
  --card: #141922;
  --text: #e6e1cf;
  --muted: #8a8f98;
  --line: #273042;
  --line-strong: #364258;
  --accent: #f97316;
  --accent-hover: #fb8534;
  --accent-pressed: #ea580c;
  --accent-text: #0b0e14;
  --accent-soft: rgba(249, 115, 22, .15);
  --focus-ring: rgba(249, 115, 22, .38);
  --ink: #e6e1cf;
  --ink-text: #0b0e14;
  --cta: #f97316;
  --cta-hover: #fb8534;
  --cta-text: #0b0e14;
  --logo-ink: #ffffff;
  --up: #34d399;
  --up-soft: rgba(52, 211, 153, .13);
  --down: #ff6b6f;
  --down-soft: rgba(255, 107, 111, .13);
  --flat: #8a8f98;
  --c1: #0297de; --c2: #f97316; --c3: #2dd4bf; --c4: #f472b6; --c5: #a78bfa; --c6: #fbbf24; --c7: #a3e635; --c8: #b3bdd6;
  --flat-soft: rgba(255, 255, 255, .04);
  --shadow: none;
  --bar-shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 12px 32px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* Палітри на вибір (рішення власника 2026-11-10); «Термінал» — основна, вище. Лише кольори. */
[data-theme="dark"][data-palette="tradingview"] {
  --bg: #131722; --bg-soft: rgba(255, 255, 255, .05); --card: #1e222d; --text: #d1d4dc; --muted: #787b86;
  --line: #2a2e39; --line-strong: #363a45; --accent: #2962ff; --accent-hover: #3d72ff; --accent-pressed: #1e53e5;
  --accent-text: #ffffff; --accent-soft: rgba(41, 98, 255, .18); --focus-ring: rgba(41, 98, 255, .4);
  --ink: #d1d4dc; --ink-text: #131722; --up: #26a69a; --up-soft: rgba(38, 166, 154, .15); --down: #ef5350;
  --down-soft: rgba(239, 83, 80, .15); --flat: #787b86; --c1: #2962ff;
}
[data-theme="dark"][data-palette="slate"] {
  --bg: #020617; --bg-soft: rgba(148, 163, 184, .08); --card: #0f172a; --text: #e2e8f0; --muted: #94a3b8;
  --line: #1e293b; --line-strong: #334155; --accent: #0297de; --accent-hover: #19a8ee; --accent-pressed: #0280bd;
  --accent-text: #ffffff; --accent-soft: rgba(2, 151, 222, .15); --focus-ring: rgba(2, 151, 222, .38);
  --ink: #e2e8f0; --ink-text: #020617; --flat: #94a3b8; --flat-soft: rgba(148, 163, 184, .06);
}
[data-theme="dark"][data-palette="linear"] {
  --bg: #08090a; --bg-soft: rgba(255, 255, 255, .05); --card: #141516; --text: #f7f8f8; --muted: #8a8f98;
  --line: #23252a; --line-strong: #34363c; --accent: #5e6ad2; --accent-hover: #6e7ae0; --accent-pressed: #4c58c0;
  --accent-text: #ffffff; --accent-soft: rgba(94, 106, 210, .18); --focus-ring: rgba(94, 106, 210, .4);
  --ink: #f7f8f8; --ink-text: #08090a; --up: #4cb782; --up-soft: rgba(76, 183, 130, .14); --flat: #8a8f98; --c1: #5e6ad2;
}

/* Світла тема: фон світлий, палітра міняє акцент (кнопки, вкладки, обводки) і кольори графіків; Slate — як :root */
[data-theme="light"][data-palette="terminal"] {
  --accent: #ea580c; --accent-hover: #f97316; --accent-pressed: #c2410c; --accent-text: #ffffff;
  --accent-soft: rgba(249, 115, 22, .1); --focus-ring: rgba(249, 115, 22, .25);
}
[data-theme="light"][data-palette="tradingview"] {
  --accent: #2962ff; --accent-hover: #3d72ff; --accent-pressed: #1e53e5; --accent-text: #ffffff;
  --accent-soft: rgba(41, 98, 255, .1); --focus-ring: rgba(41, 98, 255, .25);
  --up: #089981; --up-soft: rgba(8, 153, 129, .1); --down: #f23645; --down-soft: rgba(242, 54, 69, .1); --c1: #2962ff;
}
[data-theme="light"][data-palette="linear"] {
  --accent: #5e6ad2; --accent-hover: #6e7ae0; --accent-pressed: #4c58c0; --accent-text: #ffffff;
  --accent-soft: rgba(94, 106, 210, .1); --focus-ring: rgba(94, 106, 210, .25);
  --up: #2f9e6a; --up-soft: rgba(47, 158, 106, .1); --c1: #5e6ad2;
}

/* Вибір палітри в Налаштуваннях */
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.palette { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: none; color: var(--text); cursor: pointer; text-align: left; font: inherit; font-weight: 600; font-size: 14px; }
.palette:hover { border-color: var(--line-strong); }
.palette[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.palette-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 8px; border-radius: 8px; height: 64px; }
.palette-preview i { border-radius: 5px; }
.palette-preview i:last-child { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; padding: 0 6px; }
.palette-preview b { width: 26px; height: 8px; border-radius: 99px; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 500 16px/1.5 var(--font); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, .kpi-value, .brand { font-family: var(--display); }
h1 { font-size: 30px; line-height: 1.15; margin: 0; letter-spacing: -.025em; font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 650; }
p { margin: 0 0 10px; }
code { font-family: var(--mono); font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.pre, .notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.notes.clamp { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.collapsible { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.collapsible .notes { margin: 0; }
.expand-btn { align-self: center; width: 36px; height: 28px; display: grid; place-items: center; border-radius: 99px;
  border: 1px solid var(--line-strong); background: var(--bg-soft); color: var(--muted); cursor: pointer; }
.expand-btn:hover { color: var(--text); }
.expand-btn .icon { transition: transform .2s ease; }
.expand-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
[hidden] { display: none !important; }

/* ---------- каркас ---------- */
#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.content { flex: 1; min-width: 0; }
main#main { max-width: 1480px; margin: 0 auto; padding: 30px 40px 56px; outline: none; }
.page { display: flex; flex-direction: column; gap: 18px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Верхня панель на ПК: плаває над сторінкою — логотип у колі й розділи в заокругленій «пігулці» (колір картки теми) */
.topbar { position: sticky; top: 0; z-index: 30; padding-top: 14px; pointer-events: none; }
.topbar-in { max-width: 1480px; margin: 0 auto; padding: 0 40px; height: 56px; display: flex; align-items: center; gap: 12px; }
.topbar-in > * { pointer-events: auto; }
.brand-dot, .topnav, .top-actions .icon-btn { background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line);
  box-shadow: var(--bar-shadow); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.brand-dot { width: 54px; height: 54px; border-radius: 50%; justify-content: center; flex: none; }
.brand-dot.brand-dot { background: #fff; border-color: rgba(10, 20, 48, .1); --logo-ink: #0f1e45; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand.center { justify-content: center; flex-direction: column; gap: 6px; padding: 0 0 8px; }
.topnav { display: flex; align-items: center; gap: 4px; height: 54px; padding: 0 12px; border-radius: 99px; }
.topnav .nav-item { position: relative; padding: 8px 20px; border-radius: 99px; color: var(--muted); font-weight: 550; font-size: 15px; transition: color .15s; }
.topnav .nav-item:hover { color: var(--text); }
.topnav .nav-item.active { color: var(--accent); font-weight: 650; }
/* три крапки під активним розділом: розкриваються з центру, потім ледь помітно «дихають» */
.topnav .nav-item.active::after { content: ''; position: absolute; left: 50%; bottom: 1px; width: 15px; height: 4px; transform: translateX(-50%);
  background: radial-gradient(circle, currentColor 1.6px, transparent 1.9px) 0 0 / 5px 4px repeat-x;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent) 70%, transparent));
  animation: nav-dots-in .35s cubic-bezier(.2, .9, .3, 1.3), nav-dots-breathe 2.6s ease-in-out .35s infinite; }
@keyframes nav-dots-in { from { transform: translateX(-50%) scaleX(0); opacity: 0; } }
@keyframes nav-dots-breathe { 50% { opacity: .55; } }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.btn.pill { border-radius: 99px; height: 38px; padding: 0 18px 0 14px; }
.top-actions .icon-btn { color: var(--muted); border-radius: 50%; width: 46px; height: 46px; display: grid; place-items: center; }
.top-actions .btn.pill { height: 46px; box-shadow: var(--bar-shadow); }
.top-actions .icon-btn:hover, .top-actions .icon-btn.active { color: var(--text); background: var(--bg-soft); }

.bottombar { display: none; }

/* ---------- заголовки сторінок ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; }
.section-title { margin-top: 8px; }

/* ---------- кнопки й поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--card); cursor: pointer; font-weight: 550; white-space: nowrap;
  transition: background .12s, opacity .12s, box-shadow .12s, transform .12s; }
.btn:hover { background: var(--bg-soft); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); box-shadow: 0 6px 16px -8px var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active { background: var(--accent-pressed); border-color: var(--accent-pressed); transform: translateY(1px); }
/* головна дія темним (як заклик на лендингу) */
.btn.dark { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.btn.dark:hover { opacity: .9; background: var(--ink); }
.btn.cta { background: var(--cta); color: var(--cta-text); border-color: var(--cta); box-shadow: 0 8px 22px -10px var(--cta); }
.btn.cta:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-soft); }
.btn.danger, .btn.ghost.danger { color: var(--down); }
.btn.danger:not(.ghost) { background: var(--down); color: #fff; border-color: var(--down); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%;
  border-color: var(--muted) transparent var(--muted) transparent; animation: spin .7s linear infinite; }
.btn.primary.loading::after { border-color: var(--accent-text) transparent var(--accent-text) transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; cursor: pointer; color: var(--text); flex: none; }
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; background: none; border: 0;
  padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.link:hover { text-decoration-color: currentColor; }

input, select, textarea { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--card); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 .25rem var(--focus-ring); }
textarea { resize: vertical; line-height: 1.5; }
input[type="file"] { padding: 7px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.row .field { min-width: 140px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-tight { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.segmented { display: inline-flex; background: var(--bg-soft); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 550; font-size: 14px; }
.segmented button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(10, 20, 48, .12); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 99px; background: var(--bg-soft); border: 1px solid var(--line);
  font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--line-strong); }
.chips.small .chip { font-size: 12px; padding: 2px 9px; }

/* ---------- картки ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.grid-cards.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

/* ---------- статистика ---------- */
.period-bar { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-soft); border-radius: 12px; padding: 3px; }
.period-label { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--card); height: 34px; padding: 0 14px; border-radius: 9px;
  font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(10, 20, 48, .1); min-width: 150px; justify-content: center; }
.period-bar .icon-btn { width: 34px; height: 34px; }
.period-pick { display: flex; flex-direction: column; gap: 14px; }
.period-pick .row input { flex: 1; min-width: 130px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi.up .kpi-value { color: var(--up); }
.kpi.down .kpi-value { color: var(--down); }
.kpi-sub { font-size: 12px; color: var(--muted); }

/* Головна: короткий звіт */
.home-date { margin: 4px 0 0; }
.home-date::first-letter { text-transform: uppercase; }
a.home-kpi { color: inherit; transition: border-color .15s, transform .15s; }
a.home-kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); }
/* Та сама сітка, що й плитки: крива — на три плитки, останні угоди — на одну; обидва блоки однакової висоти */
.home-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.home-chart { grid-column: span 3; display: flex; flex-direction: column; }
.home-chart .chart.fit { flex: 1; min-height: 260px; }
.chart.fit .chart-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.home-recent { display: flex; flex-direction: column; }
.home-recent .chart-foot { margin-top: auto; padding-top: 8px; }
.home-trades { display: flex; flex-direction: column; }
.home-trade { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 8px; margin: 0 -8px;
  border-radius: var(--radius-sm); color: inherit; }
.home-trade + .home-trade { border-top: 1px solid var(--line); }
.home-trade:hover { background: var(--bg-soft); }
.ht-main, .ht-side { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ht-side { align-items: flex-end; flex: none; }
.ht-sym { display: flex; align-items: center; gap: 6px; }
.home-empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 24px; }
.home-empty p { max-width: 460px; margin: 0 0 12px; }

/* ---------- Дашборд ---------- */
.home-settings { display: none; color: var(--muted); flex: none; }
.home-hello { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.home-drafts { display: flex; align-items: center; gap: 10px; color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-weight: 550; }
.home-drafts span { flex: 1; }
.home-drafts:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.dash-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.dash-row.wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-row > .card { display: flex; flex-direction: column; grid-column: auto; }
.dash-row .chart-foot { margin-top: auto; padding-top: 8px; }
/* Розкладка Дашборду: 6 колонок, блок займає 2–6 (налаштовує користувач) */
.dash-board { display: flex; flex-direction: column; gap: 14px; }
.dash-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.dash-block { position: relative; display: flex; flex-direction: column; min-width: 0; }
.dash-block > .card { flex: 1; display: flex; flex-direction: column; }
.dash-block .chart-foot { margin-top: auto; padding-top: 8px; }
.dash-block > .kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.dash-tools, .dash-resize { display: none; }
.dash-grid.editing .dash-block { outline: 2px dashed var(--line-strong); outline-offset: 3px; border-radius: var(--radius); }
.dash-grid.editing .dash-block > :not(.dash-tools):not(.dash-resize) { pointer-events: none; user-select: none; }
.dash-grid.editing .dash-tools { display: flex; gap: 6px; position: absolute; top: 8px; right: 8px; z-index: 3; }
.dash-tool { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--text); cursor: pointer; box-shadow: var(--bar-shadow); }
.dash-tool:hover { border-color: var(--accent); color: var(--accent); }
.dash-grid.editing .dash-block { cursor: grab; -webkit-touch-callout: none; user-select: none; }
.dash-grid.editing .dash-resize { display: block; position: absolute; right: -3px; bottom: -3px; width: 22px; height: 22px; z-index: 3;
  cursor: ew-resize; touch-action: none; border-right: 4px solid var(--accent); border-bottom: 4px solid var(--accent);
  border-bottom-right-radius: 10px; }
/* Місце, куди ляже блок, і сам блок, що «висить» під курсором / пальцем */
.dash-grid.editing .dash-block.placeholder { outline: 2px dashed var(--accent); background: var(--accent-soft); }
.dash-block.placeholder > * { visibility: hidden; }
.dash-block.pressing { transform: scale(.98); transition: transform .2s; }
.dash-ghost { position: fixed; z-index: 1000; pointer-events: none; margin: 0; display: flex; flex-direction: column;
  border-radius: var(--radius); box-shadow: 0 24px 60px rgba(0, 0, 0, .45), 0 0 0 2px var(--accent);
  transition: scale .15s, rotate .15s; scale: 1.03; rotate: 1deg; cursor: grabbing; will-change: transform; }
.dash-ghost > .card { flex: 1; }
.dash-ghost .dash-tools, .dash-ghost .dash-resize { display: none !important; }
body.dash-dragging, body.dash-dragging * { cursor: grabbing !important; user-select: none; }
.dash-block.resizing { outline-color: var(--accent) !important; }
.dash-editbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px;
  border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent); position: sticky; top: 84px; z-index: 5; backdrop-filter: blur(8px); }
.dash-editbar[hidden], .dash-tray[hidden] { display: none; }
.dash-tray { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-tray .chip { cursor: pointer; font: inherit; font-size: 13px; color: var(--text); }
.dash-tray .chip:hover { border-color: var(--accent); }
.dash-metric { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 14px; }
.dash-metric + .dash-metric { border-top: 1px solid var(--line); }
.dash-metric b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); min-width: 0; }
a.week-day:hover { border-color: var(--line-strong); }
.week-day b { font-size: 17px; }
.week-day.weekend, .week-day.future { opacity: .55; }
.week-day.up { background: var(--up-soft); border-color: color-mix(in srgb, var(--up) 35%, transparent); }
.week-day.down { background: var(--down-soft); border-color: color-mix(in srgb, var(--down) 35%, transparent); }
.week-day.up, .week-day.down { opacity: 1; }
.week-day.today { border-color: var(--accent); }
.week-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; opacity: 1; }
.week-pct { font-size: 13px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dash-bars { display: flex; flex-direction: column; }
.dash-bar { display: grid; grid-template-columns: minmax(90px, 1.1fr) minmax(0, 2fr) auto; align-items: center; gap: 12px;
  padding: 8px; margin: 0 -8px; border-radius: 10px; }
.dash-bar:hover { background: var(--bg-soft); }
.dash-bar-name { display: flex; flex-direction: column; min-width: 0; }
.dash-bar-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar-track { height: 10px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.dash-bar-fill { display: block; height: 100%; border-radius: 99px; animation: reveal-x .8s cubic-bezier(.2, .7, .2, 1) backwards; }
.dash-bar-fill.up { background: linear-gradient(90deg, color-mix(in srgb, var(--up) 55%, transparent), var(--up));
  box-shadow: 0 0 10px color-mix(in srgb, var(--up) 45%, transparent); }
.dash-bar-fill.down { background: linear-gradient(90deg, color-mix(in srgb, var(--down) 55%, transparent), var(--down));
  box-shadow: 0 0 10px color-mix(in srgb, var(--down) 45%, transparent); }
.dash-bar:hover .dash-bar-fill { filter: brightness(1.15); }
.dash-bar-pct { font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.dash-note-list { display: flex; flex-direction: column; }
.dash-note { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; margin: 0 -8px; border-radius: 10px; min-width: 0; }
.dash-note + .dash-note { border-top: 1px solid var(--line); }
.dash-note:hover { background: var(--bg-soft); }
.dash-note-title, .notes-item-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dash-note-title b, .notes-item-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-note-text, .notes-snippet { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dash-note-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.dash-note-empty p { margin: 0; }

/* Мої рахунки (MT5): картки в один рядок, що гортається вбік; на ПК — стрілки, на телефоні видно краєчок наступної */
.dash-accounts .card-head { justify-content: flex-start; flex-wrap: nowrap; }
.acc-count { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.acc-navs { display: flex; gap: 4px; margin-left: auto; flex: none; }
.acc-nav { width: 32px; height: 32px; }
.acc-nav:disabled { opacity: .35; cursor: default; }
.acc-strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 20px; margin: 0 -20px; padding: 2px 20px 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.acc-strip::-webkit-scrollbar { display: none; }
.acc-tile { flex: 0 0 236px; min-width: 0; scroll-snap-align: start; display: flex; flex-direction: column; gap: 3px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); color: inherit; transition: border-color .15s; }
.acc-tile:hover { border-color: var(--line-strong); }
.acc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.acc-platform { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 2px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); flex: none; }
.acc-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.acc-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--flat); flex: none; }
.acc-status.ok i { background: var(--up); }
.acc-status.error { color: var(--down); }
.acc-status.error i { background: var(--down); }
.acc-status.pending i { background: var(--cta); animation: acc-pulse 1.6s ease-in-out infinite; }
@keyframes acc-pulse { 50% { opacity: .35; } }
.acc-name, .acc-server { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-equity { display: flex; flex-wrap: wrap; column-gap: 6px; white-space: nowrap; }
.acc-money { margin-top: 6px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.acc-balance { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.acc-wait { margin-top: 6px; }
.acc-add { flex-basis: 110px; align-items: center; justify-content: center; gap: 6px; color: var(--muted); border-style: dashed; background: transparent; font-weight: 600; }
.acc-add:hover { color: var(--accent); border-color: var(--accent); }
.acc-empty { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: inherit; }
.acc-empty:hover { border-color: var(--accent); }
.acc-empty > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.acc-empty-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex: none; }
/* Налаштування → Торгові рахунки */
.acc-list { display: flex; flex-direction: column; margin: 4px 0 14px; }
.acc-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.acc-row:first-child { border-top: 0; }
.acc-row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.acc-row-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-row-main .acc-status { margin-top: 2px; }
a.acc-row-main { color: inherit; text-decoration: none; }
a.acc-row-main:hover b { color: var(--accent); }
/* Сторінка рахунку (#/stats?account=): шапка з балансом над статистикою */
.back-link { display: inline-block; margin-bottom: 10px; font-size: 14px; }
.acc-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.acc-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.acc-head-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.acc-head-name h1 { margin: 2px 0 0; font-size: 26px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-head-name .row { gap: 8px; align-items: center; }
.acc-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.acc-fig { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.acc-fig b { font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-synced { margin: -4px 0 0; }
.acc-row-side { flex: none; font-variant-numeric: tabular-nums; }
.acc-help { margin: 12px 0; font-size: 14px; }
.acc-help summary { cursor: pointer; color: var(--accent); font-weight: 550; }
.acc-help ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

/* ---------- Нотатки ---------- */
.notes-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 14px; align-items: start; }
.notes-side { display: flex; flex-direction: column; gap: 12px; padding: 14px; position: sticky; top: 92px;
  max-height: calc(100dvh - 120px); }
.notes-tools { display: flex; flex-direction: column; gap: 10px; }
.notes-search { position: relative; display: block; color: var(--muted); }
.notes-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.notes-search input { padding-left: 36px; }
.notes-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.notes-item { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; padding: 10px; border-radius: 10px;
  border: 0; background: none; cursor: pointer; min-width: 0; }
.notes-item:hover { background: var(--bg-soft); }
.notes-item.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.notes-item .icon, .dash-note .icon { color: var(--accent); }
.notes-none { margin: 8px 4px; }
.notes-editor { display: flex; flex-direction: column; gap: 10px; min-height: min(70dvh, 640px); }
.notes-bar { display: flex; align-items: center; gap: 10px; }
.notes-status { flex: 1; }
.notes-actions { display: flex; gap: 4px; }
.notes-actions .btn.on { color: var(--accent); }
.notes-back { display: none; }
.notes-title { border: 0; padding: 4px 0; min-height: 0; font-size: 22px; font-weight: 700; background: none; box-shadow: none !important; }
.notes-body { flex: 1; border: 0; padding: 4px 0; background: none; resize: none; min-height: 420px; font-size: 15px; line-height: 1.6;
  box-shadow: none !important; }
.notes-title:focus-visible, .notes-body:focus-visible { outline: none; }

.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 22px; margin: 0; }
.metric { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.metric dt { color: var(--muted); font-size: 14px; }
.metric dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.fields { grid-template-columns: 1fr; margin-bottom: 12px; }

.bars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.bar-head { display: flex; justify-content: space-between; gap: 10px; }
.val { font-weight: 650; font-variant-numeric: tabular-nums; }
.winbar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--flat-soft); margin-top: 8px; gap: 3px;
  animation: reveal-x .8s cubic-bezier(.2, .7, .2, 1) backwards; }
.winbar > span { border-radius: 99px; }
.winbar .w { background: linear-gradient(90deg, color-mix(in srgb, var(--up) 75%, transparent), var(--up)); }
.winbar .l { background: linear-gradient(90deg, color-mix(in srgb, var(--down) 75%, transparent), var(--down)); }
.winbar .b { background: var(--flat); opacity: .55; }
.foot { margin-top: -4px; }

/* ---------- журнал: календар ліворуч, угоди праворуч; під ними сесії й новини ---------- */
.journal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 20px; align-items: stretch; }
.journal-side .cal-box { margin: 0; container-type: inline-size; }
/* Календар у пів ширини: дрібніші плашки днів, щоб % не обрізались */
@container (max-width: 640px) { @media (min-width: 901px) {
  .journal-side .cal-day { padding: 5px 4px; min-height: 84px; }
  .journal-side .cal-res { padding: 4px 5px; }
  .journal-side .cal-pct { font-size: 12.5px; }
  .journal-side .cal-count { font-size: 11px; }
} }
/* Висоту ряду задає календар; список праворуч гортається всередині */
.journal-main { position: relative; min-width: 0; min-height: 420px; container-type: inline-size; }
.journal-main-in { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; }
.journal-scroll { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow); scrollbar-width: thin; }
.journal-scroll .table-wrap { margin: 0; overflow: visible; }
.journal-scroll .table thead th { position: sticky; top: 0; z-index: 1; background: var(--card); }
.journal-scroll > .btn { margin: 8px auto 12px; display: flex; width: calc(100% - 24px); }
.journal-scroll .empty { padding: 40px 16px; }
/* У вузькій колонці таблиця ховає другорядні стовпці, а не гортається вбік */
@container (max-width: 920px) { .col-setup { display: none; } }
@container (max-width: 700px) { .col-rr, .col-type { display: none; } }
.journal-extra { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 20px; align-items: stretch; }
/* Новини й сесії — однакової висоти: рядки сесій розподіляються по висоті блоку */
.journal-extra > .card { display: flex; flex-direction: column; }
.sess-card .sess { flex: 1; display: flex; }
.sess-card .sess-grid { flex: 1; justify-content: space-between; }

/* торгові сесії */
.sess-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.sess-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 132px; gap: 14px; align-items: center; }
.sess-name { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; white-space: nowrap; line-height: 1.25; }
.sess-name > div, .sess-status { display: flex; flex-direction: column; min-width: 0; }
.sess-name .muted { font-size: 12px; font-variant-numeric: tabular-nums; }
.sess-swatch { width: 9px; height: 9px; border-radius: 3px; background: var(--sess); flex: none; }
.sess-track { position: relative; height: 30px; border-radius: 8px; background: var(--bg-soft); overflow: hidden; }
.sess-track.bare { background: none; height: 16px; overflow: visible; }
.sess-bar { position: absolute; top: 4px; bottom: 4px; border-radius: 6px; background: color-mix(in srgb, var(--sess) 30%, transparent); }
.sess-bar.live { background: var(--sess); box-shadow: 0 0 14px color-mix(in srgb, var(--sess) 45%, transparent); }
.sess-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); opacity: .85; border-radius: 2px; }
.sess-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sess-tick:first-child { transform: none; }
.sess-tick:nth-last-child(2) { transform: translateX(-100%); }
.sess-now-label { position: absolute; top: -2px; transform: translateX(-50%); font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 5px;
  background: var(--text); color: var(--bg); font-variant-numeric: tabular-nums; }
.sess-status { font-size: 12px; color: var(--muted); white-space: nowrap; line-height: 1.3; }
.sess-status b { font-size: 13px; color: var(--text); font-weight: 600; }
.sess-status > * { overflow: hidden; text-overflow: ellipsis; }
.sess-status.open b { color: var(--up); }
.sess-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--up); margin-right: 6px; vertical-align: 1px;
  animation: sess-pulse 1.8s ease-in-out infinite; }
@keyframes sess-pulse { 50% { opacity: .35; } }

/* важливі новини */
.news-card .card-head .segmented button { padding: 4px 10px; font-size: 13px; }
.news { display: flex; flex-direction: column; gap: 12px; max-height: 340px; overflow: auto; margin-top: 4px; padding-right: 4px; scrollbar-width: thin; }
.news-date { margin: 0 0 4px; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.news-row { display: grid; grid-template-columns: 46px 42px 10px minmax(0, 1fr); grid-template-areas: "time cur dot title" ". . . nums";
  column-gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.news-row:last-child { border-bottom: 0; }
.news-row.past { opacity: .45; }
.news-time { grid-area: time; font-variant-numeric: tabular-nums; font-weight: 600; }
.news-cur { grid-area: cur; font-size: 11px; font-weight: 700; padding: 2px 0; border-radius: 6px; background: var(--bg-soft); text-align: center; }
.news-impact { grid-area: dot; width: 8px; height: 8px; border-radius: 50%; background: var(--c2); }
.news-row.high .news-impact { background: var(--down); }
.news-title { grid-area: title; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-nums { grid-area: nums; font-size: 12px; }
.news-empty { padding: 18px 0; text-align: center; }
.news-src { margin: 10px 0 0; font-size: 11px; }

@media (max-width: 1100px) {
  .journal-grid, .journal-extra { grid-template-columns: minmax(0, 1fr); }
  .journal-main { min-height: 0; }
  .journal-main-in { position: static; }
  .journal-scroll { overflow: visible; border: 0; background: none; box-shadow: none; border-radius: 0; }
  .journal-scroll .table thead th { position: static; }
}
@media (max-width: 640px) {
  .sess-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name status" "track track"; row-gap: 6px; }
  .sess-name { grid-area: name; }
  .sess-track { grid-area: track; }
  .sess-status { grid-area: status; }
  .sess-scale > span { display: none; }
}

/* ---------- календар результатів ---------- */
.cal-box { margin-bottom: 4px; }
.cal { padding: 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav .icon-btn { width: 34px; height: 34px; }
.cal-title { margin: 0 6px; font-size: 18px; min-width: 150px; text-align: center; }
.cal-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.cal-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 5px 10px; border-radius: 99px; background: var(--bg-soft); font-size: 13px; }
.cal-chip b { font-variant-numeric: tabular-nums; }
.cal-grid { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row + .cal-row { border-top: 1px solid var(--line); }
.cal-names > div { padding: 7px 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  background: var(--bg-soft); }
.cal-row > * + * { border-left: 1px solid var(--line); }
.cal-day { min-height: 92px; padding: 6px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; color: var(--text);
  min-width: 0; border: 0; border-radius: 0; background: transparent; font: inherit; text-align: left; animation: fade-in .25s ease-out; }
.cal-day.out { color: var(--muted); opacity: .45; }
.cal-num { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-text); }
.cal-res { margin-top: auto; display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 8px; min-width: 0;
  transition: filter .15s, box-shadow .15s; }
.cal-pct { font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-count { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day.has { cursor: pointer; }
.cal-day.has:hover .cal-res { filter: brightness(1.15); }
.cal-day.up .cal-res { background: color-mix(in srgb, var(--up) 16%, var(--card)); }
.cal-day.down .cal-res { background: color-mix(in srgb, var(--down) 16%, var(--card)); }
.cal-day.flat .cal-res { background: var(--bg-soft); }
.cal-day.up .cal-pct { color: var(--up); }
.cal-day.down .cal-pct { color: var(--down); }
.cal-day.selected .cal-res { box-shadow: 0 0 0 2px var(--accent); }
.cal-empty { margin: 12px 0 0; text-align: center; }
.chart-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.pop-details { padding: 8px 10px 4px; width: 340px; max-width: 100%; }
.pop-details h3 { margin: 0 0 6px; font-size: 15px; }
.pop-details .metrics { grid-template-columns: 1fr; }
.pop-details .metric:last-child { border-bottom: 0; }
.view-toggle { display: inline-flex; background: var(--bg-soft); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.view-toggle button { display: grid; place-items: center; width: 32px; height: 28px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); cursor: pointer; }
.view-toggle button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(10, 20, 48, .12); }
.donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; animation: fade-in .25s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.donut-figure { flex: 0 0 168px; max-width: 168px; margin: 0 auto; }
.donut-svg { width: 100%; height: auto; display: block; overflow: visible; }
.donut-track { fill: none; stroke: var(--bg-soft); stroke-width: 18; }
.donut-arc { fill: none; stroke-width: 18; cursor: pointer; transform: rotate(-90deg); transform-origin: 70px 70px;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--glow) 50%, transparent));
  transition: stroke-dasharray .9s cubic-bezier(.2, .7, .2, 1), stroke-width .2s, opacity .2s, filter .2s; }
.donut-arc.on { stroke-width: 24; filter: drop-shadow(0 0 9px color-mix(in srgb, var(--glow) 75%, transparent)); }
.donut-arc.dim { opacity: .25; }
.donut-big { font-size: 20px; font-weight: 700; fill: var(--text); font-family: var(--font); font-variant-numeric: tabular-nums; }
.donut-big.up { fill: var(--up); }
.donut-big.down { fill: var(--down); }
.donut-small { font-size: 10.5px; fill: var(--muted); font-family: var(--font); }
.donut-side { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.donut-item { display: grid; grid-template-columns: 10px 1fr auto auto; row-gap: 5px; align-items: center; gap: 10px; width: 100%; padding: 6px 8px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: left; cursor: pointer; font-size: 14px; }
.donut-item:hover, .donut-item[aria-pressed="true"] { background: var(--bg-soft); }
.donut-item .dot { width: 10px; height: 10px; border-radius: 50%; }
.donut-share { grid-column: 2 / -1; height: 4px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.donut-share > span { display: block; height: 100%; border-radius: 99px; opacity: .85; animation: reveal-x .8s cubic-bezier(.2, .7, .2, 1) backwards; }
.donut-item:hover .donut-share > span, .donut-item[aria-pressed="true"] .donut-share > span { opacity: 1; }
@keyframes reveal-x { from { clip-path: inset(0 100% 0 0); } }
.donut-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.donut-svg circle:focus { outline: none; }
.donut-svg { -webkit-tap-highlight-color: transparent; }
.donut-detail { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-soft); animation: fade-in .2s ease-out; }
.donut-detail[hidden] { display: none; }
.donut-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-height: 28px; }
.donut-detail-head b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.donut-detail-head .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.donut-detail-head .icon-btn { width: 28px; height: 28px; color: var(--muted); }
.donut-cells { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }
.donut-cells dt { font-size: 12px; color: var(--muted); }
.donut-cells dd { margin: 2px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.donut-open { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 14px; }

.chart { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--line-strong); stroke-width: 1.2; stroke-dasharray: 4 4; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { transform-box: fill-box; transform-origin: center bottom; cursor: pointer; transition: opacity .15s, filter .15s; }
.chart .bar.up { fill: var(--up); stroke: var(--up); }
.chart .bar.down { fill: var(--down); stroke: var(--down); transform-origin: center top; }
.chart .bar:not(.idle).up { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--up) 45%, transparent)); }
.chart .bar:not(.idle).down { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--down) 45%, transparent)); }
.chart .bar.idle { fill-opacity: .5; stroke-width: 1; stroke-opacity: .9; }
.chart .bars.hovering .bar:not(.on) { opacity: .6; }
.chart .bar.on { opacity: 1; filter: brightness(1.2); }
.chart .bar.grow { animation: bar-grow .55s cubic-bezier(.2, .9, .3, 1.15) backwards; }
@keyframes bar-grow { from { transform: scaleY(0); opacity: 0; } }
.chart .bars { cursor: pointer; }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.up { stroke: var(--up); }
.chart .line.down { stroke: var(--down); }
.chart .area.up { fill: var(--up-soft); }
.chart .area.down { fill: var(--down-soft); }
.chart .guide { stroke: var(--line-strong); stroke-width: 1; }
.chart .dot { stroke: var(--card); stroke-width: 2; }
.chart .dot.up { fill: var(--up); }
.chart .dot.down { fill: var(--down); }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 12px; padding: 6px 10px;
  border-radius: 8px; pointer-events: none; white-space: nowrap; line-height: 1.4; }
.chart-empty { padding: 30px 0; text-align: center; }

/* ---------- журнал ---------- */
.filters { display: flex; flex-direction: column; gap: 10px; }
.search { position: relative; display: flex; align-items: center; }
.fchips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; flex: none; }
.fchip:hover { border-color: var(--muted); }
.fchip .icon { color: var(--muted); }
.fchip[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 .2rem var(--focus-ring); }
.fchip.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.fchip.ghost:hover { color: var(--text); }
.fchip-label { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.fchip-name { color: var(--muted); font-weight: 500; }
.fchip-wrap { display: inline-flex; align-items: center; flex: none; border-radius: 99px; background: color-mix(in srgb, var(--accent) 10%, var(--card));
  border: 1px solid var(--accent); }
.fchip-wrap .fchip { border: 0; background: transparent; padding-right: 4px; }
.fchip-wrap .fchip b { color: var(--accent); font-weight: 650; }
.fchip-x { display: grid; place-items: center; width: 28px; height: 28px; margin-right: 4px; border: 0; border-radius: 50%; background: transparent;
  color: var(--accent); cursor: pointer; }
.fchip-x:hover { background: var(--card); }

/* випадне меню фільтра: під кнопкою на ПК, панель знизу на телефоні */
.pop-layer { position: fixed; inset: 0; z-index: 60; }
.pop { position: fixed; min-width: 240px; max-width: min(380px, calc(100vw - 16px)); max-height: min(440px, calc(100dvh - 120px)); overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .16); padding: 6px;
  animation: pop-in .12s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.pop-list { display: flex; flex-direction: column; }
.pop-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); text-align: left; cursor: pointer; font-size: 14px; }
.pop-item:hover { background: var(--bg-soft); }
.pop-item[aria-checked="true"] { color: var(--accent); font-weight: 600; }
.pop-empty { padding: 10px 12px; margin: 0; }
.pop-foot { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; margin-top: 4px; border: 0; border-top: 1px solid var(--line);
  background: transparent; color: var(--accent); cursor: pointer; font-size: 14px; font-weight: 550; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.pop-foot:hover { background: var(--bg-soft); }
.range { display: flex; flex-direction: column; gap: 14px; padding: 10px; width: 340px; max-width: 100%; }
.range-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.range-presets .chip { padding: 6px 12px; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.range-dates { display: flex; align-items: flex-end; gap: 8px; }
.range-dates input { min-width: 0; }
.range-dash { padding-bottom: 10px; color: var(--muted); }
.range .auth-error { margin: -6px 0 0; }

/* свої типи угод і теги */
.label-list { display: flex; flex-direction: column; margin-bottom: 10px; }
.label-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); min-height: 44px; }
.label-row .label-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 550; }
.label-row .icon-btn { width: 34px; height: 34px; color: var(--muted); }
.label-row .icon-btn:hover { color: var(--text); }
.label-row .icon-btn.danger:hover { color: var(--down); }
.label-row.editing input { flex: 1; min-height: 36px; height: 36px; }
.label-add { display: flex; gap: 8px; }
.label-add input { flex: 1; min-height: 38px; height: 38px; }
.label-add .btn { flex: none; }
.labels-grid h3 { margin: 0 0 6px; font-size: 15px; }
.labels-grid { gap: 22px; }
.modal .labels { min-width: min(380px, 80vw); }
.label-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.label-pick .chip { padding: 6px 12px; font-size: 14px; }
.label-pick .label-new { width: 150px; min-height: 32px; height: 32px; border-radius: 99px; padding: 0 12px; font-size: 14px; border-style: dashed; }
.search .icon { position: absolute; left: 11px; color: var(--muted); }
.search input { padding-left: 36px; height: 38px; min-height: 38px; }

.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table .num { text-align: right; }
.table .nowrap { white-space: nowrap; }
.table.compact td, .table.compact th { padding: 8px 10px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--bg-soft); }
.table .clip { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.sortable button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
.sortable.active { color: var(--text); }
.table.trades { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; border-collapse: separate; border-spacing: 0; }
.table.trades tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 10px 0; }
.est { color: var(--muted); margin-left: 2px; }
.att { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge.take { background: var(--up-soft); color: var(--up); }
.badge.stop { background: var(--down-soft); color: var(--down); }
.badge.breakeven, .badge.muted { background: var(--flat-soft); color: var(--muted); }

.trade-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.tc-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tc-sym { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.dir { font-size: 12px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 6px; }
.tc-pct { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; margin-top: 6px; }
.tc-notes { margin: 8px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- угода ---------- */
.big-pct { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.page-head h1 + .row { margin-top: 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 10px 0; }
.thumb { display: block; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--bg-soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.wide { grid-column: 1 / -1; aspect-ratio: auto; }
.thumb.wide img { height: auto; max-height: 420px; object-fit: contain; }
.thumb.missing { display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12px; gap: 4px; padding: 8px; }
.files { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
details.raw { margin-top: 12px; color: var(--muted); font-size: 14px; }
details.raw summary { cursor: pointer; }
.facts { display: block; background: var(--bg-soft); padding: 8px 10px; border-radius: 8px; margin: 10px 0; white-space: pre-wrap; color: var(--muted); }

.trade-form { display: flex; flex-direction: column; gap: 14px; }
.trade-form .segmented { align-self: flex-start; }
.draft h3 { color: var(--muted); }
.drafts { display: flex; flex-direction: column; gap: 14px; }
.sticky-actions { position: sticky; bottom: 12px; background: var(--bg); padding: 8px 0; }
.card > textarea { display: block; width: 100%; margin-bottom: 10px; }
.row > .btn.wide { flex: 1; }
.mic.recording { background: var(--down); color: #fff; animation: pulse 1.2s ease infinite; }
.mic.busy { opacity: .5; pointer-events: none; }
@keyframes pulse { 50% { opacity: .65; } }

/* ---------- асистент ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; min-height: calc(100dvh - 252px); }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: min(680px, 88%); padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { align-self: flex-end; background: transparent; color: var(--text); border: 1.5px solid var(--accent); border-bottom-right-radius: 5px; }
.bubble.assistant { align-self: flex-start; background: var(--bg-soft); border-bottom-left-radius: 5px; }
.bubble.thinking { color: var(--muted); animation: pulse 1.2s ease infinite; }
.chat-log > .chips, .chat-log > .btn { align-self: flex-start; }
.chat-hello { text-align: center; padding: 40px 0; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.chat-input { position: sticky; bottom: 0; display: flex; gap: 6px; align-items: flex-end; background: var(--bg); padding: 10px 0 4px; }
.chat-input textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; border-radius: 22px; padding: 10px 16px; }
.send { background: var(--accent); color: var(--accent-text); border-radius: 50%; width: 44px; height: 44px; }
.send:hover { background: var(--accent-hover); }

/* ---------- налаштування ---------- */
.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.profile-block + .profile-block { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.profile-block textarea { margin-bottom: 10px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.grid-form .field + .field { margin-top: 0; }
.card .field + .field, .card .field + .row, .card .row + .field { margin-top: 12px; }

/* ---------- вхід і онбординг ---------- */
main.login, main.onboarding { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.onboarding-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 32px 28px; }
.onboarding-card h1 { font-size: 22px; text-align: center; }

/* гість: головна (лендинг) і вхід — на весь екран */
main.login { padding: 0; place-items: stretch; width: 100%; display: block; }
.auth-page { width: 100%; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.land-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 32px;
  max-width: 1480px; width: 100%; margin: 0 auto; }
.land-top .brand { padding: 0; }
.land-top-right { display: flex; align-items: center; gap: 10px; }
.auth-langs { display: flex; gap: 2px; }
.auth-langs button { background: none; border: 0; padding: 6px 9px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.auth-langs button.on { color: var(--text); background: var(--bg-soft); }



.auth-side { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px 56px; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.auth-card .segmented { align-self: stretch; display: grid; grid-template-columns: 1fr 1fr; }
.journal-switch { grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; margin: 0 0 14px; background: var(--bg-soft); border-radius: var(--radius-sm); }
.journal-switch a { text-align: center; padding: 8px 12px; border-radius: 7px; color: var(--muted); font-weight: 550; font-size: 14px; }
.journal-switch a.on { background: var(--card); color: var(--accent); font-weight: 650; box-shadow: 0 1px 2px rgba(10, 20, 48, .12); }
.auth-head h2 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
.auth-head p { margin: 0; }
.auth-providers { display: flex; flex-direction: column; gap: 10px; }
.btn.provider { gap: 10px; background: var(--card); border-color: var(--line-strong); }
.btn.provider:hover { background: var(--bg-soft); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .field + .field { margin-top: 0; }
.auth-form small { display: block; margin-top: 6px; }
.pw { position: relative; }
.pw input { padding-right: 44px; }
.pw .reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.auth-error { margin: 0; color: var(--down); font-size: 14px; }
.auth-tg .notice p { margin: 0 0 6px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 760px) {
  .land-top { padding: 14px 16px; }
  .land-top .brand { font-size: 16px; }
  .auth-head h2 { font-size: 20px; }
  .auth-card { padding: 22px 18px; }
}
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.notice { background: var(--bg-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.widget { display: flex; justify-content: center; min-height: 40px; }
.boot { flex: 1; display: grid; place-items: center; align-content: center; gap: 18px; min-height: 100dvh; color: var(--text); }

/* ---------- службове ---------- */
.spinner { width: 28px; height: 28px; margin: 60px auto; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--text);
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty p { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 60; transition: .2s; pointer-events: none; max-width: min(520px, 90vw); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--down); color: #fff; }
.overlay { position: fixed; inset: 0; background: rgba(19, 21, 23, .4); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s ease; }
.modal { background: var(--card); border-radius: var(--radius); padding: 22px; width: min(440px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  border: 1px solid var(--line); }
.modal h3 { font-size: 17px; margin-bottom: 10px; }
.modal-body { color: var(--muted); margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sheet-overlay { place-items: end center; padding: 0; }
.sheet { background: var(--card); width: 100%; border-radius: 18px 18px 0 0; padding: 10px 10px calc(16px + env(safe-area-inset-bottom)); display: flex;
  flex-direction: column; animation: up .2s ease; }
@keyframes up { from { transform: translateY(30px); } to { transform: none; } }
.sheet-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 10px; font-weight: 550; }
.sheet-item:hover { background: var(--bg-soft); }
.mobile-only { display: none !important; }

/* ---------- телефон ---------- */
@media (max-width: 900px) {
  .topbar { display: none; }
  .desktop-only { display: none !important; }
  .mobile-only { display: revert !important; }
  .cards.mobile-only { display: flex !important; }
  .journal-switch.mobile-only { display: grid !important; }
  main#main { padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
  h1 { font-size: 22px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-chart { grid-column: auto; }
  .home-settings { display: inline-grid; }
  /* Шестірня — навпроти привітання; «Налаштувати» / «Уся статистика» — один невеликий рядок під ним */
  .home-hello { width: 100%; }
  .home-actions { width: 100%; flex-wrap: nowrap; gap: 6px; }
  .home-actions .btn { height: 34px; padding: 0 10px; gap: 6px; font-size: 13px; min-width: 0; }
  .home-actions .btn svg { width: 16px; height: 16px; flex: none; }
  /* Рахунки на телефоні: картка ~3/4 ширини — краєчок наступної підказує, що можна гортати */
  .acc-strip { margin: 0 -16px; padding: 2px 16px 4px; scroll-padding: 0 16px; gap: 8px; }
  .acc-tile { flex-basis: 74%; padding: 11px 13px; }
  .acc-add { flex-basis: 84px; }
  .acc-balance { font-size: 20px; }
  .acc-navs { display: none; }
  .acc-row { gap: 10px; }
  .acc-head { gap: 12px; margin-bottom: 14px; }
  .acc-head-name h1 { font-size: 22px; }
  .acc-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .acc-fig { padding: 10px 12px; }
  .acc-fig b { font-size: 18px; }
  .acc-fig:first-child { grid-column: 1 / -1; }
  .acc-fig:first-child b { font-size: 24px; }
  .dash-row, .dash-row.wide { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .dash-block { grid-column: auto !important; }
  .dash-block > .kpis { grid-template-columns: 1fr 1fr; }
  .dash-grid.editing .dash-resize { display: none; }
  .dash-editbar { top: 8px; }
  .week-days { gap: 4px; }
  .week-day { padding: 8px 2px; }
  .week-pct { font-size: 11px; }
  .notes-layout { grid-template-columns: minmax(0, 1fr); }
  .notes-side { position: static; max-height: none; }
  .notes-layout.open .notes-side, .notes-layout:not(.open) .notes-editor { display: none; }
  .notes-back { display: inline-flex; }
  .notes-actions .btn-text { display: none; }
  .notes-bar { gap: 6px; }
  .notes-editor { min-height: calc(100dvh - 260px); }
  .notes-body { min-height: 320px; }
  .home-chart .chart.fit { min-height: 220px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 22px; }
  .card { padding: 14px 16px; }
  .grid-cards, .grid-cards.two { grid-template-columns: 1fr; gap: 12px; }
  .page { gap: 14px; }
  .page-head { align-items: flex-start; }
  .period-bar { width: 100%; }
  .period-label { flex: 1; min-width: 0; }
  .fchips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .fchips::-webkit-scrollbar { display: none; }
  .fchip-label { max-width: 180px; }
  .pop-layer { background: rgba(0, 0, 0, .35); }
  .pop-details { width: auto; }
  .cal { padding: 12px; }
  .cal-head { flex-direction: column; align-items: stretch; }
  .cal-nav { justify-content: space-between; }
  .cal-title { font-size: 16px; min-width: 0; flex: 1; }
  .cal-stats { justify-content: center; }
  .cal-names > div { padding: 6px 2px; text-align: center; font-size: 11px; letter-spacing: 0; }
  .cal-day { min-height: 58px; padding: 3px 2px; align-items: center; text-align: center; }
  .cal-res { padding: 3px 2px; border-radius: 6px; align-self: stretch; }
  .cal-num { margin: 0; font-size: 12px; width: 22px; height: 22px; }
  .cal-pct { font-size: 11px; font-weight: 650; }
  .cal-count { display: none; }
  .pop { left: 0 !important; right: 0; top: auto !important; bottom: 0; max-width: none; width: 100%; max-height: 75dvh; border-radius: 18px 18px 0 0;
    padding: 10px 10px calc(16px + env(safe-area-inset-bottom)); animation: sheet-in .18s ease-out; }
  .pop::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 8px; }
  .pop-item { padding: 13px 14px; font-size: 16px; }
  .range { width: auto; }
  .range input[type="date"] { font-size: 16px; }
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); z-index: 40; align-items: center; justify-content: space-around; }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); background: none; border: 0; padding: 6px 0;
    position: relative; flex: 1; min-width: 0; cursor: pointer; white-space: nowrap; }
  .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.15px; }
  .bottombar .fab { flex: none; margin-left: 2px; margin-right: 2px; }
  .tab.active { color: var(--accent); font-weight: 600; }
  .fab { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center;
    margin-top: -22px; box-shadow: 0 8px 22px -6px var(--accent); }
  .chat { min-height: calc(100dvh - 210px); }
  .chat-input { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .sticky-actions { bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .grid2 { grid-template-columns: 1fr; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Форма угоди: часткові закриття */
.exit-rows { display: flex; flex-direction: column; gap: 8px; }
.exit-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 8px; align-items: center; }
.exit-rows:empty { display: none; }
.result-fields:not([hidden]) { display: flex; flex-direction: column; gap: 14px; }

/* Вкладка «Сесії»: журнал угод періоду під розрізом */
.session-trades { margin-top: 20px; }
.session-trades > .row { justify-content: space-between; margin-bottom: 10px; }
.session-trades > .row h2 { margin: 0; }
.session-table .table-wrap { margin: 0; max-height: 640px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.session-table .table thead th { position: sticky; top: 0; z-index: 1; background: var(--card); }

/* Форма рахунку MT5: «Підтягнути всю історію угод» */
.acc-history { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 4px; cursor: pointer; }
.acc-history input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.acc-history > span { display: flex; flex-direction: column; gap: 2px; }
