:root {
  --bg: #070b12;
  --bg-card: rgba(17, 23, 33, 0.82);
  --bg-card-strong: rgba(10, 14, 21, 0.95);
  --line: rgba(166, 144, 108, 0.24);
  --line-soft: rgba(166, 144, 108, 0.14);
  --text: #f6efe3;
  --muted: #c8bca9;
  --accent: #d8a860;
  --accent-soft: rgba(216, 168, 96, 0.2);
  --alert: #ff7070;
  --profit: #6ee7a6;
  --warning: #ffc267;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 12% -10%, #2a2134 0, transparent 55%),
    radial-gradient(circle at 95% 120%, #2d2616 0, transparent 42%),
    radial-gradient(circle at 80% 10%, #102739 0, transparent 35%),
    var(--bg);
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
}

.ambient {
  position: fixed;
  inset: auto;
  filter: blur(70px);
  z-index: 0;
  pointer-events: none;
}

.ambient-a {
  top: -120px;
  right: -110px;
  width: 360px;
  height: 360px;
  border-radius: 60% 40% 50% 40%;
  background: rgba(148, 123, 187, 0.3);
  animation: driftA 11s ease-in-out infinite alternate;
}

.ambient-b {
  left: -130px;
  bottom: 14%;
  width: 320px;
  height: 320px;
  border-radius: 52% 48% 35% 65%;
  background: rgba(216, 168, 96, 0.22);
  animation: driftB 10s ease-in-out infinite alternate;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.09;
  background-image: radial-gradient(#fff 0.45px, transparent 0.45px);
  background-size: 3px 3px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1880px, 96vw);
  margin: 18px auto 42px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px 4px 8px;
}

.kicker {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: #d7b98e;
}

h1 {
  margin: 6px 0 0;
  font-size: clamp(1.55rem, 2.7vw, 2.2rem);
  letter-spacing: -0.02em;
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
}

.status-pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  border: 1px solid rgba(216, 168, 96, 0.6);
  border-radius: 999px;
  color: #f0d6aa;
  background: rgba(216, 168, 96, 0.14);
  padding: 8px 12px;
}

.tabs {
  display: inline-flex;
  gap: 8px;
  background: rgba(8, 17, 26, 0.72);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 5px;
  margin: 8px 0 14px;
}

.tab {
  border: none;
  color: var(--muted);
  background: transparent;
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.tab.active {
  color: #1d1205;
  background: linear-gradient(130deg, #ffd699, #d8a860);
}

.tab-panel {
  display: none;
  grid-template-columns: 300px minmax(240px, 21%) minmax(760px, 1fr);
  gap: 14px;
}

.tab-panel.active {
  display: grid;
  align-items: stretch;
  min-width: 0;
}

#portfolioTab.tab-panel.active {
  grid-template-columns: 1fr;
}

#portfolioRiskTab.tab-panel.active {
  grid-template-columns: 300px minmax(0, 1fr);
}

#browserTab.tab-panel.active {
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
}

#uploadTab.tab-panel.active {
  grid-template-columns: 320px minmax(840px, 1fr);
}

#walkForwardTab.tab-panel.active {
  grid-template-columns: 1fr;
}

.tab-panel.active > .panel {
  min-width: 0;
}

.panel {
  border: 1px solid var(--line-soft);
  background: linear-gradient(148deg, var(--bg-card), var(--bg-card-strong));
  border-radius: var(--radius);
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.35);
}

.controls {
  padding: 16px;
  align-self: start;
  position: sticky;
  top: 16px;
}

.controls h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.controls h3 {
  margin: 4px 0 10px;
  font-size: 0.94rem;
  color: #e6c18b;
}

.sidebar-copy {
  margin: 0 0 12px;
  color: #bfae96;
  font-size: 0.8rem;
  line-height: 1.45;
}

.controls label {
  display: block;
  margin: 10px 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a89a84;
}

.controls select,
.controls input,
.controls textarea {
  width: 100%;
  border: 1px solid rgba(183, 160, 124, 0.25);
  color: var(--text);
  background: rgba(11, 15, 23, 0.74);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.87rem;
}

.controls textarea {
  min-height: 190px;
  resize: vertical;
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.45;
}

.browser-nav-panel,
.browser-detail-panel {
  min-width: 0;
}

.browser-nav-panel {
  padding: 18px;
  align-self: start;
  justify-self: stretch;
  position: sticky;
  top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.browser-nav-panel > * {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.browser-nav-head {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.browser-nav-head h2 {
  margin: 6px 0 0;
  font-size: 1.2rem;
}

.browser-nav-panel label {
  display: block;
  margin: 2px 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a89a84;
}

.browser-nav-panel input {
  width: 100%;
  border: 1px solid rgba(183, 160, 124, 0.25);
  color: var(--text);
  background: rgba(11, 15, 23, 0.74);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.84rem;
}

.browser-nav-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.browser-nav-btn {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(180, 156, 121, 0.2);
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.09), transparent 34%),
    linear-gradient(165deg, rgba(14, 19, 28, 0.96), rgba(8, 11, 17, 0.96));
  color: var(--text);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.browser-nav-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 168, 96, 0.55);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.browser-nav-btn.active {
  border-color: rgba(216, 168, 96, 0.85);
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.2), transparent 38%),
    linear-gradient(165deg, rgba(39, 28, 16, 0.92), rgba(10, 11, 17, 0.96));
}

.browser-nav-btn:focus {
  outline: none;
}

.browser-nav-btn:focus-visible {
  outline: 2px solid rgba(255, 214, 153, 0.9);
  outline-offset: -2px;
  box-shadow:
    inset 0 0 0 1px rgba(12, 18, 28, 0.95),
    0 12px 24px rgba(0, 0, 0, 0.22);
}

.browser-nav-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.browser-nav-copy strong {
  display: block;
  font-size: 0.92rem;
}

.browser-nav-copy small {
  display: block;
  color: #beac92;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.browser-nav-count {
  align-self: center;
  min-width: 38px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(11, 15, 23, 0.86);
  border: 1px solid rgba(183, 160, 124, 0.24);
  color: #f3d6a5;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  font-weight: 700;
}

.browser-detail-panel {
  padding: 18px;
  min-height: calc(100vh - 176px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}

.browser-detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.browser-detail-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.browser-detail-copy h2 {
  margin: 6px 0 0;
  font-size: 1.28rem;
}

.browser-detail-copy .sidebar-copy {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.browser-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(126px, 1fr));
  gap: 10px;
  min-width: 0;
}

.browser-stat-card {
  border: 1px solid rgba(180, 156, 121, 0.18);
  border-radius: 14px;
  padding: 12px;
  background: rgba(8, 11, 17, 0.68);
}

.browser-stat-card span {
  display: block;
  color: #bba88b;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.browser-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.1rem;
  font-family: "IBM Plex Mono", monospace;
}

.browser-grid-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.browser-result-meta {
  color: #cab9a0;
  font-size: 0.76rem;
  font-family: "IBM Plex Mono", monospace;
}

.browser-table {
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(17, 24, 34, 0.95), rgba(9, 12, 18, 0.98));
  overflow: auto;
}

.browser-table-head,
.browser-row-main {
  display: grid;
  align-items: center;
  gap: 12px;
}

.browser-table-head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-width: 1180px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(180, 156, 121, 0.18);
  background: rgba(10, 14, 21, 0.96);
}

.browser-table-head span {
  color: #bba88b;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.browser-table-body {
  display: grid;
}

.browser-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px;
  min-width: 1180px;
  border-bottom: 1px solid rgba(180, 156, 121, 0.12);
}

.browser-row:last-child {
  border-bottom: none;
}

