/* 达麦控制台 · 调色台日光舱 (seed a8f12203) */
:root {
  --bg: #f3f7f8;
  --bg-tint: #e7f3f0;
  --surface: #ffffff;
  --surface-2: #f7fbfb;
  --ink: #1a2b34;
  --ink-soft: #3d5160;
  --muted: #6b7f8c;
  --line: #d9e5ea;
  --line-strong: #c5d5dc;
  --accent: #0d9f8a;
  --accent-2: #0b8573;
  --accent-soft: #d8f3ee;
  --accent-ring: rgba(13, 159, 138, 0.28);
  --danger: #c23b4a;
  --danger-soft: #fdecee;
  --ok: #1a7a52;
  --ok-soft: #e6f6ee;
  --warn: #9a6b12;
  --warn-soft: #fff4dd;
  --sidebar-w: 248px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(26, 43, 52, 0.04), 0 8px 24px rgba(26, 43, 52, 0.04);
  --font: "Manrope", "Noto Sans SC", "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--accent-soft); color: var(--ink); }

/* —— App shell —— */
.app-page {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 14px 16px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fcfb 100%);
  border-right: 1px solid var(--line);
  overflow: auto;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px 16px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #12b89f, #0d9f8a 55%, #0b8573);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 13px;
  box-shadow: 0 8px 18px rgba(13, 159, 138, 0.28);
}
.brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand-text span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.side-nav { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.nav-link.is-active,
.sidebar nav a.active {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: rgba(13, 159, 138, 0.18);
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-foot {
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px solid var(--line);
}
.who { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.who-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.who-role {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-2);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 8px;
}
.foot-actions { display: flex; gap: 14px; }
.linkish {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}
.linkish:hover { color: var(--accent-2); }
form.inline { display: inline; margin: 0; }

.workspace { min-width: 0; background:
  radial-gradient(900px 420px at 100% -10%, var(--bg-tint), transparent 60%),
  var(--bg);
}
.main {
  padding: 28px 32px 56px;
  max-width: 1180px;
}

/* —— Page chrome —— */
.page-head { margin-bottom: 22px; }
.page-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.page-head.row, .row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.muted { color: var(--muted); font-size: 13px; margin: 0; font-weight: 500; }
.mono { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }

/* —— Surfaces —— */
.stat, .panel, .auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 18px 20px; margin-bottom: 16px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.panel.narrow { max-width: 480px; }
.panel.table-wrap { padding: 0; overflow: auto; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--accent-soft);
  opacity: 0.7;
  pointer-events: none;
}
.stat-label {
  position: relative;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.stat-value {
  position: relative;
  font-size: 32px;
  font-weight: 800;
  margin-top: 8px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* —— Forms —— */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar input[type="search"],
.filters select,
.filters input {
  flex: 1;
  max-width: 280px;
  margin: 0;
  width: auto;
  min-width: 140px;
}
.filters { flex-wrap: wrap; }
.batch-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.batch-bar select, .batch-bar input { width: auto; margin: 0; min-width: 140px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-form select, .inline-form input { width: auto; margin: 0; min-width: 90px; }
.empty-inline { margin: 0; padding: 8px 0; }

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}
input, select, textarea {
  width: 100%;
  margin-top: 4px;
  margin-bottom: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.stack { display: flex; flex-direction: column; }
.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.checkline input { width: auto; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px rgba(13, 159, 138, 0.25);
}
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* —— Tables —— */
.table-wrap { overflow: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.data th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 700;
  position: sticky;
  top: 0;
}
table.data tbody tr:hover td { background: rgba(13, 159, 138, 0.04); }
table.data.compact td, table.data.compact th { padding: 9px 12px; }
.empty { text-align: center; color: var(--muted); padding: 32px !important; }
.truncate {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eef3f5;
  color: var(--ink-soft);
}
.tag-active { background: var(--ok-soft); color: var(--ok); }
.tag-disabled { background: var(--danger-soft); color: var(--danger); }

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
}
.flash-ok { background: var(--ok-soft); border-color: #b7e0c7; color: var(--ok); }
.flash-error { background: var(--danger-soft); border-color: #f0b4b4; color: var(--danger); }

.kv { display: grid; gap: 10px; margin: 0; }
.kv > div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.kv dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.kv dd { margin: 0; }
.codeblock {
  background: #152029;
  color: #d7e6ef;
  padding: 14px;
  border-radius: 10px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}
.danger-zone {
  border-color: #f0c2c2;
  background: linear-gradient(180deg, #fff, #fff8f8);
}
.pager {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
}

/* —— Auth —— */
.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(700px 360px at 15% 0%, rgba(13, 159, 138, 0.18), transparent 55%),
    radial-gradient(600px 320px at 90% 100%, rgba(90, 170, 200, 0.16), transparent 50%),
    linear-gradient(165deg, #eef6f5, #f3f7f8 40%, #e8f0f2);
}
.auth-main { width: min(420px, 92vw); }
.auth-card { padding: 32px 28px; }
.auth-brand { padding: 0 0 18px; margin-bottom: 4px; }
.auth-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* —— Prompt studio —— */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.prompt-head { margin-bottom: 16px; }
.seg-tabs {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: #e4ecee;
  border-radius: 12px;
  margin-bottom: 18px;
}
.seg-tab {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
}
.seg-tab:hover { color: var(--ink); text-decoration: none; background: rgba(255,255,255,.5); }
.seg-tab.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(26, 43, 52, 0.08);
}
.prompt-studio {
  display: grid;
  gap: 16px;
  max-width: 820px;
}
.prompt-block { margin-bottom: 0; padding: 20px 22px 18px; }
.prompt-block .panel-head { margin-bottom: 14px; align-items: flex-start; }
.prompt-hint { margin-top: 4px; line-height: 1.5; max-width: 52ch; }
.prompt-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}
.prompt-picker { margin-bottom: 14px; }
.prompt-picker label { margin-bottom: 6px; }
.prompt-select {
  margin: 0;
  height: 44px;
  font-size: 14px;
  font-weight: 700;
  background: var(--surface-2);
}
.prompt-stage {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 16px;
  min-height: 220px;
}
.prompt-pane[hidden] { display: none !important; }
.prompt-pane.is-active {
  display: block;
  animation: prompt-in .18s var(--ease);
}
@keyframes prompt-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.prompt-form { margin: 0; }
.prompt-form label { margin-bottom: 12px; }
.prompt-form input,
.prompt-form textarea {
  margin-top: 6px;
  margin-bottom: 0;
  background: #fff;
}
.prompt-form textarea {
  min-height: 160px;
  line-height: 1.55;
  resize: vertical;
}
.prompt-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.prompt-lock textarea { margin-bottom: 0; }
.prompt-danger-zone {
  border-style: dashed;
  background: #fcfdfd;
}
.prompt-danger-zone .btn { color: var(--muted); }

@media (max-width: 960px) {
  .app-page { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .nav-group { min-width: 140px; flex: 1; }
  .sidebar-foot { border-top: 0; padding-top: 8px; }
  .stat-grid, .grid-2 { grid-template-columns: 1fr 1fr; }
  .main { padding: 18px; }
}
@media (max-width: 720px) {
  .prompt-studio { max-width: none; }
  .prompt-block { padding: 16px; }
  .seg-tabs { width: 100%; display: flex; }
  .seg-tab { flex: 1; justify-content: center; }
}
@media (max-width: 640px) {
  .stat-grid, .grid-2 { grid-template-columns: 1fr; }
  .page-head.row { flex-direction: column; align-items: flex-start; }
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); font-weight: 700; font-size: 12px; }
.table-wrap { overflow-x: auto; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions .inline { display: inline; margin: 0; }
.linkish.danger { color: #b42318; }
