:root {
  color-scheme: dark;
  --bg: #090d14;
  --panel: #111923;
  --raised: #18232f;
  --line: #263746;
  --text: #f2f4f7;
  --muted: #8fa0b2;
  --accent: #d6b56f;
  --success: #57c785;
  --danger: #f06c75;
  --info: #7fa9e8;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  color: var(--text);
  background:
    radial-gradient(circle at 0 0, rgba(214, 181, 111, .10), transparent 32rem),
    radial-gradient(circle at 100% 100%, rgba(80, 132, 188, .10), transparent 38rem),
    var(--bg);
  font: 14px/1.55 "Microsoft YaHei UI", system-ui, sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { min-height: 1.4em; color: var(--danger); }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 7vw;
  padding: 7vw;
}
.login-brand { max-width: 620px; }
.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid rgba(214, 181, 111, .55);
  border-radius: 16px;
  background: rgba(214, 181, 111, .10);
  font: 700 34px Georgia, serif;
}
.brand-mark.small { width: 38px; height: 38px; border-radius: 10px; font-size: 22px; }
.eyebrow { color: var(--accent); letter-spacing: .16em; font-weight: 700; margin: 28px 0 8px; }
h1 { font-size: clamp(38px, 5vw, 72px); line-height: 1.1; margin: 0 0 20px; }
h2, h3, p { margin-top: 0; }
.login-points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.login-points span, .tag {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c7d2dc;
  background: rgba(17, 25, 35, .78);
  font-size: 12px;
}
.login-card, .panel {
  border: 1px solid rgba(52, 71, 86, .82);
  background: rgba(17, 25, 35, .88);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}
.login-card { width: min(420px, 100%); padding: 34px; justify-self: end; }
label { display: grid; gap: 7px; color: #b6c2ce; font-size: 12px; }
input, textarea, select {
  width: 100%;
  color: var(--text);
  background: #0c131c;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
.login-card label { margin-top: 16px; }
.login-card .primary { width: 100%; margin-top: 8px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  border-right: 1px solid var(--line);
  background: rgba(13, 20, 29, .92);
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 28px; }
.sidebar-brand strong { display: block; font-size: 12px; letter-spacing: .10em; }
.sidebar-brand small { color: var(--muted); font-size: 10px; }
nav { display: grid; gap: 4px; }
nav button {
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 12px 14px;
  border-radius: 8px;
}
nav button:hover, nav button.active { color: var(--accent); background: rgba(214, 181, 111, .10); }
.sidebar-footer {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.workspace { min-width: 0; padding: 0 34px 36px; }
.topbar {
  min-height: 105px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(38, 55, 70, .75);
  margin-bottom: 24px;
}
.topbar h2 { margin-bottom: 4px; font-size: 25px; }
.topbar p { margin: 0; font-size: 12px; }
.toast { color: var(--success); font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.metric span { color: var(--muted); font-size: 11px; }
.metric strong { display: block; color: var(--accent); font-size: 27px; margin-top: 7px; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.split-grid.wide-left { grid-template-columns: minmax(0, 1.65fr) minmax(330px, .75fr); }
.panel { padding: 20px; min-width: 0; }
.panel h3 { font-size: 17px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h3 { margin: 0; }
.stack { display: grid; gap: 9px; }
.stack-item { border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: rgba(12, 19, 28, .48); }
.stack-item strong { display: block; margin-bottom: 4px; }
.stack-item small { color: var(--muted); }
.section-gap { margin-top: 28px !important; }
.action-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

button.primary, button.secondary, button.ghost, button.danger {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
}
button.primary { color: #17120a; background: var(--accent); font-weight: 700; }
button.secondary { color: var(--text); background: #17212c; border-color: var(--line); }
button.ghost { color: var(--muted); background: transparent; }
button.ghost:hover { color: var(--text); background: #17212c; }
button.danger { color: var(--danger); background: rgba(240, 108, 117, .08); border-color: rgba(240, 108, 117, .30); }

.table-host { overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); background: #0d151e; font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .tag { display: inline-block; padding: 2px 7px; }
.form-grid { display: grid; gap: 12px; }
.form-grid.compact { margin-top: 14px; grid-template-columns: 1fr 1fr; }
.span-2 { grid-column: span 2; }
.align-end { align-self: end; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.cover-preview {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.cards-output { display: grid; gap: 7px; margin-top: 14px; max-height: 430px; overflow: auto; }
.card-code { font-family: Consolas, monospace; background: #0c131c; border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; user-select: all; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .split-grid, .split-grid.wide-left { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; padding: 28px; }
  .login-card { justify-self: stretch; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; position: static; }
  nav { grid-template-columns: repeat(2, 1fr); }
  .workspace { padding: 0 16px 24px; }
  .form-grid.compact { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