.browser-row-main {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.16s ease;
}

.browser-row:hover .browser-row-main {
  background:
    linear-gradient(90deg, rgba(216, 168, 96, 0.08), rgba(216, 168, 96, 0)),
    rgba(255, 255, 255, 0.01);
}

.browser-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 196px;
  padding: 0 16px;
  border-left: 1px solid rgba(180, 156, 121, 0.12);
  background: rgba(8, 11, 17, 0.36);
}

.browser-row-actions .btn-inline {
  white-space: nowrap;
}

.browser-actions-head {
  justify-self: start;
}

.browser-cell {
  min-width: 0;
  overflow: hidden;
  color: #efe5d5;
  font-size: 0.82rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-cell.strong {
  font-weight: 700;
}

.browser-cell.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  color: #d7c9b6;
}

.browser-grid-head-runs {
  grid-template-columns: 76px minmax(160px, 1.15fr) 112px 1fr 1fr 96px 110px 176px 196px;
}

.browser-grid-row-runs {
  grid-template-columns: 76px minmax(160px, 1.15fr) 112px 1fr 1fr 96px 110px 176px;
}

.browser-grid-head-portfolios {
  grid-template-columns: 76px minmax(170px, 1.15fr) minmax(170px, 1fr) 96px 88px 190px 112px 196px;
}

.browser-grid-row-portfolios {
  grid-template-columns: 76px minmax(170px, 1.15fr) minmax(170px, 1fr) 96px 88px 190px 112px;
}

.browser-grid-head-risk {
  grid-template-columns: 76px 132px minmax(170px, 1fr) 1fr 88px 100px 100px 112px 196px;
}

.browser-grid-row-risk {
  grid-template-columns: 76px 132px minmax(170px, 1fr) 1fr 88px 100px 100px 112px;
}

.field-hint {
  margin: 6px 0 0;
  color: #ab9c87;
  font-size: 0.76rem;
  line-height: 1.45;
}

.file-picker {
  position: relative;
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.file-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(183, 160, 124, 0.25);
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.14), transparent 42%),
    linear-gradient(160deg, rgba(14, 19, 28, 0.96), rgba(8, 11, 18, 0.98));
  color: var(--text);
  padding: 12px 13px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.file-picker.dragover .file-picker-btn {
  border-color: rgba(216, 168, 96, 0.92);
  box-shadow:
    0 0 0 1px rgba(216, 168, 96, 0.18) inset,
    0 14px 28px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.file-picker.dragover .file-picker-icon {
  background: linear-gradient(135deg, rgba(216, 168, 96, 0.4), rgba(216, 168, 96, 0.16));
}

.file-picker-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 168, 96, 0.7);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.file-picker.is-droppable .file-picker-label::after {
  content: " Drop a file here";
  color: #e7c48d;
}

.file-picker-btn:focus-visible {
  outline: 2px solid rgba(216, 168, 96, 0.95);
  outline-offset: 2px;
}

.file-picker-icon {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 9px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(216, 168, 96, 0.26), rgba(216, 168, 96, 0.1));
  border: 1px solid rgba(216, 168, 96, 0.28);
  color: #f5d7a8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
}

.file-picker-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.file-picker-copy strong {
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.file-picker-label {
  color: #b8aa95;
  font-size: 0.77rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-picker-chev {
  flex: 0 0 auto;
  color: #e7c48d;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.controls hr {
  border: none;
  border-top: 1px dashed rgba(147, 176, 205, 0.25);
  margin: 16px 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls label.toggle-card {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(183, 160, 124, 0.18);
  border-radius: 10px;
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.06), transparent 44%),
    linear-gradient(160deg, rgba(14, 19, 28, 0.76), rgba(8, 11, 18, 0.9));
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.controls label.toggle-card:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 168, 96, 0.55);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.controls label.toggle-card:focus-within {
  border-color: rgba(216, 168, 96, 0.9);
  box-shadow: 0 0 0 1px rgba(216, 168, 96, 0.14) inset;
}

.controls label.toggle-card input {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin: 0;
  flex: 0 0 auto;
  border-radius: 5px;
  border: 1px solid rgba(190, 166, 127, 0.34);
  background: rgba(8, 11, 18, 0.96);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.controls label.toggle-card input::before {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg) translateY(-1px);
}

.controls label.toggle-card input:checked {
  border-color: rgba(216, 168, 96, 0.95);
  background: linear-gradient(135deg, #ffd699, #d8a860);
  box-shadow: 0 0 0 1px rgba(216, 168, 96, 0.18) inset;
}

.controls label.toggle-card input:checked::before {
  border-left-color: #1b1203;
  border-bottom-color: #1b1203;
}

.controls label.toggle-card input:focus-visible {
  outline: 2px solid rgba(216, 168, 96, 0.95);
  outline-offset: 2px;
}

.controls label.toggle-card .toggle-copy {
  display: inline-block;
  color: #b7aa95;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  line-height: 1;
}

.btn {
  width: 100%;
  border: 1px solid rgba(183, 160, 124, 0.36);
  border-radius: 12px;
  margin-top: 10px;
  padding: 11px;
  font-weight: 700;
  color: #f4e9d8;
  background: linear-gradient(160deg, rgba(24, 22, 31, 0.9), rgba(12, 13, 19, 0.98));
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 168, 96, 0.75);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  border-color: rgba(143, 130, 110, 0.35);
  box-shadow: none;
}

.btn.btn-primary:disabled {
  background: linear-gradient(130deg, rgba(155, 126, 82, 0.45), rgba(100, 78, 49, 0.45));
  color: rgba(244, 233, 216, 0.7);
}

.btn-primary {
  color: #1b1203;
  border: 1px solid rgba(216, 168, 96, 0.8);
  background: linear-gradient(130deg, #ffd699, #d8a860);
}

.btn-danger {
  color: #fff2f2;
  border: 1px solid rgba(255, 112, 112, 0.78);
  background: linear-gradient(135deg, #ff7d7d, #b72323);
}

.btn-danger:hover {
  border-color: rgba(255, 157, 157, 0.92);
}

.tree-panel,
.detail-panel {
  padding: 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}

.panel-header p {
  margin: 6px 0 10px;
  color: #bfae96;
  font-size: 0.8rem;
}

.tree-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
}

.market-selector {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(180, 156, 121, 0.2);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(17, 22, 32, 0.86), rgba(8, 11, 18, 0.9));
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.market-selector:hover {
  border-color: rgba(216, 168, 96, 0.55);
  transform: translateY(-1px);
}

.market-selector.active {
  border-color: rgba(216, 168, 96, 0.86);
  background: linear-gradient(150deg, rgba(40, 31, 20, 0.9), rgba(14, 16, 22, 0.95));
}

.market-selector-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.market-selector-head strong {
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.market-selector-head span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.71rem;
  color: #baa586;
}

.market-selector-meta {
  margin-top: 6px;
  font-size: 0.74rem;
  color: #a89273;
}

.explorer-panel {
  min-height: calc(100vh - 176px);
}

.walk-forward-panel {
  min-height: calc(100vh - 176px);
}

.walk-forward-detail-shell {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.walk-forward-flow-shell {
  padding: 18px;
  min-height: calc(100vh - 176px);
}

.walk-forward-step-layout-setup {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.72fr);
  align-items: start;
}

.walk-forward-step-layout-review {
  grid-template-columns: 1fr;
}

.walk-forward-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 8px;
}

.walk-forward-config-item {
  display: grid;
  align-content: start;
}

.walk-forward-config-item .field-hint {
  margin-top: 6px;
}

.walk-forward-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.portfolio-stage-card label.walk-forward-toggle-card {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin: 0;
  padding: 12px 13px;
  min-height: 92px;
}

.portfolio-stage-card label.walk-forward-toggle-card input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  padding: 0;
}

