:root {
  /* Приват24 lightGreen */
  color-scheme: light;
  --bg: #f0f3f4;
  --card: #fff;
  --text: rgba(0, 0, 0, 0.96);
  --muted: rgba(0, 0, 0, 0.54);
  --line: rgba(0, 0, 0, 0.15);
  --green: #4ea524;
  --green-hover: #53b125;
  --green-pressed: #499b22;
  --green-dark: #3b7d1c;
  --ink: #1e2527;
  --gray: #a3acae;
  --accent: #4ea524;
  --red: #f53d46;
  --red-text: #d22d35;
  --warn: #ffb300;
  --blue: #008ffe;
  --on-accent: #fff;
  --overlay: rgba(30, 37, 39, 0.6);
  --shadow: 0 8px 24px rgba(30, 37, 39, 0.08);
  --tone-sell: rgba(78, 165, 36, 0.16);
  --tone-buy: rgba(0, 143, 254, 0.14);
  --tone-wait: rgba(30, 37, 39, 0.05);
  --tone-bad: rgba(245, 61, 70, 0.12);
  font-family: Manrope, Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  /* Приват24 darkGreen */
  color-scheme: dark;
  --bg: #15191a;
  --card: #1e2527;
  --text: rgba(255, 255, 255, 0.96);
  --muted: rgba(255, 255, 255, 0.54);
  --line: rgba(255, 255, 255, 0.15);
  --green: #4ea524;
  --green-hover: #53b125;
  --green-pressed: #499b22;
  --green-dark: #9ed91f;
  --ink: #f4f6f6;
  --gray: #a3acae;
  --accent: #4ea524;
  --red: #f53d46;
  --red-text: #fa7a80;
  --warn: #ffb300;
  --blue: #008ffe;
  --on-accent: #fff;
  --overlay: rgba(0, 0, 0, 0.72);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --tone-sell: rgba(78, 165, 36, 0.22);
  --tone-buy: rgba(0, 143, 254, 0.2);
  --tone-wait: rgba(255, 255, 255, 0.06);
  --tone-bad: rgba(245, 61, 70, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

.pb-strip {
  height: 4px;
  background: var(--green);
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px 48px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 16px 24px 12px;
}

.top-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.top-actions .icon-btn {
  background: var(--card);
}

.icon-btn.is-busy svg {
  animation: spin 0.8s linear infinite;
}

.icon-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
}

h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.badge {
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  text-align: right;
  line-height: 1.25;
}

.badge.green {
  background: var(--green);
  color: var(--on-accent);
}

.badge.gray {
  background: var(--tone-wait);
  color: var(--muted);
}

.rates .hot span {
  color: var(--green-dark);
  font-weight: 700;
}

.rates .hot b {
  color: var(--green);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.card,
.rates,
.chart-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card {
  padding: 12px;
}

.card span,
.rates span,
.meta,
.calc-out span {
  color: var(--muted);
  font-size: 12px;
}

.card strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.rates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
  padding: 12px 14px;
  gap: 12px;
}

.cross-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.cross-panel[hidden] {
  display: none;
}

.cross-panel span {
  color: var(--muted);
  font-size: 12px;
}

.cross-panel b {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 800;
}

.cross-panel .hint {
  margin: 4px 0 0;
}

.cross-panel.cross-hot {
  background: var(--tone-buy);
  border-color: transparent;
}

.cross-panel.cross-night {
  background: var(--tone-wait);
}

.rates b {
  display: block;
  margin-top: 4px;
}

.insights {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 8px;
}

.insights[hidden] {
  display: none;
}

.insight {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.insight-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--tone-wait);
  color: var(--muted);
}

.insight-copy {
  min-width: 0;
}

.insight-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.insight-title {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
}

.insight-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.insight--go {
  background: var(--tone-sell);
  border-color: transparent;
}

.insight--go .insight-icon {
  background: var(--green);
  color: var(--on-accent);
}

.insight--go .insight-title {
  color: var(--green-dark);
}

.insight--buy {
  background: var(--tone-buy);
  border-color: transparent;
}

.insight--buy .insight-icon {
  background: var(--blue);
  color: var(--on-accent);
}

.insight--buy .insight-title {
  color: var(--blue);
}

.insight--wait .insight-icon,
.insight--meh .insight-icon {
  background: var(--tone-wait);
  color: var(--muted);
}

.insight--bad {
  background: var(--tone-bad);
  border-color: transparent;
}

.insight--bad .insight-icon {
  background: var(--red);
  color: var(--on-accent);
}

.insight--bad .insight-title {
  color: var(--red-text);
}

.chart-panel {
  margin-top: 14px;
  padding: 16px;
}

.charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.charts .chart-panel {
  margin-top: 0;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.chart-head h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.chart-head .hint {
  margin: 0;
}

.predict-btn {
  color: var(--green-dark);
}

.predict-warn {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 179, 0, 0.16);
  border: 1px solid rgba(255, 179, 0, 0.45);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.predict-dir {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--green-dark);
}

.predict-now {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.predict-now b {
  color: var(--text);
  font-size: 20px;
}

.predict-factors-title {
  margin: 16px 0 8px;
  font-size: 13px;
  color: var(--muted);
}

#predictFactors {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
}

.chart-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.chart-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.chart-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.settings-wrap {
  position: relative;
  flex: none;
}

.info-wrap {
  position: relative;
  flex: none;
}

.info-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 21;
  width: min(320px, calc(100vw - 32px));
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.info-pop::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 10px;
}

.info-pop[hidden] {
  display: none;
}

.info-pop .chart-hint {
  margin: 0 0 10px;
}

