:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --ink: #171a2b;
  --ink-soft: #3d4258;
  --muted: #70758a;
  --line: #e2e5ee;
  --line-strong: #cfd4e2;
  --primary: #4f46e5;
  --primary-dark: #3d34c9;
  --primary-soft: #eeecff;
  --teal: #0f766e;
  --teal-soft: #e5f7f3;
  --warn: #a35a06;
  --warn-soft: #fff5df;
  --danger: #b42318;
  --danger-soft: #fef0ee;
  --pass: #147a54;
  --pass-soft: #e8f8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 26, 43, 0.04), 0 8px 24px rgba(23, 26, 43, 0.04);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(900px 400px at 8% -8%, rgba(79, 70, 229, 0.09), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(15, 118, 110, 0.06), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(26px, 2.4vw, 34px); line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 10px; }
h2 { font-size: 19px; line-height: 1.35; margin-bottom: 8px; }
h3 { font-size: 16px; }
code, pre { font-family: var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(79, 70, 229, 0.32); outline-offset: 2px; }

.shell { width: 100%; max-width: 1220px; margin: 0 auto; padding-inline: 24px; }
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--ink); color: white; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { left: 12px; color: white; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 22px; min-height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); flex: 0 0 auto; }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, #5b52ee, #3730a3); color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: 0.04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: -0.01em; }
.brand-text small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 9px;
  color: var(--ink-soft); font-size: 14px; white-space: nowrap;
}
.nav-link span {
  display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 5px;
  background: var(--surface-soft); border: 1px solid var(--line); color: var(--muted);
  font-size: 10px; font-weight: 800;
}
.nav-link:hover { background: var(--surface-soft); color: var(--ink); }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.nav-link.is-active span { background: var(--primary); color: white; border-color: var(--primary); }
.workspace-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px;
  background: var(--surface-soft); border: 1px solid var(--line); color: var(--muted);
  font-size: 12px; white-space: nowrap; flex: 0 0 auto;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pass); box-shadow: 0 0 0 3px var(--pass-soft); }

