:root {
  --nav: #c8ddeb;
  --nav-active: #a9c2d4;
  --ink: #1e2c3a;
  --muted: #667789;
  --panel: #ffffff;
  --bg: #e8f0f5;
  --line: #d9e2ea;
  --blue: #2e5a83;
  --green: #21a947;
  --red: #e43145;
  --gold: #f4b000;
  --gray: #798491;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
}

.side {
  background: var(--nav);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.brand {
  padding: 28px 20px 20px;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.logo {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  background: #00a6d8;
  display: grid;
  place-items: center;
  color: white;
  font-size: 40px;
  font-weight: 900;
  box-shadow: inset 0 0 0 7px #fff;
}

.brand-name {
  font-size: 12px;
  color: #2b4b63;
}

.market-pill,
.broker-foot {
  width: calc(100% - 32px);
  margin: 0 16px;
  height: 28px;
  border-radius: 3px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 12px;
}

.broker-foot {
  margin-top: auto;
  margin-bottom: 0;
  border-radius: 0;
  width: 100%;
  height: 52px;
}

.green {
  background: var(--green);
}

.red {
  background: var(--red);
}

.nav {
  margin-top: 32px;
}

.nav button {
  width: 100%;
  background: transparent;
  color: #294357;
  text-align: left;
  padding: 13px 22px;
  display: flex;
  gap: 10px;
  align-items: center;
  transition: background 140ms ease, color 140ms ease;
}

.nav button:hover,
.nav button.active {
  background: var(--nav-active);
}

.icon {
  width: 18px;
  text-align: center;
}

.main {
  min-width: 0;
}

.topbar {
  height: 66px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

h1 {
  margin: 0;
  font-size: 22px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 4px 9px;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.status-label {
  color: #333;
  font-size: 12px;
}

.header-clock {
  text-align: right;
  text-transform: uppercase;
  color: #5a6c7d;
  font-size: 10px;
  letter-spacing: 0;
}

.header-clock strong {
  display: block;
  color: #2d4e73;
  font-size: 16px;
  letter-spacing: 1px;
}

.content {
  padding: 22px 24px 32px;
}

.page-title {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 500;
  color: #355b80;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.toolbar-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.btn {
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 3px;
  background: var(--blue);
  color: white;
  font-weight: 700;
  font-size: 12px;
  transition: transform 140ms ease, filter 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn.secondary {
  background: var(--gray);
}

.secondary {
  background: var(--gray);
}

.btn.green {
  background: var(--green);
}

.btn.red {
  background: var(--red);
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.section-header {
  background: var(--blue);
  color: #fff;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-weight: 700;
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 14px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.metric {
  min-height: 110px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  margin-bottom: 10px;
}

.metric strong {
  font-size: 25px;
  color: #2f5a85;
}

.metric .positive {
  color: var(--green);
}

.metric .negative {
  color: var(--red);
}

.form-table {
  width: 100%;
  border-collapse: collapse;
}

.form-table td {
  border-bottom: 1px solid #eef2f5;
  padding: 12px 16px;
}

.form-table td:first-child {
  color: #667789;
  width: 42%;
}

.form-table input,
.form-table select {
  width: min(180px, 100%);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px 8px;
  color: var(--ink);
}

.toggle {
  width: 46px;
  height: 24px;
  border-radius: 999px;
  background: #d7dce1;
  position: relative;
}

.toggle::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 160ms ease;
}

.toggle.on {
  background: #76ca8e;
}

.toggle.on::after {
  transform: translateX(22px);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

table.data th {
  background: var(--blue);
  color: #fff;
  text-align: left;
  padding: 11px 12px;
  font-size: 12px;
}

table.data td {
  border-bottom: 1px solid #edf2f6;
  padding: 10px 12px;
  white-space: nowrap;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}

.chart-panel {
  background: #fff;
  border: 1px solid var(--line);
  padding: 16px;
}

.chart-panel h3 {
  margin: 0 0 12px;
  text-transform: uppercase;
  color: #355b80;
  font-size: 13px;
}

.chart {
  width: 100%;
  height: 270px;
}

.logs {
  height: 520px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.log-line {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f3f6;
  white-space: pre-wrap;
}

.notice {
  background: #fff3cd;
  border-left: 4px solid var(--gold);
  padding: 14px 16px;
  color: #745800;
}

.error {
  color: var(--red);
  font-weight: 700;
}

.empty {
  color: var(--muted);
  padding: 26px;
  text-align: center;
}

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

  .side {
    min-height: auto;
  }

  .nav {
    margin: 10px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .broker-foot {
    display: none;
  }

  .topbar,
  .title-row {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
  }

  .topbar {
    gap: 12px;
    padding: 16px;
  }

  .header-clock {
    text-align: left;
  }

  .metrics,
  .chart-row {
    grid-template-columns: 1fr;
  }
}
