:root {
  --bg: #0b0f15;
  --bg-elev: #101722;
  --panel: #131c28;
  --panel-soft: #182233;
  --panel-muted: #0f1620;
  --line: #293447;
  --line-strong: #3a4760;
  --text: #ecf2fa;
  --text-soft: #a8b5c7;
  --text-dim: #7f8da3;
  --primary: #8cb4ff;
  --primary-soft: rgba(140,180,255,.14);
  --good: #35c47c;
  --good-soft: rgba(53,196,124,.14);
  --warn: #f0b64c;
  --warn-soft: rgba(240,182,76,.15);
  --danger: #ef6158;
  --danger-soft: rgba(239,97,88,.15);
  --shadow: 0 10px 30px rgba(0,0,0,.30);
  --radius: 18px;
  --radius-sm: 12px;
  --font-main: Arial, "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(circle at top left, rgba(140,180,255,.08), transparent 28%),
    radial-gradient(circle at top right, rgba(53,196,124,.05), transparent 24%),
    linear-gradient(180deg, #0a0f15 0%, #0b1119 100%);
  color: var(--text);
  font-family: var(--font-main);
  min-height: 100vh;
}

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

.shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(11,15,21,.88);
  backdrop-filter: blur(12px);
}

.brand-block h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -.3px;
}

.brand-block p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.topnav a {
  padding: 10px 14px;
  border: 1px solid rgba(140,180,255,.18);
  background: rgba(140,180,255,.08);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.page-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-title-row h2 {
  margin: 0;
  font-size: 22px;
}

.page-title-row .hint {
  color: var(--text-soft);
  font-size: 14px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)), var(--panel);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -10% 0 auto;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(140,180,255,.12), transparent 60%);
  pointer-events: none;
}
.metric-card span {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
  margin-bottom: 10px;
}
.metric-card strong {
  display: block;
  font-size: 30px;
  letter-spacing: -.5px;
}
.metric-card small {
  display: block;
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
}
.content-grid.single {
  grid-template-columns: 1fr;
}

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.018), rgba(255,255,255,.01)), var(--panel);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.panel-header h3, .panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.panel-sub {
  color: var(--text-soft);
  font-size: 12px;
}

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

.row {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)), var(--panel-soft);
  border: 1px solid rgba(255,255,255,.06);
}

.row strong {
  font-size: 14px;
}

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

.timeline li {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)), var(--panel-soft);
  border: 1px solid rgba(255,255,255,.06);
  color: var(--text);
}

