:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --bg-strong: #eceff3;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --text: #18212f;
  --text-strong: #0b1220;
  --muted: #657386;
  --line: #d7dee7;
  --line-strong: #b9c4d1;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --brand-soft: #e3f5f1;
  --accent: #b7791f;
  --accent-soft: #fff4d8;
  --good: #146c43;
  --good-soft: #dcf8e8;
  --bad: #b42345;
  --bad-soft: #ffe4e9;
  --warning: #946200;
  --shadow: 0 12px 34px rgba(20, 31, 44, 0.08);
  --elevate: 0 10px 22px rgba(20, 31, 44, 0.12);
  --on-brand: #ffffff;
  --input-bg: #ffffff;
  --track-bg: #e6ebf0;
  --skeleton-bg: #eef2f6;
  --scrim: rgba(11, 18, 32, 0.5);
  --hover-tint: rgba(15, 118, 110, 0.06);
  --toast-bg: #111827;
  --toast-text: #ffffff;
  --app-gradient: linear-gradient(180deg, #eef4f3 0, #f7f8fa 260px, var(--bg) 100%);
  --metric-grad: linear-gradient(180deg, #ffffff, #fbfcfd);
  --chart-bg: linear-gradient(180deg, rgba(227, 245, 241, 0.42), rgba(255, 255, 255, 0.94) 42%), #ffffff;
  --topbar-tint: #eefaf7;
  --mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Fira Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
}

/* OLED-friendly dark "terminal" theme (Financial Dashboard palette) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060b16;
  --bg-strong: #0b1220;
  --panel: #0e1626;
  --panel-soft: #111b2e;
  --text: #e6edf7;
  --text-strong: #f6f9ff;
  --muted: #93a1b8;
  --line: #22304a;
  --line-strong: #33425e;
  --brand: #0f766e;
  --brand-strong: #34d3c4;
  --brand-soft: #10312f;
  --accent: #f5b841;
  --accent-soft: #33280f;
  --good: #34d399;
  --good-soft: #10311f;
  --bad: #fb7185;
  --bad-soft: #3a1522;
  --warning: #fbbf24;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  --elevate: 0 12px 28px rgba(0, 0, 0, 0.55);
  --on-brand: #ffffff;
  --input-bg: #0c1524;
  --track-bg: #1b2740;
  --skeleton-bg: #16223c;
  --scrim: rgba(2, 6, 16, 0.68);
  --hover-tint: rgba(52, 211, 153, 0.08);
  --toast-bg: #1b2740;
  --toast-text: #f6f9ff;
  --app-gradient: radial-gradient(1200px 520px at 50% -10%, #0c1a2b 0, transparent 70%), var(--bg);
  --metric-grad: linear-gradient(180deg, #101a2c, #0c1422);
  --chart-bg: linear-gradient(180deg, rgba(52, 211, 153, 0.06), transparent 55%), var(--panel);
  --topbar-tint: #0c1a24;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--app-gradient);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
}

.topbar,
.app-shell {
  width: 100%;
  max-width: none;
  margin-right: auto;
  margin-left: auto;
  padding-right: clamp(18px, 2.4vw, 34px);
  padding-left: clamp(18px, 2.4vw, 34px);
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-top: 26px;
  padding-bottom: 14px;
}

.portal-mode .topbar {
  display: none;
}

.portal-mode .portal-view {
  min-height: 100vh;
  padding-top: clamp(22px, 8vh, 76px);
}

.brand-lockup {
  min-width: 0;
}

.topbar h1,
.panel h2,
.portfolio-name {
  margin: 0;
  color: var(--text-strong);
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 36px;
  line-height: 1.05;
}

.header-copy {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions,
.tabs,
.inline-form,
.panel-heading,
.metric,
.asset-chip,
.row-actions,
.coin-line,
.portfolio-header,
.toolbar-inline {
  display: flex;
  align-items: center;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.app-shell {
  margin-bottom: 48px;
}

.workspace {
  display: grid;
  gap: 10px;
}

@media (min-width: 981px) {
  body:not(.portal-mode) {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  body:not(.portal-mode) .topbar {
    flex: 0 0 auto;
  }

  body:not(.portal-mode) .app-shell {
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
    overflow: hidden;
  }

  body:not(.portal-mode) .workspace,
  body:not(.portal-mode) #adminView.view.is-active {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body:not(.portal-mode) #userView.view.is-active {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 28px;
    scrollbar-gutter: stable;
  }

  body:not(.portal-mode) .master-shell {
    height: 100%;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
  }

  body:not(.portal-mode) .master-sidebar {
    position: static;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  body:not(.portal-mode) .master-content {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    padding-bottom: 28px;
    scrollbar-gutter: stable;
  }
}

.portal-view {
  display: grid;
  place-items: start center;
  min-height: calc(100vh - 150px);
  padding-top: clamp(18px, 5vh, 58px);
}

.portal-panel {
  width: min(520px, 100%);
}

.portal-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.portal-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.portal-role.is-active {
  color: #ffffff;
  background: var(--brand);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.portal-role svg {
  width: 17px;
  height: 17px;
}

.portal-form {
  display: grid;
  gap: 12px;
}

.portal-form .form-submit {
  width: 100%;
}

.portal-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  color: var(--brand-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  font-weight: 900;
  text-decoration: none;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.portal-link:hover {
  background: var(--brand-soft);
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 8px 18px rgba(20, 31, 44, 0.09);
}

.portal-link svg {
  width: 17px;
  height: 17px;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: end;
}

.captcha-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.captcha-box {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-strong);
  background: var(--panel-soft);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 4px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  min-width: 0;
}

.tab,
.icon-button,
.primary-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.tab {
  gap: 8px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  min-width: 0;
}

.tab.is-active {
  color: #ffffff;
  background: var(--brand);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.tab svg,
.primary-button svg,
.ghost-button svg,
.danger-button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  color: var(--brand-strong);
  background: var(--panel);
  border: 1px solid var(--line);
}

.primary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--brand);
}

.ghost-button {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.danger-button {
  color: var(--bad);
  background: var(--bad-soft);
}

.tab:hover,
.icon-button:hover,
.primary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(20, 31, 44, 0.12);
}

.market-strip {
  display: grid;
  gap: 0;
  overflow: hidden;
  margin: 14px 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.market-mode-tabs {
  display: inline-flex;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.market-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.market-mode svg {
  width: 16px;
  height: 16px;
}

.market-mode:hover {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.market-mode.is-active {
  color: #ffffff;
  background: var(--brand);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.market-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.market-list-head,
.market-row {
  display: grid;
  grid-template-columns: 44px minmax(220px, 1fr) minmax(140px, auto) minmax(90px, auto) minmax(160px, auto);
  gap: 12px;
  align-items: center;
}

.market-list-head {
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.market-list-head span:first-child {
  grid-column: 2;
}

.market-row {
  position: relative;
  min-height: 66px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.market-row:hover {
  background: #f4fbf9;
}

.market-row:focus-visible,
.market-result:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: -3px;
}

.market-row.is-selected,
.market-result.is-selected {
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}

.favorite-button {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.favorite-button:hover,
.favorite-button.is-active {
  color: var(--accent);
  border-color: rgba(183, 121, 31, 0.22);
  background: var(--accent-soft);
}

.favorite-button svg {
  width: 17px;
  height: 17px;
}

.favorite-button.is-active svg {
  fill: currentColor;
}

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

.market-pair strong {
  display: block;
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 900;
}

.market-pair > div > span {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-price {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.market-price svg {
  width: 16px;
  height: 16px;
}

.market-price.price-up {
  color: var(--good);
  animation: pricePopUp 0.78s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.market-price.price-down {
  color: var(--bad);
  animation: pricePopDown 0.78s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.market-price.price-flat svg {
  opacity: 0.35;
}

.market-row .source-line {
  margin: 0;
  white-space: nowrap;
}

.market-detail-panel {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(20, 31, 44, 0.06);
}

.market-detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.market-detail-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.market-detail-title > div > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.market-detail-title h3 {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 24px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-detail-live {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.market-detail-price {
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
}

.market-detail-price.price-up {
  color: var(--good);
  animation: pricePopUp 0.78s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.market-detail-price.price-down {
  color: var(--bad);
  animation: pricePopDown 0.78s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.market-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 14px;
  align-items: stretch;
}

.candle-panel {
  min-width: 0;
}

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

.candle-topline span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.candle-topline strong {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 900;
}

.candle-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.candle-control {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--input-bg);
  font-size: 12px;
  font-weight: 900;
}

.candle-control:hover,
.candle-control.is-active {
  color: #ffffff;
  border-color: var(--brand);
  background: var(--brand);
}

.candle-chart-frame {
  min-height: 320px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.candle-svg {
  display: block;
  width: 100%;
  height: 300px;
}

.candle-grid {
  stroke: #e7edf3;
  stroke-width: 1;
}

.candle-axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.candle-wick {
  stroke-width: 1.7;
  stroke-linecap: round;
}

.candle-body {
  stroke-width: 1;
}

.candle-up {
  fill: rgba(20, 108, 67, 0.85);
  stroke: var(--good);
}

.candle-down {
  fill: rgba(180, 35, 69, 0.86);
  stroke: var(--bad);
}

.candle-empty {
  display: grid;
  place-items: center;
  min-height: 300px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  font-weight: 900;
  text-align: center;
}

.market-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.market-stat-grid div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(249, 250, 251, 0.92);
}

.market-stat-grid dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.market-stat-grid dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
}

.price-tile {
  min-width: 0;
  min-height: 86px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  box-shadow: 0 6px 18px rgba(20, 31, 44, 0.04);
}

.price-tile .coin-line {
  justify-content: space-between;
  gap: 10px;
}

.price {
  margin-top: 8px;
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
}

.source-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coin-color, var(--brand));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.78);
}

.coin-logo {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 50%;
  color: #ffffff;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.34), transparent 38%),
    var(--coin-color, var(--brand));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.coin-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1px;
  border-radius: inherit;
  background: #ffffff;
}

.coin-logo-lg {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.coin-logo-xl {
  width: 42px;
  height: 42px;
  font-size: 15px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.82);
}

.symbol {
  color: var(--text-strong);
  font-weight: 900;
}

.change,
.status-pill,
.code-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.status-pill {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.change.positive,
.code-pill.positive {
  color: var(--good);
  background: var(--good-soft);
}

.change.negative,
.code-pill.negative {
  color: var(--bad);
  background: var(--bad-soft);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-chip.is-active {
  color: var(--good);
  background: var(--good-soft);
}

.status-chip.is-paused {
  color: var(--warning);
  background: var(--accent-soft);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.compact-panel {
  max-width: 620px;
}

.panel-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 19px;
  line-height: 1.2;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
}

.master-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.master-sidebar {
  position: sticky;
  top: 58px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.master-menu-item {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
  text-align: left;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.master-menu-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.master-menu-item:hover {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.master-menu-item.is-active {
  color: #ffffff;
  background: var(--brand);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.master-content {
  min-width: 0;
}

.master-section {
  display: none;
}

.master-section.is-active {
  display: block;
}

.span-2 {
  grid-column: 1 / -1;
}

.metrics-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.55fr);
  gap: 18px;
  margin-top: 18px;
}

.dashboard-chart-panel,
.dashboard-detail-panel {
  min-height: 360px;
}

.asset-chart {
  display: grid;
  gap: 12px;
}

.asset-chart-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.asset-chart-list {
  display: grid;
  gap: 10px;
}

.asset-chart-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.35fr) minmax(160px, 1fr) minmax(120px, auto) minmax(80px, auto);
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-soft);
  text-align: left;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.asset-chart-row:hover,
.asset-chart-row.is-active {
  border-color: rgba(15, 118, 110, 0.28);
  background: var(--brand-soft);
  box-shadow: 0 8px 18px rgba(20, 31, 44, 0.08);
}

.asset-chart-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 900;
}

.asset-chart-track {
  position: relative;
  display: block;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track-bg);
}

.asset-chart-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--bar-width, 0%);
  min-width: 6px;
  border-radius: inherit;
}

.asset-chart-bar.positive {
  background: var(--good);
}

.asset-chart-bar.negative {
  background: var(--bad);
}

.asset-detail-stack {
  display: grid;
  gap: 14px;
}

.asset-detail-hero {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.asset-detail-hero h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 24px;
  line-height: 1.1;
}

.asset-detail-hero strong {
  font-family: var(--mono);
  font-size: 20px;
}

.asset-mini-chart {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--good);
  background:
    linear-gradient(180deg, rgba(20, 108, 67, 0.05), transparent),
    var(--panel-soft);
}

.asset-mini-chart.negative {
  color: var(--bad);
  background:
    linear-gradient(180deg, rgba(180, 35, 69, 0.05), transparent),
    var(--panel-soft);
}

.chart-topline,
.chart-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chart-topline span,
.chart-legend span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.chart-topline strong {
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 15px;
}

.asset-mini-chart svg {
  display: block;
  width: 100%;
  min-height: 150px;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  filter: drop-shadow(0 6px 9px rgba(15, 118, 110, 0.14));
}

.asset-mini-chart.negative .chart-line {
  filter: drop-shadow(0 6px 9px rgba(180, 35, 69, 0.12));
}

.chart-fill {
  color: currentColor;
}

.chart-baseline {
  stroke: var(--line-strong);
  stroke-dasharray: 5 5;
  stroke-width: 1.4;
}

.chart-dot {
  fill: var(--panel);
  stroke: currentColor;
  stroke-width: 3;
}

.chart-dot.is-live {
  fill: currentColor;
}

.graph-screen {
  display: grid;
  gap: 14px;
}

.graph-heading {
  align-items: flex-start;
}

.graph-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.graph-filters label {
  display: grid;
  gap: 5px;
  min-width: 148px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.graph-filters select {
  min-height: 38px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-strong);
  background: var(--input-bg);
  font-weight: 900;
}

.graph-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.graph-summary-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.graph-summary-item span,
.graph-summary-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.graph-summary-item strong {
  display: block;
  margin: 7px 0 5px;
  overflow-wrap: anywhere;
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.2;
}

.graph-summary-item.positive strong {
  color: var(--good);
}

.graph-summary-item.negative strong {
  color: var(--bad);
}

.graph-daily-chart {
  min-height: 390px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chart-bg);
}

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

.graph-chart-topline span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.graph-chart-topline strong {
  display: block;
  margin-top: 4px;
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 22px;
}

.daily-close-svg {
  display: block;
  width: 100%;
  height: 330px;
  color: var(--good);
}

.daily-close-svg.negative {
  color: var(--bad);
}

.daily-grid-line {
  stroke: #e6edf3;
  stroke-width: 1;
}

.daily-zero-line {
  stroke: var(--line-strong);
  stroke-dasharray: 6 6;
  stroke-width: 1.4;
}

.daily-chart-line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  filter: drop-shadow(0 8px 12px rgba(15, 118, 110, 0.12));
}

.daily-close-svg.negative .daily-chart-line {
  filter: drop-shadow(0 8px 12px rgba(180, 35, 69, 0.12));
}

.daily-chart-fill {
  fill: currentColor;
  opacity: 0.12;
}

.daily-chart-dot {
  fill: #ffffff;
  stroke: currentColor;
  stroke-width: 3;
}

.daily-chart-dot.is-live {
  fill: currentColor;
}

.daily-axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.graph-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

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

.section-title-row h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 16px;
}

.graph-table-wrap {
  max-height: 360px;
  overflow: auto;
}

.graph-asset-breakdown {
  display: grid;
  gap: 8px;
}

.graph-breakdown-row {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) minmax(86px, auto) minmax(96px, auto) minmax(118px, auto);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 900;
}

.graph-breakdown-row span:not(.asset-chip),
.graph-breakdown-row strong {
  font-family: var(--mono);
  white-space: nowrap;
}

.asset-mini-chart text {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
}

.asset-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.asset-detail-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.asset-detail-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.asset-detail-grid dd {
  margin: 5px 0 0;
  color: var(--text-strong);
  font-family: var(--mono);
  font-weight: 700;
}

.asset-detail-note {
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-size: 13px;
  font-weight: 900;
}

.metric {
  align-items: flex-start;
  justify-content: space-between;
  min-height: 104px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--metric-grad);
}

.metric strong {
  display: block;
  margin-top: 7px;
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.metric small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--brand);
}

.metric.tone-good .metric-icon {
  background: var(--good);
}

.metric.tone-bad .metric-icon {
  background: var(--bad);
}

.metric.tone-accent .metric-icon {
  color: var(--text-strong);
  background: var(--accent-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.coin-picker-field {
  position: relative;
}

.coin-search-results {
  position: absolute;
  top: calc(100% - 6px);
  right: 0;
  left: 0;
  z-index: 20;
  display: grid;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.coin-result,
.market-result {
  min-width: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.coin-result {
  display: grid;
  grid-template-columns: minmax(76px, auto) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 9px;
  border-radius: 8px;
}

.coin-result:hover {
  background: var(--brand-soft);
}

.coin-result small {
  color: var(--muted);
  font-weight: 900;
}

.coin-result-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.market-search-field {
  margin-bottom: 14px;
}

.market-results {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.market-result {
  display: grid;
  grid-template-columns: 34px minmax(74px, auto) minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  cursor: pointer;
}

.market-result:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--brand-soft);
}

.market-result strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-result-price {
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.transactions-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.35fr) minmax(180px, 0.35fr);
  gap: 10px;
  margin-bottom: 12px;
}

.transaction-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.transactions-table-wrap {
  border-radius: 8px;
}

.transactions-table th,
.transactions-table td {
  vertical-align: middle;
}

.transaction-row td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.transaction-row td > strong {
  display: block;
  color: var(--text-strong);
  font-weight: 900;
  line-height: 1.2;
}

.transaction-row td > span,
.transaction-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.transaction-row .asset-chip {
  align-items: center;
}

.transaction-row .asset-chip strong {
  display: block;
  color: var(--text-strong);
  font-size: 13px;
  line-height: 1.1;
}

.compact-empty {
  min-height: 54px;
}

.inline-form {
  gap: 12px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--input-bg);
  outline: none;
}

input::placeholder {
  color: #96a1b2;
  font-weight: 700;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.wide,
.form-submit {
  grid-column: 1 / -1;
}

.form-submit {
  justify-self: start;
}

.form-hint {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

tbody tr {
  transition: background 0.16s ease;
}

tbody tr:hover {
  background: #f6fbfa;
}

tbody tr:last-child td {
  border-bottom: 0;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.asset-chip {
  gap: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.positive-text {
  color: var(--good);
  font-weight: 900;
}

.negative-text {
  color: var(--bad);
  font-weight: 900;
}

.row-actions {
  justify-content: flex-end;
  gap: 8px;
}

.portfolio-space {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.portfolio-header {
  justify-content: space-between;
  gap: 14px;
}

.portfolio-name {
  font-size: 25px;
  line-height: 1.15;
}

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

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
}

.allocation-list,
.performance-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  font-size: 13px;
  font-weight: 900;
}

.bar-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track-bg);
}

.bar-fill {
  width: var(--bar-width, 0%);
  min-width: 3px;
  height: 100%;
  border-radius: inherit;
  background: var(--coin-color, var(--brand));
}

.bar-fill.positive {
  background: var(--good);
}

.bar-fill.negative {
  background: var(--bad);
}

/* Investor portfolio enhancements */
.portfolio-hero {
  position: relative;
  overflow: hidden;
}

.portfolio-hero::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: radial-gradient(1100px 220px at 100% -40%, rgba(15, 118, 110, 0.1), transparent 70%);
}

