* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Cambria, "Book Antiqua", "Palatino Linotype", Palatino, serif;
  background: #f5f7fa;
  color: #17212b;
}

button,
input,
select {
  font: inherit;
}

.page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 72px;
}

.login-shell {
  width: 100%;
  max-width: 360px;
}

.login-panel .panel-head h1 {
  font-size: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 12px;
}

.login-field {
  gap: 8px;
}

.login-field input {
  width: 100%;
}

.login-error {
  min-height: 18px;
  color: #9b1c1c;
  font-size: 13px;
}

.login-actions {
  margin-top: 4px;
  gap: 10px;
}

.login-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  color: #334e68;
  text-decoration: none;
  background: #fff;
}

.topbar,
.band {
  margin-bottom: 16px;
}

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

.page-nav {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 8px 12px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
  color: #334e68;
  text-decoration: none;
  font-size: 13px;
}

.page-nav a.active {
  background: #eef4ff;
  border-color: #bfd3f7;
  color: #0b4fd6;
}

.topbar h1,
.panel-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.topbar p,
.panel-head p,
#chainMeta {
  margin: 0;
  color: #52606d;
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(420px, 0.9fr);
  gap: 16px;
}

.panel {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 16px;
}

.panel-subhead {
  margin: 14px 0 8px;
  font-size: 13px;
  color: #486581;
  font-weight: 600;
}

.panel-subhead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-grid,
.monitoring-defaults-grid {
  display: grid;
  gap: 12px;
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.summary-card,
.monitoring-card {
  padding: 14px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-card {
  padding: 10px 14px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
  border-left-width: 4px;
  border-left-color: #d9e2ec;
}

.info-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.info-card-head h2 {
  margin: 0;
  font-size: 18px;
  flex: 0 0 180px;
}

.info-bias {
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
}

.info-note {
  margin: 6px 0 0;
  color: #9b1c1c;
  font-size: 13px;
}

.info-inline-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  flex: 1 1 auto;
}

.info-metric {
  min-width: 0;
}

.info-metric-label {
  font-size: 12px;
  color: #486581;
  margin-bottom: 4px;
}

.info-metric-value {
  font-size: 15px;
  font-weight: 600;
}

.strength-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.strength-label {
  flex: 0 0 92px;
  font-size: 12px;
  color: #486581;
}

.strength-track {
  flex: 1 1 auto;
  height: 8px;
  display: grid;
  grid-template-columns: repeat(var(--segments, 1), minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  background: #d7dee7;
  border-radius: 999px;
  overflow: hidden;
}

.strength-segment {
  height: 100%;
  min-width: 0;
}

.strength-segment-pending {
  background: #e5e7eb;
}

.info-controls {
  align-items: center;
}

.info-controls label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.info-controls select {
  width: auto;
  min-width: 88px;
}

.info-controls button {
  align-self: center;
}

.bias-neutral {
  background: #94a3b8;
}

.bias-bull-1 {
  background: #86efac;
}

.bias-bull-2 {
  background: #4ade80;
}

.bias-bull-3 {
  background: #16a34a;
}

.bias-bear-1 {
  background: #fca5a5;
}

.bias-bear-2 {
  background: #f87171;
}

.bias-bear-3 {
  background: #dc2626;
}

.bias-pill-neutral {
  background: #f1f5f9;
  color: #475569;
}

.bias-pill-bull-1 {
  background: #dcfce7;
  color: #166534;
}

.bias-pill-bull-2 {
  background: #bbf7d0;
  color: #166534;
}

.bias-pill-bull-3 {
  background: #86efac;
  color: #14532d;
}

.bias-pill-bear-1 {
  background: #fee2e2;
  color: #991b1b;
}

.bias-pill-bear-2 {
  background: #fecaca;
  color: #991b1b;
}

.bias-pill-bear-3 {
  background: #fca5a5;
  color: #7f1d1d;
}

.summary-card-label {
  color: #486581;
  font-size: 13px;
  margin-bottom: 8px;
}

.summary-card-value {
  font-size: 24px;
  font-weight: 600;
}

.monitoring-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.inline-form .toggle {
  margin-top: 0;
}

.rules-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: auto;
}

.rules-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: end;
}

