:root {
  --bg: #f4f7fc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #5b6b84;
  --line: #dbe3ef;
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --brand-soft: #e8efff;
  --ok: #0f766e;
  --ok-soft: #e5f7f3;
  --warn: #a8550a;
  --warn-soft: #fff4e2;
  --err: #b91c1c;
  --err-soft: #fdecec;
  --fatal: #7f1d1d;
  --fatal-soft: #fbe4e4;
  --info: #1d4ed8;
  --info-soft: #eef3ff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 28px rgba(15, 23, 42, 0.05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Noto Sans Thai", "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.92em; background: #eef2f8; padding: 1px 5px; border-radius: 5px; }
.hidden { display: none !important; }
.meta { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.link { color: var(--brand); font-weight: 600; text-decoration: none; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* ------------------------------------------------------------- top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  color: #fff;
  background: linear-gradient(120deg, #0f2d6b 0%, #143a8a 45%, #1d4ed8 100%);
  box-shadow: 0 6px 18px rgba(15, 45, 107, 0.25);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 800; letter-spacing: 0.5px; font-size: 13px;
}
.brand strong { display: block; font-size: 16px; line-height: 1.2; }
.brand .sub { display: block; font-size: 11.5px; color: rgba(255, 255, 255, 0.76); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12); color: #fff;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill-muted { color: rgba(255, 255, 255, 0.72); }
.pill-ok { background: rgba(16, 185, 129, 0.22); border-color: rgba(16, 185, 129, 0.45); }
.pill-warn { background: rgba(245, 158, 11, 0.22); border-color: rgba(245, 158, 11, 0.5); }
.pill-err { background: rgba(239, 68, 68, 0.24); border-color: rgba(239, 68, 68, 0.55); }
.pill-version {
  background: rgba(250, 204, 21, 0.22);
  border-color: rgba(250, 204, 21, 0.6);
  font-weight: 700;
}
.release-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 18px;
  background: linear-gradient(90deg, #fff8e6, #fffdf5);
  border-bottom: 1px solid #f0d79a;
  color: #7a4b00;
  font-size: 12.5px;
}
.release-banner .tag { font-size: 10.5px; }
.footer {
  max-width: 1900px;
  margin: 18px auto 34px;
  padding: 0 22px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11.5px;
}
.footer strong { color: var(--ink); }

/* -------------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  align-items: start;
  max-width: 1900px;
  margin: 0 auto;
}
.sidebar { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 82px; max-height: calc(100vh - 100px); overflow: auto; padding-right: 2px; }
.content { min-width: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field > span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="url"], input[type="password"], input:not([type]), select, textarea {
  font-family: inherit; font-size: 13px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; margin-bottom: 7px; color: #263449; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--brand); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions.column { flex-direction: column; }
.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:hover { background: #f3f6fc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #1743b8; }
.btn.ghost { background: transparent; color: var(--brand); border-color: #c7d6f8; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn.tiny { padding: 4px 9px; font-size: 11.5px; font-weight: 600; border-radius: 6px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--err); border-color: #f3c1c1; }
.btn.danger:hover { background: var(--err-soft); }
/* --------------------------------------------------------------- tabs */
.tabs {
  position: sticky;
  top: 64px;
  z-index: 25;
  display: flex; gap: 4px; flex-wrap: wrap;
  background: #e9eef8; border: 1px solid #d8e2f3;
  padding: 4px; border-radius: 11px; margin-bottom: 14px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}
.tab {
  flex: 1 1 auto; border: 0; background: transparent; color: #3d4f6b;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tab:hover { background: rgba(255, 255, 255, 0.6); }
.tab.active { background: #fff; color: var(--brand-dark); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.badge {
  min-width: 18px; height: 18px; border-radius: 999px; padding: 0 5px;
  display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 700; background: var(--err); color: #fff;
}
.badge.zero { background: #94a3b8; }
.pane { display: none; }
.pane.active { display: block; animation: fade .12s ease; }
@keyframes fade { from { opacity: .5; } to { opacity: 1; } }

.notice {
  background: #fff; border: 1px dashed #c9d6ea; border-radius: var(--radius);
  padding: 18px; color: var(--muted); text-align: center;
}
.pane-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* -------------------------------------------------------------- editors */
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor-card {
  background: #0f172a; border: 1px solid #1e293b; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.editor-card > header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; background: #111c33; border-bottom: 1px solid #1e293b; color: #e2e8f0;
}
.editor-card h3 { font-size: 12.5px; font-family: var(--mono); color: #cfe0ff; }
.editor-card .meta { color: #8ea3c4; display: block; margin-top: 2px; }
.editor-actions { display: flex; gap: 6px; align-items: center; }
.editor-card .btn { background: #1b2a45; border-color: #2b3f63; color: #dbe7ff; }
.editor-card .btn:hover { background: #24395c; }
.editor-wrap { display: flex; min-height: 420px; height: calc(100vh - 300px); }
.gutter {
  margin: 0; padding: 10px 8px 10px 10px; width: 46px; text-align: right;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; color: #51648a;
  background: #0d1626; border-right: 1px solid #1e293b; overflow: hidden; user-select: none;
}
.editor-wrap textarea {
  flex: 1; width: 100%; resize: none; border: 0; border-radius: 0;
  background: #0b1322; color: #d7e3f4; padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; tab-size: 4;
  white-space: pre; overflow: auto;
}
.editor-wrap textarea:focus { box-shadow: none; }
.runbar {
  margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow);
}
.runbar-text { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.runbar-text strong { color: var(--ink); font-size: 13.5px; }

/* ------------------------------------------------------------- findings */
.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.summary-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); border-left: 5px solid #cbd5e1;
}
.summary-card .n { font-size: 24px; font-weight: 750; line-height: 1.1; }
.summary-card .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.summary-card.fatal { border-left-color: var(--fatal); }
.summary-card.fatal .n { color: var(--fatal); }
.summary-card.error { border-left-color: var(--err); }
.summary-card.error .n { color: var(--err); }
.summary-card.warning { border-left-color: var(--warn); }
.summary-card.warning .n { color: var(--warn); }
.summary-card.info { border-left-color: var(--brand); }
.summary-card.info .n { color: var(--brand); }
.summary-card.status { border-left-color: #0ea5a4; }
.summary-card.status .n { font-size: 15px; }
.verdict-ok { color: var(--ok); }
.verdict-bad { color: var(--err); }

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #eef2f8; border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button {
  border: 0; background: transparent; font: inherit; font-size: 11.5px; font-weight: 600;
  color: #475569; padding: 4px 9px; border-radius: 6px; cursor: pointer;
}
.seg button.active { background: #fff; color: var(--brand-dark); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.search { padding: 6px 9px !important; font-size: 12px !important; min-width: 200px; }
.findings { display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow: auto; padding-right: 2px; }
.finding {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  border-left: 4px solid #cbd5e1; background: #fff;
}
.finding.fatal { border-left-color: var(--fatal); background: #fffafa; }
.finding.error { border-left-color: var(--err); background: #fffbfb; }
.finding.warning { border-left-color: var(--warn); background: #fffdf8; }
.finding.info { border-left-color: var(--brand); }
.finding-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.finding-head .code { font-family: var(--mono); font-size: 11px; color: #475569; background: #eef2f8; padding: 1px 6px; border-radius: 4px; }
.finding-head .loc { margin-left: auto; font-size: 11.5px; }
.loc button {
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--brand);
  font: inherit; text-decoration: underline dotted;
}
.finding .msg { margin-top: 5px; font-weight: 600; font-size: 13px; }
.finding .detail { margin-top: 4px; font-size: 12px; color: #46566d; font-family: var(--mono); word-break: break-word; }
.finding .hint { margin-top: 5px; }
.sev {
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; color: #fff; background: #64748b;
}
.sev.fatal { background: var(--fatal); }
.sev.error { background: var(--err); }
.sev.warning { background: var(--warn); }
.sev.info { background: var(--brand); }
.empty { color: var(--muted); text-align: center; padding: 22px; font-size: 13px; }

/* ------------------------------------------------------- tables & cards */
.table-wrap { overflow: auto; max-height: 460px; border: 1px solid var(--line); border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid #eef2f8; text-align: left; vertical-align: top; }
table.data th { position: sticky; top: 0; background: #f6f9ff; color: #45566f; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; z-index: 1; }
table.data tr:last-child td { border-bottom: 0; }
table.data code { background: transparent; padding: 0; font-size: 11.5px; }
.ok-dot, .bad-dot, .warn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.ok-dot { background: #10b981; }
.bad-dot { background: #ef4444; }
.warn-dot { background: #f59e0b; }
.tag {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: #eef2f8; color: #475569; white-space: nowrap;
}
.tag.blue { background: var(--brand-soft); color: var(--brand-dark); }
.tag.green { background: var(--ok-soft); color: var(--ok); }
.tag.red { background: var(--err-soft); color: var(--err); }
.tag.amber { background: var(--warn-soft); color: var(--warn); }
.tag.slate { background: #eef2f8; color: #52627a; }

.cross-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cross-col h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.cross-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.cross-item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.cross-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-body { max-height: 520px; overflow: auto; }

.process { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.process > header { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #f7faff; border-bottom: 1px solid var(--line); font-weight: 650; font-size: 13px; }
.process .steps { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; }
.step-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; font-size: 11.5px; background: #fff; }
.step-chip.missing { border-color: #f3c1c1; background: #fff7f7; color: var(--err); }
.form-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.form-card > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.form-card h4 { font-size: 13px; font-family: var(--mono); }
.field-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 12px; }
.field-list li { font-size: 11.5px; color: #45566f; display: flex; gap: 6px; align-items: baseline; }
.field-list .md { font-family: var(--mono); color: #263449; }
.field-list .type { color: #64748b; }
.dtd-summary { display: flex; gap: 10px; flex-wrap: wrap; }
.dtd-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; flex: 1 1 260px; font-size: 12.5px; }
.dtd-box strong { display: block; margin-bottom: 4px; }

/* ----------------------------------------------------------------- live */
.live-server { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.kv { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fbfdff; min-width: 0; }
.kv .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kv .v { font-weight: 650; font-size: 13px; word-break: break-word; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.check-row .status { flex: 0 0 74px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.check-row .status.ok { color: var(--ok); }
.check-row .status.warn { color: var(--warn); }
.check-row .status.fail { color: var(--err); }
.check-row .status.skipped { color: #64748b; }
.check-row .body { min-width: 0; }
.check-row .label { font-weight: 650; font-size: 13px; }
.check-row .detail { font-size: 12px; color: #52627a; word-break: break-word; }
.live-deltas { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.delta { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.delta h4 { font-size: 12px; margin-bottom: 6px; color: #334155; }
.delta .sub { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.delta ul { margin: 0; padding-left: 18px; font-size: 12px; max-height: 160px; overflow: auto; }
.delta li { word-break: break-word; }

/* -------------------------------------------------------------- preview */
.preview-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.preview-toolbar .field { min-width: 180px; flex: 1 1 180px; margin-bottom: 0; }
.preview-toolbar-actions { display: flex; gap: 8px; }
.preview-note { margin-bottom: 12px; font-size: 12.5px; color: var(--muted); }
.dspace-preview { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.ds-topbar { background: linear-gradient(120deg, #143a8a, #1d4ed8); color: #fff; padding: 10px 18px; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.ds-topbar strong { font-size: 13px; }
.ds-breadcrumb { padding: 9px 18px; background: #f8fafc; border-bottom: 1px solid var(--line); font-size: 12px; color: #64748b; }
.ds-progress { display: flex; overflow-x: auto; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.ds-step { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; font-size: 12px; color: #64748b; white-space: nowrap; border: 0; background: none; cursor: pointer; }
.ds-step .num { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #cbd5e1; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: #fff; color: #64748b; }
.ds-step.active .num { border-color: #1d4ed8; background: #1d4ed8; color: #fff; }
.ds-step.active { color: #0f172a; font-weight: 650; }
.ds-step.done .num { border-color: #10b981; background: #10b981; color: #fff; }
.ds-body { padding: 18px; background: #fff; }
.ds-section { max-width: 960px; margin: 0 auto; }
.ds-section h2 { font-size: 20px; margin-bottom: 4px; }
.ds-section .lead { color: #64748b; font-size: 13px; margin-bottom: 16px; }
.ds-row { display: flex; flex-wrap: wrap; gap: 0 16px; margin-bottom: 6px; }
.ds-field { flex: 1 1 240px; min-width: 200px; margin-bottom: 12px; }
.ds-field label { display: block; font-weight: 650; font-size: 13.5px; margin-bottom: 3px; }
.ds-field .req { color: #dc2626; margin-left: 2px; }
.ds-field .ds-hint { font-size: 11.5px; color: #64748b; margin-bottom: 4px; }
.ds-field input[type="text"], .ds-field select, .ds-field textarea { width: 100%; }
.ds-field textarea { min-height: 92px; resize: vertical; }
.ds-field .ds-readonly { background: #f1f5f9; color: #475569; }
.ds-field .err { color: #b91c1c; font-size: 11.5px; margin-top: 3px; }
.ds-array { display: flex; flex-direction: column; gap: 8px; }
.ds-array-item { display: flex; gap: 8px; align-items: flex-start; }
.ds-array-item .grow { flex: 1; min-width: 0; }
.btn-mini { border: 1px solid var(--line); background: #fff; border-radius: 7px; font-size: 11.5px; padding: 3px 8px; cursor: pointer; color: #334155; }
.btn-mini:hover { background: #f3f6fc; }
.btn-mini.danger { color: var(--err); border-color: #f3c1c1; }
.ds-footer { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 14px 18px; background: #f8fafc; flex-wrap: wrap; }
.ds-placeholder { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 26px; text-align: center; color: #64748b; background: #fbfdff; }
.ds-upload { border: 2px dashed #93c5fd; background: #eff6ff; border-radius: 10px; padding: 26px; text-align: center; color: #1e40af; }
.ds-upload strong { display: block; font-size: 14px; }
.ds-radio { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; min-height: 38px; background: #fff; }
.tag-input .chip { background: #e8efff; color: #1e3a8a; border-radius: 999px; padding: 2px 8px; font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.tag-input .chip button { border: 0; background: none; color: #1e3a8a; cursor: pointer; font-size: 13px; padding: 0 2px; }
.tag-input input { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 120px; padding: 2px 4px !important; }
.vocab-badge { font-size: 10.5px; color: #1d4ed8; background: #eef3ff; border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.field-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.ds-meta-preview { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; }
.ds-meta-preview summary { cursor: pointer; padding: 9px 12px; font-weight: 600; font-size: 12.5px; }
.ds-meta-preview pre { margin: 0; padding: 0 12px 12px; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; color: #334155; }

/* --------------------------------------------------------------- misc */
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .3); max-width: 380px; font-size: 13px;
}
.toast.err { background: #991b1b; }
.toast.ok { background: #065f46; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .editor-wrap { height: 440px; }
}
@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cross-summary { grid-template-columns: 1fr; }
  .topbar { height: auto; padding: 10px 14px; flex-wrap: wrap; }
  .brand .sub { display: none; }
  .tabs { position: static; box-shadow: none; }
}
@media (max-width: 640px) {
  .layout { padding: 10px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tab { flex: 0 0 auto; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .editor-wrap { height: 360px; }
  .preview-toolbar .field { flex: 1 1 100%; }
  .filters { width: 100%; }
  .search { min-width: 100%; }
}


.muted { color: var(--muted); }
.ds-field.invalid input,
.ds-field.invalid select,
.ds-field.invalid textarea { border-color: #dc2626; background: #fff5f5; }