.portfolio-hero.hero-down::before {
  background: radial-gradient(1100px 220px at 100% -40%, rgba(180, 35, 69, 0.09), transparent 70%);
}

.hero-value {
  display: grid;
  justify-items: end;
  gap: 6px;
  text-align: right;
}

.hero-value > strong {
  font-size: 30px;
  line-height: 1;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.hero-value .change {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-value .change svg {
  width: 15px;
  height: 15px;
}

.highlight-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.highlight-card {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.highlight-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.highlight-label svg {
  width: 14px;
  height: 14px;
  color: var(--brand);
}

.highlight-card strong {
  font-size: 20px;
  color: var(--text-strong);
}

.highlight-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.investor-graph-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg-group {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.seg-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn.is-active {
  color: #ffffff;
  background: var(--brand);
}

.investor-graph-summary:empty {
  display: none;
}

.investor-graph-summary {
  margin-bottom: 12px;
}

.allocation-donut {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.donut-chart {
  position: relative;
  width: 168px;
  height: 168px;
}

.donut-chart svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.donut-seg {
  transition: stroke-dasharray 0.4s ease;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  text-align: center;
}

.donut-center span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.donut-center strong {
  font-size: 18px;
  color: var(--text-strong);
}

.donut-legend {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.donut-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 13px;
  font-weight: 800;
}

.donut-legend-weight {
  color: var(--text-strong);
}

@media (max-width: 720px) {
  .highlight-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .allocation-donut {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.empty-state {
  min-height: 138px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: 8px;
  color: var(--toast-text);
  background: var(--toast-bg);
  box-shadow: var(--shadow);
}

.investors-toolbar {
  margin-bottom: 12px;
}

.investors-toolbar label {
  max-width: 360px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--scrim);
  backdrop-filter: blur(3px);
  animation: modalFade 0.16s ease;
}

body.modal-open {
  overflow: hidden;
}

.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(11, 18, 32, 0.28);
  animation: modalRise 0.18s ease;
}

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

.modal-head h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 20px;
}

.modal-desc {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}

.modal-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.modal-form .wide,
.modal-actions {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.modal-actions button {
  min-width: 124px;
}

@keyframes modalFade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalRise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--skeleton-bg);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.2s infinite;
}

.is-loading svg {
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(100%);
  }
}

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

@keyframes pricePopUp {
  0% {
    transform: translateY(4px) scale(0.96);
    opacity: 0.85;
  }

  42% {
    transform: translateY(-2px) scale(1.05);
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes pricePopDown {
  0% {
    transform: translateY(-4px) scale(0.96);
    opacity: 0.85;
  }

  42% {
    transform: translateY(2px) scale(1.05);
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 31px;
  }

  .admin-grid,
  .master-shell,
  .dashboard-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .master-sidebar {
    position: static;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px;
  }

  .master-menu-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .metrics-grid,
  .portfolio-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-chart-panel,
  .dashboard-detail-panel {
    min-height: auto;
  }

  .market-detail-layout {
    grid-template-columns: 1fr;
  }

  .market-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .graph-heading {
    gap: 12px;
  }

  .graph-filters {
    width: 100%;
    justify-content: flex-start;
  }

  .graph-summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .graph-detail-grid {
    grid-template-columns: 1fr;
  }

  .transactions-toolbar {
    grid-template-columns: 1fr;
  }

  .transaction-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar,
  .app-shell {
    width: 370px;
    max-width: calc(100vw - 20px);
    margin-right: 0;
    margin-left: 0;
    padding-right: 10px;
    padding-left: 10px;
  }

  .topbar {
    padding-top: 18px;
    padding-bottom: 12px;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .tabs {
    width: 100%;
    overflow: hidden;
  }

  .tab {
    flex-basis: 0;
    flex: 1;
    justify-content: center;
    padding: 0 10px;
  }

  .price {
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .source-line {
    font-size: 10px;
  }

  .panel {
    padding: 14px;
  }

  .form-grid,
  .metrics-grid,
  .portfolio-metrics {
    grid-template-columns: 1fr;
  }

  .market-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .market-mode-tabs {
    width: 100%;
  }

  .market-mode {
    flex: 1;
    padding: 0 8px;
  }

  .market-list-head {
    display: none;
  }

  .market-row,
  .asset-chart-row,
  .market-result {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .market-row {
    position: relative;
    padding-left: 54px;
  }

  .market-row .favorite-button {
    position: absolute;
    top: 14px;
    left: 12px;
  }

  .market-detail-panel {
    padding: 12px;
  }

  .market-detail-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .market-detail-live {
    grid-column: 1 / -1;
    justify-content: flex-start;
    order: 3;
  }

  .market-detail-title h3 {
    font-size: 21px;
  }

  .candle-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .candle-controls {
    justify-content: flex-start;
  }

  .candle-chart-frame {
    min-height: 260px;
  }

  .candle-svg {
    height: 250px;
  }

  .candle-empty {
    min-height: 250px;
  }

  .market-stat-grid {
    grid-template-columns: 1fr;
  }

  .graph-filters,
  .graph-filters label {
    width: 100%;
  }

  .graph-summary-cards {
    grid-template-columns: 1fr;
  }

  .transaction-summary {
    grid-template-columns: 1fr;
  }

  .graph-daily-chart {
    min-height: 310px;
    padding: 10px;
  }

  .daily-close-svg {
    height: 270px;
  }

  .graph-chart-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .graph-breakdown-row {
    grid-template-columns: 1fr;
  }

  .asset-detail-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .inline-form .primary-button,
  .form-submit {
    width: 100%;
  }

  .portfolio-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ============================================================
   UI/UX pro polish — tabular numerals, micro-interactions,
   theme toggle, live-value flash (ui-ux-pro-max guidance)
   ============================================================ */

/* Tabular figures so live-updating money/percent keep a stable width
   (number-tabular rule — prevents column jitter on real-time price ticks) */
.metric strong,
.metric small,
.hero-value strong,
.highlight-card strong,
.change,
.positive-text,
.negative-text,
.market-price,
.market-result-price,
.graph-summary-item strong,
.donut-center strong,
.donut-legend-weight,
table td,
.market-count,
.asset-detail-grid dd,
.market-stat-grid dd,
.candle-axis-label,
.daily-axis-label,
code {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Unified smooth transitions on interactive surfaces (150-300ms, GPU-friendly) */
.metric,
.highlight-card,
.market-row,
.market-result,
.coin-result,
.asset-chart-row,
.seg-btn,
.master-menu-item,
.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.portal-link,
.status-chip,
.favorite-button {
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}

/* Subtle card hover lift (transform + shadow only, no layout shift) */
.metric:hover,
.highlight-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevate);
  border-color: var(--line-strong);
}

/* Press feedback (scale 0.98) for tappable controls */
.primary-button:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active,
.seg-btn:active,
.market-mode:active,
.master-menu-item:active {
  transform: scale(0.98);
}

/* Theme toggle: swap sun/moon glyph by active theme */
.theme-toggle .sun {
  display: none;
}

.theme-toggle .moon {
  display: inline-flex;
}

:root[data-theme="dark"] .theme-toggle .sun {
  display: inline-flex;
}

:root[data-theme="dark"] .theme-toggle .moon {
  display: none;
}

.portal-theme-toggle {
  margin-left: auto;
}

/* Live-value flash when the number changes on refresh (real-time feedback) */
@keyframes valueFlashUp {
  0% {
    color: var(--good);
    transform: translateY(-1px);
  }

  100% {
    color: inherit;
    transform: translateY(0);
  }
}

@keyframes valueFlashDown {
  0% {
    color: var(--bad);
    transform: translateY(1px);
  }

  100% {
    color: inherit;
    transform: translateY(0);
  }
}

.flash-up {
  animation: valueFlashUp 0.7s ease-out;
}

.flash-down {
  animation: valueFlashDown 0.7s ease-out;
}

/* Dark-mode chart + surface legibility tweaks */
:root[data-theme="dark"] .daily-grid-line,
:root[data-theme="dark"] .candle-grid {
  stroke: var(--line);
  opacity: 0.6;
}

:root[data-theme="dark"] .coin-logo img {
  background: #0b1220;
}