.detail-box {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)), var(--panel-soft);
  border: 1px solid rgba(255,255,255,.06);
  color: var(--text);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  appearance: none;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
}
button.primary {
  background: linear-gradient(180deg, rgba(140,180,255,.22), rgba(140,180,255,.12));
  border-color: rgba(140,180,255,.4);
}
button.warn {
  background: linear-gradient(180deg, rgba(240,182,76,.18), rgba(240,182,76,.08));
  border-color: rgba(240,182,76,.4);
}
button.danger {
  background: linear-gradient(180deg, rgba(239,97,88,.22), rgba(239,97,88,.10));
  border-color: rgba(239,97,88,.45);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge.running { background: var(--good-soft); color: #a8f3ca; border: 1px solid rgba(53,196,124,.25); }
.badge.stopped { background: rgba(124,138,160,.15); color: #d4deea; border: 1px solid rgba(124,138,160,.22); }
.badge.warn { background: var(--warn-soft); color: #ffe19f; border: 1px solid rgba(240,182,76,.28); }
.badge.danger { background: var(--danger-soft); color: #ffc2be; border: 1px solid rgba(239,97,88,.28); }
.badge.live { background: var(--primary-soft); color: #d7e5ff; border: 1px solid rgba(140,180,255,.3); }
.badge.paper { background: rgba(168,181,199,.14); color: #dde6f1; border: 1px solid rgba(168,181,199,.25); }
.badge.dev { background: rgba(140,180,255,.10); color: #dce8ff; border: 1px solid rgba(140,180,255,.18); }

.kill-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(239,97,88,.18), rgba(239,97,88,.08));
  border: 1px solid rgba(239,97,88,.35);
  box-shadow: var(--shadow);
}
.kill-banner.hidden { display: none; }
.kill-banner strong { font-size: 18px; }
.kill-banner p { margin: 6px 0 0; color: #ffd2cf; }

.section-note {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}
.form-grid label {
  display: block;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)), var(--panel-soft);
  border: 1px solid rgba(255,255,255,.06);
  color: var(--text-soft);
  font-size: 12px;
}
.form-grid input {
  width: 100%;
  margin-top: 8px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: #0c131d;
  color: var(--text);
}

.soft-page .panel, .soft-page .metric-card {
  background: linear-gradient(180deg, rgba(255,255,255,.018), rgba(255,255,255,.01)), #15202e;
}

@media (max-width: 1200px) {
  .hero-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar { display: block; }
  .topnav { margin-top: 12px; }
  .hero-grid, .form-grid { grid-template-columns: 1fr; }
}

/* ===== header_v2 ===== */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
}

.app-topbar .brand-block h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
}

.topnav a.active {
  font-weight: 700;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10);
}

.context-bar {
  display: block;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.context-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.context-purpose {
  font-size: 14px;
  opacity: 0.82;
  line-height: 1.4;
  text-align: right;
}

.strategy-submenu {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px 18px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.strategy-submenu a,
.strategy-submenu span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1;
}

.strategy-submenu a {
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.strategy-submenu a.active {
  font-weight: 700;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}

.strategy-submenu .disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

body .shell {
  padding-top: 36px;
}

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

  .context-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .context-purpose {
    text-align: left;
  }

  .topnav {
    gap: 8px;
  }

  .topnav a,
  .strategy-submenu a,
  .strategy-submenu span {
    min-height: 34px;
    padding: 0 12px;
  }
}
/* ===== /header_v2 ===== */

/* Strategy compact layout */
.strategy-compact .strategy-hero-grid {
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 8px;
}

.strategy-compact .compact-card {
  padding: 10px 12px;
  min-height: auto;
}

.strategy-compact .compact-card span,
.strategy-compact .compact-card .metric-label {
  font-size: 11px;
  line-height: 1.2;
}

.strategy-compact .compact-card strong,
.strategy-compact .compact-card .metric-value {
  font-size: 15px;
  line-height: 1.2;
  margin-top: 4px;
  word-break: break-word;
}

@media (max-width: 1200px) {
  .strategy-compact .strategy-hero-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .strategy-compact .strategy-hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .compare-grid-4 {
    grid-template-columns: 100px 1fr;
  }

  .compare-grid-4 .cell:nth-child(2n) {
    border-right: 0;
  }

  .compare-grid-4 .cell:nth-child(4n) {
    border-right: 0;
  }

  .compare-grid-4 .cell:nth-last-child(-n+2) {
    border-bottom: 0;
  }
}

/* Strategy compare table: 6 columns, gap 0 */
.compare-grid-6 {
  display: grid;
  grid-template-columns: 96px 0.8fr 96px 0.8fr 96px 0.8fr;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.compare-grid-6 .cell {
  padding: 6px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  line-height: 1.3;
}

.compare-grid-6 .cell.head {
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

.compare-grid-6 .cell.value {
  word-break: break-word;
}

.compare-grid-6 .cell:nth-child(6n) {
  border-right: 0;
}

.compare-grid-6 .cell:nth-last-child(-n+6) {
  border-bottom: 0;
}

@media (max-width: 1100px) {
  .compare-grid-6 {
    grid-template-columns: 96px 0.8fr 96px 0.8fr;
  }

  .compare-grid-6 .cell:nth-child(4n) {
    border-right: 0;
  }
}

@media (max-width: 768px) {
  .compare-grid-6 {
    grid-template-columns: 96px 0.8fr;
  }

  .compare-grid-6 .cell:nth-child(2n) {
    border-right: 0;
  }
}

/* Strategy compare table mobile fix */
.compare-grid-6 .cell {
  min-width: 0;
  box-sizing: border-box;
}

.compare-grid-6 .cell.value {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 600px) {
  .compare-grid-6 {
    grid-template-columns: 84px minmax(0, 1fr) !important;
  }

  .compare-grid-6 .cell {
    padding: 5px 6px;
    font-size: 11px;
    line-height: 1.25;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .compare-grid-6 .cell:nth-child(2n) {
    border-right: 0 !important;
  }

  .compare-grid-6 .cell:nth-child(6n) {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }

  .compare-grid-6 .cell:nth-last-child(-n+6) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .compare-grid-6 .cell:nth-last-child(-n+2) {
    border-bottom: 0 !important;
  }
}

/* Strategy compare table: 8 columns, equal width */
.compare-grid-8 {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.compare-grid-8 .cell {
  min-width: 0;
  box-sizing: border-box;
  padding: 6px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  line-height: 1.3;
}

.compare-grid-8 .cell.head {
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

.compare-grid-8 .cell.value {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.compare-grid-8 .cell:nth-child(8n) {
  border-right: 0;
}

.compare-grid-8 .cell:nth-last-child(-n+8) {
  border-bottom: 0;
}

@media (max-width: 1100px) {
  .compare-grid-8 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .compare-grid-8 .cell:nth-child(4n) {
    border-right: 0;
  }

  .compare-grid-8 .cell:nth-last-child(-n+4) {
    border-bottom: 0;
  }
}

@media (max-width: 600px) {
  .compare-grid-8 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-grid-8 .cell:nth-child(2n) {
    border-right: 0;
  }

  .compare-grid-8 .cell:nth-last-child(-n+2) {
    border-bottom: 0;
  }
}

/* Strategy plain blocks */
.strategy-plain-block {
  margin-bottom: 0;
}

.strategy-plain-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 6px 0;
}

/* Strategy card blocks */
.strategy-card-block {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.strategy-card-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 6px 0;
}

.strategy-inside-actions {
  justify-content: flex-end;
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.range-wrap input[type="range"] {
  flex: 1;
  min-width: 0;
}

.range-wrap strong {
  min-width: 18px;
  text-align: right;
}

@media (max-width: 768px) {
  .strategy-card-title {
    font-size: 22px;
  }

  .strategy-inside-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }
}



/* Strategy UI cleanup: title size + equal bottom panel widths */
.strategy-compact .page-title-row h2 {
  font-size: 18px;
}

.strategy-compact .strategy-card-title {
  font-size: 18px;
}

.strategy-bottom-grid {
  grid-template-columns: 1fr 1fr;
}



/* Strategy explain modal + actual variables box */
.strategy-family-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.strategy-inline-button {
  padding: 4px 10px;
  min-height: auto;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.strategy-actual-vars-box {
  gap: 10px;
}

.strategy-filter-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border: 1px solid rgba(255,255,255,.08);
}

.strategy-filter-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
  border-right: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.strategy-filter-pair .cell {
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.3;
  box-sizing: border-box;
}

.strategy-filter-pair .cell.head {
  font-weight: 700;
  background: rgba(255,255,255,.03);
  border-right: 1px solid rgba(255,255,255,.08);
}

.strategy-filter-pair .cell.value {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1200px) {
  .strategy-filter-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .strategy-filter-grid-4 {
    grid-template-columns: 1fr;
  }

  .strategy-filter-pair {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .strategy-filter-pair .cell {
    padding: 5px 6px;
    font-size: 11px;
    line-height: 1.25;
  }
}

.strategy-actual-vars-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
}

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

.strategy-var-chip {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)), var(--panel-soft);
}

.strategy-var-label {
  font-size: 11px;
  color: var(--text-soft);
  margin-bottom: 4px;
}

.strategy-var-value {
  font-size: 13px;
  font-weight: 700;
}

.strategy-filter-status {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
}

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

.strategy-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.62);
}

.strategy-modal-card {
  width: min(1100px, 95vw);
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,.018), rgba(255,255,255,.01)), var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.strategy-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.strategy-modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.strategy-modal-body {
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.strategy-modal-body h4 {
  margin: 0 0 6px 0;
  font-size: 16px;
}

.strategy-modal-body p,
.strategy-modal-body li {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.strategy-modal-body ul {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 768px) {
  .strategy-vars-grid {
    grid-template-columns: 1fr;
  }

  .strategy-modal {
    padding: 12px;
  }

  .strategy-modal-card {
    width: 100%;
    max-height: 92vh;
  }
}

/* Strategy edit table 8 columns / 1:2 ratio override */
#strategy_edit_table.compare-grid-8 {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) minmax(0, 2fr)
    minmax(0, 1fr) minmax(0, 2fr)
    minmax(0, 1fr) minmax(0, 2fr)
    minmax(0, 1fr) minmax(0, 2fr);
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#strategy_edit_table.compare-grid-8 .cell {
  min-width: 0;
  box-sizing: border-box;
  padding: 6px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  line-height: 1.3;
}

#strategy_edit_table.compare-grid-8 .cell.head {
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

#strategy_edit_table.compare-grid-8 .cell.value {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#strategy_edit_table.compare-grid-8 .cell:nth-child(8n) {
  border-right: 0;
}

#strategy_edit_table.compare-grid-8 .cell:nth-last-child(-n+8) {
  border-bottom: 0;
}

#strategy_edit_table.compare-grid-8 .cell.value > select,
#strategy_edit_table.compare-grid-8 .cell.value > input[type="text"],
#strategy_edit_table.compare-grid-8 .cell.value > input[type="time"],
#strategy_edit_table.compare-grid-8 .cell.value > .range-wrap {
  width: 100%;
}

@media (max-width: 1400px) {
  #strategy_edit_table.compare-grid-8 {
    grid-template-columns:
      minmax(0, 1fr) minmax(0, 2fr)
      minmax(0, 1fr) minmax(0, 2fr);
  }

  #strategy_edit_table.compare-grid-8 .cell:nth-child(4n) {
    border-right: 0;
  }

  #strategy_edit_table.compare-grid-8 .cell:nth-last-child(-n+4) {
    border-bottom: 0;
  }
}

