:root {
  --bg-main: #070910;
  --bg-panel: #0e1119;
  --bg-panel-2: #111523;
  --line: #1c2434;
  --line-strong: #2a3550;
  --text-main: #dce4f3;
  --text-muted: #8b95aa;
  --up: #00d087;
  --down: #ff4d5e;
  --accent: #4fb8ff;
  --warn: #ffcb4f;
  --perp-row-height: 21px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 10% 20%, #101726 0%, #070910 55%, #05070c 100%);
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.12;
}

.app-shell {
  min-height: 100vh;
  padding: 6px 6px 82px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 6px;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-panel-2) 100%);
  border-radius: 0;
  padding: 6px;
  animation: panel-in 380ms ease-out both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand h1 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 28px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.brand p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.brand-inline-link {
  color: #9ec8ff;
  text-decoration: none;
}

.brand-inline-link:hover {
  color: #c4e0ff;
  text-decoration: underline;
}

.brand-logo {
  width: 42px;
  height: 42px;
  display: block;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
}

.status-cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #b8c6de;
  font-size: 11px;
  padding: 4px 7px;
}

.status-pill.feed-live {
  border-color: rgba(0, 208, 135, 0.45);
  color: #9fe9c8;
}

.status-pill.feed-offline {
  border-color: rgba(158, 176, 206, 0.35);
  color: #9eb0ce;
}

.status-pill.feed-connecting {
  border-color: rgba(79, 184, 255, 0.48);
  color: #b6dcff;
}

.status-pill.feed-error {
  border-color: rgba(255, 77, 94, 0.5);
  color: #ffb8bf;
}

.status-link {
  text-decoration: none;
  cursor: pointer;
}

.status-btn {
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
}

.status-btn:hover {
  background: #132138;
}

.account-user {
  font-family: "Rajdhani", sans-serif;
  font-size: 16px;
  letter-spacing: 0.04em;
}

.account-plan {
  font-size: 9px;
}

.account-mini-meta {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  color: var(--text-muted);
  font-size: 10px;
}

.account-mini-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot.live {
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(0, 208, 135, 0.75);
  animation: pulse 1.8s infinite;
}

.dot.idle {
  background: #61708e;
  box-shadow: none;
  animation: none;
}

.dot.warn {
  background: var(--warn);
  box-shadow: none;
  animation: none;
}

.dot.error {
  background: var(--down);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 208, 135, 0.75);
  }
  80% {
    box-shadow: 0 0 0 10px rgba(0, 208, 135, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 208, 135, 0);
  }
}

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

.metric {
  border: 1px solid var(--line);
  background: #0c1019;
  padding: 4px 6px;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.metric-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.metric-value {
  font-size: 14px;
  color: #ecf2ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pnl-value {
  font-family: "Rajdhani", sans-serif;
  font-size: 22px;
  line-height: 1;
}

.metric-meta {
  color: #8ea2c6;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric-meta.source-live {
  color: #9fe9c8;
}

.metric-meta.source-sim {
  color: #b6dcff;
}

.workspace-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) 6px minmax(0, 1fr);
  gap: 0;
}

.column-splitter {
  width: 6px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: linear-gradient(90deg, #0f1627 0%, #0a111f 100%);
  cursor: col-resize;
}

.column-splitter.disabled {
  opacity: 0.45;
  cursor: default;
}

.left-stack,
.right-stack {
  min-height: 0;
  display: grid;
  gap: 0;
}

.left-stack {
  grid-template-rows: minmax(158px, 0.18fr) 6px minmax(200px, 0.36fr) 6px minmax(202px, 0.46fr);
}

.right-stack {
  grid-template-rows: minmax(270px, 0.54fr) 6px minmax(250px, 0.46fr);
  align-content: start;
}

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

.panel-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-collapse-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #c5d5ef;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.panel-collapse-btn:hover {
  background: #152033;
}

.panel-splitter {
  height: 6px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0f1627 0%, #0a111f 100%);
  cursor: row-resize;
}