.page { padding-top: 26px; padding-bottom: 54px; min-height: calc(100vh - 160px); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; margin-bottom: 22px; }
.page-head > div:first-child { min-width: 0; flex: 1 1 auto; }
.eyebrow { margin: 0 0 7px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.lede { color: var(--ink-soft); max-width: 760px; margin-bottom: 0; }
.head-note {
  flex: 0 0 286px; padding: 14px 16px; border-radius: 12px;
  background: var(--primary-soft); border: 1px solid #dcd8ff;
}
.head-note strong { display: block; font-size: 20px; line-height: 1.2; }
.head-note span { display: block; color: var(--primary-dark); font-weight: 700; margin-top: 2px; }
.head-note small { display: block; color: #5d5885; margin-top: 5px; line-height: 1.45; }
.head-note.warn { background: var(--warn-soft); border-color: #f2dfb3; }
.head-note.warn strong, .head-note.warn span { color: var(--warn); }
.head-note.warn small { color: #7a5a23; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); min-width: 0;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 14px; }
.section-head > div { min-width: 0; }
.section-head h2 { margin-bottom: 3px; }
.section-head p { margin-bottom: 0; }
.section-head.compact { align-items: center; margin-bottom: 10px; }
.badge {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-soft); color: var(--muted);
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge-muted { background: var(--surface-soft); }
.badge-pass { background: var(--pass-soft); color: var(--pass); border-color: #bfe8d5; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: #f0dca9; }
.badge-error { background: var(--danger-soft); color: var(--danger); border-color: #f4c7c2; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-soft); font-size: 14px; font-weight: 650;
  line-height: 1.2; white-space: nowrap; transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn:hover { background: var(--surface-soft); color: var(--ink); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-quiet { background: var(--surface-soft); }
.btn-danger { color: var(--danger); border-color: #f0c7c3; background: var(--danger-soft); }
.btn-danger:hover { background: #fde4e0; color: #8f1c13; }
.btn-tiny { min-height: 29px; padding: 4px 8px; font-size: 12px; border-radius: 7px; }
.btn-wide { width: 100%; }

label { display: block; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.field-label em { color: var(--muted); font-style: normal; font-weight: 500; }
textarea, input[type="text"], select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
  padding: 10px 12px; color: var(--ink); min-width: 0;
}
textarea { resize: vertical; line-height: 1.6; }
textarea::placeholder, input::placeholder { color: #a2a6b6; }
textarea:focus, input[type="text"]:focus, select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12); }
select { appearance: auto; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.inline-field > span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.inline-field select { min-width: 150px; width: auto; }
.inline-field input { min-width: 220px; width: auto; }
.inline-field.compact select { min-width: 128px; }
.char-count { color: var(--muted); font-size: 12px; white-space: nowrap; }

.create-card { border-top: 3px solid var(--primary); }
.create-card textarea { min-height: 84px; }
.create-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.detection-note { margin-top: 14px; padding: 10px 12px; border-radius: 9px; background: var(--teal-soft); color: var(--teal); font-size: 13px; }
.legend { display: inline-flex; gap: 9px; align-items: center; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 2px; }
.legend-dot.confirmed { background: var(--pass); }
.legend-dot.default { background: var(--warn); }
.legend-dot.inferred { background: #8b90a4; }

.draft-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 14px; }
.draft-kicker { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.domain-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--primary-soft); color: var(--primary-dark); font-size: 14px; }
.sep { color: var(--line-strong); }
.draft-title { min-width: 0; }
.draft-title h2 { margin: 4px 0 5px; font-size: 23px; overflow-wrap: anywhere; }
.draft-title p { margin: 0; font-size: 12.5px; }
.draft-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; }

.progress-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-bottom: 16px; padding-block: 16px; }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; font-weight: 700; }
.progress-top strong { font-size: 22px; }
.progress-track { height: 8px; border-radius: 999px; background: #eceef5; overflow: hidden; margin-top: 7px; }
.progress-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #6d65f0, #4338ca); transition: width 0.35s ease; }
.progress-fill.is-confirm { background: linear-gradient(90deg, #19a97c, #0f766e); }
.progress-fill.is-low { background: linear-gradient(90deg, #f59e0b, #b45309); }
.progress-fill.is-danger { background: linear-gradient(90deg, #ef4444, #b91c1c); }

.studio { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }
.sticky-panel { display: grid; gap: 14px; position: sticky; top: 82px; min-width: 0; }
.field-card { padding: 20px 22px; }
.field-list { border-top: 1px solid var(--line); }
.field-group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 13px 0 2px; }
.field-group-title span { font-size: 12px; font-weight: 800; color: var(--primary-dark); letter-spacing: 0.08em; }
.field-group-title em { font-style: normal; color: var(--muted); font-size: 11px; }
.loading { padding: 20px 0; color: var(--muted); }
.field-item { padding: 15px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.field-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 7px; }
.field-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.field-name strong { font-size: 14px; }
.field-id { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.req { font-size: 11px; color: var(--danger); font-weight: 700; }
.opt { font-size: 11px; color: var(--muted); }
.status-badge { flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.status-confirmed { color: var(--pass); background: var(--pass-soft); border-color: #bfe8d5; }
.status-default { color: var(--warn); background: var(--warn-soft); border-color: #f0dca9; }
.status-inferred { color: #5f6478; background: var(--surface-soft); }
.status-missing { color: var(--danger); background: var(--danger-soft); border-color: #f4c7c2; }
.field-explain { font-size: 12px; color: var(--muted); margin: 0 0 8px; line-height: 1.5; }
.select-wrap { position: relative; min-width: 0; }
.field-select { padding-right: 28px; text-overflow: ellipsis; }
.option-hint { margin-top: 5px; font-size: 11.5px; color: #8a8fa3; line-height: 1.45; overflow-wrap: anywhere; }
.custom-input { margin-top: 7px; font-size: 13px; }
.field-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.field-actions .btn { min-height: 29px; padding: 4px 8px; font-size: 12px; border-radius: 7px; }
.field-evidence { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.evidence-chip { font-size: 11px; color: var(--teal); background: var(--teal-soft); border: 1px solid #c9eee7; border-radius: 6px; padding: 2px 6px; max-width: 100%; overflow-wrap: anywhere; }

.element-card { padding: 17px; }
.element-list { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; margin-top: 10px; }
.element-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 7px; border-radius: 7px; background: var(--surface-soft); min-width: 0; }
.element-label { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.element-row .status-badge { font-size: 10px; padding: 1px 5px; }
.element-req { color: var(--danger); font-weight: 800; }
.generate-card { border-top: 3px solid var(--teal); }
.generate-card h2 { font-size: 16px; }
.inline-error { margin-top: 10px; padding: 9px 11px; border-radius: 8px; background: var(--danger-soft); border: 1px solid #f4c7c2; color: var(--danger); font-size: 12.5px; overflow-wrap: anywhere; }

.result-card { margin-top: 16px; border-top: 3px solid var(--pass); }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.check-card { display: flex; align-items: flex-start; gap: 8px; padding: 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-soft); min-width: 0; }
.check-card.pass { border-color: #c7ebda; background: var(--pass-soft); }
.check-card.warn, .check-card.warning { border-color: #f0dca9; background: var(--warn-soft); }
.check-card.error { border-color: #f4c7c2; background: var(--danger-soft); }
.check-card strong { display: block; font-size: 12.5px; line-height: 1.35; }
.check-card span { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.check-status { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--muted); }
.check-card.pass .check-status { background: var(--pass); }
.check-card.warning .check-status, .check-card.warn .check-status { background: var(--warn); }
.check-card.error .check-status { background: var(--danger); }
.notice { margin: 12px 0; padding: 10px 12px; border-radius: 9px; background: var(--warn-soft); border: 1px solid #f0dca9; color: #6f4a12; font-size: 12.5px; overflow-wrap: anywhere; }
.notice.inline { margin: 0; flex: 1 1 auto; }
.markdown-preview { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.markdown-preview summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); }
pre { margin: 10px 0 0; padding: 14px; border-radius: 9px; background: #111827; color: #e5e7eb; overflow: auto; max-width: 100%; }
.markdown-preview pre, .markdown-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-size: 12.5px; line-height: 1.65; }

.panel-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 11px; background: #e9ebf3; margin-bottom: 12px; }
.tab-btn { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 650; font-size: 13.5px; }
.tab-btn.is-active { background: white; color: var(--ink); box-shadow: 0 1px 3px rgba(23, 26, 43, 0.1); }
.form-card { margin-bottom: 14px; }
.upload-row { margin-bottom: 12px; }
.split-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.optional-box { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.optional-box summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.optional-box textarea { margin-top: 8px; }
.wide-select { max-width: 640px; }
.trigger-card { margin-bottom: 16px; }
.query-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.query-grid textarea { font-family: var(--mono); font-size: 12.5px; }
.query-grid .field-label { display: flex; justify-content: space-between; gap: 8px; }
.query-grid .field-label em { font-weight: 500; color: var(--muted); }
.sample-actions { display: flex; gap: 8px; }
.run-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.report-head { display: flex; align-items: center; gap: 20px; margin-bottom: 12px; }
.report-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.report-head h2 { margin-bottom: 4px; }
.score-ring { flex: 0 0 auto; width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; align-content: center; background: var(--primary-soft); color: var(--primary-dark); font-size: 28px; font-weight: 800; line-height: 1; }
.score-ring small { display: block; font-size: 11px; font-weight: 600; margin-top: 4px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.summary-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 14px; }
.summary-cell { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; box-shadow: var(--shadow); min-width: 0; }
.summary-cell strong { display: block; font-size: 22px; line-height: 1.1; }
.summary-cell span { color: var(--muted); font-size: 12px; }
.summary-cell.error strong { color: var(--danger); }
.summary-cell.warn strong { color: var(--warn); }
.summary-cell.pass strong { color: var(--pass); }
.checklist { border-top: 1px solid var(--line); }
.checklist-group { padding: 10px 0 2px; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: 0.06em; }
.check-row { display: grid; grid-template-columns: 62px minmax(0, 1.2fr) minmax(0, 2.2fr) 58px; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.check-row .check-title { font-weight: 700; color: var(--ink-soft); overflow-wrap: anywhere; }
.check-row .check-message { color: var(--muted); overflow-wrap: anywhere; }
.check-row .check-line { font-family: var(--mono); color: var(--muted); text-align: right; font-size: 11.5px; }
.check-pill { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 5px; display: inline-block; text-align: center; }
.check-pill.pass { color: var(--pass); background: var(--pass-soft); }
.check-pill.warning, .check-pill.warn { color: var(--warn); background: var(--warn-soft); }
.check-pill.error { color: var(--danger); background: var(--danger-soft); }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.data-table th { text-align: left; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 9px; border-bottom: 1px solid var(--line-strong); }
.data-table td { padding: 10px 9px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafbff; }
.trigger-table th:nth-child(1) { width: 36px; }
.trigger-table th:nth-child(2) { width: 35%; }
.trigger-table th:nth-child(3), .trigger-table th:nth-child(4) { width: 62px; }
.trigger-table th:nth-child(5) { width: 19%; }
.trigger-table th:nth-child(6) { width: 72px; }
.trigger-table th:nth-child(7) { width: 52px; }
.trigger-table td:nth-child(7) { text-align: center; font-weight: 800; }
.trigger-table .hit { color: var(--pass); }
.trigger-table .miss { color: var(--danger); }
.text-pass { color: var(--pass); }
.text-warn { color: var(--warn); }
.text-error { color: var(--danger); }

.template-section { margin-bottom: 18px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(188px, 1fr)); gap: 10px; }
.template-card { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 13px; box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; gap: 4px; transition: border-color 0.15s, transform 0.15s; }
.template-card:hover { border-color: #c3bdfa; transform: translateY(-1px); }
.template-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12); }
.template-icon { font-size: 20px; color: var(--primary); line-height: 1; }
.template-name { font-weight: 800; font-size: 14.5px; }
.template-summary { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.template-trigger { color: #8a8fa3; font-size: 10.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-state { display: inline-flex; align-items: center; gap: 7px; color: var(--teal); background: var(--teal-soft); border: 1px solid #c9eee7; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.c-studio { margin-bottom: 16px; }
.c-guide { border-top: 3px solid var(--warn); }
.guide-list { margin: 0 0 14px; padding-left: 18px; color: var(--ink-soft); font-size: 13px; }
.guide-list li { margin-bottom: 7px; }
.empty-state { text-align: center; padding: 28px 20px; background: var(--surface-soft); border: 1px dashed var(--line-strong); border-radius: 11px; color: var(--muted); }
.empty-state strong { color: var(--ink-soft); }
.empty-state p { margin: 6px 0 0; }
.empty-state.small { padding: 18px 12px; }
.empty-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.materials-card { margin-bottom: 16px; }
.material-list { display: grid; gap: 9px; }
.material-item { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; background: var(--surface-soft); min-width: 0; }
.material-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.material-excerpt { font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }
.material-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.confidence { display: inline-flex; align-items: center; gap: 5px; }
.confidence-bar { width: 54px; height: 5px; border-radius: 99px; background: #e5e8f0; overflow: hidden; }
.confidence-bar i { display: block; height: 100%; background: var(--teal); border-radius: inherit; }
.pending-badge { color: var(--warn); background: var(--warn-soft); border: 1px solid #f0dca9; border-radius: 5px; padding: 1px 6px; font-size: 10.5px; font-weight: 700; }
.reason { color: #8a8fa3; font-size: 11px; }

.table-card { padding: 8px 8px; }
.library-table th:nth-child(1) { width: 30%; }
.library-table th:nth-child(2) { width: 9%; }
.library-table th:nth-child(3), .library-table th:nth-child(4) { width: 8%; }
.library-table th:nth-child(5) { width: 9%; }
.library-table th:nth-child(6) { width: 13%; }
.library-table th:nth-child(7) { width: 23%; }
.skill-name { font-weight: 750; overflow-wrap: anywhere; }
.subline { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.actions-col { text-align: right; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.breadcrumb span:last-child { overflow-wrap: anywhere; }
.detail-head { align-items: center; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.stat-card span { display: block; color: var(--muted); font-size: 11.5px; }
.stat-card strong { font-size: 19px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.markdown-card { min-width: 0; }
.markdown-body { margin: 0; background: #111827; max-height: 70vh; }
.inspection-card { position: sticky; top: 82px; }
.inspection-score { display: flex; align-items: baseline; gap: 6px; margin: 8px 0 4px; }
.inspection-score strong { font-size: 34px; line-height: 1; }
.inspection-score span { color: var(--muted); font-size: 12px; }
.mini-checklist { border-top: 1px solid var(--line); margin: 12px 0; }
.mini-check { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.mini-check em { font-style: normal; font-family: var(--mono); color: var(--muted); font-size: 10.5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.mini-check.pass .status-dot { background: var(--pass); }
.mini-check.warning .status-dot, .mini-check.warn .status-dot { background: var(--warn); }
.mini-check.error .status-dot { background: var(--danger); }
.error-page { max-width: 720px; margin: 8vh auto 0; padding: 34px; }
.error-page h1 { font-size: 38px; }

.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(420px, calc(100vw - 48px));
  background: var(--ink); color: white; padding: 11px 15px; border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2); font-size: 13px; overflow-wrap: anywhere;
}
.toast.is-error { background: var(--danger); }
.toast.is-success { background: var(--pass); }
.footer { display: flex; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 24px; color: var(--muted); font-size: 11.5px; border-top: 1px solid var(--line); flex-wrap: wrap; }

@media (max-width: 1080px) {
  .studio, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .sticky-panel, .inspection-card { position: static; }
  .element-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-table th:nth-child(1) { width: 28%; }
  .library-table th:nth-child(7) { width: 27%; }
}
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding-block: 10px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .workspace-pill { margin-left: auto; }
  .page-head { flex-direction: column; gap: 14px; }
  .head-note { flex-basis: auto; width: 100%; }
  .progress-grid { grid-template-columns: 1fr; gap: 14px; }
  .query-grid { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: repeat(3, 1fr); }
  .detail-actions { justify-content: flex-start; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .element-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .draft-head { flex-direction: column; }
  .draft-actions { justify-content: flex-start; }
  .check-row { grid-template-columns: 58px minmax(0, 1.2fr) minmax(0, 2fr); }
  .check-row .check-line { display: none; }
  .report-head { flex-wrap: wrap; }
  .report-actions { justify-content: flex-start; }
}
@media (max-width: 620px) {
  .shell { padding-inline: 14px; }
  .nav-link { padding: 7px 9px; }
  .workspace-pill { display: none; }
  .check-grid, .summary-strip, .stat-grid { grid-template-columns: 1fr 1fr; }
  .check-row { grid-template-columns: 55px minmax(0, 1fr); }
  .check-row .check-message { grid-column: 2; }
  .check-row .check-line { display: none; }
  .card { padding: 15px; }
  .query-grid { gap: 12px; }
  .detail-actions .btn, .report-actions .btn { flex: 1 1 auto; }
  .row-actions { gap: 3px; }
}
@media print {
  .topbar, .footer, .btn, .toast, .panel-tabs { display: none !important; }
  body { background: white; }
  .card { box-shadow: none; break-inside: avoid; }
  pre { white-space: pre-wrap; background: #f6f6f6; color: #111; }
}
