:root {
  color-scheme: dark;
  --bg: #101820;
  --surface: #17232d;
  --surface-2: #1d2d38;
  --text: #f3f7f8;
  --muted: #9fb0b8;
  --line: #2b3e4a;
  --green: #45c486;
  --red: #ff6b6b;
  --yellow: #ffd166;
  --blue: #58a6ff;
}

* {
  box-sizing: border-box;
}

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

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 16px;
  margin-bottom: 10px;
}

p,
span,
label {
  color: var(--muted);
}

.version {
  display: block;
  margin: 3px 0 4px;
  color: var(--yellow);
  font-size: 12px;
}

.status-line.ok {
  color: var(--green);
}

.status-line.warning {
  color: var(--red);
}

button,
input {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
}

button {
  cursor: pointer;
  color: var(--bg);
  background: var(--green);
  border-color: transparent;
  font-weight: 700;
}

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

.actions button {
  padding: 8px 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

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

.dashboard-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
}

.tat-strip {
  display: grid;
  grid-template-columns: minmax(300px, 520px) minmax(220px, 320px) 1fr;
  gap: 18px;
  align-items: center;
  margin: 14px 0 6px;
}

.credit-card {
  background: #f8fafc;
  color: #1c2730;
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 118px;
}

.credit-card h2 {
  color: #26333d;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  line-height: 1.65;
  font-size: 15px;
}

.metric-row span {
  color: #25313a;
}

.metric-row strong {
  color: #17212a;
  font-weight: 500;
}

.gauge-zone {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
  justify-items: center;
  align-items: end;
}

.gauge-card {
  position: relative;
  min-width: 190px;
  min-height: 150px;
  display: grid;
  place-items: center;
}

.gauge {
  --angle: 0deg;
  position: relative;
  width: 166px;
  height: 100px;
  overflow: hidden;
}

.gauge::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 136px 136px 0 0;
  background: conic-gradient(from 270deg at 50% 100%, #df111b 0deg 70deg, #f4cf24 70deg 110deg, #1e8a2f 110deg 180deg, transparent 180deg 360deg);
}

.gauge::after {
  content: "";
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: -69px;
  height: 138px;
  border-radius: 138px 138px 0 0;
  background: var(--bg);
}

.needle {
  position: absolute;
  width: 3px;
  height: 82px;
  left: calc(50% - 1.5px);
  bottom: 0;
  background: #101010;
  transform-origin: bottom center;
  transform: rotate(var(--angle));
  z-index: 2;
}

.gauge-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 3;
  text-align: center;
  color: var(--text);
  font-size: 12px;
}

.gauge-tick {
  position: absolute;
  color: var(--muted);
  font-size: 13px;
  z-index: 4;
}

.gauge-tick.top {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.gauge-tick.left {
  left: 9px;
  top: 58px;
}

.gauge-tick.right {
  right: 9px;
  top: 58px;
}

.gauge-tick.min {
  left: 32px;
  bottom: 0;
}

.gauge-tick.max {
  right: 32px;
  bottom: 0;
}

.tat-risk {
  display: grid;
  gap: 7px;
  align-content: center;
  color: var(--text);
}

.tat-marker {
  width: 6px;
  height: 22px;
  background: var(--blue);
}

.tat-risk strong {
  color: #0d7a18;
  font-size: 20px;
  font-weight: 700;
}

.tat-risk strong span {
  color: inherit;
}

.tat-risk .stop-label {
  color: #d30d0d;
}

.tat-risk .closed-label {
  color: var(--blue);
}

.bar-track {
  width: 100%;
  height: 18px;
  overflow: hidden;
}

.bar-track.metric {
  background: transparent;
}

.bar-track.total {
  background: #d8d8d8;
}

.bar-fill {
  display: block;
  height: 100%;
  width: 0%;
}

.bar-fill.open {
  background: #0f7a0f;
}

.bar-fill.closed {
  background: var(--blue);
}

.bar-fill.stop {
  background: #e00606;
}

.bar-fill.total-fill {
  width: 100%;
  background: #d8d8d8;
}

.bar-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.tat-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--text);
  font-size: 13px;
  margin: 8px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.tat-tabs span {
  color: var(--text);
}

.tat-tabs b {
  font-weight: 700;
}

.summary-grid article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-grid article {
  padding: 14px;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.panel {
  padding: 14px;
}

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

.panel-title strong {
  color: var(--green);
  font-size: 18px;
}

.screen-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}

.screen-tabs::-webkit-scrollbar,
.screens::-webkit-scrollbar {
  display: none;
}

.screen-tab {
  min-width: max-content;
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.screen-tab.active {
  color: var(--bg);
  background: var(--green);
  border-color: transparent;
}

.screen-tab span {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.8;
}

.screens {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  margin-top: 4px;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.screens.dragging {
  scroll-behavior: auto;
  cursor: grabbing;
}

.screen {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  padding-right: 0;
}

.dashboard-trades {
  margin-top: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  color: var(--blue);
  font-size: 12px;
  text-transform: uppercase;
}

.status-badge {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.status-open {
  color: var(--green);
}

.status-stopped {
  color: var(--red);
}

.status-expired {
  color: var(--muted);
}

.status-closed {
  color: var(--blue);
}

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

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

.empty,
.events li {
  color: var(--muted);
}

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

.events li {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 10px;
}

@media (max-width: 920px) {
  .topbar,
  .tat-strip {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar {
    align-items: stretch;
  }

  .actions {
    justify-content: flex-start;
  }

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

  .tat-tabs {
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .app {
    padding: 12px;
  }

  h1 {
    font-size: 20px;
  }

  button,
  input {
    padding: 8px 10px;
  }

  .actions button {
    padding: 7px 8px;
  }

  .credit-card {
    min-height: 0;
    padding: 8px 12px;
  }

  .metric-row {
    font-size: 13px;
  }

  .gauge-zone {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .gauge-card {
    min-width: 0;
  }

  .gauge {
    width: 118px;
    height: 72px;
  }

  .gauge::after {
    left: 12px;
    right: 12px;
    bottom: -50px;
    height: 100px;
  }

  .needle {
    height: 58px;
  }

  .gauge-tick {
    display: none;
  }

  .tat-risk strong {
    font-size: 17px;
  }

  .bar-scale {
    font-size: 18px;
  }

  .tat-tabs {
    font-size: 12px;
    gap: 12px;
    flex-wrap: nowrap;
  }

  .summary-grid article {
    padding: 12px;
    min-height: 76px;
  }

  .summary-grid strong {
    font-size: 22px;
  }

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

@media (max-width: 820px) {
  .tat-strip {
    grid-template-columns: 1fr;
  }

  .gauge-zone {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .tat-tabs {
    flex-wrap: wrap;
    gap: 10px;
  }

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