.panel-splitter.disabled {
  opacity: 0.45;
  cursor: default;
}

.resizable-panel {
  min-height: 0;
  overflow: hidden;
}

.resizable-panel.panel-collapsed {
  overflow: hidden;
}

.resizable-panel.panel-collapsed > :not(.panel-head) {
  display: none;
}

h2 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inline-tag {
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #9db0cf;
  font-size: 10px;
  padding: 3px 6px;
  text-transform: uppercase;
  display: inline-flex;
  gap: 8px;
}

.inline-tag.source-live {
  border-color: rgba(0, 208, 135, 0.48);
  color: #9fe9c8;
}

.inline-tag.source-sim {
  border-color: rgba(79, 184, 255, 0.44);
  color: #b6dcff;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  min-height: 0;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.compact-table th,
.compact-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  padding: 3px 5px;
  text-align: left;
  white-space: nowrap;
}

#perp-table th,
#perp-table td {
  height: var(--perp-row-height);
  padding-top: 2px;
  padding-bottom: 2px;
}

.compact-table th:last-child,
.compact-table td:last-child {
  border-right: none;
}

.compact-table th {
  background: #0b1019;
  color: #8f9fbe;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 1;
}

.mode-select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 0;
}

.compact-table tbody tr:hover {
  background: #141e30;
}

.compact-table tbody tr.selected {
  outline: 1px solid var(--accent);
  background: #172239;
}

.compact-table tbody tr.placeholder-row td {
  color: var(--text-muted);
}

.compact-table tbody tr.placeholder-row:hover {
  background: transparent;
}

.tight th,
.tight td {
  padding: 3px 4px;
}

.chart-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.chart-stage {
  position: relative;
  min-height: 0;
  height: 100%;
}

#tv-chart {
  min-height: 140px;
  border: 1px solid var(--line);
  height: 100%;
}

.perp-panel .table-wrap {
  height: calc((var(--perp-row-height) * 7) + 2px);
  max-height: calc((var(--perp-row-height) * 7) + 2px);
  overflow-y: auto;
}

.chart-timeframe {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
}

.chart-tf-btn {
  border: none;
  border-right: 1px solid var(--line-strong);
  background: transparent;
  color: #9eb0ce;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  padding: 3px 5px;
  cursor: pointer;
}

.chart-tf-btn:last-child {
  border-right: none;
}

.chart-tf-btn:hover {
  background: #152033;
}

.chart-tf-btn.active {
  background: #173055;
  color: #d2e4ff;
}

.chart-indicator-toggle {
  border: 1px solid #2f5a93;
  background: #132742;
  color: #cfe2ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  padding: 3px 7px;
  text-transform: uppercase;
  cursor: pointer;
}

.chart-indicator-toggle:hover {
  background: #19345d;
}

.chart-indicator-toggle.off {
  border-color: #4a556e;
  background: #1a2030;
  color: #9ba8bf;
}

.chart-position-lines {
  position: absolute;
  inset: 1px;
  pointer-events: none;
  overflow: hidden;
}

.chart-guide-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
}

.chart-guide-line.entry {
  border-top-color: rgba(79, 184, 255, 0.75);
}

.chart-guide-line.sl {
  border-top-color: rgba(255, 77, 94, 0.78);
}

.chart-guide-line.tp {
  border-top-color: rgba(0, 208, 135, 0.76);
}

.chart-guide-line.indicator {
  border-top-style: solid;
  border-top-width: 1px;
  opacity: 0.78;
}

.chart-guide-label {
  position: absolute;
  right: 5px;
  top: -8px;
  border: 1px solid var(--line-strong);
  background: #091020;
  color: #c8d7ef;
  font-size: 9px;
  padding: 1px 4px;
  text-transform: uppercase;
}

.chart-guide-label.indicator {
  background: rgba(9, 16, 32, 0.92);
  color: #d4e2f8;
  border-color: rgba(126, 160, 214, 0.55);
}

