:root {
  color-scheme: dark;
  --bg-deep: #071426;
  --bg-blue: #0d2340;
  --panel: rgba(12, 25, 47, 0.68);
  --panel-strong: rgba(8, 18, 36, 0.82);
  --panel-soft: rgba(26, 47, 82, 0.48);
  --line: rgba(210, 224, 246, 0.16);
  --line-strong: rgba(235, 199, 119, 0.34);
  --ink: #f5f1e8;
  --muted: #c3cad8;
  --faint: #8995aa;
  --gold: #efc777;
  --gold-soft: #ffdf9f;
  --blue: #4ea3ff;
  --blue-strong: #2475d8;
  --danger: #ff8d8d;
  --success: #8be6c8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family: "Microsoft YaHei", "Segoe UI", Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    linear-gradient(120deg, rgba(15, 43, 78, 0.96), rgba(7, 20, 38, 0.98) 52%, rgba(35, 36, 42, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 78px);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 26%),
    linear-gradient(90deg, rgba(78, 163, 255, 0.12), transparent 38%, rgba(239, 199, 119, 0.08));
}

button,
input,
select {
  font: inherit;
}

.shell {
  position: relative;
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0;
}

.workspace {
  min-height: calc(100svh - 60px);
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 18px;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 2px 2px 6px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 650px;
  font-family: Georgia, "Microsoft YaHei", serif;
  font-size: clamp(38px, 6vw, 74px);
  line-height: 0.98;
  font-weight: 850;
  text-wrap: balance;
}

.subtitle {
  max-width: 560px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
}

h2 {
  font-size: 20px;
  font-weight: 850;
}

.status {
  min-width: 116px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(10, 23, 44, 0.62);
  color: var(--gold-soft);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
}

.query-bar,
.metric,
.message,
.log-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.query-bar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 120px;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-radius: 8px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

select,
input {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(210, 224, 246, 0.18);
  border-radius: 6px;
  background: rgba(5, 14, 28, 0.72);
  color: var(--ink);
  outline: none;
  padding: 0 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

select {
  color-scheme: dark;
}

select:focus,
input:focus {
  border-color: rgba(239, 199, 119, 0.72);
  box-shadow: 0 0 0 4px rgba(239, 199, 119, 0.12);
}

input::placeholder {
  color: #77849a;
}

input:disabled {
  color: var(--faint);
  background: rgba(5, 14, 28, 0.48);
}

.primary-button,
.ghost-button {
  height: 46px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 850;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.primary-button {
  border: 1px solid rgba(87, 169, 255, 0.58);
  background: linear-gradient(180deg, #2e94ff, var(--blue-strong));
  color: #fff;
  box-shadow: 0 12px 30px rgba(36, 117, 216, 0.26);
}

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

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.is-loading .primary-button {
  background: linear-gradient(180deg, #2f7ed0, #1b5fae);
}

.metrics {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 1fr;
  gap: 12px;
}

.metric {
  min-height: 122px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 32, 58, 0.72), rgba(8, 18, 36, 0.78));
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.metric strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: clamp(23px, 3vw, 36px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-strong {
  border-color: rgba(239, 199, 119, 0.32);
  background: linear-gradient(180deg, rgba(40, 86, 149, 0.84), rgba(18, 47, 92, 0.86));
}

.metric-strong span {
  color: rgba(245, 241, 232, 0.78);
}

.metric-strong strong {
  color: #fff4d4;
}

.message {
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.message[data-type="success"] {
  border-color: rgba(139, 230, 200, 0.34);
  background: rgba(24, 72, 68, 0.58);
  color: var(--success);
}

.message[data-type="warning"] {
  border-color: rgba(239, 199, 119, 0.36);
  background: rgba(84, 62, 25, 0.58);
  color: var(--gold-soft);
}

.message[data-type="error"] {
  border-color: rgba(255, 141, 141, 0.38);
  background: rgba(82, 30, 36, 0.58);
  color: var(--danger);
}

.log-panel {
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel-strong);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.ghost-button {
  min-width: 98px;
  border: 1px solid rgba(239, 199, 119, 0.28);
  background: rgba(7, 20, 38, 0.62);
  color: var(--gold-soft);
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(210, 224, 246, 0.1);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  color: var(--faint);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(78, 163, 255, 0.07);
}

.model-pill {
  display: inline-flex;
  max-width: 220px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(78, 163, 255, 0.12);
  color: #b9dcff;
  font-size: 12px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.detail {
  max-width: 330px;
  color: var(--muted);
}

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

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

  .workspace {
    min-height: auto;
  }

  .masthead {
    align-items: flex-start;
    flex-direction: column;
  }

  .query-bar,
  .metrics {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 98px;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .ghost-button {
    width: 100%;
  }
}
