:root {
  --bg: #f4f7fb;
  --paper: #ffffff;
  --ink: #1b2430;
  --muted: #5e6b7a;
  --line: #d7dfea;
  --brand: #006d77;
  --brand-2: #0a9396;
  --danger: #b42318;
  --ok: #12733e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 8%, #d6f3f2 0%, rgba(214, 243, 242, 0) 44%),
    radial-gradient(circle at 88% 10%, #e4efe5 0%, rgba(228, 239, 229, 0) 32%),
    var(--bg);
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #edf7f6 0%, #f6f9fc 48%, #eef6ef 100%);
}

.brand h1 {
  margin: 0;
  font-size: 26px;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.layout {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(13, 38, 59, 0.06);
  padding: 16px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.auth-stage {
  position: relative;
  min-height: 640px;
  border: 1px solid rgba(67, 210, 193, 0.22);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(8, 15, 25, 0.96), rgba(8, 28, 33, 0.94) 48%, rgba(21, 24, 33, 0.96)),
    #08131a;
  box-shadow: 0 28px 70px rgba(4, 18, 28, 0.28);
  display: grid;
  grid-template-columns: minmax(360px, 1.25fr) minmax(360px, 0.75fr);
}

.market-visual {
  position: relative;
  min-height: 100%;
  padding: 34px;
  color: #e9fffb;
  overflow: hidden;
}

.scan-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(98, 255, 218, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 255, 218, 0.11) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.8) 56%, transparent 100%);
}

.scan-grid::after {
  content: "";
  position: absolute;
  inset: -30% 0;
  background: linear-gradient(180deg, transparent, rgba(67, 210, 193, 0.26), transparent);
  animation: scanMove 5s linear infinite;
}