.chart-position-overlay {
  position: absolute;
  left: 6px;
  top: 6px;
  display: grid;
  gap: 4px;
  pointer-events: none;
  max-width: min(58%, 440px);
}

.position-chip {
  border: 1px solid var(--line-strong);
  background: rgba(8, 13, 22, 0.86);
  color: #c5d5ef;
  font-size: 10px;
  padding: 3px 5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.position-chip .tag {
  border: 1px solid var(--line-strong);
  background: #101827;
  padding: 1px 4px;
}

.position-chip .entry {
  color: #4fb8ff;
}

.position-chip .tp {
  color: #00d087;
}

.position-chip .sl {
  color: #ff4d5e;
}

.indicator-chip {
  border: 1px solid #2a3550;
  background: rgba(7, 14, 26, 0.9);
  color: #c8d9f4;
  font-size: 10px;
  padding: 3px 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.indicator-chip .tag {
  border: 1px solid #324f7f;
  background: #11213a;
  color: #cde4ff;
  padding: 1px 4px;
}

.indicator-item {
  border: 1px solid rgba(79, 184, 255, 0.32);
  background: #0f1d31;
  color: #b7d7ff;
  padding: 1px 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.perp-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.tabs-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.tab-btn {
  border: 1px solid var(--line-strong);
  background: #0c1019;
  color: #b9c7de;
  font-size: 11px;
  text-transform: uppercase;
  padding: 4px 6px;
  cursor: pointer;
}

.tab-btn.active {
  background: #172239;
  border-color: #3a517e;
  color: #d9e5ff;
}

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

.tab-panel.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tab-panel .table-wrap {
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
}

.overall-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.overall-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 7px 8px;
}

.overall-panel .panel-head {
  margin-bottom: 7px;
}

.mini-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.big-number {
  margin: 5px 0 0;
  font-size: 21px;
  letter-spacing: 0.02em;
  font-family: "Rajdhani", sans-serif;
}

.overall-panel .big-number {
  font-size: 18px;
  margin-top: 1px;
  line-height: 1.1;
}

.overall-panel .mini-label {
  font-size: 9px;
  letter-spacing: 0.04em;
}

.overall-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0a1220 0%, #0a0f19 100%);
  padding: 7px 9px 6px;
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 0;
}

.overall-card-pnl {
  border-left: 2px solid rgba(0, 208, 135, 0.5);
}

.overall-card-win {
  border-left: 2px solid rgba(79, 184, 255, 0.5);
}

.overall-sub {
  margin: 1px 0 0;
  color: #8ea2c6;
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.overall-meter {
  height: 5px;
  margin-top: 2px;
  border: 1px solid var(--line-strong);
  background: #070d17;
  position: relative;
  overflow: hidden;
}

.overall-meter-fill {
  display: block;
  height: 100%;
  width: 48%;
  transition: width 220ms ease;
}

.overall-meter-fill.up {
  background: linear-gradient(90deg, rgba(0, 208, 135, 0.35), rgba(0, 208, 135, 0.9));
}

.overall-meter-fill.down {
  background: linear-gradient(90deg, rgba(255, 77, 94, 0.35), rgba(255, 77, 94, 0.9));
}

.overall-meter-fill.neutral {
  background: linear-gradient(90deg, rgba(79, 184, 255, 0.3), rgba(79, 184, 255, 0.75));
}

.agents-panel {
  display: grid;
  grid-template-rows: auto auto auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.agents-panel .table-wrap {
  min-height: 160px;
  height: auto;
  max-height: none;
}

.agents-panel .agents-list-wrap {
  overflow: visible;
}

.strategy-config {
  border: 1px solid var(--line);
  background: #0a0e17;
  padding: 6px;
  margin-bottom: 8px;
}

.account-metric {
  grid-column: span 2;
  display: grid;
  gap: 2px;
}

.account-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
}

.field input,
.field select {
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 4px 5px;
  border-radius: 0;
}

.param-grid {
  margin-top: 6px;
  border: 1px solid var(--line);
}

.param-grid-head,
.param-grid-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(110px, 1fr) 74px;
  align-items: center;
}

.param-grid-head {
  background: #0b1019;
  color: #8f9fbe;
  font-size: 10px;
  text-transform: uppercase;
}

.param-grid-head span {
  padding: 4px 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.param-grid-head span:last-child {
  border-right: none;
  text-align: center;
}

.param-grid-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.param-grid-row > label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  padding: 0 6px;
}

.param-grid-row > input {
  width: calc(100% - 10px);
  margin: 4px 5px;
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 4px 5px;
  border-radius: 0;
}

.param-grid-row > select {
  width: calc(100% - 10px);
  margin: 4px 5px;
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 4px 5px;
  border-radius: 0;
}

.adaptive-cell {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 30px;
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.adaptive-cell input[type="checkbox"] {
  margin: 0;
  width: 13px;
  height: 13px;
  accent-color: #4fb8ff;
}

.adaptive-na {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 30px;
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 12px;
}

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

.analysis-row .btn {
  width: auto;
  min-width: 132px;
  margin-top: 0;
}

.btn-secondary {
  background: #0f1a2c;
  border-color: #2f486f;
}

.btn-secondary:hover {
  background: #162844;
}

.analyze-status {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
}

.strategy-box {
  margin-top: 6px;
  border: 1px solid var(--line);
  background: #090d14;
  color: #c5d5ef;
  font-size: 11px;
  line-height: 1.4;
  padding: 6px;
  min-height: 48px;
}

.activity-strategy-box {
  margin-top: 6px;
}

.btn {
  margin-top: 7px;
  width: 100%;
  border: 1px solid #3464a2;
  background: #13253f;
  color: #d2e4ff;
  padding: 5px 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  cursor: pointer;
}

.btn:hover {
  background: #183158;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-small {
  border: 1px solid #39588f;
  background: #12223b;
  color: #d8e6ff;
  font-size: 10px;
  padding: 2px 5px;
  cursor: pointer;
}

.btn-small:hover {
  background: #19345d;
}

.btn-small-danger {
  border-color: #6f3442;
  background: #311722;
  color: #ffd0d7;
}

.btn-small-danger:hover {
  background: #4a1e30;
}

.btn-small-success {
  border-color: #1f5d47;
  background: #103427;
  color: #bff5dd;
}

.btn-small-success:hover {
  background: #154a36;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 8, 0.74);
  display: grid;
  place-items: center;
  z-index: 140;
  padding: 10px;
}

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

.modal-panel {
  width: min(520px, 100%);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #0b1019 0%, #0a0f18 100%);
  padding: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.48);
}

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

.modal-head h3 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal-close {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #c7d5ef;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  cursor: pointer;
}

.modal-close:hover {
  background: #16243d;
}

.modal-copy {
  margin: 6px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.modal-form {
  border: 1px solid var(--line);
  background: #080d15;
  padding: 6px;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 6px 8px;
}

.modal-form label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  align-self: center;
}

.modal-form input {
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 0;
}

.modal-form select {
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 0;
}

.integration-fields {
  grid-column: 1 / -1;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 6px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 6px;
  margin-top: 2px;
}

.provider-form {
  display: none;
}

.provider-form.active {
  display: grid;
}

.integration-fields-head {
  grid-column: 1 / -1;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #93a9cc;
  border: 1px solid var(--line);
  background: #070c14;
  padding: 4px 6px;
}

.modal-hint {
  grid-column: 2;
  margin-top: -3px;
  color: #8fa6ca;
  font-size: 10px;
}

.modal-actions {
  margin-top: 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.modal-actions .btn {
  margin-top: 0;
}

.modal-status {
  margin-top: 6px;
  border: 1px solid var(--line);
  background: #090d14;
  color: #9eb0ce;
  font-size: 11px;
  padding: 5px 6px;
}

#activity-log {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  background: #090d14;
}

#activity-log li {
  font-size: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#activity-log li:last-child {
  border-bottom: none;
}