.portfolio-stage-card label.walk-forward-toggle-card .toggle-copy {
  display: grid;
  gap: 4px;
  line-height: 1.3;
}

.portfolio-stage-card label.walk-forward-toggle-card .toggle-copy strong {
  color: #d8c2a0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.portfolio-stage-card label.walk-forward-toggle-card .toggle-copy small {
  color: #ab9c87;
  font-size: 0.74rem;
  line-height: 1.45;
}

.walk-forward-review-head {
  margin-bottom: 2px;
}

.walk-forward-review-grid {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.walk-forward-review-grid > * {
  min-width: 0;
}

.walk-forward-market-card {
  position: sticky;
  top: 16px;
  min-height: calc(100vh - 280px);
  display: flex;
  flex-direction: column;
}

.walk-forward-detail-card {
  min-width: 0;
}

.walk-forward-detail-card .summary-cards {
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
}

.walk-forward-detail-card .chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.walk-forward-detail-card .result-overview-content {
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.2fr);
}

.walk-forward-detail-card .result-overview-side {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.walk-forward-detail-card .result-secondary-grid,
.walk-forward-detail-card .result-matrix-pair-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.walk-forward-detail-card .result-keyvalue-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.walk-forward-market-card .tree-list {
  max-height: calc(100vh - 360px);
}

#wfWindowTable,
#wfDailyTable {
  min-width: 100%;
}

.explorer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 10px;
}

.explorer-toolbar label {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a99679;
  font-weight: 700;
}

.explorer-toolbar select {
  border: 1px solid rgba(183, 160, 124, 0.26);
  color: var(--text);
  background: rgba(11, 15, 23, 0.8);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.79rem;
}

.walk-forward-market-board .panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.walk-forward-market-board .panel-header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.walk-forward-market-board .explorer-toolbar {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}

.walk-forward-market-board .explorer-toolbar select {
  width: auto;
  min-width: 92px;
}

.quick-stats {
  margin-bottom: 12px;
}

.parameter-heatmap-shell {
  margin-bottom: 14px;
  border: 1px solid rgba(180, 156, 121, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.08), transparent 38%),
    linear-gradient(160deg, rgba(13, 18, 26, 0.86), rgba(8, 11, 16, 0.94));
  padding: 12px;
}

.parameter-heatmap-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.parameter-heatmap-head h3 {
  margin: 0;
  font-size: 0.9rem;
  color: #f6efe3;
}

.parameter-heatmap-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 220px;
}

.parameter-heatmap-control span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a99679;
  white-space: nowrap;
}

.parameter-heatmap-control select {
  flex: 1 1 auto;
  border: 1px solid rgba(183, 160, 124, 0.26);
  color: var(--text);
  background: rgba(11, 15, 23, 0.8);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.79rem;
}

.parameter-heatmap-meta {
  margin: 6px 0 10px;
  color: #9f9483;
  font-size: 0.68rem;
  line-height: 1.35;
}

.parameter-heatmap-wrap {
  overflow-x: clip;
  width: 100%;
}

.parameter-heatmap-grid {
  display: grid;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.parameter-heatmap-corner,
.parameter-heatmap-axis {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(180, 156, 121, 0.2);
  border-radius: 12px;
  background: rgba(8, 11, 16, 0.86);
  color: #d9c2a0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  min-height: 34px;
  padding: 6px 7px;
}

.parameter-heatmap-corner {
  color: #f0d6aa;
  background:
    linear-gradient(135deg, rgba(216, 168, 96, 0.18), rgba(216, 168, 96, 0.04)),
    rgba(8, 11, 16, 0.9);
}

.parameter-heatmap-axis-y {
  justify-content: flex-start;
  padding-left: 10px;
}

.parameter-heatmap-cell {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 8px 8px 7px;
  border-radius: 14px;
  border: 1px solid var(--heatmap-border, rgba(180, 156, 121, 0.2));
  background:
    linear-gradient(180deg, var(--heatmap-bg, rgba(12, 17, 24, 0.18)) 0, transparent 40%),
    radial-gradient(circle at top right, var(--heatmap-glow, rgba(216, 168, 96, 0.08)), transparent 44%),
    linear-gradient(160deg, rgba(14, 19, 27, 0.92), rgba(8, 11, 16, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 16px rgba(0, 0, 0, 0.1);
}

.parameter-heatmap-cell-empty {
  place-items: center;
  background: linear-gradient(160deg, rgba(12, 17, 24, 0.54), rgba(8, 11, 16, 0.86));
  border-style: dashed;
}

.parameter-heatmap-metric-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.parameter-heatmap-mini-label {
  color: #b1a48f;
  font-size: 0.52rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex: 0 0 auto;
}

.parameter-heatmap-mini-value {
  font-size: 0.62rem;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  min-width: 0;
}

.parameter-heatmap-bar {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  align-self: end;
  margin-top: 1px;
}

.parameter-heatmap-bar span {
  display: block;
  width: var(--heatmap-pnl-width, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--heatmap-pnl, rgba(216, 168, 96, 0.45));
}

.builder-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.builder-stat-grid .metric-card strong {
  font-size: 0.94rem;
}

.chip-positive {
  color: #b5f0ca;
}

.chip-negative {
  color: #ffadad;
}

.param-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  align-content: start;
}

.param-insight-card {
  border: 1px solid rgba(180, 156, 121, 0.2);
  background: linear-gradient(160deg, rgba(13, 18, 26, 0.84), rgba(8, 11, 16, 0.92));
  border-radius: 14px;
  color: var(--text);
  padding: 10px;
  cursor: pointer;
  text-align: left;
}

.param-insight-card:hover {
  border-color: rgba(216, 168, 96, 0.72);
}

.param-insight-card.active {
  border-color: rgba(216, 168, 96, 0.84);
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.14), transparent 36%),
    linear-gradient(160deg, rgba(33, 25, 15, 0.94), rgba(8, 11, 16, 0.96));
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
}

.param-insight-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.param-insight-head strong {
  font-size: 0.84rem;
  font-family: "IBM Plex Mono", monospace;
}

.param-insight-head span {
  font-weight: 700;
  font-size: 0.84rem;
}

.walk-forward-market-board {
  display: grid;
  gap: 14px;
}

.walk-forward-market-grid {
  min-height: 120px;
}

.walk-forward-market-grid .placeholder-text {
  grid-column: 1 / -1;
}

.wf-market-card {
  min-height: 132px;
}

.wf-selectable-card {
  cursor: pointer;
  display: grid;
  gap: 10px;
}

.wf-selectable-card:focus-visible {
  outline: none;
  border-color: rgba(216, 168, 96, 0.92);
  box-shadow: 0 0 0 3px rgba(216, 168, 96, 0.14);
}

.wf-selectable-card.selected {
  border-color: rgba(216, 168, 96, 0.88);
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.16), transparent 38%),
    linear-gradient(160deg, rgba(35, 27, 16, 0.94), rgba(9, 12, 17, 0.98));
}

.wf-selectable-card.selected .param-insight-head strong::after {
  content: "Selected";
  display: inline-flex;
  margin-left: 8px;
  border: 1px solid rgba(216, 168, 96, 0.45);
  border-radius: 999px;
  padding: 3px 7px;
  color: #f0d6aa;
  background: rgba(216, 168, 96, 0.1);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.wf-market-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(180, 156, 121, 0.14);
  color: #baa68a;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
}

