:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #647084;
  --line: #d8deea;
  --accent: #0c7c59;
  --danger: #b42318;
  --blue: #205fbe;
}

* {
  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;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

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

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

p {
  color: var(--muted);
  margin-top: 6px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 132px;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d97706;
}

.status[data-state="connected"] .status-dot {
  background: var(--accent);
}

.status[data-state="disconnected"] .status-dot {
  background: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  margin-top: 22px;
  align-items: start;
}

.composer,
.feed {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.composer {
  display: grid;
  gap: 14px;
  padding: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
}

button {
  height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button,
.secondary-link,
.primary-link,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
}

.secondary-button,
.secondary-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.primary-link {
  border: 1px solid transparent;
  background: var(--blue);
  color: #fff;
}

.danger-button {
  border: 1px solid #f5b4ae;
  background: #fff;
  color: var(--danger);
}

button:hover {
  filter: brightness(0.94);
}

.hint {
  min-height: 22px;
  font-size: 13px;
}

.feed {
  min-height: 540px;
  overflow: hidden;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.filters label {
  width: 150px;
}

.users-workspace {
  grid-template-columns: 320px 1fr;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.check-row input {
  width: 18px;
  height: 18px;
}

.feed-header button {
  width: auto;
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

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

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

.signal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.signal-table th,
.signal-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.signal-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.signal-table th:nth-child(1),
.signal-table td:nth-child(1) {
  width: 190px;
}

.signal-table th:nth-child(2),
.signal-table td:nth-child(2) {
  width: 98px;
}

.user-table th:nth-child(1),
.user-table td:nth-child(1) {
  width: 260px;
}

.user-table th:nth-child(6),
.user-table td:nth-child(6) {
  width: 170px;
}

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

.row-actions button {
  width: auto;
}

.signal-badge {
  display: inline-flex;
  align-items: center;
  min-width: 58px;
  justify-content: center;
  border-radius: 6px;
  padding: 4px 8px;
  background: #edf2f7;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

tr[data-signal="buy"] .signal-badge {
  background: #dff5ec;
  color: var(--accent);
}

tr[data-signal="sell"] .signal-badge {
  background: #fde4e1;
  color: var(--danger);
}

tr[data-signal="exit"] .signal-badge {
  background: #fff1d6;
  color: #a15c00;
}

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

.auth-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
}

.auth-panel .primary-link {
  width: 100%;
  margin-top: 22px;
}

.auth-error {
  margin-top: 14px;
  color: var(--danger);
  font-weight: 700;
}

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

  .toolbar {
    display: grid;
  }

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

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

  .signal-table {
    min-width: 720px;
  }

  .feed-header {
    display: grid;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  h1 {
    font-size: 24px;
  }

}
