:root {
  color-scheme: dark;
  --ink: #101816;
  --surface: #17211f;
  --surface-2: #1c2926;
  --surface-3: #23322f;
  --line: #344640;
  --muted: #91a19c;
  --text: #eef4f0;
  --cream: #f2eee4;
  --forest: #173b32;
  --mint: #69d5ae;
  --mint-soft: #b6f1dc;
  --gold: #eabf68;
  --red: #e77c72;
  --blue: #73b9db;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: var(--ink);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--ink); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; background:
  radial-gradient(circle at 22% 0%, rgba(58, 128, 105, .17), transparent 27rem),
  var(--ink); }
.topbar { height: 82px; padding: 0 4vw; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(16, 24, 22, .92); }
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid var(--mint); color: var(--mint-soft); font: 500 13px "SFMono-Regular", Consolas, monospace; letter-spacing: .08em; transform: rotate(-3deg); }
h1, h2, h3, h4, p { margin: 0; }
h1 { font: 600 19px Georgia, serif; letter-spacing: .015em; }
.eyebrow { color: var(--muted); font: 500 10px "SFMono-Regular", Consolas, monospace; letter-spacing: .14em; text-transform: uppercase; }
.status-cluster { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(105, 213, 174, .08); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.auth-state { color: var(--muted); font: 9px "DM Mono", monospace; text-transform: uppercase; }
.auth-state.signed-in { color: var(--mint); }
.auth-action { padding: 7px 9px; color: var(--mint-soft); background: transparent; border: 1px solid var(--line); text-decoration: none; cursor: pointer; font: 9px "DM Mono", monospace; text-transform: uppercase; }
.auth-action:hover { border-color: var(--mint); }
main { width: min(1760px, 94vw); margin: 0 auto; }
.hero { padding: 42px 0 34px; display: flex; align-items: end; justify-content: space-between; gap: 40px; }
.hero h2 { margin-top: 9px; max-width: 780px; font: 600 clamp(35px, 4.2vw, 66px)/.98 Georgia, serif; color: var(--cream); letter-spacing: -.03em; }
.hero-copy { max-width: 720px; margin-top: 18px; color: #aebcb7; font-size: 14px; line-height: 1.65; }
.hero-steps { display: flex; border-bottom: 1px solid var(--line); white-space: nowrap; }
.hero-steps span { padding: 10px 14px; color: #71807b; font: 500 10px "DM Mono", monospace; text-transform: uppercase; }
.hero-steps .active { color: var(--mint); border-bottom: 2px solid var(--mint); }
.workspace-grid { display: grid; grid-template-columns: minmax(250px, .72fr) minmax(560px, 1.8fr) minmax(280px, .85fr); gap: 14px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; box-shadow: 0 16px 48px rgba(0, 0, 0, .14); }
.panel-heading { min-height: 72px; padding: 19px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.panel-heading h3 { margin-top: 5px; font: 600 18px "Source Serif 4", serif; }
.provider-chip, .advisory-badge, .save-state, .logic-chip { padding: 5px 7px; border: 1px solid var(--line); color: var(--muted); font: 500 8px "DM Mono", monospace; letter-spacing: .08em; white-space: nowrap; }
.advisory-badge { color: var(--gold); border-color: rgba(234, 191, 104, .35); }
.save-state { color: var(--mint); }
.source-panel, .check-panel { position: sticky; top: 14px; }
.file-picker { margin: 20px; min-height: 104px; display: flex; align-items: center; gap: 13px; padding: 18px; border: 1px dashed #48615a; background: rgba(105, 213, 174, .025); cursor: pointer; transition: .2s ease; }
.file-picker:hover { border-color: var(--mint); background: rgba(105, 213, 174, .06); }
.file-picker input { display: none; }
.file-picker strong, .file-picker small { display: block; }
.file-picker strong { font-size: 12px; }
.file-picker small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.file-icon { font: 400 28px "DM Mono", monospace; color: var(--mint); }
.divider { display: flex; align-items: center; gap: 10px; margin: 0 20px 12px; color: #687772; font: 9px "DM Mono", monospace; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.source-input { display: block; width: calc(100% - 40px); height: 154px; margin: 0 20px; padding: 12px; resize: vertical; color: #b8c9c3; background: #111a18; border: 1px solid #2d403a; font: 9px/1.6 "DM Mono", monospace; }
.source-input:focus, input:focus, select:focus, textarea:focus { outline: 1px solid var(--mint); border-color: var(--mint); }
.button-row { display: flex; gap: 8px; margin: 12px 20px 20px; }
.button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface-3); cursor: pointer; font-size: 11px; font-weight: 600; transition: .18s ease; }
.button:hover { transform: translateY(-1px); border-color: #627a72; }
.button.secondary { color: var(--ink); background: var(--cream); border-color: var(--cream); }
.button.ghost { color: var(--muted); background: transparent; }
.button.compact { min-height: 32px; color: var(--gold); border-color: rgba(234, 191, 104, .32); background: transparent; }
.add-facet-controls { display: flex; align-items: center; gap: 8px; }
.add-facet-controls select { height: 32px; padding: 0 9px; color: var(--text); background: #121c1a; border: 1px solid #30433d; font-size: 10px; }
.button.primary { color: #0c211b; background: var(--mint); border-color: var(--mint); }
.button.loss-button { margin-top: 8px; color: var(--gold); border-color: rgba(234, 191, 104, .45); background: transparent; }
.button.full { width: 100%; }
.document-meta { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.document-meta div { padding: 13px 9px; text-align: center; border-right: 1px solid var(--line); }
.document-meta div:last-child { border-right: 0; }
.document-meta span, .document-meta strong { display: block; }
.document-meta span { color: var(--muted); font: 8px "DM Mono", monospace; text-transform: uppercase; }
.document-meta strong { margin-top: 5px; font: 500 16px "DM Mono", monospace; }
.document-meta strong.warn { color: var(--gold); }
.author-panel { min-height: 760px; }
.spec-tabs { display: flex; align-items: stretch; padding: 14px 20px 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.spec-tabs button { min-width: 130px; max-width: 210px; padding: 10px 12px; overflow: hidden; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-size: 10px; }
.spec-tabs button span { margin-right: 8px; color: #65756f; font: 9px "DM Mono", monospace; }
.spec-tabs button.active { color: var(--text); border-bottom-color: var(--mint); }
.spec-tabs .add-tab { min-width: 36px; color: var(--mint); text-align: center; font-size: 18px; }
.document-fields { padding: 20px 24px 0; }
.spec-editor { padding: 26px 24px 30px; }
.section-title-row, .section-title-row > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title-row.spaced { margin-top: 30px; }
.section-number { display: grid; place-items: center; width: 34px; height: 34px; color: var(--mint); border: 1px solid rgba(105, 213, 174, .3); font: 10px "DM Mono", monospace; }
.section-number.gold { color: var(--gold); border-color: rgba(234, 191, 104, .3); }
.section-number.accent { color: var(--blue); border-color: rgba(115, 185, 219, .3); }
.section-title-row h4 { margin-top: 4px; font: 600 16px "Source Serif 4", serif; }
.text-button, .icon-button { padding: 5px; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: 10px; }
.text-button.danger { color: var(--red); }
.text-button:disabled { opacity: .25; cursor: not-allowed; }
.field-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-top: 16px; }
.field-grid.four { grid-template-columns: repeat(4, 1fr); }
.field-grid.facet-fields { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field { display: grid; gap: 7px; }
.field.wide { min-width: 0; }
.field.grow { flex: 1; }
.field > span { color: var(--muted); font: 8px "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.field input, .field select, .facet-topline select { width: 100%; height: 38px; padding: 0 11px; color: var(--text); background: #121c1a; border: 1px solid #30433d; border-radius: 2px; font-size: 11px; }
.field input:disabled { color: #697872; }
.facet-card { margin-top: 14px; padding: 16px; border: 1px solid #354943; background: var(--surface-2); }
.applicability-card { display: flex; align-items: end; gap: 14px; border-left: 2px solid var(--blue); }
.requirement-card { border-left: 2px solid var(--gold); }
.preserved-card { display: flex; gap: 16px; align-items: center; border-left: 2px solid var(--muted); color: var(--muted); font-size: 11px; }
.facet-handle { color: var(--blue); font: 500 9px "DM Mono", monospace; letter-spacing: .1em; }
.gold-text { color: var(--gold); }
.cardinality { padding: 6px 8px; color: var(--muted); border: 1px solid var(--line); font: 8px "DM Mono", monospace; }
.cardinality.fixed { margin-bottom: 6px; }
.support-note { margin: 8px 0 0; color: #778781; font-size: 9px; line-height: 1.5; }
.support-note.warning { color: var(--gold); }
.facet-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.facet-topline .facet-handle { flex: 1; }
.facet-topline select { width: 110px; height: 28px; padding: 0 7px; font-size: 9px; }
.icon-button { color: var(--red); font-size: 17px; }
.empty-state { display: grid; place-items: center; min-height: 500px; padding: 50px; text-align: center; }
.empty-state > span { color: var(--mint); font-size: 50px; }
.empty-state h3 { margin-top: 16px; font: 600 22px "Source Serif 4", serif; }
.empty-state p { margin-top: 8px; color: var(--muted); font-size: 12px; }
.check-summary { display: grid; grid-template-columns: 1fr 1fr; }
.check-summary > div { padding: 16px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.check-summary > div:last-child { border-right: 0; }
.check-summary strong, .check-summary span { display: block; }
.check-summary strong { font: 500 23px "DM Mono", monospace; }
.check-summary span { margin-top: 3px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.diagnostic-list { max-height: 255px; overflow-y: auto; }
.diagnostic { display: flex; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.diagnostic-icon { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--blue); }
.diagnostic.warning .diagnostic-icon { background: var(--gold); }
.diagnostic.error .diagnostic-icon { background: var(--red); }
.diagnostic strong { font: 500 9px "DM Mono", monospace; letter-spacing: .05em; }
.diagnostic p { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.fixture-check-card { margin: 18px; padding: 17px; background: #111a18; border: 1px solid #30423d; }
.fixture-check-card h4 { margin-top: 8px; font: 600 15px "Source Serif 4", serif; }
.fixture-check-card > p:not(.eyebrow) { margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.check-button { width: 100%; margin-top: 13px; color: var(--mint); background: rgba(105, 213, 174, .06); border-color: rgba(105, 213, 174, .32); }
.report-button { margin-top: 10px; color: var(--blue); background: transparent; border-color: rgba(115, 185, 219, .35); }
.fixture-result { margin: 0 18px 18px; padding: 14px; border: 1px solid var(--line); }
.fixture-result.pass { border-color: rgba(105, 213, 174, .45); background: rgba(105, 213, 174, .05); }
.fixture-result.fail, .fixture-result.error { border-color: rgba(231, 124, 114, .45); }
.fixture-result strong { color: var(--mint); font: 500 9px "DM Mono", monospace; }
.fixture-result.fail strong, .fixture-result.error strong { color: var(--red); }
.fixture-result p { margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.fixture-result details { margin-top: 10px; color: var(--muted); font-size: 9px; }
.fixture-result pre { max-height: 190px; overflow: auto; white-space: pre-wrap; font: 8px/1.5 "DM Mono", monospace; }
.catalog-card { margin: 0 18px 18px; padding: 17px; background: #111a18; border: 1px solid #30423d; }
.catalog-card h4 { margin-top: 8px; font: 600 13px "Source Serif 4", serif; }
.catalog-pin { margin-top: 6px; color: #66756f; font: 8px "DM Mono", monospace; letter-spacing: .04em; }
.catalog-status { margin-top: 9px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.catalog-sources { margin-top: 11px; list-style: none; display: grid; gap: 5px; }
.catalog-sources li { display: flex; justify-content: space-between; gap: 10px; color: #8fa39c; font: 8px "DM Mono", monospace; letter-spacing: .04em; }
.catalog-source-state { color: var(--mint); text-transform: uppercase; }
.catalog-truncation { margin-top: 9px; color: var(--gold); font-size: 9px; line-height: 1.5; }
.catalog-unsupported { margin-top: 9px; color: #66756f; font-size: 8px; line-height: 1.5; }
.file-picker.compact { margin: 12px 0 0; min-height: 0; padding: 12px; }
.schema-note { color: #8fa39c; }
.schema-note strong { color: var(--mint); }
.export-zone { padding: 18px; border-top: 1px solid var(--line); }
.export-zone .button { margin-top: 10px; }
.export-zone > p:last-child { margin-top: 9px; color: #66756f; text-align: center; font-size: 8px; }
.notice-bar { display: flex; align-items: center; gap: 10px; margin: 14px 0; padding: 13px 16px; background: var(--forest); border: 1px solid #2e5b4e; color: #b9d8cd; font-size: 10px; }
.notice-bar > span { color: var(--mint); font-size: 8px; }
.export-preview { margin-bottom: 14px; }
.export-preview pre { max-height: 420px; margin: 0; padding: 20px; overflow: auto; color: #b8c9c3; background: #111a18; font: 10px/1.65 "DM Mono", monospace; white-space: pre-wrap; }
footer { width: min(1760px, 94vw); margin: 0 auto; padding: 20px 0 34px; display: flex; justify-content: space-between; color: #586660; font: 8px "DM Mono", monospace; letter-spacing: .05em; text-transform: uppercase; }

@media (max-width: 1180px) {
  .workspace-grid { grid-template-columns: 280px 1fr; }
  .check-panel { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: 1.2fr 1fr 1fr; }
  .check-panel > .panel-heading { grid-column: 1 / -1; }
  .diagnostic-list { max-height: 280px; }
  .export-zone { border-top: 0; border-left: 1px solid var(--line); }
  .field-grid.four { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .topbar { padding: 0 20px; }
  .status-cluster { display: none; }
  .auth-state { display: none; }
  main { width: calc(100% - 24px); }
  .hero { align-items: start; flex-direction: column; padding-top: 30px; }
  .hero-steps { width: 100%; overflow-x: auto; }
  .workspace-grid { grid-template-columns: 1fr; }
  .source-panel { position: static; }
  .check-panel { grid-column: auto; display: block; }
  .export-zone { border-top: 1px solid var(--line); border-left: 0; }
  .field-grid, .field-grid.four { grid-template-columns: 1fr; }
  .applicability-card { align-items: stretch; flex-direction: column; }
  .section-title-row.spaced { align-items: flex-start; }
  .add-facet-controls { align-items: stretch; flex-direction: column; }
  .cardinality.fixed { align-self: start; }
  footer { flex-direction: column; gap: 8px; }
}
.pack-card { margin: 0 18px 18px; padding: 17px; background: #111a18; border: 1px solid #30423d; }
.pack-card h4 { margin-top: 8px; font: 600 13px "Source Serif 4", serif; }
.pack-status { margin-top: 8px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.pack-card .button { margin-top: 10px; }
.pack-button { color: var(--blue); background: transparent; border-color: rgba(115, 185, 219, .35); }
.pack-scope { margin-top: 9px; color: #66756f; font-size: 8px; line-height: 1.5; }