.wf-market-card-meta strong {
  color: #ffd699;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wf-selectable-actions {
  align-items: center;
}

.wf-selection-note {
  max-width: 620px;
  margin: 0;
}

.wf-selectable-market-board {
  align-items: stretch;
}

.param-insight-metrics {
  margin-top: 7px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.7rem;
  color: #bca98d;
}

.param-insight-metrics b {
  color: #f5e8d4;
}

.param-insight-card canvas {
  margin-top: 8px;
  height: 80px;
}

.placeholder-text {
  margin: 0;
  color: #b7a58a;
  font-size: 0.85rem;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

#wfReviewStats,
#wfModalQuickStats,
#wfModalConfigCards {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.metric-card {
  border: 1px solid rgba(180, 156, 121, 0.21);
  border-radius: 12px;
  background: rgba(10, 13, 20, 0.74);
  padding: 10px;
}

.metric-card p {
  margin: 0;
  font-size: 0.68rem;
  color: #b5a58f;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.result-summary-shell {
  display: block;
  margin-bottom: 12px;
}

.result-overview-board,
.result-matrix-panel,
.result-side-panel {
  border-radius: 18px;
  border: 1px solid rgba(180, 156, 121, 0.2);
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.08), transparent 34%),
    linear-gradient(160deg, rgba(14, 20, 30, 0.95), rgba(8, 11, 17, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.result-overview-board {
  padding: 14px;
}

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

.result-overview-heading-meta {
  color: #cbbda5;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
}

.result-overview-content {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(0, 1.45fr);
  gap: 12px;
}

.result-overview-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: rgba(180, 156, 121, 0.18);
  border-radius: 16px;
}

.result-overview-side {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: rgba(180, 156, 121, 0.16);
  border-radius: 16px;
}

.result-overview-metric {
  min-height: 84px;
  padding: 11px 13px;
  background: rgba(8, 11, 17, 0.92);
}

.result-overview-metric span {
  display: block;
  margin: 0;
  font-size: 0.68rem;
  color: #c6b79f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-overview-metric strong {
  display: block;
  margin-top: 9px;
  font-size: 1.06rem;
  line-height: 1.15;
}

.result-overview-metric-emphasis {
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.18), transparent 46%),
    linear-gradient(160deg, rgba(39, 28, 16, 0.95), rgba(12, 11, 9, 0.98));
}

.result-overview-metric-emphasis strong {
  font-size: 1.48rem;
}

.result-metric-sections {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

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

.result-matrix-panel,
.result-side-panel {
  padding: 14px;
}

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

.result-matrix-head h3 {
  margin: 4px 0 0;
  font-size: 1rem;
}

.result-metric-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #bba88b;
}

.result-matrix-wrap {
  border: 1px solid rgba(180, 156, 121, 0.16);
  border-radius: 14px;
  overflow: auto;
  background: rgba(7, 10, 15, 0.82);
}

.result-yearly-summary-wrap {
  margin-bottom: 12px;
}

.result-yearly-summary-table td {
  font-weight: 400;
}

.result-adjusted-tp-wrap {
  margin-top: 12px;
}

.result-matrix-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.result-matrix-table thead {
  background: rgba(17, 22, 31, 0.96);
}

.result-matrix-table th,
.result-matrix-table td {
  padding: 9px 10px;
  border-right: 1px solid rgba(180, 156, 121, 0.12);
  border-bottom: 1px solid rgba(180, 156, 121, 0.12);
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
}

.result-matrix-table thead th {
  color: #d7c5a9;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
}

.result-matrix-table thead th:first-child,
.result-matrix-table tbody th {
  text-align: left;
}

.result-matrix-table tbody th {
  background: rgba(11, 15, 23, 0.94);
  color: #d5c4aa;
  font-weight: 600;
}

.result-matrix-table tbody td {
  background: rgba(8, 11, 18, 0.92);
  color: #ece4d6;
}

.result-matrix-table tbody td.chip-positive {
  color: #b5f0ca;
}

.result-matrix-table tbody td.chip-negative {
  color: #ffadad;
}

.result-matrix-table tbody tr:nth-child(even) td {
  background: rgba(12, 16, 24, 0.94);
}

.result-matrix-table tbody tr:nth-child(even) th {
  background: rgba(13, 17, 25, 0.96);
}

.result-matrix-empty {
  color: #998b77;
}

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

.result-keyvalue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(180, 156, 121, 0.16);
}

.result-keyvalue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  background: rgba(8, 11, 18, 0.92);
  font-family: "IBM Plex Mono", monospace;
}

.result-keyvalue-row span {
  color: #c6b79f;
  font-size: 0.72rem;
}

.result-keyvalue-row strong {
  font-size: 0.8rem;
  text-align: right;
}

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

.chart-card {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(180, 156, 121, 0.22);
  border-radius: 12px;
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(13, 17, 26, 0.9), rgba(8, 11, 17, 0.95));
  padding: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.chart-card h3 {
  margin: 0 0 8px;
  font-size: 0.84rem;
  color: #d2b285;
}

.chart-frame {
  width: 100%;
  position: relative;
  border: 1px solid rgba(180, 156, 121, 0.16);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(7, 10, 15, 0.95), rgba(10, 14, 20, 0.98));
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 100%;
  height: 240px;
  background:
    linear-gradient(180deg, rgba(12, 16, 23, 0.12), rgba(10, 13, 18, 0.25)),
    rgba(8, 10, 15, 0.82);
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  min-width: 150px;
  max-width: 240px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid rgba(216, 168, 96, 0.35);
  background: rgba(7, 10, 15, 0.96);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.35);
  color: #f6efe3;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  line-height: 1.45;
}

.chart-tooltip strong {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 4px;
  color: #ffd699;
}

.chart-tooltip .tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.chart-tooltip .tooltip-label {
  color: #bca98d;
}

.chart-tooltip .tooltip-value {
  color: #f7ecd9;
}

.chart-tooltip .tooltip-positive {
  color: #8cf0b5;
}

.chart-tooltip .tooltip-negative {
  color: #ffb3b3;
}

.table-wrap {
  margin-top: 10px;
  max-height: 700px;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid rgba(180, 156, 121, 0.2);
  border-radius: 12px;
  background: rgba(7, 10, 15, 0.8);
}

table {
  width: max-content;
  border-collapse: collapse;
  font-size: 0.74rem;
}

thead {
  background: #121823;
  z-index: 1;
}

th,
td {
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid rgba(180, 156, 121, 0.14);
  border-right: 1px solid rgba(180, 156, 121, 0.18);
  padding: 8px;
  font-family: "IBM Plex Mono", monospace;
}

th:first-child,
td:first-child {
  text-align: left;
}

.portfolio-analysis-tab .detail-panel,
.portfolio-builder-sidebar {
  min-height: 0;
}

.portfolio-flow-shell {
  padding: 18px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.portfolio-flow-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.portfolio-flow-head h2 {
  margin: 4px 0 0;
  font-size: 1.4rem;
}

.portfolio-flow-copy {
  max-width: 620px;
  margin: 0;
  color: #c4b39a;
  font-size: 0.84rem;
  line-height: 1.5;
}

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

.walk-forward-stepbar {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.portfolio-step-chip {
  border: 1px solid rgba(180, 156, 121, 0.18);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(12, 18, 26, 0.88), rgba(7, 10, 16, 0.94));
  padding: 14px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.portfolio-step-chip:hover {
  border-color: rgba(216, 168, 96, 0.52);
  transform: translateY(-1px);
}

.portfolio-step-chip.active {
  border-color: rgba(216, 168, 96, 0.84);
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.14), transparent 34%),
    linear-gradient(160deg, rgba(38, 28, 16, 0.94), rgba(10, 11, 16, 0.96));
}

