/* БАЗАР: Капитал — light fintech social UI inspired by finbazar.ru */

:root {
  --bg: #f4f6f8;
  --bg-elevated: #ffffff;
  --bg-soft: #eef2f6;
  --border: #e4e9ef;
  --border-strong: #d0d8e2;
  --text: #1a2332;
  --text-secondary: #5a6b7d;
  --text-muted: #8a97a8;
  --accent: #2f6fed;
  --accent-hover: #1f5ad4;
  --accent-soft: #e8f0fe;
  --green: #12a454;
  --green-soft: #e6f7ed;
  --red: #e53935;
  --red-soft: #fdecea;
  --orange: #f5a623;
  --orange-soft: #fff6e5;
  --purple: #7b61ff;
  --shadow-sm: 0 1px 2px rgba(26, 35, 50, 0.04);
  --shadow-md: 0 4px 16px rgba(26, 35, 50, 0.07);
  --shadow-lg: 0 12px 40px rgba(26, 35, 50, 0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --font: "Golos Text", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --header-h: 64px;
  --max: 1180px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #dce9ff 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e8fff3 0%, transparent 50%),
    var(--bg);
}

button,
input {
  font-family: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Header ───────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2f6fed 0%, #12a454 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(47, 111, 237, 0.35);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-chip {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  min-width: 88px;
}

.stat-chip .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-chip .value {
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-chip.accent {
  background: var(--accent-soft);
  border-color: #c9dbff;
}

.stat-chip.green {
  background: var(--green-soft);
  border-color: #bde9cf;
}

/* ── Layout ───────────────────────────────────────────── */

.app-main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .app-main {
    grid-template-columns: 1fr;
  }
  .side-col {
    order: -1;
  }
}

/* ── Cards ────────────────────────────────────────────── */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: 16px 18px;
}

.card + .card {
  margin-top: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-title .hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Tabs ─────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--bg-soft);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.tab-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

/* ── Hero / goal ──────────────────────────────────────── */

.hero {
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(47, 111, 237, 0.08), rgba(18, 164, 84, 0.08)),
    #fff;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.hero h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  color: var(--text-secondary);
  max-width: 52ch;
  font-size: 14px;
}

.day-badge {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.progress-wrap {
  margin-top: 16px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
}

.progress-bar {
  height: 10px;
  background: var(--bg-soft);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f6fed, #12a454);
  border-radius: var(--radius-pill);
  transition: width 0.35s ease;
}

.hero-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Capital win goal */
.goal-chip.won .value,
.goal-chip.won .label {
  color: #0a7a3e;
}

.goal-panel {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(47, 111, 237, 0.08), rgba(18, 164, 84, 0.08));
  border: 1px solid rgba(47, 111, 237, 0.18);
}

.goal-panel.won {
  background: linear-gradient(135deg, rgba(18, 164, 84, 0.12), rgba(18, 164, 84, 0.05));
  border-color: rgba(18, 164, 84, 0.35);
}

.goal-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.goal-panel-head strong {
  font-size: 14px;
}

.goal-panel-head span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary, #6b7785);
}

.goal-panel-head span.goal-won {
  color: #0a7a3e;
}

.goal-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.goal-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f6fed, #12a454);
  transition: width 0.35s ease;
}

.goal-bar-fill.won {
  background: linear-gradient(90deg, #12a454, #0a7a3e);
}

.goal-detail {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-secondary, #6b7785);
  line-height: 1.4;
}

/* ── Buttons ──────────────────────────────────────────── */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.25);
  box-shadow: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 111, 237, 0.28);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-soft);
}

.btn-buy {
  background: var(--green);
  color: #fff;
}

.btn-buy:hover:not(:disabled) {
  filter: brightness(0.95);
}

.btn-sell {
  background: var(--red);
  color: #fff;
}

.btn-sell:hover:not(:disabled) {
  filter: brightness(0.95);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 6px 10px;
}