.rules-check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  color: #334e68;
  white-space: nowrap;
  flex: 0 0 auto;
}

.rules-check input {
  margin: 0;
}

.rules-field {
  min-width: 0;
  flex: 0 0 auto;
  min-height: 54px;
  justify-content: space-between;
}

.rules-field-disabled {
  opacity: 0.6;
}

.rules-field input[type="time"] {
  width: 108px;
}

.rules-field input[type="number"] {
  width: 86px;
}

.rules-field select {
  width: 118px;
}

.rules-field input,
.rules-field select,
.rules-save-wrap button {
  height: 38px;
}

.rules-save-wrap {
  display: inline-flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 54px;
  flex: 0 0 auto;
  margin-left: 8px;
}

.rules-save-state {
  color: #045d56;
  font-size: 13px;
  min-width: 42px;
}

.rules-text {
  color: #52606d;
  font-size: 13px;
}

.controls,
.ticket-controls,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.set-name-field {
  min-width: 260px;
}

.ticket-status {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  font-size: 13px;
  color: #334e68;
  background: #f8fafc;
}

.ticket-status.status-error {
  color: #9b1c1c;
  border-color: #f1b5b5;
  background: #fff5f5;
}

.ticket-status.status-ok {
  color: #045d56;
  border-color: #b8e6df;
  background: #f0fffb;
}

.ticket-controls button {
  align-self: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #334e68;
}

input,
select,
button {
  border: 1px solid #bcccdc;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}

button {
  cursor: pointer;
}

button.primary {
  background: #0b69ff;
  border-color: #0b69ff;
  color: #fff;
}

.subtle-btn {
  padding: 4px 10px;
  color: #486581;
  background: #f8fafc;
}

.buy-btn {
  color: #045d56;
}

.sell-btn {
  color: #9b1c1c;
}

.buy-btn.is-selected {
  background: #e6f7ee;
  border-color: #8ed0ab;
  color: #045d56;
  font-weight: 600;
}

.sell-btn.is-selected {
  background: #fdecec;
  border-color: #f2b2b2;
  color: #9b1c1c;
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #e4e7eb;
  border-radius: 6px;
}

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

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #e4e7eb;
  text-align: right;
  white-space: nowrap;
  font-size: 13px;
}

td.left,
th.left {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #486581;
  z-index: 1;
}

.lots-head {
  text-align: center;
}

.lots-input {
  width: 44px;
  min-width: 44px;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
}

td:first-child,
td:nth-child(2),
th:first-child,
th:nth-child(2) {
  text-align: center;
}

.strike-cell {
  font-weight: 600;
  text-align: center;
}

.atm-row td {
  background: #eef4ff;
}

.atm-row .strike-cell {
  background: #dbeafe;
  color: #0b4fd6;
}

.ticket-wrap table {
  min-width: 100%;
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
}

.account-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.danger-btn {
  color: #9b1c1c;
}

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

.grabHandle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  color: #829ab1;
  cursor: grab;
  user-select: none;
  font-weight: 700;
  letter-spacing: 1px;
}

.grabHandle:active {
  cursor: grabbing;
}

.underlyingDivider td {
  border-top: 8px solid #f5f7fa;
}

.sideBadge {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
  color: #fff;
  font-size: 0.85rem;
}

.badgeBuy {
  background: #4a9f2b;
}

.badgeSell {
  background: #df4b53;
}

.pnlPos {
  color: #4a9f2b;
  font-weight: 600;
}

.pnlNeg {
  color: #df4b53;
  font-weight: 600;
}

pre {
  margin: 0;
  padding: 12px;
  min-height: 200px;
  max-height: 420px;
  overflow: auto;
  background: #0f172a;
  color: #d9e2ec;
  border-radius: 6px;
  font-size: 12px;
}

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

  .info-grid {
    gap: 10px;
  }

  .info-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .info-card-head h2 {
    flex: none;
  }

  .info-inline-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
}

@media (max-width: 900px) {
  .monitoring-defaults-grid {
    grid-template-columns: 1fr;
  }

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

  .info-controls label {
    flex-direction: column;
    align-items: flex-start;
  }
}