.portfolio-step-chip.complete .portfolio-step-no {
  color: #8cf0b5;
  border-color: rgba(110, 231, 166, 0.45);
}

.portfolio-step-chip.disabled {
  opacity: 0.48;
}

.portfolio-step-no {
  min-width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(216, 168, 96, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: #ffd699;
  background: rgba(12, 16, 22, 0.75);
}

.portfolio-step-text {
  display: grid;
  gap: 4px;
}

.portfolio-step-text strong {
  font-size: 0.92rem;
}

.portfolio-step-text small {
  color: #baa586;
  line-height: 1.4;
}

.portfolio-step-panels {
  min-height: 0;
  flex: 0 0 auto;
}

.portfolio-step-panel {
  display: none;
  min-height: 0;
}

.portfolio-step-panel.active {
  display: block;
}

.portfolio-step-layout {
  display: grid;
  gap: 14px;
}

.portfolio-step-layout-setup {
  grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
  align-items: start;
}

.portfolio-step-layout-build {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  align-items: start;
}

.portfolio-step-layout-review {
  grid-template-columns: 1fr;
}

.portfolio-stage-card {
  border: 1px solid rgba(180, 156, 121, 0.18);
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.07), transparent 36%),
    linear-gradient(160deg, rgba(11, 16, 24, 0.9), rgba(7, 10, 16, 0.95));
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.portfolio-stage-card-open-saved {
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: visible;
  align-self: start;
}

.portfolio-stage-card label {
  display: block;
  margin: 10px 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a89a84;
}

.portfolio-stage-card select,
.portfolio-stage-card input,
.portfolio-stage-card textarea {
  width: 100%;
  border: 1px solid rgba(183, 160, 124, 0.25);
  color: var(--text);
  background: rgba(11, 15, 23, 0.74);
  border-radius: 10px;
  padding: 10px 42px 10px 12px;
  font-size: 0.87rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.portfolio-stage-card input {
  padding-right: 12px;
}

.portfolio-stage-card textarea {
  min-height: 190px;
  resize: vertical;
  padding: 11px 12px;
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.45;
  caret-color: #ffd699;
  color-scheme: dark;
}

.portfolio-stage-card select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #e4c48e 50%),
    linear-gradient(135deg, #e4c48e 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.portfolio-stage-card select:focus,
.portfolio-stage-card input:focus,
.portfolio-stage-card textarea:focus {
  outline: none;
  border-color: rgba(216, 168, 96, 0.65);
  box-shadow: 0 0 0 3px rgba(216, 168, 96, 0.14);
  background-color: rgba(12, 18, 27, 0.92);
}

.portfolio-stage-card-main {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.portfolio-stage-card-side {
  position: sticky;
  top: 16px;
}

.portfolio-stage-head {
  margin-bottom: 10px;
}

.portfolio-stage-head h3 {
  margin: 4px 0 0;
  font-size: 1.08rem;
}

.portfolio-step-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.portfolio-step-actions .btn {
  width: auto;
  min-width: 180px;
}

.portfolio-step-actions-stack {
  flex-direction: column;
}

.portfolio-step-actions-stack .btn {
  width: 100%;
}

.saved-portfolio-list-wide {
  max-height: none;
  height: auto;
  overflow: visible;
  overflow-y: visible;
  padding-right: 0;
}

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

.portfolio-sort-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portfolio-sort-inline label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a89a84;
}

.portfolio-sort-inline select {
  border: 1px solid rgba(183, 160, 124, 0.25);
  color: var(--text);
  background: rgba(11, 15, 23, 0.74);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.84rem;
}

.selected-portfolio-list-compact {
  grid-template-columns: 1fr;
  max-height: calc(100vh - 470px);
  overflow-y: auto;
  padding-right: 2px;
}

.portfolio-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.portfolio-review-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.portfolio-review-actions .btn {
  width: auto;
  min-width: 150px;
}

.portfolio-selection-strip-review {
  margin-top: 2px;
}

.portfolio-review-charts .chart-card canvas {
  height: 320px;
}

.saved-portfolio-head {
  margin-bottom: 10px;
}

.saved-portfolio-head h3 {
  margin: 0;
}

.saved-portfolio-head p {
  margin: 5px 0 0;
  color: #b5a58f;
  font-size: 0.78rem;
}

.saved-portfolio-list,
.selected-portfolio-list,
.portfolio-candidate-board {
  display: grid;
  gap: 10px;
  align-content: start;
}

.saved-portfolio-list {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.saved-portfolio-card {
  border: 1px solid rgba(180, 156, 121, 0.2);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(14, 19, 28, 0.9), rgba(8, 11, 17, 0.94));
  padding: 12px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.saved-portfolio-card:hover {
  border-color: rgba(216, 168, 96, 0.66);
  transform: translateY(-1px);
}

.saved-portfolio-card.active {
  border-color: rgba(216, 168, 96, 0.9);
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.18), transparent 38%),
    linear-gradient(160deg, rgba(39, 28, 16, 0.92), rgba(10, 11, 17, 0.96));
}

.saved-portfolio-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.saved-portfolio-top strong {
  display: block;
  font-size: 0.88rem;
}

.saved-portfolio-top span {
  color: #c4b39a;
  font-size: 0.71rem;
  font-family: "IBM Plex Mono", monospace;
}

.saved-portfolio-metrics {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #baa586;
  font-size: 0.7rem;
}

.portfolio-candidate-panel {
  overflow: hidden;
}

.portfolio-search-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.portfolio-search-toolbar input {
  width: 100%;
  border: 1px solid rgba(183, 160, 124, 0.25);
  color: var(--text);
  background: rgba(11, 15, 23, 0.74);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.84rem;
}

.portfolio-search-meta {
  margin: 0 0 10px;
  color: #bba88b;
  font-size: 0.74rem;
  line-height: 1.4;
}

.portfolio-candidate-board {
  overflow-y: auto;
  padding-right: 2px;
}

.market-portfolio-card {
  border: 1px solid rgba(180, 156, 121, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 8%, rgba(95, 211, 255, 0.08), transparent 24%),
    linear-gradient(160deg, rgba(12, 18, 26, 0.9), rgba(7, 10, 16, 0.96));
  padding: 14px;
}

.market-portfolio-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.market-portfolio-head h3 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.market-portfolio-tag {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.67rem;
  color: #d8a860;
}

.market-portfolio-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
  color: #baa586;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
}

.market-card-count {
  min-width: 86px;
  text-align: right;
}

.market-card-count span {
  display: block;
  color: #aa9a84;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.market-card-count strong {
  font-size: 1.05rem;
}

.portfolio-param-list {
  display: grid;
  gap: 8px;
}

.portfolio-param-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(180, 156, 121, 0.16);
  border-radius: 14px;
  background: rgba(9, 13, 20, 0.8);
  padding: 10px;
}

.portfolio-param-row.selected {
  border-color: rgba(216, 168, 96, 0.86);
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.1), transparent 44%),
    rgba(18, 16, 12, 0.9);
}

.portfolio-param-main {
  min-width: 0;
}

.portfolio-param-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.portfolio-param-title strong {
  font-size: 0.82rem;
  font-family: "IBM Plex Mono", monospace;
}

.portfolio-param-state {
  color: #d7c2a0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.portfolio-param-metrics {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #b8a688;
  font-size: 0.69rem;
}

.portfolio-param-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-inline {
  border: 1px solid rgba(180, 156, 121, 0.28);
  border-radius: 999px;
  background: rgba(11, 15, 23, 0.86);
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.72rem;
  cursor: pointer;
}

