:root {
  color-scheme: dark;
  --bg: #090d12;
  --rail: #0d131b;
  --surface: #111923;
  --surface-2: #16212d;
  --line: #263241;
  --text: #edf4fa;
  --muted: #8b9aaa;
  --cyan: #21d4e6;
  --amber: #e6b84a;
  --red: #ff5e66;
  --green: #40d98f;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 16px;
  background: var(--rail);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(33, 212, 230, 0.45);
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(33, 212, 230, 0.08);
  font-size: 20px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.25;
}

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  border-color: rgba(33, 212, 230, 0.24);
  background: rgba(33, 212, 230, 0.08);
}

.icon {
  width: 22px;
  color: var(--cyan);
  text-align: center;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 16px rgba(230, 184, 74, 0.7);
}

.status-dot.ok {
  background: var(--green);
  box-shadow: 0 0 16px rgba(64, 217, 143, 0.7);
}

.status-dot.bad {
  background: var(--red);
  box-shadow: 0 0 16px rgba(255, 94, 102, 0.7);
}

.workspace {
  padding: 24px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 760;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 13, 18, 0.34);
}

.session-bar span {
  max-width: 160px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-bar .secondary-button {
  min-width: 76px;
  height: 30px;
  padding: 0 10px;
}

.controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.controls label,
.symbol-add {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.symbol-add {
  grid-template-columns: minmax(92px, 120px) 38px;
  align-items: end;
}

select,
input,
#refresh-button,
.secondary-button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
}

select {
  min-width: 116px;
  padding: 0 12px;
}

input {
  width: 100%;
  padding: 0 12px;
  text-transform: uppercase;
}

#refresh-button {
  min-width: 96px;
  padding: 0 16px;
  color: #061014;
  border-color: transparent;
  background: var(--cyan);
  font-weight: 740;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-button {
  min-width: 94px;
  padding: 0 14px;
  color: var(--cyan);
  background: rgba(33, 212, 230, 0.08);
  cursor: pointer;
  white-space: nowrap;
}

.secondary-button:hover {
  border-color: rgba(33, 212, 230, 0.45);
}

.danger-button {
  color: var(--red);
  border-color: rgba(255, 94, 102, 0.3);
  background: rgba(255, 94, 102, 0.08);
}

.danger-button:hover {
  border-color: rgba(255, 94, 102, 0.58);
}

.icon-button {
  min-width: 38px;
  width: 38px;
  padding: 0;
  font-size: 20px;
  font-weight: 760;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  margin-bottom: 16px;
}

.view-hidden {
  display: none !important;
}

.signal-panel,
.status-panel,
.metric-card,
.chart-panel,
.table-panel,
.trade-plan-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(22, 33, 45, 0.96), rgba(17, 25, 35, 0.96));
  box-shadow: var(--shadow);
}

.signal-panel {
  min-height: 210px;
  padding: 18px;
}

.status-panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.panel-header span:first-child {
  color: var(--text);
  font-weight: 720;
  text-transform: uppercase;
}

.panel-header span:last-child {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 28px;
}

.signal-color {
  overflow-wrap: anywhere;
  font-size: 48px;
  line-height: 1;
  font-weight: 850;
  color: var(--amber);
}

.signal-panel.cyan .signal-color {
  color: var(--cyan);
}

.signal-panel.yellow .signal-color {
  color: var(--amber);
}

.signal-panel.red .signal-color {
  color: var(--red);
}

.signal-copy {
  max-width: 640px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.hedge-action {
  min-width: 190px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 13, 18, 0.38);
}

.hedge-action span,
.hedge-action small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.hedge-action strong {
  display: block;
  margin: 7px 0;
  color: var(--text);
  font-size: 22px;
}

.score-bar {
  height: 8px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: #080c11;
}

#score-fill {
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: var(--amber);
  transition: width 220ms ease, background 220ms ease;
}

.signal-panel.cyan #score-fill {
  background: var(--cyan);
}

.signal-panel.yellow #score-fill {
  background: var(--amber);
}

.signal-panel.red #score-fill {
  background: var(--red);
}

.status-list {
  display: grid;
  gap: 12px;
  margin: 22px 0 0;
}

.status-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.status-list dt {
  color: var(--muted);
  font-size: 13px;
}

.status-list dd {
  margin: 0;
  max-width: 210px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-list {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.endpoint-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  min-height: 26px;
  padding: 6px 8px;
  border: 1px solid rgba(38, 50, 65, 0.75);
  border-radius: 6px;
  background: rgba(9, 13, 18, 0.28);
  color: var(--muted);
  font-size: 11px;
}

.endpoint-row strong {
  color: var(--green);
  font-size: 11px;
}

.endpoint-row.error strong {
  color: var(--red);
}

.endpoint-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  min-height: 126px;
  padding: 16px;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin: 14px 0 10px;
  overflow: hidden;
  font-size: 22px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  gap: 16px;
}