@media (max-width: 768px) {
  #strategy_edit_table.compare-grid-8 {
    grid-template-columns:
      minmax(0, 1fr) minmax(0, 2fr);
  }

  #strategy_edit_table.compare-grid-8 .cell:nth-child(2n) {
    border-right: 0;
  }

  #strategy_edit_table.compare-grid-8 .cell:nth-last-child(-n+2) {
    border-bottom: 0;
  }
}


/* Strategy summary cards + session id readonly */
.strategy-summary-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.strategy-summary-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
}

.strategy-summary-label {
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.strategy-summary-value {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.strategy-inline-text {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  color: var(--text);
  font-weight: 400;
  line-height: 1.3;
  background: transparent;
  border: 0;
  border-radius: 0;
  min-height: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.strategy-inline-readonly {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1400px) {
  .strategy-summary-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .strategy-summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .strategy-summary-value {
    font-size: 14px;
  }
}


/* Strategy summary cards like warroom + change flash */
.strategy-summary-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.strategy-summary-card {
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: #1a2230;
  padding: 10px 12px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.strategy-summary-label {
  color: #92a0b2;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 6px;
  text-align: center;
}

.strategy-summary-value {
  color: #e7edf6;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
  word-break: break-word;
  text-align: center;
}

.strategy-inline-readonly {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1400px) {
  .strategy-summary-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .strategy-summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .strategy-summary-value {
    font-size: 14px;
  }
}

@keyframes strategyChangeFlashPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(94,196,255,0);
    background: rgba(94,196,255,0);
  }
  12% {
    box-shadow:
      0 0 0 2px rgba(94,196,255,.95),
      0 0 28px rgba(94,196,255,.42);
    background: rgba(94,196,255,.28);
  }
  28% {
    box-shadow:
      0 0 0 2px rgba(94,196,255,.82),
      0 0 22px rgba(94,196,255,.32);
    background: rgba(94,196,255,.20);
  }
  44% {
    box-shadow:
      0 0 0 2px rgba(94,196,255,.92),
      0 0 30px rgba(94,196,255,.45);
    background: rgba(94,196,255,.26);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(94,196,255,.18),
      0 0 10px rgba(94,196,255,.12);
    background: rgba(94,196,255,.08);
  }
}

.strategy-change-flash {
  border-color: rgba(94,196,255,.95) !important;
  background: rgba(94,196,255,.18) !important;
  animation: strategyChangeFlashPulse 6.5s ease;
  transition:
    background-color .2s ease,
    border-color .2s ease,
    box-shadow .2s ease;
}


/* Strategy summary card flash variants */
@keyframes strategyChangeFlashNeutral {
  0% {
    box-shadow: 0 0 0 0 rgba(94,196,255,0);
    background: rgba(94,196,255,0);
  }
  16% {
    box-shadow:
      0 0 0 2px rgba(94,196,255,.95),
      0 0 28px rgba(94,196,255,.42);
    background: rgba(94,196,255,.24);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(94,196,255,.16),
      0 0 8px rgba(94,196,255,.10);
    background: rgba(94,196,255,.08);
  }
}

@keyframes strategyChangeFlashUp {
  0% {
    box-shadow: 0 0 0 0 rgba(47,191,113,0);
    background: rgba(47,191,113,0);
  }
  16% {
    box-shadow:
      0 0 0 2px rgba(47,191,113,.95),
      0 0 28px rgba(47,191,113,.42);
    background: rgba(47,191,113,.24);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(47,191,113,.16),
      0 0 8px rgba(47,191,113,.10);
    background: rgba(47,191,113,.08);
  }
}

@keyframes strategyChangeFlashDown {
  0% {
    box-shadow: 0 0 0 0 rgba(229,83,75,0);
    background: rgba(229,83,75,0);
  }
  16% {
    box-shadow:
      0 0 0 2px rgba(229,83,75,.95),
      0 0 28px rgba(229,83,75,.42);
    background: rgba(229,83,75,.24);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(229,83,75,.16),
      0 0 8px rgba(229,83,75,.10);
    background: rgba(229,83,75,.08);
  }
}

@keyframes strategyChangeFlashWarn {
  0% {
    box-shadow: 0 0 0 0 rgba(240,180,41,0);
    background: rgba(240,180,41,0);
  }
  16% {
    box-shadow:
      0 0 0 2px rgba(240,180,41,.95),
      0 0 28px rgba(240,180,41,.42);
    background: rgba(240,180,41,.24);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(240,180,41,.16),
      0 0 8px rgba(240,180,41,.10);
    background: rgba(240,180,41,.08);
  }
}

@keyframes strategyChangeFlashDanger {
  0% {
    box-shadow: 0 0 0 0 rgba(229,83,75,0);
    background: rgba(229,83,75,0);
  }
  16% {
    box-shadow:
      0 0 0 2px rgba(229,83,75,.98),
      0 0 30px rgba(229,83,75,.48);
    background: rgba(229,83,75,.28);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(229,83,75,.18),
      0 0 10px rgba(229,83,75,.12);
    background: rgba(229,83,75,.10);
  }
}

.strategy-change-flash.strategy-change-neutral {
  border-color: rgba(94,196,255,.95) !important;
  animation: strategyChangeFlashNeutral 2.4s ease;
}

.strategy-change-flash.strategy-change-up {
  border-color: rgba(47,191,113,.95) !important;
  animation: strategyChangeFlashUp 2.4s ease;
}

.strategy-change-flash.strategy-change-down {
  border-color: rgba(229,83,75,.95) !important;
  animation: strategyChangeFlashDown 2.4s ease;
}

.strategy-change-flash.strategy-change-warn {
  border-color: rgba(240,180,41,.95) !important;
  animation: strategyChangeFlashWarn 2.4s ease;
}

.strategy-change-flash.strategy-change-danger {
  border-color: rgba(229,83,75,.98) !important;
  animation: strategyChangeFlashDanger 2.4s ease;
}



/* Strategy summary / funnel card layout */
.strategy-status-card-box {
  display: grid;
  gap: 10px;
}

.strategy-status-section {
  display: grid;
  gap: 6px;
}

.strategy-status-section-title {
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-soft);
}

.strategy-status-headline-card {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015)), var(--panel-soft);
}

