:root {
  --ink: #17201b;
  --muted: #66726c;
  --line: #d8ded7;
  --panel: #ffffff;
  --page: #f4f6f2;
  --accent: #0b7a75;
  --accent-strong: #075b57;
  --gold: #b88722;
  --danger: #bb3e3e;
  --warn: #ad7514;
  --ok: #217a43;
  --shadow: 0 18px 45px rgba(24, 40, 32, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(11, 122, 117, 0.08), rgba(184, 135, 34, 0.08)),
    var(--page);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button:not(:disabled):active {
  transform: translateY(1px);
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 122, 117, 0.14);
}

.hidden {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
}

.brand-panel {
  min-height: 100vh;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(10, 42, 38, 0.88), rgba(11, 122, 117, 0.86)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900' viewBox='0 0 900 900'%3E%3Cg fill='none' stroke='rgba(255,255,255,.16)' stroke-width='1'%3E%3Cpath d='M80 210h740M80 360h740M80 510h740M80 660h740M210 80v740M360 80v740M510 80v740M660 80v740'/%3E%3Cpath d='M100 640c92-148 160-204 236-154 52 34 94 54 155-21 72-89 145-117 262-52' stroke-width='5'/%3E%3Cpath d='M100 500c95 24 171 6 227-68 45-60 108-86 179-49 67 35 132 29 248-87' stroke-width='3'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.brand-mark {
  width: 74px;
  height: 74px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 24px;
  margin-bottom: 28px;
}

.brand-panel h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1.08;
  font-weight: 800;
}

.brand-panel p {
  margin: 16px 0 32px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
}

.brand-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 80px;
}

.brand-strip span {
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
}

.brand-panel small {
  color: rgba(255, 255, 255, 0.72);
}

.auth-panel {
  align-self: center;
  justify-self: center;
  width: min(430px, calc(100vw - 36px));
  padding: 32px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(216, 222, 215, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}

.tab {
  height: 40px;
  border-radius: 6px;
  color: var(--muted);
  background: #edf1ec;
}

.tab.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(11, 122, 117, 0.18);
}

.auth-form {
  display: grid;
  gap: 14px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.primary,
.secondary,
.ghost {
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  white-space: nowrap;
}

.primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(11, 122, 117, 0.2);
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  color: var(--accent-strong);
  border: 1px solid rgba(11, 122, 117, 0.28);
  background: #f7fbf9;
}

.ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.wide {
  width: 100%;
  margin-top: 4px;
}

.hint,
.message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.message {
  min-height: 22px;
  margin-top: 14px;
}

.message.error {
  color: var(--danger);
}

.message.ok {
  color: var(--ok);
}

.dashboard {
  min-height: 100vh;
}

.topbar {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 34px;
  color: #fff;
  background: linear-gradient(120deg, #13251f, #0b716c 58%, #806018);
}

.topbar h1 {
  margin: 3px 0 4px;
  font-size: 30px;
  line-height: 1.1;
}

.topbar p,
.eyebrow {
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
}

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

.top-actions .ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.user-pill {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 9px 12px;
  color: rgba(255, 255, 255, 0.9);
}

.workspace {
  width: min(1560px, calc(100vw - 36px));
  margin: 22px auto 0;
  padding-bottom: 28px;
}

.control-band,
.metrics-grid,
.content-grid,
.admin-panel {
  margin-bottom: 16px;
}

.control-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(24, 40, 32, 0.06);
}

.run-box,
.sort-box {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.sort-box label {
  min-width: 168px;
}

.search-label {
  min-width: 240px !important;
}

.button-icon {
  display: inline-block;
  margin-right: 7px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  min-height: 34px;
  font-size: 28px;
  line-height: 1.15;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.results-panel,
.side-panel,
.admin-panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(24, 40, 32, 0.06);
}

.panel-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2,
.info-block h3 {
  margin: 0;
  font-size: 18px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status-chip {
  min-width: 82px;
  text-align: center;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--accent-strong);
  background: rgba(11, 122, 117, 0.1);
  font-size: 13px;
}

.status-chip.busy {
  color: var(--warn);
  background: rgba(173, 117, 20, 0.13);
}

.status-chip.error {
  color: var(--danger);
  background: rgba(187, 62, 62, 0.12);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf0ec;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #4b5751;
  background: #f7f9f5;
  font-weight: 700;
}

tbody tr:hover {
  background: #fbfcfa;
}

.stock-name {
  display: grid;
  gap: 3px;
}

.stock-name strong {
  font-size: 14px;
}

.stock-name span,
.muted {
  color: var(--muted);
}

.buy-zone {
  color: var(--accent-strong);
  font-weight: 700;
}

.score {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 30px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.risk-low {
  color: var(--ok);
}

.risk-mid {
  color: var(--warn);
}

.risk-high {
  color: var(--danger);
}

.reason-list {
  max-width: 320px;
  line-height: 1.55;
}

.empty {
  height: 220px;
  text-align: center;
  color: var(--muted);
  vertical-align: middle;
}

.side-panel {
  display: grid;
  gap: 0;
}

.info-block {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.info-block:last-child {
  border-bottom: 0;
}

dl {
  display: grid;
  grid-template-columns: minmax(86px, 0.9fr) minmax(0, 1.5fr);
  gap: 9px 14px;
  margin: 14px 0 0;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.explain {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.diagnostics {
  margin-top: 12px;
  max-height: 160px;
  overflow: auto;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

.admin-panel {
  padding-bottom: 8px;
}

.compact table {
  min-width: 920px;
}

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

.mini {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 5px;
}

.approve {
  color: #fff;
  background: var(--ok);
}

.reject {
  color: #fff;
  background: var(--danger);
}

footer {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 360px;
    padding: 36px;
  }

  .brand-panel h1 {
    font-size: 38px;
  }

  .auth-panel {
    margin: 24px 0 42px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .info-block {
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }

  .info-block:last-child {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .brand-panel {
    min-height: 320px;
    padding: 28px 22px;
  }

  .brand-panel h1 {
    font-size: 32px;
  }

  .brand-strip {
    margin-bottom: 32px;
  }

  .topbar,
  .control-band {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-grid,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .info-block {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .run-box,
  .sort-box,
  .top-actions {
    width: 100%;
  }

  .run-box > *,
  .sort-box label,
  .search-label {
    width: 100%;
  }
}