.btn-inline-accent {
  border-color: rgba(216, 168, 96, 0.72);
  color: #1d1205;
  background: linear-gradient(130deg, #ffd699, #d8a860);
}

.btn-inline-remove {
  border-color: rgba(255, 112, 112, 0.4);
  color: #ffd6d6;
}

.portfolio-selection-strip {
  margin: 10px 0 2px;
  padding: 12px;
  border: 1px solid rgba(180, 156, 121, 0.18);
  border-radius: 14px;
  background: rgba(8, 11, 17, 0.7);
}

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

.selection-strip-head h3 {
  margin: 0;
  font-size: 0.9rem;
}

.selection-count-badge {
  border: 1px solid rgba(216, 168, 96, 0.35);
  border-radius: 999px;
  padding: 6px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: #f0d6aa;
  background: rgba(216, 168, 96, 0.1);
}

.selected-portfolio-list {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.selected-portfolio-card {
  border: 1px solid rgba(180, 156, 121, 0.16);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(14, 19, 28, 0.88), rgba(8, 11, 17, 0.94));
  padding: 12px;
}

.selected-portfolio-card strong {
  display: block;
  font-size: 0.86rem;
}

.selected-portfolio-card p {
  margin: 5px 0 0;
  color: #b9a78c;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
}

.selected-portfolio-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

#portfolioPositionsTable,
#portfolioDailyTable {
  min-width: 100%;
}

#portfolioPositionsTable tbody tr:hover td,
#portfolioDailyTable tbody tr:hover td,
#portfolioPositionsTable tbody tr:hover th,
#portfolioDailyTable tbody tr:hover th {
  background: rgba(34, 29, 21, 0.55);
}

.summary-cards .placeholder-text {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px dashed rgba(180, 156, 121, 0.18);
  border-radius: 12px;
  background: rgba(9, 13, 18, 0.55);
}

#portfolioMarketTable {
  min-width: max-content;
}

#portfolioMarketTable thead th {
  position: sticky;
  top: 0;
  vertical-align: bottom;
  background: #121823;
  z-index: 5;
}

#portfolioMarketTable thead .sticky-date-col {
  z-index: 7;
}

#portfolioMarketTable thead .sticky-fund-col {
  right: 0;
  z-index: 9;
  background: #121823;
  box-shadow: -12px 0 18px rgba(0, 0, 0, 0.25);
}

#portfolioMarketTable .market-col {
  min-width: 180px;
}

.market-col-head {
  font-size: 0.68rem;
  color: #f2ddba;
  white-space: nowrap;
}

.market-cell {
  min-width: 180px;
  text-align: left;
}

.market-cell-high-risk {
  background: linear-gradient(180deg, rgba(25, 74, 55, 0.58), rgba(16, 47, 35, 0.72));
  box-shadow: inset 0 0 0 1px rgba(140, 236, 184, 0.18);
}

.market-cell-high-risk .market-risk {
  color: #cbf8dc;
}

.market-risk {
  font-weight: 700;
  color: #f6efe3;
}

.market-param {
  margin-top: 4px;
  font-size: 0.62rem;
  color: #b8a688;
  white-space: normal;
  line-height: 1.25;
}

.market-missing {
  color: #6f7f8f;
}

.sticky-date-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: linear-gradient(180deg, rgba(34, 26, 14, 0.98), rgba(23, 18, 10, 0.98));
  box-shadow: 10px 0 18px rgba(0, 0, 0, 0.22);
}

.row-date {
  z-index: 4;
  background: linear-gradient(180deg, rgba(41, 31, 18, 0.98), rgba(27, 20, 11, 0.98));
}

.sticky-fund-col {
  position: sticky;
  right: 0;
  z-index: 8;
  background: #121823;
  box-shadow: -12px 0 18px rgba(0, 0, 0, 0.25);
  width: 180px;
  min-width: 180px;
  overflow: hidden;
  background-clip: padding-box;
  isolation: isolate;
}

.fund-cell {
  text-align: left;
}

.fund-cell-high-risk {
  background: linear-gradient(180deg, rgba(48, 146, 97, 0.96), rgba(22, 95, 60, 0.98)) !important;
  box-shadow:
    inset 0 0 0 1px rgba(210, 255, 228, 0.32),
    -12px 0 18px rgba(0, 0, 0, 0.25);
}

.fund-cell-high-risk .market-risk {
  color: #f2fff7;
  text-shadow: 0 0 14px rgba(165, 255, 207, 0.18);
}

#portfolioMarketTable th:last-child,
#portfolioMarketTable td:last-child {
  border-right: none;
}

#portfolioMarketTable tbody .sticky-fund-col {
  background: rgba(10, 14, 20, 0.98);
}

#portfolioMarketTable tbody tr:hover td:not(.sticky-fund-col),
#portfolioMarketTable tbody tr:hover th:not(.sticky-date-col) {
  background: rgba(34, 29, 21, 0.55);
}

#portfolioMarketTable tbody tr:hover .sticky-date-col {
  background: linear-gradient(180deg, rgba(41, 31, 18, 0.98), rgba(27, 20, 11, 0.98));
}

#portfolioMarketTable tbody tr:hover .sticky-fund-col {
  background: rgba(10, 14, 20, 0.98);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: start center;
  padding: 40px 24px 24px;
}

.loading-overlay.hidden {
  display: none;
}

.loading-overlay-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(216, 168, 96, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(24, 22, 18, 0.82), rgba(10, 10, 12, 0.9));
  backdrop-filter: blur(8px);
}

.loading-overlay-card {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  border-radius: 24px;
  border: 1px solid rgba(216, 168, 96, 0.34);
  background: linear-gradient(180deg, rgba(26, 22, 15, 0.95), rgba(12, 11, 9, 0.96));
  box-shadow: 0 36px 80px rgba(1, 7, 21, 0.55);
  padding: 28px 28px 32px;
}

.loading-overlay-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: #e0c08a;
}

.loading-overlay-card h2 {
  margin: 8px 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: #f8efe0;
}

.loading-overlay-copy {
  margin: 0 0 18px;
  max-width: 640px;
  color: rgba(236, 224, 205, 0.9);
  line-height: 1.6;
}

.loading-progress-shell {
  position: relative;
  width: 100%;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(216, 168, 96, 0.3);
  background: rgba(36, 29, 18, 0.74);
}

.loading-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
  color: #f3e0bb;
}

.loading-progress-meta strong {
  font-size: 1.1rem;
}

.loading-progress-meta span {
  color: rgba(236, 224, 205, 0.78);
  font-size: 0.92rem;
}

.loading-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(216, 168, 96, 0.12), #d8a860, rgba(255, 232, 183, 0.98));
  box-shadow: 0 0 24px rgba(216, 168, 96, 0.4);
  transition: width 0.35s ease;
}

.loading-progress-eta {
  margin: 12px 0 0;
  color: rgba(236, 224, 205, 0.72);
  font-size: 0.9rem;
}

.loading-warning-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(216, 168, 96, 0.22);
  background: rgba(8, 8, 8, 0.24);
}

.loading-warning-panel.hidden {
  display: none;
}

.loading-warning-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #f3e0bb;
}

.loading-warning-head span {
  color: rgba(236, 224, 205, 0.72);
  font-size: 0.88rem;
}

.loading-warning-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.loading-warning-item {
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(245, 233, 214, 0.88);
  font-size: 0.9rem;
  line-height: 1.45;
}

.loading-overlay-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 8, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1400px, 95vw);
  margin: 2.5vh auto;
  height: 95vh;
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(180, 156, 121, 0.36);
  background: linear-gradient(160deg, rgba(17, 24, 36, 0.98), rgba(9, 12, 18, 0.98));
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
  padding: 18px;
}