.strategy-status-headline-value {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.strategy-status-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.strategy-status-chip {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.strategy-time-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.02);
}

.strategy-time-card-label {
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.25;
  margin-bottom: 6px;
}

.strategy-time-card-value {
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.strategy-funnel-card-shell {
  display: grid;
}

.strategy-funnel-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.strategy-funnel-metric-card {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
}

.strategy-funnel-metric-label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-funnel-metric-value {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 15px;
  line-height: 1.1;
  font-weight: 800;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .strategy-status-chip-grid,
  .strategy-time-card-grid,
  .strategy-funnel-card-grid {
    grid-template-columns: 1fr;
  }
}

.strategy-time-policy-line {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.content-grid.strategy-bottom-grid {
  grid-template-columns: 1fr 1fr;
}

/* OAI_20260402_STRATEGY_TABLE_ALIGNMENT_V1 */
#current_candidates table th,
#current_candidates table td,
#current_positions table th,
#current_positions table td,
#recent_order_flow table th,
#recent_order_flow table td,
#trade_history table th,
#trade_history table td {
  border-color: rgba(148, 163, 184, 0.18) !important;
}

#current_candidates table thead th,
#current_positions table thead th,
#recent_order_flow table thead th,
#trade_history table thead th {
  text-align: center !important;
}