.log-badge {
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #9eb0ce;
  font-size: 10px;
  padding: 1px 4px;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.log-message {
  min-width: 0;
}

#activity-log li.log-open .log-badge {
  color: #00d087;
  border-color: rgba(0, 208, 135, 0.5);
}

#activity-log li.log-entry .log-badge {
  color: #4fb8ff;
  border-color: rgba(79, 184, 255, 0.55);
}

#activity-log li.log-exit .log-badge {
  color: #ffcb4f;
  border-color: rgba(255, 203, 79, 0.55);
}

#activity-log li.log-open .log-message {
  color: #9fe9c8;
}

#activity-log li.log-entry .log-message {
  color: #9ccfff;
}

#activity-log li.log-exit .log-message {
  color: #f6d893;
}

.system-bottom-bar {
  position: fixed;
  left: 6px;
  right: 6px;
  bottom: 6px;
  z-index: 70;
  padding: 6px;
}

.system-bottom-strip {
  display: grid;
  grid-template-columns: auto repeat(6, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.system-bottom-strip .inline-tag {
  align-self: stretch;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  padding: 6px 8px;
}

.system-bottom-strip .metric {
  min-height: 0;
  padding: 4px 6px;
  gap: 2px;
}

.system-bottom-strip .metric-label {
  font-size: 10px;
}

.system-bottom-strip .metric-value {
  font-size: 12px;
}

.activity-panel {
  display: grid;
  grid-template-rows: auto minmax(118px, 0.72fr) auto minmax(0, 1fr);
  min-height: 0;
}

.activity-panel .table-wrap {
  min-height: 0;
  height: 100%;
  max-height: 100%;
}

.activity-panel .agent-pnl-wrap {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.activity-panel #activity-log {
  min-height: 0;
}

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

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

.flash-up {
  animation: flash-up 500ms ease-out;
}

.flash-down {
  animation: flash-down 500ms ease-out;
}

@keyframes flash-up {
  0% {
    background: rgba(0, 208, 135, 0.3);
  }
  100% {
    background: transparent;
  }
}

@keyframes flash-down {
  0% {
    background: rgba(255, 77, 94, 0.28);
  }
  100% {
    background: transparent;
  }
}

@media (max-width: 1260px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1.45fr) 6px minmax(0, 1fr);
  }

  .left-stack {
    grid-template-rows: minmax(150px, 0.19fr) 6px minmax(192px, 0.38fr) 6px minmax(194px, 0.43fr);
  }

  .right-stack {
    grid-template-rows: minmax(240px, 0.54fr) 6px minmax(230px, 0.46fr);
  }
}

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

  .left-stack {
    gap: 6px;
    grid-template-rows: minmax(135px, auto) minmax(200px, auto) minmax(190px, auto);
  }

  .right-stack {
    gap: 6px;
    grid-template-rows: repeat(2, auto);
  }

  .panel-splitter {
    display: none;
  }

  .column-splitter {
    display: none;
  }

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

  .account-metric {
    grid-column: span 3;
  }

  #tv-chart {
    min-height: 150px;
  }

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

  .status-cluster {
    width: 100%;
  }

  .perp-panel .table-wrap,
  .tabs-panel .table-wrap,
  .agents-panel .table-wrap,
  .activity-panel .table-wrap {
    max-height: 280px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 4px 4px 120px;
    gap: 4px;
  }

  .panel {
    padding: 6px;
  }

  .brand h1 {
    font-size: 22px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

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

  .chart-position-overlay {
    max-width: calc(100% - 12px);
  }

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

  .account-metric {
    grid-column: span 2;
  }

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

  .modal-form {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .integration-fields {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .modal-hint {
    grid-column: 1;
    margin-top: 0;
  }

  .param-grid-head,
  .param-grid-row {
    grid-template-columns: minmax(120px, 1fr) minmax(100px, 1fr) 64px;
  }

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

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

  .system-bottom-bar {
    left: 4px;
    right: 4px;
    bottom: 4px;
  }

  .system-bottom-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-bottom-strip .inline-tag {
    grid-column: span 2;
  }
}
