:root {
  --black: #111;
  --white: #fff;
  --canvas: #f5f5f3;
  --muted: #686868;
  --line: #d7d7d3;
  --soft: #ececea;
  --serif: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: "Avenir Next", Avenir, "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--black); background: var(--canvas); font-family: var(--sans); }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, .button { cursor: pointer; }

.auth-shell { display: grid; place-items: center; padding: 32px; background: var(--canvas); }
.auth-stage { width: min(100%, 520px); }
.auth-card { padding: clamp(32px, 7vw, 56px); border: 1px solid var(--black); background: var(--white); }
.auth-card__mast { display: flex; align-items: center; gap: 14px; margin-bottom: 48px; }
.auth-card h1, .page-head h1, .article-head h1 { font-family: var(--serif); font-weight: 400; letter-spacing: -.035em; line-height: 1; }
.auth-card h1 { margin: 0; font-size: clamp(2.5rem, 7vw, 3.6rem); }
em { color: inherit; font-style: normal; font-weight: inherit; }
.lede { max-width: 42ch; color: var(--muted); font: 1rem/1.6 var(--serif); }
.brand__mark { display: grid; place-items: center; flex: 0 0 40px; height: 40px; color: var(--white); background: var(--black); font-weight: 800; letter-spacing: -.05em; }
.eyebrow { display: block; font: 700 .66rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }

.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.rail { position: fixed; inset: 0 auto 0 0; width: 220px; padding: 24px 18px; color: var(--white); background: var(--black); display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 1rem; font-weight: 700; }
.rail .brand__mark { border: 1px solid var(--white); }
.rail__nav { margin: 56px -18px 0; border-top: 1px solid #363636; }
.rail__link { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; padding: 14px 18px; border-bottom: 1px solid #363636; color: #aaa; text-decoration: none; font-size: .9rem; font-weight: 600; }
.rail__link span { color: #666; font: .62rem var(--mono); }
.rail__link:hover, .rail__link.is-active { color: var(--black); background: var(--white); }
.rail__link:hover span, .rail__link.is-active span { color: var(--muted); }
.rail__footer { margin-top: auto; display: grid; gap: 6px; overflow: hidden; }
.rail__footer strong { overflow: hidden; font-size: .75rem; text-overflow: ellipsis; }
.rail__footer .eyebrow { color: #777; }
.rail .text-button { color: var(--white); }
.workspace { grid-column: 2; min-width: 0; padding: clamp(30px, 5vw, 64px); }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 40px; }
.page-head h1 { margin: 8px 0 0; font-size: clamp(2.4rem, 4vw, 3.6rem); }
.page-head--compact h1 { font-size: clamp(2.3rem, 3.8vw, 3.3rem); }
.button { display: inline-flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 44px; padding: 11px 15px; border: 1px solid var(--black); color: var(--black); background: var(--white); text-decoration: none; font-size: .86rem; font-weight: 700; transition: color .12s, background .12s; }
.button:hover { color: var(--white); background: var(--black); }
.button:disabled { cursor: not-allowed; opacity: .38; }
.button--primary { color: var(--white); background: var(--black); }
.button--primary:hover { color: var(--black); background: var(--white); }
.button--accent, .button--quiet { background: var(--white); }
.text-button { padding: 0; border: 0; background: none; color: inherit; text-decoration: underline; text-underline-offset: 3px; }

.status-strip { display: grid; grid-template-columns: repeat(3, 1fr) 1.5fr; border: 1px solid var(--black); background: var(--white); margin-bottom: 56px; }
.metric, .connection-card { min-height: 122px; padding: 18px; border-right: 1px solid var(--line); }
.metric strong { display: block; margin: 8px 0 2px; font: 400 3rem/1 var(--serif); }
.metric small, .connection-card small { color: var(--muted); }
.connection-card { border-right: 0; display: flex; align-items: center; gap: 14px; }
.connection-card div { display: grid; gap: 4px; }
.signal { width: 9px; height: 9px; border: 1px solid var(--black); border-radius: 50%; background: var(--white); }
.signal--live { background: var(--black); }
.section-head { margin-bottom: 16px; }
.section-head h2 { margin: 5px 0 0; font: 400 1.85rem var(--serif); }

.table-wrap { overflow-x: auto; border: 1px solid var(--black); }
table { width: 100%; border-collapse: collapse; background: var(--white); }
th { padding: 12px 14px; text-align: left; font: 700 .62rem var(--mono); letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--black); }
td { padding: 16px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; max-width: 420px; margin-top: 5px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.story-link { font: 600 1rem/1.3 var(--serif); text-underline-offset: 3px; }
.status { display: inline-flex; padding: 5px 7px; border: 1px solid var(--line); background: var(--white); font: 700 .6rem var(--mono); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.status--translated { background: var(--soft); }
.status--draft_created { color: var(--white); border-color: var(--black); background: var(--black); }
.status--failed { border-color: var(--black); }
.empty-state { grid-column: 1 / -1; padding: 52px; border: 1px dashed #aaa; text-align: center; background: var(--white); }
.empty-state span { font: .65rem var(--mono); text-transform: uppercase; }
.empty-state h3 { margin: 10px auto 18px; max-width: 500px; font: 400 1.8rem var(--serif); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.source-card { position: relative; min-height: 300px; padding: 22px; border: 1px solid var(--black); background: var(--white); color: inherit; text-decoration: none; transition: color .12s, background .12s; }
.source-card:hover { color: var(--white); background: var(--black); }
.source-card .signal { position: absolute; top: 24px; right: 22px; }
.source-card:hover .signal { border-color: var(--white); }
.source-card:hover .signal--live { background: var(--white); }
.source-card__index { color: var(--muted); font: .66rem var(--mono); }
.source-card h2 { margin: 38px 0 4px; font: 400 1.9rem var(--serif); }
.source-card p { color: var(--muted); }
.source-card:hover p, .source-card:hover .source-card__index { color: #bbb; }
.source-card dl { margin: 30px 0; border-top: 1px solid var(--line); }
.source-card dl div { display: grid; grid-template-columns: 88px 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); }
.source-card dt { font: .6rem var(--mono); text-transform: uppercase; }
.source-card dd { margin: 0; overflow: hidden; font: .72rem var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.source-card__action { position: absolute; bottom: 22px; font-size: .85rem; font-weight: 700; }

.panel { border: 1px solid var(--black); background: var(--white); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: clamp(22px, 4vw, 40px); }
.form-stack { display: grid; gap: 17px; margin-top: 30px; }
label { display: grid; gap: 7px; font: 700 .67rem var(--mono); letter-spacing: .035em; text-transform: uppercase; }
input, textarea, select { width: 100%; border: 1px solid var(--black); border-radius: 0; padding: 12px 13px; color: var(--black); background: var(--white); outline: none; font: 500 .92rem/1.45 var(--sans); text-transform: none; }
input:focus, textarea:focus, select:focus { box-shadow: inset 0 0 0 1px var(--black); }
textarea { resize: vertical; font-family: var(--mono); font-size: .76rem; }
label small { color: var(--muted); font: .7rem/1.4 var(--sans); letter-spacing: 0; text-transform: none; }
.optional { color: var(--muted); font-size: .56rem; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.switch { display: flex; flex-direction: row; align-items: center; gap: 11px; }
.switch input { position: absolute; opacity: 0; width: 1px; }
.switch span { position: relative; width: 40px; height: 22px; border: 1px solid var(--black); background: var(--white); }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; top: 3px; left: 3px; background: var(--black); transition: transform .12s; }
.switch input:checked + span::after { transform: translateX(18px); }

.import-panel { display: grid; grid-template-columns: 52px 1fr; align-items: start; gap: 26px 16px; max-width: 820px; padding: 38px; }
.step-number { display: grid; place-items: center; width: 40px; height: 40px; color: var(--white); background: var(--black); font: .66rem var(--mono); }
.import-note { grid-column: 2; padding: 18px; border: 1px solid var(--line); background: var(--soft); }
.import-note p { margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.import-panel > .button, .import-panel > a { grid-column: 2; justify-self: start; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.integration-panel { display: grid; gap: 19px; padding: 28px; }
.integration-panel__head { display: flex; align-items: center; gap: 13px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.integration-panel__head h2 { margin: 3px 0 0; font: 400 1.8rem var(--serif); }
.integration-panel__head .signal { margin-left: auto; }
.service-badge { display: grid; place-items: center; width: 44px; height: 44px; color: var(--white); background: var(--black); font-weight: 800; }
.service-badge--wp { background: var(--black); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.inline-actions { display: flex; justify-content: space-between; gap: 14px; }
.credential-note { padding: 16px; border: 1px solid var(--line); background: var(--soft); }
.credential-note p { margin-bottom: 0; color: var(--muted); line-height: 1.5; }

.article-head { display: flex; justify-content: space-between; align-items: start; gap: 28px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--black); }
.article-head h1 { max-width: 950px; margin: 9px 0; font-size: clamp(2.1rem, 3.8vw, 3.3rem); }
.article-head a { font-size: .85rem; font-weight: 700; }
.editor-shell { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--black); background: var(--white); }
.editor-pane { min-width: 0; padding: 22px; }
.editor-pane + .editor-pane { border-left: 1px solid var(--black); }
.editor-pane header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.editor-pane header strong { color: var(--muted); font: .65rem var(--mono); }
.editor-pane label + label { margin-top: 17px; }
.editor-pane textarea { min-height: 460px; background: var(--white); }
.editor-pane--translation { background: #fafafa; }
.editor-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--black); background: var(--soft); }
.editor-actions form { margin: 0; }
.editor-actions--standalone { border: 1px solid var(--black); border-top: 0; }
.wp-success { display: flex; justify-content: space-between; padding: 18px 22px; color: var(--white); background: var(--black); text-decoration: none; }

.notice { margin: 0 0 22px; padding: 13px 15px; border: 1px solid var(--black); background: var(--white); }
.notice--error { border-style: dashed; }
.notice--ok { background: var(--soft); }
code { font-family: var(--mono); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

@media (max-width: 1000px) {
  .status-strip { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2), .connection-card { border-right: 0; }
  .settings-grid, .editor-shell { grid-template-columns: 1fr; }
  .editor-pane + .editor-pane { border-left: 0; border-top: 1px solid var(--black); }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .rail { position: static; width: auto; height: auto; padding: 14px; flex-direction: row; align-items: center; overflow-x: auto; }
  .rail__nav { display: flex; margin: 0 0 0 auto; border: 0; }
  .rail__link { display: block; padding: 10px 11px; border: 0; white-space: nowrap; }
  .rail__link span, .rail__footer { display: none; }
  .workspace { padding: 26px 17px 56px; }
  .page-head { align-items: start; flex-direction: column; }
  .page-head h1 { font-size: 2.8rem; }
  .status-strip, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: 1; }
  .metric, .connection-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .import-panel { grid-template-columns: 1fr; padding: 22px; }
  .import-panel > *, .import-note, .import-panel > .button, .import-panel > a { grid-column: 1; }
  .editor-actions { flex-direction: column; }
  .editor-actions .button { width: 100%; }
  .wp-success { align-items: start; flex-direction: column; gap: 8px; }
}