#current_candidates table tbody td:nth-child(3),
#current_positions table tbody td:nth-child(2),
#current_positions table tbody td:nth-child(3),
#current_positions table tbody td:nth-child(4),
#recent_order_flow table tbody td:nth-child(6),
#recent_order_flow table tbody td:nth-child(7),
#trade_history table tbody td:nth-child(4),
#trade_history table tbody td:nth-child(5) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

/* OAI_20260402_STRATEGY_CURRENT_CANDIDATES_CODE_CENTER_V1 */
#current_candidates table thead th:nth-child(2),
#current_candidates table tbody td:nth-child(2) {
  text-align: center !important;
  font-variant-numeric: tabular-nums;
}

/* OAI_20260402_STRATEGY_RECENT_ORDER_FLOW_CENTER_V1 */
#recent_order_flow table thead th:nth-child(2),
#recent_order_flow table tbody td:nth-child(2),
#recent_order_flow table thead th:nth-child(4),
#recent_order_flow table tbody td:nth-child(4),
#recent_order_flow table thead th:nth-child(5),
#recent_order_flow table tbody td:nth-child(5) {
  text-align: center !important;
}

/* OAI_20260402_STRATEGY_TODAY_TRADE_HISTORY_ALIGN_V1 */
#trade_history table thead th:nth-child(3),
#trade_history table tbody td:nth-child(3) {
  text-align: center !important;
}

#trade_history table tbody td:nth-child(1),
#trade_history table tbody td:nth-child(2) {
  color: inherit;
}
