:root {
  --bg: #f4f2ec; --card: #ffffff; --ink: #1c211e; --muted: #6d7570; --line: #e3e0d6;
  --accent: #1f2a24; --gold: #c99a2e; --gold-soft: #f6ecd2; --red: #b5412f; --green: #2f7a4f;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121614; --card: #1a201d; --ink: #e9ece8; --muted: #8f9892; --line: #2a322e;
    --accent: #e8c26a; --gold: #e8c26a; --gold-soft: #2c2817; --red: #e07a66; --green: #6bc28f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: inherit; }
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 30px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
code { background: var(--gold-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 13px; text-transform: lowercase; }

/* шапка */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.top nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.top nav a { text-decoration: none; padding: 7px 11px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-size: 14px; }
.top nav a:hover { color: var(--ink); background: var(--bg); }
.top nav a.on { color: var(--ink); background: var(--gold-soft); font-weight: 600; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; font-size: 17px; letter-spacing: -.01em; }
.brand.big { font-size: 26px; justify-content: center; }
.mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px;
  background: #1f2a24; color: #e8c26a; font-weight: 800; font-size: 16px; }
.brand.big .mark { width: 40px; height: 40px; font-size: 22px; }

/* элементы */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
input, select, textarea { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
select.inline { width: auto; padding: 4px 8px; font-size: 13px; }
button, .btn { font: inherit; font-size: 14px; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.primary { background: #1f2a24; color: #fff; }
.primary:hover { background: #2d3c34; }
@media (prefers-color-scheme: dark) { .primary { background: var(--gold); color: #17140a; } .primary:hover { background: #f0d082; } }
.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.ghost:hover { background: var(--bg); }
.small { padding: 4px 10px; font-size: 13px; }
.danger { color: var(--red); }
.alert { background: #fbe9e5; color: var(--red); border-radius: 8px; padding: 8px 12px; margin: 12px 0; }
.empty { color: var(--muted); padding: 8px 0; margin: 0; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 6px; }
.label.late, .late { color: var(--red); }
.tag { background: var(--gold-soft); border-radius: 6px; padding: 0 6px; font-size: 12px; }
.tag.doing { background: #dfeee5; color: var(--green); }

.quick { display: flex; gap: 8px; min-width: min(460px, 100%); }
.quick input { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.form-grid .wide { grid-column: span 2; }
form.card.form-grid { margin-top: 0; }
details.add summary { cursor: pointer; font-weight: 600; list-style: none; }
details.add summary::-webkit-details-marker { display: none; }

/* сводка */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; text-decoration: none; display: flex; flex-direction: column; }
.stat b { font-size: 28px; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13px; }
.stat:hover { border-color: var(--gold); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 .card { margin: 0; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.line:last-child { border: 0; }
.goal-mini { padding: 8px 0; }
.bar { height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; margin: 4px 0; }
.bar.big { height: 8px; margin: 10px 0; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 4px; }

/* задачи */
.task { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-left: 3px solid transparent; padding-left: 8px; }
.task.p1 { border-left-color: var(--red); }
.task.p3 { opacity: .85; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.check { width: 20px; height: 20px; padding: 0; border-radius: 6px; border: 1.5px solid var(--muted); background: transparent;
  color: var(--green); font-size: 13px; justify-content: center; margin-top: 2px; }
.check:hover { border-color: var(--green); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14.5px; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.task-row { display: flex; align-items: flex-start; gap: 8px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border: 0; }
.task-row .task { flex: 1; }
details.pop { position: relative; display: inline-block; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop[open] { z-index: 5; }
.pop-body { position: absolute; right: 0; top: 34px; width: 300px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.14); display: flex; flex-direction: column; gap: 8px; }

/* цели */
.goal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.goal-head h2 { margin-bottom: 2px; }
.goal.done { opacity: .7; } .goal.dropped, .goal.paused { opacity: .55; }
.inline-add { margin-top: 10px; min-width: 0; }
.inline-add input[type=date] { flex: 0 0 150px; }

/* план */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 16px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 180px; display: flex; flex-direction: column; }
.day.today { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.day.today h3 { color: var(--gold); }
.day .task { padding: 5px 0 5px 6px; }
.day .task-title { font-size: 13.5px; }
.day-add { margin-top: auto; padding-top: 8px; }
.day-add input { font-size: 13px; padding: 6px 8px; background: transparent; border-style: dashed; }

/* таблицы */
.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td a { text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .chips { margin: 0; }
.chip { text-decoration: none; padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line); font-size: 13px; background: var(--card); }
.chip.on { background: #1f2a24; color: #fff; border-color: #1f2a24; }
@media (prefers-color-scheme: dark) { .chip.on { background: var(--gold); color: #17140a; border-color: var(--gold); } }

/* портфолио */
.prose { max-width: 820px; padding: 28px 36px; }
.prose h1 { font-size: 26px; margin-bottom: 12px; }
.prose h2 { font-size: 18px; margin: 26px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prose ul { padding-left: 20px; } .prose li { margin: 4px 0; }
.prose p { margin: 4px 0; }

/* синхронизация */
.copy { display: flex; gap: 8px; margin: 10px 0; }
.copy input { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
pre { background: var(--bg); border-radius: 8px; padding: 12px; overflow-x: auto; }

/* вход */
.login { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: min(380px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); text-align: center; }
.login-card form { text-align: left; margin-top: 20px; }

@media (max-width: 960px) {
  .week { grid-template-columns: 1fr; } .day { min-height: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .top { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .top nav { order: 3; width: 100%; flex: none; }
  .top form { margin-left: auto; }
  .form-grid { grid-template-columns: 1fr; } .form-grid .wide { grid-column: auto; }
  h1 { font-size: 24px; } .prose { padding: 20px; }
  .quick { min-width: 100%; }
}
@media print {
  .top, .page-head .actions, .actions { display: none !important; }
  body { background: #fff; } .card { border: 0; box-shadow: none; }
}

/* инвестиции */
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); }
.right { text-align: right; }
.chart .cl { font-size: 12px; fill: var(--muted); }
ol { padding-left: 20px; } ol li { margin: 4px 0; }

/* --- Инвестиции: эмитенты, календарь --- */
.tag.warn { background: #fbe9e5; color: var(--red); }
@media (prefers-color-scheme: dark) { .tag.warn { background: #3a1f1a; } }
table.issuers td.share { min-width: 170px; white-space: nowrap; }
table.issuers td.share .bar { display: inline-block; width: 110px; height: 8px; margin-right: 8px; vertical-align: middle; }
tr.risk-high td { background: color-mix(in srgb, var(--red) 8%, transparent); }
tr.risk-high .bar i { background: var(--red); }
tr.risk-mid .bar i { background: var(--gold); }
tr.ev-key td { background: var(--gold-soft); }
tfoot td { border-top: 1px solid var(--line); padding-top: 8px; }
.nowrap { white-space: nowrap; }
.months { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 4px 0 12px; }
.month { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; min-width: 78px; }
.month span { color: var(--muted); font-size: 12px; }
.month b { font-size: 15px; }
h2 .small { font-weight: 400; margin-left: 6px; }

/* --- Инвестиции: действия и напоминания --- */
.actions-grid { align-items: start; }
.actions-grid h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 4px 0 8px; text-transform: uppercase; letter-spacing: .03em; }
.sugg { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 10px 0 10px 10px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.sugg.p1 { border-left-color: var(--red); }
.sugg-body { min-width: 0; }
.sugg-act { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.sugg-act .btn { width: 100%; white-space: nowrap; }
.add-reminder { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-reminder input[name=title] { flex: 1 1 220px; }
.add-reminder input[type=date] { flex: 0 0 150px; }
.done-list { margin: 6px 0; }
.done-list summary { cursor: pointer; padding: 4px 0; }
@media (max-width: 700px) { .sugg { flex-direction: column; } .sugg-act { flex-direction: row; } .sugg-act .btn { width: auto; } }

/* --- Цель --- */
.goal-hero { padding-top: 18px; }
.gh-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.gh-now { font-size: 40px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.gh-status { border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.gh-status.ok { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.gh-status.behind { background: var(--gold-soft); color: var(--ink); }
.gh-bar { height: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 14px 0 6px; }
.gh-bar i { display: block; height: 100%; min-width: 4px; background: linear-gradient(90deg, var(--gold), var(--green)); border-radius: 999px; }
.gh-bar.small-bar { height: 8px; margin: 6px 0 0; }
.gh-scale { display: flex; justify-content: space-between; }
.gh-line { margin: 12px 0 0; font-size: 15px; line-height: 1.5; }
.stat .bar { margin: 8px 0 4px; }
.goal-strip { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: center; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; margin-bottom: 16px; }
.goal-strip:hover { border-color: var(--gold); }
.goal-strip .gs-text { display: flex; flex-direction: column; }
.goal-strip .gs-text span { color: var(--muted); font-size: 13px; }
.goal-strip .gh-bar { grid-column: 1 / -1; }
.goal-strip .gs-go { color: var(--gold); font-size: 14px; font-weight: 600; grid-row: 1; grid-column: 2; }
.mbars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; }
.mbar { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.mbar-col { position: relative; width: 100%; height: 140px; background: var(--bg); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.mbar-col i { display: block; width: 100%; background: var(--gold); border-radius: 6px 6px 0 0; }
.mbar-col i.ok { background: var(--green); }
.mbar-plan { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--muted); z-index: 1; }
.mbar b { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mbar span { font-size: 11px; color: var(--muted); }
.mbar.cur .mbar-col { outline: 2px solid var(--gold); outline-offset: 1px; }
#gchart .ln-plan { fill: none; stroke: var(--gold); stroke-width: 2.5; }
#gchart .ln-need { fill: none; stroke: var(--green); stroke-width: 2; stroke-dasharray: 6 5; }
#gchart .tl { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 3 4; }
#gchart .gd { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
#gchart .gl { stroke: var(--line); stroke-width: 1; }
#gchart .cl { fill: var(--muted); font-size: 11px; }
.lg { display: inline-block; width: 14px; height: 0; border-top: 2.5px solid var(--gold); vertical-align: middle; margin: 0 4px 0 10px; }
.lg-need { border-top: 2px dashed var(--green); } .lg-target { border-top: 1.5px dashed var(--red); }
.whatif { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.whatif label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.whatif output { color: var(--ink); font-weight: 700; font-size: 18px; }
.whatif input[type=range] { width: 100%; accent-color: var(--gold); }
.whatif-res { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.whatif-res div { background: var(--bg); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; }
.whatif-res b { font-size: 24px; letter-spacing: -.02em; }
.whatif-res span { color: var(--muted); font-size: 12px; }
.goal-settings summary { cursor: pointer; list-style: none; }
.goal-settings summary::-webkit-details-marker { display: none; }
.goal-settings[open] summary { margin-bottom: 12px; }
@media (max-width: 700px) {
  .whatif, .whatif-res { grid-template-columns: 1fr; }
  .mbars { gap: 3px; } .mbar b { display: none; } .mbar-col { height: 100px; }
  .gh-now { font-size: 30px; }
}