.ticker-strip {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ticker-strip span {
  border: 1px solid rgba(98, 255, 218, 0.28);
  border-radius: 999px;
  background: rgba(5, 20, 30, 0.7);
  color: #8fffe5;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 11px;
}

.signal-card {
  position: absolute;
  z-index: 1;
  width: min(280px, 42%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(11, 24, 35, 0.72);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
  padding: 16px;
}

.signal-card span,
.signal-card small {
  color: rgba(233, 255, 251, 0.72);
  font-size: 12px;
}

.signal-card strong {
  display: block;
  color: #ffffff;
  font-size: 36px;
  margin: 8px 0 4px;
}

.primary-signal {
  left: 34px;
  top: 130px;
}

.secondary-signal {
  right: 48px;
  bottom: 64px;
}

.market-line {
  position: absolute;
  z-index: 1;
  left: 7%;
  right: 12%;
  top: 50%;
  height: 150px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 18px;
}

.market-line i {
  display: block;
  height: 52px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #8fffe5, #43d2c1 44%, rgba(255, 199, 95, 0.88));
  box-shadow: 0 0 22px rgba(67, 210, 193, 0.5);
  animation: barPulse 2.8s ease-in-out infinite;
}

.market-line i:nth-child(2) { height: 98px; animation-delay: 0.12s; }
.market-line i:nth-child(3) { height: 72px; animation-delay: 0.24s; }
.market-line i:nth-child(4) { height: 132px; animation-delay: 0.36s; }
.market-line i:nth-child(5) { height: 88px; animation-delay: 0.48s; }
.market-line i:nth-child(6) { height: 118px; animation-delay: 0.6s; }
.market-line i:nth-child(7) { height: 64px; animation-delay: 0.72s; }

.auth-panel {
  align-self: center;
  justify-self: center;
  width: min(440px, calc(100% - 48px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(247, 252, 255, 0.92);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(20px);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 8px;
  gap: 8px;
  background: rgba(9, 20, 32, 0.9);
}

.auth-tab {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: rgba(233, 255, 251, 0.72);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  padding: 11px 16px;
}

.auth-tab.active {
  border-color: rgba(143, 255, 229, 0.5);
  background: linear-gradient(135deg, rgba(67, 210, 193, 0.28), rgba(255, 199, 95, 0.16));
  color: #ffffff;
  box-shadow: inset 0 0 18px rgba(143, 255, 229, 0.12);
}

.auth-form {
  display: grid;
  gap: 13px;
  padding: 24px;
}

.auth-form h2 {
  margin: 0;
  font-size: 24px;
}

.auth-form .muted {
  margin-bottom: 2px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  min-height: 44px;
  box-shadow: 0 14px 28px rgba(0, 109, 119, 0.24);
}

.field-feedback {
  display: none;
  color: var(--danger);
  font-size: 12px;
}

.was-validated input:invalid {
  border-color: var(--danger);
  outline-color: rgba(180, 35, 24, 0.14);
}

.was-validated input:invalid + .field-feedback {
  display: block;
}

.auth-alert {
  display: none;
  border-top: 1px solid rgba(215, 223, 234, 0.8);
  background: rgba(239, 248, 249, 0.9);
  color: #34515c;
  font-size: 13px;
  padding: 12px 24px;
}

.auth-alert.active {
  display: block;
}

@keyframes scanMove {
  from { transform: translateY(-30%); }
  to { transform: translateY(30%); }
}

@keyframes barPulse {
  0%, 100% { filter: brightness(0.88); transform: scaleY(0.92); }
  50% { filter: brightness(1.18); transform: scaleY(1); }
}

.muted {
  color: var(--muted);
  margin: 0 0 14px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.auth-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input, select {
  width: 100%;
  border: 1px solid #bccbdb;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
}

input:focus, select:focus {
  outline: 2px solid rgba(0, 109, 119, 0.2);
  border-color: var(--brand);
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  border: 1px solid #afbdcd;
  background: #fff;
  color: #27374a;
  border-radius: 6px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  border-color: var(--brand);
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
}

.btn.subtle {
  background: #f2f7fb;
}

.btn.danger {
  border-color: #e8bbc1;
  background: #fff5f6;
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.inline-label {
  min-width: 180px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.schedule-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  background: #f8fbfc;
  display: grid;
  gap: 10px;
}

.schedule-panel h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.schedule-controls {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.schedule-controls label {
  min-width: 120px;
}

.schedule-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  border-collapse: collapse;
  min-width: 1240px;
  width: 100%;
}

th, td {
  border-bottom: 1px solid #e3e8ef;
  padding: 7px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f4f8fd;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
  color: #3d4d60;
}

td input, td select {
  min-width: 88px;
}

.summary-box {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #f9fcff;
}

.metric .k {
  font-size: 12px;
  color: var(--muted);
}

.metric .v {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 700;
}

.result-list {
  display: grid;
  gap: 12px;
}

.schedule-log-list {
  display: grid;
  gap: 10px;
}

.schedule-log {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
}

.schedule-log-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid #e5ebf2;
  padding-bottom: 7px;
}

.schedule-log-head span,
.schedule-log-summary {
  color: var(--muted);
  font-size: 12px;
}

.schedule-log-summary {
  margin-top: 8px;
}

.schedule-log ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.schedule-log li {
  margin: 5px 0;
  line-height: 1.5;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.card-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #f2f8fb 0%, #f7fafc 100%);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.card-body {
  padding: 12px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 6px 10px;
  margin-bottom: 8px;
}

.kv-grid div {
  font-size: 13px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #edf2f8;
}

.badge.high {
  background: #ffe4e1;
  color: #9b2319;
}

.badge.medium {
  background: #fff3d9;
  color: #8f5800;
}

.badge.low {
  background: #e7f8ea;
  color: var(--ok);
}

.levels {
  margin-top: 10px;
  border: 1px solid #e5ebf2;
  border-radius: 6px;
  overflow: auto;
}

.levels table {
  min-width: 100%;
}

.image-box img {
  width: 100%;
  border: 1px solid #d7dfea;
  border-radius: 6px;
}

.risk {
  margin-top: 8px;
  font-size: 12px;
  color: #7c2d12;
}

.statusbar {
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  background: #f8fbff;
  font-size: 12px;
  color: #4f5f73;
}

.hidden {
  display: none;
}

@media (max-width: 1120px) {
  .auth-stage {
    grid-template-columns: 1fr;
  }
  .market-visual {
    min-height: 300px;
  }
  .auth-panel {
    align-self: start;
    margin: 0 0 28px;
  }
  .card-body {
    grid-template-columns: 1fr;
  }
  .summary-box {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

@media (max-width: 760px) {
  .layout {
    padding: 12px;
  }
  .auth-stage {
    min-height: auto;
  }
  .market-visual {
    min-height: 220px;
    padding: 18px;
  }
  .signal-card {
    width: 42%;
    padding: 12px;
  }
  .signal-card strong {
    font-size: 26px;
  }
  .primary-signal {
    left: 18px;
    top: 74px;
  }
  .secondary-signal {
    right: 18px;
    bottom: 22px;
  }
  .market-line {
    left: 8%;
    right: 8%;
    top: 46%;
    height: 96px;
    gap: 8px;
  }
  .auth-panel {
    width: calc(100% - 24px);
  }
  .summary-box {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}