.modal-card-sm {
  width: min(560px, 94vw);
  height: auto;
  margin-top: 16vh;
}

.modal-card-danger {
  border-color: rgba(255, 112, 112, 0.42);
  background:
    radial-gradient(circle at top right, rgba(255, 112, 112, 0.24), transparent 38%),
    linear-gradient(160deg, rgba(54, 14, 18, 0.98), rgba(20, 7, 9, 0.98));
  box-shadow: 0 40px 90px rgba(28, 3, 6, 0.58);
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-kicker {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: #c5aa81;
}

.modal-kicker-danger {
  color: #ffb6b6;
}

.modal-header h2 {
  margin: 4px 0 0;
  font-size: 1.45rem;
}

.icon-btn {
  border: 1px solid rgba(180, 156, 121, 0.3);
  background: rgba(16, 20, 29, 0.85);
  color: #f7ecd9;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: rgba(216, 168, 96, 0.8);
}

.modal-subtitle {
  margin: 10px 0 12px;
  color: #beac92;
}

.modal-subtitle-danger {
  color: #f2c6c6;
}

.danger-confirm-detail {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 138, 138, 0.26);
  background: rgba(255, 112, 112, 0.1);
  color: #fff1f1;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.danger-confirm-detail.hidden {
  display: none;
}

.modal-table-wrap {
  max-height: 380px;
}

.portfolio-day-modal-card {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 14px;
  overflow: auto;
}

.portfolio-day-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.table-link-btn {
  border: none;
  padding: 0;
  background: transparent;
  color: #f6d39a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(246, 211, 154, 0.45);
  text-underline-offset: 3px;
}

.table-link-btn:hover {
  color: #ffe8be;
  text-decoration-color: rgba(255, 232, 190, 0.8);
}

.table-link-btn:focus {
  outline: 2px solid rgba(216, 168, 96, 0.4);
  outline-offset: 2px;
  border-radius: 6px;
}

.table-link-btn-muted {
  color: #d7e9ff;
  text-decoration-color: rgba(215, 233, 255, 0.4);
}

.table-link-btn-muted:hover {
  color: #eef7ff;
  text-decoration-color: rgba(238, 247, 255, 0.85);
}

.portfolio-day-table td.pnl-negative,
.portfolio-day-table td.pnl-positive {
  font-weight: 700;
}

.portfolio-day-table td.pnl-negative {
  color: #ffb3b3;
}

.portfolio-day-table td.pnl-positive {
  color: #baf3cf;
}

.portfolio-day-insight-card {
  border: 1px solid rgba(180, 156, 121, 0.18);
  border-radius: 18px;
  padding: 14px;
  background:
    radial-gradient(circle at top right, rgba(216, 168, 96, 0.08), transparent 34%),
    linear-gradient(170deg, rgba(13, 17, 24, 0.96), rgba(8, 12, 18, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  min-height: 0;
  overflow: visible;
}

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

.portfolio-day-insight-head h3 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.portfolio-day-contribution-chart {
  display: grid;
  gap: 12px;
  min-height: 100%;
  align-content: start;
}

.portfolio-day-bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr) minmax(96px, auto);
  gap: 10px;
  align-items: center;
}

.portfolio-day-bar-label {
  min-width: 0;
}

.portfolio-day-bar-label strong {
  display: block;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portfolio-day-bar-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 112, 112, 0.16) 0 50%, rgba(110, 231, 166, 0.16) 50% 100%),
    rgba(13, 18, 25, 0.9);
  border: 1px solid rgba(183, 160, 124, 0.12);
}

.portfolio-day-bar-zero {
  position: absolute;
  left: 50%;
  top: -1px;
  bottom: -1px;
  width: 1px;
  background: rgba(255, 255, 255, 0.34);
}

.portfolio-day-bar-fill {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: 999px;
}

.portfolio-day-bar-fill.positive {
  left: 50%;
  background: linear-gradient(90deg, rgba(110, 231, 166, 0.55), rgba(110, 231, 166, 0.92));
}

.portfolio-day-bar-fill.negative {
  right: 50%;
  background: linear-gradient(90deg, rgba(255, 112, 112, 0.92), rgba(255, 112, 112, 0.55));
}

.portfolio-day-bar-value {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.77rem;
  font-weight: 700;
}

.portfolio-day-bar-value.positive {
  color: #baf3cf;
}

.portfolio-day-bar-value.negative {
  color: #ffb3b3;
}

.portfolio-day-expand-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.portfolio-day-expand-row::before,
.portfolio-day-expand-row::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(180, 156, 121, 0), rgba(180, 156, 121, 0.28), rgba(180, 156, 121, 0));
}

.portfolio-day-expand-btn {
  min-width: 108px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(20, 26, 36, 0.96), rgba(10, 14, 21, 0.96));
  border-color: rgba(180, 156, 121, 0.32);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.portfolio-day-expand-btn:hover {
  border-color: rgba(216, 168, 96, 0.58);
}

.portfolio-day-modal-card .modal-table-wrap {
  margin-top: 0;
  max-height: none;
  height: auto;
  min-height: 100%;
  overflow: visible;
}

.portfolio-day-table-wrap {
  overflow: visible;
}

.portfolio-day-table {
  width: 100%;
  min-width: 100%;
}

.upload-detail-panel {
  min-height: calc(100vh - 176px);
}

.upload-table-wrap {
  max-height: 380px;
}

.validation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  margin: 8px 0 12px;
}

.file-validation-list {
  margin-top: 12px;
}

.validation-issues {
  margin: 0;
  padding-left: 18px;
  color: #ffb3b3;
  font-size: 0.8rem;
  display: grid;
  gap: 4px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-ok {
  border: 1px solid rgba(110, 231, 166, 0.55);
  background: rgba(110, 231, 166, 0.15);
  color: #c5f4dc;
}

.status-warning {
  border: 1px solid rgba(255, 194, 103, 0.65);
  background: rgba(255, 194, 103, 0.15);
  color: #ffe4b2;
}

.status-error {
  border: 1px solid rgba(255, 112, 112, 0.65);
  background: rgba(255, 112, 112, 0.14);
  color: #ffd4d4;
}

.upload-action-hint {
  margin: 10px 2px 0;
  font-size: 0.76rem;
  color: #bfae96;
  line-height: 1.35;
}

@media (max-width: 1280px) {
  .tab-panel.active {
    grid-template-columns: 1fr;
  }

  #portfolioTab.tab-panel.active {
    grid-template-columns: 1fr;
  }

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

  .portfolio-flow-head,
  .portfolio-step-toolbar,
  .portfolio-review-head,
  .browser-detail-top {
    flex-direction: column;
    align-items: stretch;
  }

  .portfolio-day-bar-row {
    grid-template-columns: 1fr;
  }

  .portfolio-day-bar-value {
    text-align: left;
  }

  .portfolio-day-content-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-stepbar,
  .portfolio-step-layout-setup,
  .portfolio-step-layout-build,
  .walk-forward-step-layout-setup,
  .walk-forward-review-grid,
  .walk-forward-config-grid,
  .walk-forward-toggle-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-stage-card-side {
    position: static;
  }

  .walk-forward-market-card {
    position: static;
    min-height: 0;
  }

  .walk-forward-market-card .tree-list {
    max-height: none;
  }

  .controls,
  .browser-nav-panel {
    position: static;
  }

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

  .browser-stats {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .result-overview-content,
  .result-secondary-grid,
  .result-matrix-pair-grid {
    grid-template-columns: 1fr;
  }

  .result-overview-side,
  .result-keyvalue-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .parameter-heatmap-head {
    flex-direction: column;
    align-items: stretch;
  }

  .parameter-heatmap-control {
    min-width: 0;
    justify-content: space-between;
  }
}

@media (max-width: 1600px) and (min-width: 1281px) {
  .walk-forward-review-grid {
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
  }

  .walk-forward-detail-card .summary-cards {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .walk-forward-detail-card .result-overview-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1450px) and (min-width: 1281px) {
  .walk-forward-detail-card .chart-grid,
  .walk-forward-detail-card .result-secondary-grid,
  .walk-forward-detail-card .result-matrix-pair-grid {
    grid-template-columns: 1fr;
  }
}

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

  .browser-meta-cards,
  .browser-stats {
    grid-template-columns: 1fr;
  }

  .result-overview-hero,
  .result-overview-side,
  .result-keyvalue-grid {
    grid-template-columns: 1fr;
  }

  .result-overview-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .result-matrix-head {
    flex-direction: column;
    align-items: stretch;
  }
}

@keyframes driftA {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(-22px, 26px);
  }
}

