:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --line: #e3e6ec;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --danger: #b91c1c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.topbar-left { display: flex; align-items: center; gap: 24px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.nav { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--accent); text-decoration: none; }

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 22px 24px 60px;
}

.muted { color: var(--muted); }
.mono { font-family: "Cascadia Code", Consolas, monospace; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 120px; }
.field.grow { flex: 1 1 220px; }
.field label { font-size: 12px; color: var(--muted); }
.field.actions { flex-direction: row; align-items: center; gap: 8px; }

input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
button:hover, .button:hover { text-decoration: none; opacity: .92; }
.button.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 18px 2px 10px;
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table { width: 100%; border-collapse: collapse; min-width: 1050px; }
thead th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
  position: sticky;
  top: 0;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.preview { max-width: 520px; color: #374151; }
.tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
}
.empty { text-align: center; color: var(--muted); padding: 40px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

.detail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.detail-head h1 { margin: 0 0 4px; font-size: 20px; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.meta-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
  padding: 10px 14px;
}
.meta-grid .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.prompt-section { margin-top: 22px; }
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title h2 { font-size: 16px; margin: 0 0 8px; }

pre.prompt {
  margin: 0;
  padding: 18px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius);
  overflow: auto;
  max-height: 70vh;
  font: 13px/1.6 "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, #e8efff, var(--bg) 55%);
}
.auth-card {
  width: min(380px, calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .08);
}
.auth-card h1 { margin: 0 0 6px; font-size: 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.auth-card button { margin-top: 4px; height: 38px; }
.alert {
  margin-top: 14px;
  padding: 9px 12px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fef2f2;
  color: var(--danger);
}

.notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  white-space: nowrap;
}
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }

.policy-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag.warn { background: #fef3c7; color: #92400e; }
.tag.danger { background: #fee2e2; color: #991b1b; }

.field > span { font-size: 12px; color: var(--muted); }

select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.form-card {
  margin-top: 18px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.form-section + .form-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.form-section h2 { margin: 0 0 4px; font-size: 16px; }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.form-grid .field { min-width: 0; }
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #374151;
}
.checkbox input { height: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: #fecaca;
  background: #fff7f7;
}
.danger-zone .hint { margin: 4px 0 0; }
button.danger { background: var(--danger); border-color: var(--danger); }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .topbar-left { flex-wrap: wrap; gap: 12px; }
  .danger-zone { align-items: flex-start; flex-direction: column; }
}
