:root {
  color-scheme: light;
  --ink: #14211b;
  --muted: #5b6962;
  --green: #164c3a;
  --green-soft: #e6f0eb;
  --cream: #f6f4ee;
  --line: #d7dfda;
  --warning: #8a3e12;
  --warning-bg: #fff4e9;
  --shadow: 0 12px 30px rgb(18 46 36 / .07);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2ef;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea { font: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #d39d45; outline-offset: 2px; }
.topbar { min-height: 92px; padding: 20px 32px; display: flex; justify-content: space-between; align-items: center; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { font-family: Georgia, serif; margin: 2px 0 0; font-size: 1.8rem; color: var(--green); }
.eyebrow { margin: 0 0 5px; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 750; color: #507064; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.status-pill, .badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 7px 11px; background: #edf1ef; color: #35453e; font-size: .78rem; font-weight: 700; }
.status-pill[data-tone="success"] { background: #dff0e7; color: #185039; }
.status-pill[data-tone="working"] { background: #fff2d8; color: #704b0f; }
.status-pill[data-tone="error"] { background: #f8dfdc; color: #842c25; }
.regulatory-warning { padding: 11px 32px; background: #7b3514; color: #fff; font-weight: 700; font-size: .88rem; text-align: center; }
.shell { max-width: 1520px; margin: 0 auto; display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: calc(100vh - 186px); }
aside { padding: 28px 20px; border-right: 1px solid var(--line); background: #f8faf8; }
nav { display: grid; gap: 5px; position: sticky; top: 20px; }
.nav-item { border: 0; background: transparent; text-align: left; padding: 11px 13px; color: #425149; border-radius: 8px; cursor: pointer; }
.nav-item:hover { background: #edf2ef; }
.nav-item.active { background: var(--green); color: white; font-weight: 700; }
.technical-link { margin-top: 14px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; padding-top: 16px; }
.sidebar-note { position: sticky; top: 490px; margin: 26px 10px 0; color: var(--muted); font-size: .77rem; line-height: 1.5; }
main { padding: 38px clamp(24px, 4vw, 64px) 70px; min-width: 0; }
main > h2 { margin: 3px 0 8px; font-family: Georgia, serif; font-size: clamp(1.75rem, 2.5vw, 2.6rem); color: #183d30; }
.lead { margin: 0 0 28px; max-width: 900px; color: var(--muted); font-size: 1.04rem; line-height: 1.6; }
h3 { margin: 0 0 10px; font-size: 1.02rem; }
p { line-height: 1.55; }
.identity-grid, .metrics, .card-grid { display: grid; gap: 14px; }
.identity-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 28px 0 16px; }
.identity-item { background: #fff; border: 1px solid var(--line); padding: 16px; border-radius: 10px; }
.identity-item span { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 5px; }
.identity-item strong { font-size: .93rem; line-height: 1.4; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 14px 0; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; box-shadow: var(--shadow); }
.metric-label, .metric-note { margin: 0; color: var(--muted); font-size: .78rem; }
.metric-value { display: block; color: var(--green); font-family: Georgia, serif; font-size: 1.8rem; margin: 5px 0; }
.progress-card, .card, .section-card, .document-card, .project-form, .draft-section, .draft-cover, .export-panel, .table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 22px; box-shadow: var(--shadow); }
.progress-card { margin: 14px 0 22px; }
.progress-track { height: 9px; background: #e6ebe8; border-radius: 10px; overflow: hidden; margin: 12px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #1d654d, #5e967e); }
.spread { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.muted { color: var(--muted); font-size: .84rem; }
.card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 20px; }
.card { margin: 16px 0; }
.notice-list { display: grid; gap: 8px; }
.notice { margin: 0; padding: 11px 13px; border-radius: 8px; overflow-wrap: anywhere; }
.warning { color: var(--warning); background: var(--warning-bg); border-left: 4px solid #cc6c31; font-weight: 650; }
.project-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.field { display: grid; gap: 7px; color: #31443b; font-weight: 700; font-size: .86rem; }
.field.wide, .wide { grid-column: 1 / -1; }
.field input, .field textarea { width: 100%; border: 1px solid #bfcac4; border-radius: 7px; padding: 11px 12px; color: var(--ink); background: #fff; font-weight: 400; line-height: 1.45; resize: vertical; }
.form-actions { display: flex; align-items: center; gap: 18px; padding-top: 8px; }
.button, .download-card { display: inline-flex; justify-content: center; align-items: center; border: 1px solid var(--green); border-radius: 7px; padding: 10px 14px; background: #fff; color: var(--green); font-weight: 750; text-decoration: none; cursor: pointer; }
.button:hover, .download-card:hover { background: var(--green-soft); }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: #0e3c2d; }
.button.small { padding: 8px 11px; font-size: .81rem; }
.ghost { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 8px 11px; }
#menu-toggle { display: none; }
.document-list, .section-list { display: grid; gap: 14px; }
.document-card h3 { margin-right: 12px; }
.requirement { color: #31443b; font-weight: 700; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.section-card { padding: 24px; }
.section-head { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 13px; align-items: start; margin-bottom: 15px; }
.section-index { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 800; }
.section-head h3 { margin-bottom: 2px; }
.section-head p { margin: 0; }
.badge[data-status="ACCEPTED"], .badge[data-status="Aceptado"] { background: #dcefe4; color: #185139; }
.badge[data-status="READY_FOR_REVIEW"], .badge[data-status="En revisión"] { background: #fff0cb; color: #724b07; }
.badge[data-status="STALE_REQUIRES_REVIEW"], .badge[data-status="Rechazado"], .badge[data-status="Pendiente"] { background: #f7e1de; color: #812c25; }
.evidence-line { color: #385347; font-size: .86rem; }
.decision-actions { border-top: 1px solid var(--line); padding-top: 14px; }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; min-width: 1120px; font-size: .78rem; }
th, td { text-align: left; vertical-align: top; padding: 11px; border-bottom: 1px solid var(--line); line-height: 1.42; }
th { position: sticky; top: 0; background: var(--green); color: #fff; font-size: .72rem; letter-spacing: .02em; }
.draft-cover { min-height: 270px; display: flex; flex-direction: column; justify-content: center; margin-bottom: 18px; background: linear-gradient(135deg, #fff, #eef5f1); }
.draft-cover h2 { font-family: Georgia, serif; font-size: 2rem; margin: 5px 0; color: var(--green); }
.draft-index { columns: 2; column-gap: 32px; }
.draft-index li { margin: 7px 0; break-inside: avoid; }
.draft-section { margin: 14px 0; }
.compact-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.export-panel { display: grid; gap: 18px; margin-top: 20px; }
.download-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.demo-steps { list-style: none; counter-reset: steps; padding: 0; display: grid; gap: 12px; }
.demo-steps li { counter-increment: steps; display: grid; grid-template-columns: 42px 1fr; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 17px; }
.demo-steps li::before { content: counter(steps); width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; }
.demo-steps p { margin: 4px 0 0; color: var(--muted); }
.technical-summary { display: grid; grid-template-columns: 220px 1fr; gap: 8px 18px; }
.technical-summary dt { font-weight: 750; }
.technical-summary dd { margin: 0; overflow-wrap: anywhere; }
.technical-history { max-height: 430px; overflow: auto; }
footer { padding: 18px 32px; background: #142a21; color: #dce8e1; text-align: center; font-size: .8rem; }

@media (max-width: 1050px) {
  .identity-grid, .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .topbar { padding: 16px 18px; }
  .topbar h1 { font-size: 1.35rem; }
  .status-pill { display: none; }
  #menu-toggle { display: inline-flex; }
  .shell { display: block; }
  aside { display: none; position: absolute; z-index: 10; width: 100%; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  aside.open { display: block; }
  nav, .sidebar-note { position: static; }
  main { padding: 28px 18px 50px; }
  .identity-grid, .metrics, .project-form, .download-grid { grid-template-columns: 1fr; }
  .field.wide, .wide { grid-column: auto; }
  .section-head { grid-template-columns: 34px 1fr; }
  .section-head .badge { grid-column: 2; justify-self: start; }
  .draft-index { columns: 1; }
  .form-actions { align-items: flex-start; flex-direction: column; }
}
@media print {
  .topbar, aside, footer, .button, .regulatory-warning { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  .card, .section-card, .draft-section { box-shadow: none; break-inside: avoid; }
}

/* V7 operational workspace */
body { background: #f2f5f3; color: #17231e; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; padding: 13px 24px; box-shadow: 0 3px 16px rgb(14 49 36 / .08); }
.topbar > div:first-of-type { display: grid; gap: 2px; }
.topbar > div:first-of-type strong { color: var(--green); font-family: Georgia, serif; font-size: 1.35rem; }
.topbar > div:first-of-type span { color: var(--muted); font-size: .78rem; }
#save-status { border-radius: 999px; padding: 7px 12px; background: #edf1ef; color: #35453e; font-size: .78rem; font-weight: 750; }
#save-status[data-tone="success"] { background: #dff0e7; color: #185039; }
#save-status[data-tone="working"] { background: #fff2d8; color: #704b0f; }
#save-status[data-tone="error"] { background: #f8dfdc; color: #842c25; }
.layout { max-width: 1600px; min-height: calc(100vh - 72px); margin: 0 auto; display: grid; grid-template-columns: 280px minmax(0,1fr); }
.sidebar { display: block; position: relative; padding: 22px 16px; border-right: 1px solid var(--line); background: #fbfcfb; }
.project-label { margin: 0 5px 16px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--green); font-weight: 800; overflow-wrap: anywhere; }
.sidebar nav { display: grid; gap: 4px; position: sticky; top: 92px; }
.sidebar nav button { border: 0; border-radius: 8px; padding: 9px 11px; background: transparent; color: #3e4d46; text-align: left; cursor: pointer; }
.sidebar nav button:hover { background: #e9efec; }
.sidebar nav button.active { background: var(--green); color: white; font-weight: 750; }
.sidebar-note { position: sticky; top: 610px; margin: 22px 8px; padding: 11px; border-left: 3px solid #b4642f; background: #fff6ec; color: #65422b; font-size: .75rem; line-height: 1.45; }
#main-view { width: 100%; max-width: 1120px; min-width: 0; padding: 38px clamp(22px,4vw,60px) 80px; }
#main-view > h1 { margin: 0 0 8px; color: #183d30; font-family: Georgia, serif; font-size: clamp(1.8rem,3vw,2.65rem); }
.form-grid, .records, .candidate-list { display: grid; gap: 15px; }
.form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.form-grid > .action-with-help { grid-column: 1 / -1; justify-self: start; }
.field { min-width: 0; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field input, .field textarea, .field select, dialog input, dialog textarea, .toolbar input, .toolbar select, .audit-page input { width: 100%; border: 1px solid #b7c6bf; border-radius: 8px; padding: 10px 11px; background: white; color: var(--ink); }
.info-button, .mic-button, .icon-button, .dialog-close { display: inline-grid; place-items: center; flex: 0 0 auto; min-width: 28px; min-height: 28px; border: 1px solid #b8c8c0; border-radius: 999px; background: white; color: var(--green); font-weight: 800; cursor: pointer; }
.mic-button { margin-left: auto; padding: 0 8px; font-size: .72rem; letter-spacing: .02em; }
.action-with-help { display: inline-flex; align-items: center; gap: 5px; margin: 4px 6px 4px 0; }
.card { min-width: 0; margin: 15px 0; }
.card h2 { margin: 0 0 12px; color: #214d3d; font-family: Georgia, serif; font-size: 1.35rem; }
.card .card { box-shadow: none; background: #fbfcfb; }
.metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.metrics .card { display: grid; gap: 8px; margin: 0; }
.metrics .card span { color: var(--muted); font-size: .78rem; }
.metrics .card strong { color: var(--green); font-size: 1.05rem; }
.project-list, .route-block, .version-row { display: grid; gap: 9px; }
.project-row, .version-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.project-row small, .version-row small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.route-block { margin-top: 14px; padding: 13px 15px; border-radius: 9px; background: #f4f7f5; }
.route-block h3 { margin: 0; color: #355547; }
.route-block ul { margin: 0; padding-left: 20px; }
.decision-note { padding: 10px 12px; border-left: 4px solid #3d8067; background: #edf5f1; }
.badge[data-status="ACCEPTED"], .badge[data-status="CLOSED"], .badge[data-status="REVIEWED"] { background: #dff0e7; color: #185039; }
.badge[data-status="REJECTED"], .badge[data-status="STALE_REQUIRES_REVIEW"] { background: #f8dfdc; color: #842c25; }
.notice.success { border-left: 4px solid #2e765a; background: #e9f4ef; color: #1f5844; font-weight: 700; }
.vertex-table, .table-wrap table { width: 100%; border-collapse: collapse; }
.vertex-table th, .vertex-table td, .table-wrap th, .table-wrap td { padding: 9px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.vertex-table th, .table-wrap th { background: #eaf0ed; color: #264b3c; font-size: .8rem; }
.vertex-table input { width: 100%; min-width: 92px; border: 1px solid #b7c6bf; border-radius: 6px; padding: 8px; }
.contour-view { display: block; width: 100%; height: auto; max-height: 420px; margin: 18px 0; border: 1px solid var(--line); border-radius: 10px; background: white; }
.candidate { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 10px; align-items: start; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fafcfb; }
.candidate input { margin-top: 4px; }
.version-row { display: grid; grid-template-columns: minmax(200px,1fr) auto; }
.history-table, .table-wrap { overflow-x: auto; }
dialog { width: min(680px,calc(100vw - 30px)); border: 0; border-radius: 14px; padding: 0; box-shadow: 0 24px 80px rgb(6 29 20 / .3); }
dialog::backdrop { background: rgb(9 30 22 / .55); }
dialog form { position: relative; padding: 26px; }
.dialog-close { position: absolute; top: 14px; right: 14px; }
.dialog-actions, .toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 16px; }
.recording-indicator { display: inline-block; border-radius: 999px; padding: 7px 11px; background: #f6dedb; color: #8a241e; font-weight: 800; }
.recording-indicator[hidden] { display: none; }
audio { width: 100%; margin: 10px 0; }
.privacy-strip { padding: 8px 22px; background: #fff4dc; border-bottom: 1px solid #e4c98d; color: #654512; font-size: .78rem; text-align: center; }
.top-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.button.small { padding: 7px 10px; font-size: .76rem; }
.inline-mic { margin: 5px 0 5px 6px; min-width: 58px; }
.consent-line { display: flex; gap: 9px; align-items: flex-start; margin: 13px 0; }
.consent-line input { width: auto; margin-top: 3px; }
#voice-mutation { display: grid; gap: 7px; margin-top: 13px; border: 1px solid var(--line); border-radius: 9px; }
#voice-mutation label { display: flex; align-items: center; gap: 7px; }
#voice-mutation input, #voice-replace-confirm { width: auto; }
#voice-dialog label { display: grid; gap: 5px; margin-top: 12px; }
#voice-replace-confirm-wrap { grid-template-columns: auto 1fr; align-items: start; }
.audit-page { padding: 36px 20px; }
.audit-shell { max-width: 1320px; margin: 0 auto; }
.audit-shell > header { max-width: 780px; }
.audit-shell > header h1 { font-family: Georgia, serif; color: var(--green); }
.toolbar label { display: grid; gap: 5px; min-width: 220px; font-size: .8rem; font-weight: 750; }
.structure-editor { display: grid; gap: 9px; max-height: 32rem; overflow: auto; margin: 14px 0; }
.structure-row { display: grid; grid-template-columns: auto minmax(15rem,1fr) 5rem minmax(12rem,.8fr); gap: 9px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #f8faf9; }
.structure-row input { min-width: 0; padding: 8px; border: 1px solid #b7c6bf; border-radius: 6px; }
.candidate input[placeholder] { min-width: 15rem; padding: 7px; border: 1px solid #b7c6bf; border-radius: 6px; }
.proposal-preview { white-space: pre-wrap; max-height: 22rem; overflow: auto; background: #f7f9fb; border: 1px solid #d8e0e8; border-radius: .5rem; padding: 1rem; font: inherit; }

@media (max-width: 900px) {
  .topbar { padding: 11px 14px; }
  #menu-toggle { display: inline-grid; }
  .layout { display: block; }
  .sidebar { display: none; position: fixed; inset: 72px 0 auto 0; z-index: 19; max-height: calc(100vh - 72px); overflow-y: auto; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .sidebar.open { display: block; }
  .sidebar nav, .sidebar-note { position: static; }
  #main-view { padding: 28px 17px 60px; }
  .form-grid, .metrics { grid-template-columns: 1fr; }
  .version-row, .project-row { align-items: stretch; grid-template-columns: 1fr; flex-direction: column; }
  .structure-row { grid-template-columns: auto 1fr; }
}