.btn-ghost.btn-danger {
  color: var(--red, #c0392b);
  border: 1px solid rgba(192, 57, 43, 0.35);
  background: rgba(192, 57, 43, 0.06);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.btn-ghost.btn-danger:hover:not(:disabled) {
  background: rgba(192, 57, 43, 0.12);
  border-color: rgba(192, 57, 43, 0.55);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
}

/* ── Settings panel (PC terminal) ─────────────────────── */

.settings-block {
  padding: 4px 2px 12px;
  max-width: 520px;
}

.settings-lead {
  margin: 0 0 16px;
  color: var(--text-secondary, #6b7785);
  font-size: 14px;
  line-height: 1.45;
}

.settings-lead code {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 6px;
}

.settings-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border, #e2e6ec);
  background: var(--bg-soft, #f6f7f9);
}

.settings-card.danger {
  border-color: rgba(192, 57, 43, 0.22);
  background: rgba(192, 57, 43, 0.04);
}

.settings-card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
  flex: 1;
}

.settings-card-text strong {
  font-size: 14px;
  color: var(--text, #1a1f26);
}

.settings-card-text span {
  font-size: 13px;
  color: var(--text-secondary, #6b7785);
  line-height: 1.4;
}

/* ── Market / portfolio rows ──────────────────────────── */

.asset-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.asset-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.asset-row:hover {
  border-color: #c9dbff;
  box-shadow: var(--shadow-md);
}

.asset-main {
  min-width: 0;
}

.asset-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.ticker {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 3px 8px;
  font-family: var(--mono);
}

.asset-name {
  font-weight: 700;
  font-size: 14px;
}

.asset-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.risk-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 11px;
}

.risk-высокий {
  background: var(--red-soft);
  color: var(--red);
}

.risk-средний {
  background: var(--orange-soft);
  color: #b7791f;
}

.risk-низкий {
  background: var(--green-soft);
  color: var(--green);
}

.price-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.price {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.chg {
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.chg.up {
  color: var(--green);
}

.chg.down {
  color: var(--red);
}

.chg.flat {
  color: var(--text-muted);
}

.spark {
  display: block;
  width: 100%;
  max-width: 160px;
  height: 28px;
  margin-top: 6px;
}

.asset-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 132px;
}

.qty-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.qty-row input {
  width: 64px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.qty-row .qty-max {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--accent-soft);
}

.held-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

/* ── Portfolio summary ────────────────────────────────── */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border);
}

.metric .m-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric .m-value {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Feed / lessons (БАЗАР-style posts) ───────────────── */

.feed-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.post {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.post:last-child {
  border-bottom: 0;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2f6fed, #7b61ff);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}

.avatar.news {
  background: linear-gradient(145deg, #f5a623, #e53935);
}

.avatar.div {
  background: linear-gradient(145deg, #12a454, #2f6fed);
}

.post-author {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
}

.post-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  margin-left: 6px;
}

.post h3 {
  margin: 0 0 6px;
  font-size: 15px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.post p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.45;
}

.concept-pill {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  background: #f0ecff;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.news-card {
  background: linear-gradient(180deg, #fffaf0, #fff);
  border: 1px solid #ffe2b0;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.news-card .label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b7791f;
  margin-bottom: 4px;
}

.news-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.news-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Toast ────────────────────────────────────────────── */

.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #1a2332;
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: slideIn 0.25s ease;
}

.toast.ok {
  background: #0f3d28;
  border: 1px solid #1f8a4c;
}

.toast.err {
  background: #4a1515;
  border: 1px solid #c62828;
}

.toast.lesson {
  background: #1a2744;
  border: 1px solid #2f6fed;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Win banner ───────────────────────────────────────── */

.win-banner {
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--green-soft);
  border: 1px solid #bde9cf;
  color: #0d6b36;
  font-weight: 700;
}

.win-banner.show {
  display: block;
}

.year-delta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 13px;
}

.year-delta .yd-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.year-delta .yd-value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.year-delta .yd-value.up {
  color: var(--green);
}

.year-delta .yd-value.down {
  color: var(--red);
}

.year-delta .yd-value.flat {
  color: var(--text-secondary);
}

.end-banner {
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef2ff, #e6f7ed);
  border: 1px solid #c9dbff;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.end-banner.show {
  display: block;
}

.end-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

/* ── Onboarding / modal tip ───────────────────────────── */

.intro {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.intro strong {
  color: var(--text);
}

.footer-note {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px 20px 28px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Utility */
.up {
  color: var(--green);
}
.down {
  color: var(--red);
}
.tabular {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ── Era chip ─────────────────────────────────────────── */

.stat-chip.era-chip {
  background: linear-gradient(135deg, #efe9ff, #e8f0fe);
  border-color: #d4ccff;
}

.stat-chip.era-chip .value {
  color: #5b4db8;
}

/* ── Historical news ──────────────────────────────────── */

.news-card.historical {
  background: linear-gradient(180deg, #f3f0ff 0%, #fff 60%);
  border-color: #cfc4ff;
}

.news-card.historical.severity-crisis,
.news-card.historical.severity-crash,
.news-card.historical.severity-war {
  background: linear-gradient(180deg, #fdecea 0%, #fff 55%);
  border-color: #f5c0bd;
}

.news-card.historical.severity-boom,
.news-card.historical.severity-recovery {
  background: linear-gradient(180deg, #e6f7ed 0%, #fff 55%);
  border-color: #bde9cf;
}

.shock-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.shock-pill {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
}

.shock-pill.up {
  background: var(--green-soft);
  color: var(--green);
}

.shock-pill.down {
  background: var(--red-soft);
  color: var(--red);
}

/* ── Timeline ─────────────────────────────────────────── */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  transition: 0.15s ease;
}

.timeline-item.fired {
  border-color: #c9dbff;
  background: linear-gradient(90deg, #f5f8ff, #fff);
}

.timeline-item.current {
  border-color: #2f6fed;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.timeline-item.future {
  opacity: 0.72;
}

.timeline-item.future .tl-sub {
  filter: blur(0);
}

.tl-year {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.03em;
  color: var(--accent);
  padding-top: 2px;
}

.timeline-item.future .tl-year {
  color: var(--text-muted);
}

.tl-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.tl-top strong {
  font-size: 14px;
  letter-spacing: -0.02em;
}

.tl-icon {
  font-size: 16px;
}

.tl-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--text-muted);
}

.timeline-item.fired .tl-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.timeline-item.current .tl-badge {
  background: #fff3cd;
  color: #9a6b00;
}

.tl-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.tl-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.post-historical {
  background: linear-gradient(180deg, #faf8ff, #fff);
}

/* ── Event modal ──────────────────────────────────────── */

body.modal-open {
  overflow: hidden;
}

.event-modal[hidden] {
  display: none !important;
}

.event-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}

.event-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 28, 40, 0.55);
  backdrop-filter: blur(6px);
}

.event-modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: modalIn 0.28s ease;
}

.event-modal-card.mood-dark {
  background: linear-gradient(180deg, #fff5f5 0%, #fff 40%);
}

.event-modal-card.mood-hopeful {
  background: linear-gradient(180deg, #f0faf4 0%, #fff 40%);
}

.event-modal-card.mood-tense {
  background: linear-gradient(180deg, #f7f4ff 0%, #fff 40%);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.event-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.event-year {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.event-severity {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--text-secondary);
}

.event-severity.severity-crisis,
.event-severity.severity-crash,
.event-severity.severity-war {
  background: var(--red-soft);
  color: var(--red);
}

.event-severity.severity-boom,
.event-severity.severity-recovery {
  background: var(--green-soft);
  color: var(--green);
}

.event-modal-icon {
  font-size: 40px;
  line-height: 1;
  margin: 4px 0 8px;
}

.event-modal-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.event-sub {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.event-countries {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.country-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
}

.event-story {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.event-lesson-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.event-lesson-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--purple);
  margin-bottom: 4px;
}

.event-lesson-box p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.event-shocks {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.event-shocks-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  background: var(--bg-soft);
  color: var(--text-muted);
}

.event-shock-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
}

.event-shock-row.up {
  color: var(--green);
  background: rgba(18, 164, 84, 0.04);
}

.event-shock-row.down {
  color: var(--red);
  background: rgba(229, 57, 53, 0.04);
}

.event-modal-card .btn-primary {
  width: 100%;
}

@media (max-width: 720px) {
  .header-stats {
    display: none;
  }
  .timeline-item {
    grid-template-columns: 52px 1fr;
  }
}

/* ─── Кабинет 2000 extras ───────────────────────────────── */

.cabinet-main {
  align-items: start;
}

.desk-hero h1 {
  font-size: 20px;
  margin: 0 0 6px;
}

.cap-strip {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.market-hint {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef4ff;
  border: 1px solid #c9dbff;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary, #3d4f66);
  font-weight: 600;
}
.stat-chip.regime-crisis ~ .market-hint,
body:has(.regime-crisis) .market-hint {
  background: #fff0f0;
  border-color: #f0c0c0;
}
.stat-chip.regime-boom ~ .market-hint,
body:has(.regime-boom) .market-hint {
  background: #eef2ff;
  border-color: #c5d0ff;
}

.month-delta {
  margin-top: 10px;
  font-weight: 800;
  font-size: 14px;
}
.month-delta.up { color: var(--green); }
.month-delta.down { color: var(--red); }

.desk-frame {
  margin-top: 14px;
}

.monitor-bezel {
  background: linear-gradient(160deg, #2a3140, #1a1f2a);
  border-radius: 18px;
  padding: 12px 12px 18px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.06);
}

.monitor-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 10px;
  color: #9aa6b5;
  font-size: 12px;
  font-family: var(--mono);
}

.monitor-toolbar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.monitor-toolbar .dot.red { background: #ff5f57; }
.monitor-toolbar .dot.yel { background: #febc2e; }
.monitor-toolbar .dot.grn { background: #28c840; }
.mon-title { margin-left: 8px; opacity: 0.85; }

.monitor-screen {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 14px;
  min-height: 420px;
}

.trade-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
}

@media (max-width: 800px) {
  .trade-grid { grid-template-columns: 1fr; }
}

.watch-explain {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-secondary, #6b7785);
}

.ipo-upcoming {
  margin-top: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #f3f6fb;
  font-size: 11px;
  color: var(--text-secondary, #6b7785);
  line-height: 1.4;
}
.ipo-upcoming strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text, #1a2332);
}

.ticker-row .tdiv {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  color: #1a7f4b;
  background: #e8f5ee;
  padding: 1px 5px;
  border-radius: 4px;
}
.ticker-row .tgrowth {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  color: #3b5bdb;
  background: #eef2ff;
  padding: 1px 5px;
  border-radius: 4px;
}
.ticker-row.held {
  border-color: #9ed4b4;
}
.stat-chip.regime-crisis .value { color: var(--red, #c0392b); }
.stat-chip.regime-boom .value { color: #2f6fed; }

.ticker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
}

.ticker-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
}
.ticker-row .ticker {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  background: var(--bg-soft);
  padding: 4px 6px;
  border-radius: 6px;
}
.ticker-row .tname {
  grid-column: 2 / 4;
  grid-row: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.ticker-row .tprice {
  grid-column: 2;
  grid-row: 2;
  font-weight: 800;
  font-size: 13px;
}
.ticker-row .tchg {
  grid-column: 3;
  grid-row: 2;
  font-size: 11px;
  font-weight: 700;
  justify-self: end;
}
.ticker-row.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.ticker-row:hover { border-color: #c9dbff; }

.chart-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tf-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #0f1419;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.candle-chart {
  width: 100%;
  height: 300px;
  border-radius: 10px;
  display: block;
  background: #0f1419;
}

.chart-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.trade-panel {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft, #f6f8fb);
}
.trade-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.trade-presets-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted, #6b7785);
  margin-right: 2px;
  min-width: 52px;
}
.trade-preset {
  min-width: 40px;
  padding: 6px 8px !important;
  font-weight: 700;
}
.trade-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.trade-qty-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary, #5a6b7d);
}
.trade-bar input {
  width: 80px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 700;
}
.trade-bar .btn-buy,
.trade-bar .btn-sell {
  min-width: 88px;
  min-height: 36px;
  font-weight: 800;
}
.trade-preview {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary, #5a6b7d);
  font-weight: 600;
}
.trade-reason {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--red, #c0392b);
}
.trade-reason:not([hidden]) {
  display: block;
}

.news-list { max-height: 70vh; overflow: auto; }
.news-lead-hint {
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary, #3d4f66);
  background: #eef4ff;
  border-radius: 8px;
  border: 1px solid #c9dbff;
}
.news-item {
  position: relative;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.news-item h3 {
  margin: 0 0 6px;
  font-size: 14px;
  padding-right: 92px;
}
.news-item p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.news-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 10px;
  font-weight: 800;
  color: #2f6fed;
  background: #e8efff;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.news-tags {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}
.news-item.tone-fear { background: linear-gradient(90deg, #fdecea, transparent); }
.news-item.tone-hype { background: linear-gradient(90deg, #e6f7ed, transparent); }
.news-item.tone-macro { background: linear-gradient(90deg, #fff6e5, transparent); }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  align-items: stretch;
}
.shop-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-soft);
  box-sizing: border-box;
}
.shop-card.owned { opacity: 0.75; }
.shop-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  flex: 0 0 auto;
}
.shop-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  flex: 1 1 auto;
}
.shop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  flex: 0 0 auto;
}
.owned-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--green);
}

.hold-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

code {
  font-family: var(--mono);
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ─── 2D World room / PC modes ─────────────────────────── */

html, body.world-body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0e14;
}

.room-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: none;
}
.room-layer.active {
  display: block;
}

#room-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  image-rendering: pixelated;
}

.room-hint-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: #dce4ef;
  font-size: 12px;
  pointer-events: none;
  z-index: 2;
}
.room-hint-bar strong {
  color: #fff;
  font-size: 13px;
}

.pc-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  background: rgba(8, 10, 16, 0.92);
  overflow: auto;
}
.pc-layer.active {
  display: block;
}

.pc-chrome {
  min-height: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 12px 24px;
}

.pc-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1c2330;
  border-radius: 12px 12px 0 0;
  padding: 10px 14px;
  border: 1px solid #2a3344;
  border-bottom: 0;
}
.pc-dots span {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  background: #555;
}
.pc-dots span:nth-child(1) { background: #ff5f57; }
.pc-dots span:nth-child(2) { background: #febc2e; }
.pc-dots span:nth-child(3) { background: #28c840; }
.pc-top-title {
  flex: 1;
  color: #9aa6b5;
  font-family: var(--mono);
  font-size: 12px;
}
.pc-body {
  background: var(--bg);
  border-radius: 0 0 12px 12px;
  border: 1px solid #2a3344;
  min-height: calc(100vh - 80px);
}
.pc-header {
  position: sticky;
  top: 0;
}
.pc-body .app-main {
  padding-bottom: 40px;
}

body.world-body .toast-host {
  z-index: 100;
}
