:root {
  --bg: #f5efe1;
  --panel: rgba(14, 20, 27, 0.92);
  --panel-soft: rgba(20, 28, 37, 0.82);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f2ec;
  --muted: #adbbc6;
  --accent: #ffb000;
  --accent-soft: rgba(255, 176, 0, 0.16);
  --teal: #67f0cc;
  --red: #ff6a5f;
  --green: #8bf18f;
  --shadow: 0 24px 90px rgba(7, 11, 15, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 176, 0, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(103, 240, 204, 0.16), transparent 24%),
    linear-gradient(180deg, #f6f1e8 0%, #f2e7d4 100%);
}

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

button {
  font: inherit;
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.page-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 28px auto 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  padding: 28px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(13, 19, 25, 0.96), rgba(20, 28, 37, 0.92)),
    linear-gradient(120deg, rgba(255, 176, 0, 0.18), rgba(103, 240, 204, 0.12));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255, 176, 0, 0.18), transparent 68%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(245, 242, 236, 0.62);
}

.hero h1,
.panel h2 {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

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

.brand-avatar-shell {
  flex: 0 0 auto;
  width: 112px;
  height: 112px;
  padding: 8px;
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 22px;
}

.hero h1 {
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
}

.hero-text {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: start;
  justify-content: end;
}

.ghost-button,
.danger-button,
.pill-button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.danger-button {
  color: #141b21;
  background: linear-gradient(135deg, #ffbf5b, #ff7f63);
  border-color: transparent;
  font-weight: 600;
}

.pill-button {
  color: var(--text);
  background: rgba(103, 240, 204, 0.12);
  border-color: rgba(103, 240, 204, 0.24);
}

.ghost-button:hover,
.danger-button:hover,
.pill-button:hover {
  transform: translateY(-1px);
}

.panel {
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.status-bar {
  margin-top: 18px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.status-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(103, 240, 204, 0.08);
}

.status-clock {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}

.status-clock strong {
  display: block;
  font-size: 15px;
  color: var(--text);
  margin-top: 4px;
}

.status-alert {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 106, 95, 0.12);
  border: 1px solid rgba(255, 106, 95, 0.24);
  color: #451714;
  box-shadow: 0 18px 45px rgba(69, 23, 20, 0.12);
}

.status-alert strong {
  display: block;
  margin-bottom: 6px;
  color: #6e1f18;
}

.status-alert span {
  display: block;
  line-height: 1.6;
}

.is-hidden {
  display: none;
}

.summary-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.summary-card {
  padding: 20px;
  border-radius: 24px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.summary-card .label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(245, 242, 236, 0.54);
}

.summary-card .value {
  margin: 12px 0 6px;
  font-size: 28px;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.summary-card .subvalue {
  color: var(--muted);
  font-size: 13px;
}

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

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

.dashboard-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
}

.bottom-grid {
  align-items: start;
}

.chart-panel,
.control-panel,
.panel {
  padding: 22px;
}

.admin-grid {
  align-items: start;
}

.admin-form {
  display: grid;
  gap: 18px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.admin-field input,
.admin-field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

.admin-field input:focus,
.admin-field select:focus {
  border-color: rgba(255, 176, 0, 0.36);
  box-shadow: 0 0 0 4px rgba(255, 176, 0, 0.08);
}

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

.admin-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

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

.admin-table-panel {
  margin-top: 18px;
}

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

.compact-button {
  padding: 8px 12px;
  border-radius: 999px;
}

.danger-outline {
  border-color: rgba(255, 106, 95, 0.28);
  color: #ffd1cb;
}

.is-error-card {
  background: rgba(255, 106, 95, 0.14);
  border-color: rgba(255, 106, 95, 0.28);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.panel-head h2 {
  font-size: 26px;
}

.chart-caption {
  font-size: 28px;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.sparkline-shell {
  height: 240px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 176, 0, 0.08), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 14px;
}

.auth-shell {
  width: min(560px, 100%);
}

.auth-panel {
  padding: 30px;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(13, 19, 25, 0.96), rgba(20, 28, 37, 0.92)),
    linear-gradient(120deg, rgba(255, 176, 0, 0.14), rgba(103, 240, 204, 0.12));
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.auth-avatar-shell {
  width: 96px;
  height: 96px;
}

.auth-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  margin-top: 26px;
  display: grid;
  gap: 16px;
}

.auth-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.auth-field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
}

.auth-field input:focus {
  border-color: rgba(255, 176, 0, 0.42);
  box-shadow: 0 0 0 4px rgba(255, 176, 0, 0.08);
}

.auth-submit {
  justify-self: start;
}

.auth-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
}

.auth-message.is-error {
  color: #ffd7d3;
}

#pnlSparkline {
  width: 100%;
  height: 100%;
}

.control-copy {
  color: var(--muted);
  line-height: 1.7;
}

.executor-summary {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.executor-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
}

.compact-head {
  margin-top: 18px;
  margin-bottom: 14px;
}

.control-list {
  display: grid;
  gap: 12px;
}

.hint-card {
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.hint-card strong {
  display: block;
  margin-bottom: 6px;
}

.positions-list,
.orders-list,
.event-feed {
  display: grid;
  gap: 12px;
}

.positions-list,
.orders-list {
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.position-card,
.order-card,
.event-card {
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.position-top,
.order-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.symbol-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.direction-badge,
.mode-badge,
.event-level {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.direction-badge.long {
  background: rgba(139, 241, 143, 0.16);
  color: var(--green);
}

.direction-badge.short {
  background: rgba(255, 106, 95, 0.16);
  color: var(--red);
}

.mode-badge {
  background: rgba(255, 176, 0, 0.14);
  color: #ffd37a;
}

.event-level.info {
  background: rgba(103, 240, 204, 0.14);
  color: var(--teal);
}

.event-level.warn {
  background: rgba(255, 176, 0, 0.14);
  color: #ffd37a;
}

.event-level.neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.position-grid,
.order-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mini-stat {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.mini-stat span {
  display: block;
  font-size: 12px;
  color: rgba(245, 242, 236, 0.56);
}

.mini-stat strong {
  display: block;
  margin-top: 6px;
  line-height: 1.45;
  word-break: break-word;
}

.position-actions {
  margin-top: 14px;
  display: flex;
  justify-content: end;
}

.table-shell {
  max-height: 560px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(14, 20, 27, 0.98);
  backdrop-filter: blur(8px);
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  white-space: nowrap;
}

th {
  color: rgba(245, 242, 236, 0.58);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.trade-note {
  max-width: 220px;
  white-space: normal;
  color: var(--muted);
}

.event-card {
  display: grid;
  gap: 10px;
}

.event-feed {
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.event-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.event-time {
  color: rgba(245, 242, 236, 0.52);
  font-size: 12px;
}

.event-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.empty-state {
  padding: 28px;
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 1160px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .page-shell {
    width: min(100vw - 16px, 100%);
    margin-top: 14px;
  }

  .hero,
  .panel,
  .chart-panel,
  .control-panel {
    padding: 18px;
    border-radius: 22px;
  }

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

  .hero-brand {
    align-items: flex-start;
  }

  .brand-avatar-shell {
    width: 84px;
    height: 84px;
    border-radius: 22px;
  }

  .position-grid,
  .order-grid,
  .executor-summary,
  .admin-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-shell {
    max-height: 420px;
  }

  .positions-list,
  .orders-list,
  .event-feed {
    max-height: 420px;
  }

  .status-bar,
  .panel-head,
  .position-top,
  .order-top,
  .admin-row-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