.chart-panel,
.table-panel {
  min-height: 330px;
  padding: 18px;
}

canvas {
  display: block;
  width: 100%;
  height: 260px;
  margin-top: 18px;
}

.table-wrap {
  max-height: 270px;
  margin-top: 14px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

th,
td {
  overflow: hidden;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th:nth-child(1),
td:nth-child(1) {
  width: 18%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 17%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 31%;
}

th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
  width: 17%;
}

th {
  color: var(--muted);
  font-weight: 650;
}

td {
  color: var(--text);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  color: #061014;
  background: var(--amber);
  font-weight: 760;
}

.tag.cyan {
  background: var(--cyan);
}

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

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(33, 212, 230, 0.16), transparent 30%),
    radial-gradient(circle at 82% 16%, rgba(230, 184, 74, 0.12), transparent 28%),
    var(--bg);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-panel {
  display: grid;
  gap: 24px;
  width: min(100%, 430px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(22, 33, 45, 0.98), rgba(17, 25, 35, 0.98));
  box-shadow: var(--shadow);
}

.login-brand {
  min-height: 42px;
}

.login-panel h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.login-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.login-form input {
  height: 42px;
  text-transform: none;
}

#login-button {
  height: 42px;
  margin-top: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #061014;
  background: var(--cyan);
  font: inherit;
  font-weight: 760;
  cursor: pointer;
}

#login-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
}

.flow-stack,
.flow-table-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.flow-table-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.flow-panel {
  min-height: auto;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.flow-card {
  min-width: 0;
  min-height: 118px;
  padding: 14px;
  border: 1px solid rgba(38, 50, 65, 0.82);
  border-radius: 8px;
  background: rgba(9, 13, 18, 0.28);
}

.flow-card span,
.flow-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.flow-card strong {
  display: block;
  margin: 12px 0 9px;
  overflow: hidden;
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-card small {
  overflow: hidden;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 84px 1fr;
  }

  .brand div:last-child,
  .nav-item span:last-child,
  .sidebar-footer span:last-child {
    display: none;
  }

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

  .flow-table-grid {
    grid-template-columns: 1fr;
  }

  .overview-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    flex-direction: row;
    align-items: center;
    padding: 12px;
  }

  .nav-list {
    display: flex;
    margin-left: auto;
  }

  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

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

  .controls {
    flex-wrap: wrap;
    align-items: end;
  }

  .session-bar {
    justify-content: space-between;
    margin-left: 0;
  }

  .symbol-picker {
    min-width: 112px;
  }

  .symbol-add {
    flex: 1 1 154px;
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .signal-body {
    align-items: stretch;
    flex-direction: column;
  }

  .signal-color {
    font-size: 34px;
  }

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

  .metric-card strong {
    font-size: 20px;
  }

  .chart-panel,
  .table-panel {
    overflow: hidden;
  }

  .trade-plan-body {
    grid-template-columns: 1fr;
  }

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

  table {
    font-size: 11px;
  }

  th,
  td {
    padding: 9px 6px;
  }
}


.risk-plan-grid,
.greeks-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.trade-plan-panel {
  padding: 18px;
}

.trade-plan-body {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.plan-bias-box {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 13, 18, 0.34);
}

.plan-bias-box span,
.plan-bias-box small,
.plan-levels dt {
  color: var(--muted);
  font-size: 12px;
}

.plan-bias-box strong {
  overflow-wrap: anywhere;
  color: var(--amber);
  font-size: 22px;
  line-height: 1.1;
}

.trade-plan-panel.long .plan-bias-box strong {
  color: var(--cyan);
}

.trade-plan-panel.short .plan-bias-box strong {
  color: var(--red);
}

.plan-levels {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.plan-levels div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(38, 50, 65, 0.75);
  border-radius: 8px;
  background: rgba(9, 13, 18, 0.28);
}

.plan-levels dd {
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.greeks-wrap {
  max-height: 430px;
}

.greeks-table {
  min-width: 1040px;
}

.greeks-table th,
.greeks-table td {
  width: auto !important;
}

.greeks-table th:nth-child(1),
.greeks-table td:nth-child(1) {
  width: 16% !important;
}

.greeks-table th:nth-child(2),
.greeks-table td:nth-child(2) {
  width: 11% !important;
}

.greeks-table th:nth-child(n + 3),
.greeks-table td:nth-child(n + 3) {
  width: 8% !important;
  text-align: right;
}

.role-hidden {
  display: none !important;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  margin: 18px 0 10px;
}

.users-panel {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .user-form {
    grid-template-columns: 1fr;
  }
}
