:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #66716e;
  --line: #d9e0dd;
  --soft: #f3f6f4;
  --paper: #fff;
  --brand: #126d5d;
  --brand-dark: #0a5145;
  --warning: #9a5a18;
  --danger: #a33a33;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: #edf1ef; }
button, input, textarea, select { font: inherit; }
button { min-height: 42px; padding: .65rem 1rem; border: 1px solid var(--brand); border-radius: 8px; color: #fff; background: var(--brand); font-weight: 650; cursor: pointer; }
button:hover { background: var(--brand-dark); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #80cbbc; outline-offset: 2px; }
button.quiet { color: var(--ink); background: var(--paper); border-color: var(--line); }
button.danger { color: var(--danger); background: #fff; border-color: #dcb7b3; }
button:disabled { opacity: .5; cursor: not-allowed; }

.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1rem, 4vw, 3rem); background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; font-weight: 720; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: #fff; background: var(--brand); font-size: .75rem; letter-spacing: .05em; }
.session { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .9rem; }
main { width: min(1440px, 100%); margin: 0 auto; padding: clamp(1rem, 3vw, 2.5rem); }
.login-card { width: min(520px, 100%); margin: 7vh auto 0; padding: clamp(1.5rem, 5vw, 3rem); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 60px rgba(26, 45, 40, .08); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.85rem, 3vw, 2.6rem); line-height: 1.08; letter-spacing: -.035em; }
h2 { font-size: 1.45rem; letter-spacing: -.02em; }
.eyebrow { margin-bottom: .55rem; color: var(--brand); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.lede, .help { color: var(--muted); line-height: 1.55; }
label { display: grid; gap: .42rem; margin-bottom: 1rem; color: #34413e; font-size: .82rem; font-weight: 680; }
input, textarea, select { width: 100%; min-height: 42px; padding: .7rem .75rem; border: 1px solid #bcc7c3; border-radius: 7px; color: var(--ink); background: var(--paper); font-weight: 450; }
textarea { resize: vertical; line-height: 1.5; }
.login-card button { width: 100%; }
.message { min-height: 1.3em; margin: .8rem 0 0; color: var(--danger); font-size: .88rem; }
.message.success { color: var(--brand); }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 1.5rem; }
.workspace-heading h1 { margin-bottom: 0; }
.operations-panel { margin: 0 0 1.5rem; padding: clamp(1.1rem, 2vw, 1.8rem); border: 1px solid #cddbd6; border-radius: 10px; background: linear-gradient(135deg, #f7faf8, #eef5f2); }
.operations-intro { max-width: 780px; }
.operations-intro h2 { margin-bottom: .45rem; }
.operations-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1rem; align-items: start; }
.operation-card { padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.84); }
.operation-card > h3 { margin-bottom: 1rem; font-size: 1.05rem; }
.compact-form { display: grid; gap: .1rem; margin: 0; padding: 1rem 0; border-top: 1px solid var(--line); }
.compact-form:first-of-type { padding-top: 0; border-top: 0; }
.compact-form h4 { margin: 0 0 .55rem; font-size: .88rem; letter-spacing: .01em; }
.compact-form label { margin-bottom: .6rem; }
.compact-form button { justify-self: start; min-height: 38px; padding: .5rem .75rem; font-size: .82rem; }
.review-governance { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.decision-list { display: grid; gap: .65rem; margin: .8rem 0; }
.decision-list article, .queue-entry { padding: .75rem; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.decision-list article p { margin: .4rem 0 .75rem; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.decision-list button, .queue-entry button { min-height: 34px; margin-top: .35rem; padding: .35rem .55rem; font-size: .76rem; }
.queue-list { display: grid; gap: .75rem; }
.queue-entry strong, .queue-entry span { display: block; }
.queue-entry span { margin-top: .3rem; color: var(--muted); font-size: .78rem; }
.workspace-grid { display: grid; grid-template-columns: minmax(240px, 310px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.workspace-grid > *, fieldset { min-width: 0; }
.item-panel, .editor-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.item-panel { position: sticky; top: 1rem; max-height: calc(100vh - 100px); overflow: auto; }
.filters { padding: 1rem; border-bottom: 1px solid var(--line); }
.filters label { margin: 0; }
.item-row { width: 100%; padding: 1rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: var(--paper); text-align: left; font-weight: 500; }
.item-row:hover, .item-row.active { background: var(--soft); }
.item-row strong, .item-row span { display: block; }
.item-row strong { margin-bottom: .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row span { color: var(--muted); font-size: .75rem; }
.editor-panel { padding: clamp(1.25rem, 3vw, 2.25rem); }
.editor-head, .dialog-head, .legend-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
fieldset { margin: 0 0 1.5rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: 8px; }
legend { padding: 0 .35rem; font-size: 1rem; font-weight: 750; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.inline-fields { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; }
.inline-fields label { min-width: 190px; margin-bottom: 0; }
.inline-fields .check { display: flex; min-width: auto; }
.governance-fields { background: #f8fbfa; }
.governance-fields select[multiple] { min-height: 108px; }
.check input { width: 18px; min-height: 18px; accent-color: var(--brand); }
.option-card { display: grid; grid-template-columns: 62px minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.option-card:first-child { border-top: 0; }
.option-card label { margin-bottom: 0; }
.option-card .option-controls { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.option-controls label { display: flex; align-items: center; }
.option-controls input { width: 18px; min-height: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; }
.comments, .review-actions { margin: 1.25rem 0; padding: 1rem; border: 1px solid var(--line); border-left: 4px solid var(--warning); border-radius: 6px; background: #fffaf3; }
.comment { padding: .8rem 0; border-top: 1px solid #eadfcd; }
.comment:first-child { border-top: 0; }
.comment span { display: inline-block; margin-right: .5rem; color: var(--muted); font-size: .74rem; text-transform: uppercase; }
dialog { width: min(840px, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 22px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(17, 28, 25, .6); }
.preview-shell { padding: clamp(1.4rem, 4vw, 2.6rem); }
.preview-progress { margin-bottom: 2rem; color: var(--muted); font-size: .82rem; }
.preview-options { display: grid; gap: .75rem; margin-top: 1.5rem; }
.preview-option { display: grid; grid-template-columns: 34px 1fr; gap: .8rem; align-items: start; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; }
.preview-key { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #9faca8; border-radius: 50%; font-weight: 700; text-transform: uppercase; }

@media (max-width: 850px) {
  .topbar { min-height: 64px; height: auto; padding-block: .6rem; }
  .brand { max-width: 150px; line-height: 1.1; }
  .session { gap: .35rem; }
  .session button { padding-inline: .65rem; }
  .workspace-grid { grid-template-columns: 1fr; }
  .operations-grid { grid-template-columns: 1fr; }
  .item-panel { position: static; max-height: 330px; }
  .field-grid, .option-card { grid-template-columns: 1fr; }
  .option-card .option-controls { grid-column: auto; }
  fieldset { padding: .9rem; }
  .form-actions { flex-wrap: wrap; }
}