@keyframes driftB {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(20px, -18px);
  }
}

.hidden {
  display: none !important;
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100%;
}

.auth-panel {
  border: 1px solid var(--line-soft);
  background: linear-gradient(155deg, rgba(9, 13, 20, 0.95), rgba(16, 24, 35, 0.88));
  border-radius: 30px;
  box-shadow: 0 28px 55px rgba(0, 0, 0, 0.34);
}

.session-chip-role,
.account-role-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #d7b98e;
}

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

.auth-panel-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.auth-panel-head h2 {
  margin: 0;
  font-size: 1.6rem;
}

.auth-status {
  margin: 0;
  color: #d9cebb;
  line-height: 1.55;
}

.auth-status.is-error {
  color: #ffc0c0;
}

.auth-status.is-success {
  color: #b7f4cc;
}

.auth-mode-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  padding: 6px;
  border-radius: 18px;
  background: rgba(8, 16, 24, 0.72);
  border: 1px solid var(--line-soft);
}

.auth-mode-tab {
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.auth-mode-tab.active {
  background: linear-gradient(135deg, rgba(216, 168, 96, 0.18), rgba(95, 211, 255, 0.16));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(216, 168, 96, 0.28);
}

.auth-form-panel {
  display: none;
}

.auth-form-panel.active {
  display: block;
}

.auth-form {
  margin-top: 18px;
}

.auth-form label,
.account-form-card label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a89a84;
}

.auth-form input,
.account-form-card input,
.admin-reset-link-row input {
  width: 100%;
  border: 1px solid rgba(183, 160, 124, 0.25);
  color: var(--text);
  background: rgba(11, 15, 23, 0.74);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
}

.auth-submit {
  width: 100%;
  margin-top: 18px;
}

.auth-footnote {
  margin: 14px 0 0;
  color: #bcae99;
  font-size: 0.82rem;
  line-height: 1.55;
}

.topbar-side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
}

.session-chip {
  display: grid;
  gap: 1px;
  min-width: 0;
  max-width: 240px;
  flex: 0 1 240px;
  padding: 7px 12px;
  border-radius: 14px;
  border: 1px solid rgba(166, 144, 108, 0.14);
  background: rgba(8, 17, 26, 0.58);
  box-shadow: none;
  overflow: hidden;
}

.session-chip strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(246, 239, 227, 0.9);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-logout {
  width: auto;
  white-space: nowrap;
  padding: 9px 14px;
  min-width: 110px;
  flex: 0 0 auto;
  margin-top: 0;
  border-radius: 14px;
  background: rgba(8, 17, 26, 0.5);
  border-color: rgba(166, 144, 108, 0.14);
  color: rgba(246, 239, 227, 0.82);
  box-shadow: none;
  font-weight: 600;
  text-align: center;
}

.topbar-logout:hover {
  border-color: rgba(166, 144, 108, 0.26);
  background: rgba(8, 17, 26, 0.72);
}

.session-chip-role {
  gap: 6px;
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  color: rgba(215, 185, 142, 0.76);
}

#statusPill {
  font-size: 0.7rem;
  padding: 7px 11px;
  border-color: rgba(166, 144, 108, 0.24) !important;
  color: rgba(240, 214, 170, 0.82) !important;
}

@media (max-width: 840px) {
  .topbar-side {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-left: 0;
  }

  .session-chip {
    max-width: min(100%, 280px);
    flex: 1 1 220px;
  }

  .topbar-logout {
    width: auto;
  }
}

#accountTab.tab-panel.active,
#userManagementTab.tab-panel.active {
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
}

.account-detail-panel,
.user-management-panel {
  padding-bottom: 22px;
}

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

.account-form-card,
.admin-reset-link-card,
.user-list-card,
.account-identity-card {
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: rgba(8, 15, 24, 0.72);
  padding: 18px;
}

.account-form-card h3 {
  margin: 0 0 8px;
}

.account-identity-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 1.02rem;
}

.account-warning {
  margin-top: 12px;
  border: 1px solid rgba(255, 112, 112, 0.32);
  background: rgba(255, 112, 112, 0.12);
  color: #ffd7d7;
  border-radius: 14px;
  padding: 12px 14px;
  line-height: 1.5;
  font-size: 0.86rem;
}

.recovery-codes-list {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.recovery-code-chip {
  border: 1px solid rgba(216, 168, 96, 0.24);
  border-radius: 14px;
  background: rgba(12, 19, 29, 0.84);
  padding: 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

.user-list {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.user-list-card {
  display: grid;
  gap: 14px;
}

.user-list-card-head,
.admin-reset-link-row,
.user-list-card-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.user-list-card strong {
  font-size: 1.02rem;
}

.user-list-card-meta {
  color: #baa88f;
  font-size: 0.82rem;
}

.user-role-pill,
.user-state-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.user-role-pill {
  background: rgba(95, 211, 255, 0.12);
  color: #b9efff;
  border: 1px solid rgba(95, 211, 255, 0.24);
}

.user-role-pill.admin {
  background: rgba(216, 168, 96, 0.14);
  color: #f4d4a4;
  border-color: rgba(216, 168, 96, 0.28);
}

.user-state-pill {
  background: rgba(255, 194, 103, 0.12);
  color: #ffd7a6;
  border: 1px solid rgba(255, 194, 103, 0.22);
}

.user-state-pill.ok {
  background: rgba(110, 231, 166, 0.12);
  color: #b9f7d1;
  border-color: rgba(110, 231, 166, 0.22);
}

.user-list-actions {
  display: flex;
  justify-content: flex-end;
}

.admin-reset-link-card {
  margin: 0 18px 18px;
}

.admin-reset-link-row {
  margin-top: 12px;
}

.admin-reset-link-row input {
  flex: 1 1 420px;
}

@media (max-width: 1220px) {
  .auth-stage,
  #accountTab.tab-panel.active,
  #userManagementTab.tab-panel.active {
    grid-template-columns: 1fr;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .auth-shell,
  .app-shell {
    width: min(96vw, 96vw);
  }

  .auth-shell {
    width: 100%;
    min-height: 100vh;
    padding: 18px;
  }

  .topbar {
    gap: 14px;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-side,
  .auth-mode-tabs {
    width: 100%;
  }

  .topbar-side {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-left: 0;
  }

  .session-chip {
    min-width: 0;
    max-width: min(100%, 280px);
    flex: 1 1 220px;
  }

  .topbar-logout {
    width: auto;
    min-width: 110px;
  }

  .recovery-codes-list {
    grid-template-columns: 1fr;
  }
}