.info-pop .favor-legend {
  margin: 0;
}

.icon-btn {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.icon-btn[aria-expanded="true"] {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-accent);
}

.settings-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: min(340px, calc(100vw - 32px));
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.settings-menu[hidden] {
  display: none;
}

.settings-title {
  margin: 12px 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-title:first-child {
  margin-top: 0;
}

.settings-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  font-size: 14px;
  cursor: pointer;
}

.settings-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.settings-pills button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

.settings-pills button.on {
  background: var(--green);
  color: var(--on-accent);
  border-color: var(--green);
}

.favor-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leg::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.leg.profit::before {
  background: var(--green);
}

.leg.zero::before {
  background: var(--warn);
}

.leg.low::before {
  background: rgba(78, 165, 36, 0.4);
}

.btn-modal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  border: 0;
  border-radius: 12px;
  padding: 8px 12px;
  background: var(--green);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
}

.btn-modal svg {
  flex-shrink: 0;
}

.btn-modal:hover {
  background: var(--green-hover);
}

.btn-modal:active {
  background: var(--green-pressed);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: var(--overlay);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(520px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px 20px 16px 16px;
  padding: 18px 18px 22px;
  box-shadow: 0 24px 80px rgba(30, 37, 39, 0.28);
}

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

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.calc-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 4px 14px 4px 4px;
}

.calc-input-wrap:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(78, 165, 36, 0.28);
}

.calc-field input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 12px 12px 14px;
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

.calc-field input::-webkit-outer-spin-button,
.calc-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calc-suffix {
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.calc-out {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.calc-out > div,
.calc-loss {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.calc-out b,
.calc-loss b {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.calc-loss {
  grid-column: 1 / -1;
}

.calc-loss b {
  color: var(--red-text);
}

.analysis {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.analysis h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.analysis ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.analysis li {
  margin: 0 0 8px;
  line-height: 1.45;
  border-radius: 12px;
  padding: 8px 10px;
}

.analysis li.tone-sell,
.analysis li.tone-both {
  background: var(--tone-sell);
}

.analysis li.tone-buy {
  background: var(--tone-buy);
}

.analysis li.tone-wait {
  background: var(--tone-wait);
}

.chart-tip {
  position: fixed;
  z-index: 40;
  max-width: 280px;
  padding: 10px 12px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--green);
  border-radius: 12px;
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: 13px;
  line-height: 1.35;
}

.chart-tip[hidden] {
  display: none;
}

.chart-tip-title {
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--green);
}

.chart-tip-text {
  margin: 0;
  color: var(--text);
}

.periods {
  display: flex;
  gap: 8px;
  margin: 14px 0 0;
}

.periods button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 0;
  cursor: pointer;
}

.periods button.on {
  background: var(--green);
  color: var(--on-accent);
  border-color: var(--green);
}

.chart-hint {
  margin: 10px 0 0;
}

.tv-chart {
  height: 280px;
  width: 100%;
}

.meta {
  margin-top: 14px;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 24px;
  }

  .modal {
    border-radius: 20px;
  }
}

@media (min-width: 1100px) {
  .wrap {
    max-width: min(1440px, calc(100vw - 96px));
  }

  .charts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
    align-items: stretch;
  }

  .charts .chart-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .charts .tv-chart {
    flex: 1;
    height: min(46vh, 440px);
    min-height: 320px;
  }
}

.view-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}

.view-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.view-tab.on {
  background: var(--green);
  color: var(--on-accent);
}

.account-view {
  display: grid;
  gap: 20px;
  margin-bottom: 8px;
}

.account-login,
.account-body > section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.account-login h2,
.account-body h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.account-user {
  margin: 0 0 12px;
  font-weight: 700;
}

.account-actions,
.account-goal-edit,
.account-balances {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.btn-primary,
.btn-ghost {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: var(--green);
  color: var(--on-accent);
}

.btn-primary[data-tone="buy"] {
  background: var(--blue);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.account-check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  width: 100%;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.progress-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#accProgressPct {
  font-size: 28px;
  font-weight: 800;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--tone-wait);
  overflow: hidden;
}

.progress-bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--green-dark));
  border-radius: inherit;
  transition: width 0.25s ease;
}

.bal-grid,
.tx-forms {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  width: 100%;
  margin-bottom: 10px;
}

.tx-form {
  display: grid;
  gap: 8px;
  align-content: start;
}

.account-flash {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--tone-sell);
  font-weight: 600;
}

.account-flash.err {
  background: var(--tone-bad);
}

.next-hint {
  margin: 0 0 10px;
  font-weight: 700;
}

.next-plans {
  display: grid;
  gap: 8px;
}

.next-plan {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--tone-wait);
  font-size: 13px;
  line-height: 1.4;
}

.next-plan b {
  display: block;
  margin-bottom: 4px;
}

.tx-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.tx-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--tone-wait);
  font-size: 13px;
}

@media (max-width: 640px) {
  .top {
    flex-wrap: wrap;
    padding: 14px 16px 8px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .view-tabs {
    order: -1;
    width: 100%;
  }

  .badge {
    white-space: normal;
    max-width: none;
    flex: 1;
    min-width: 0;
  }

  .btn-modal {
    flex: none;
    width: 42px;
    height: 42px;
    padding: 0;
    gap: 0;
    border-radius: 14px;
  }

  .btn-modal-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .cards,
  .calc-out,
  .rates,
  .cross-panel {
    grid-template-columns: 1fr;
  }

  .tv-chart {
    height: 240px;
  }

  .chart-bar {
    align-items: stretch;
  }
}
