:root {
  --ink: #182522;
  --muted: #60706b;
  --line: #dce3df;
  --line-strong: #c8d2cd;
  --canvas: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --teal: #126f69;
  --teal-dark: #0d4544;
  --teal-soft: #e8f4f1;
  --green: #23745a;
  --green-soft: #eaf5ef;
  --amber: #a15d0a;
  --amber-soft: #fff5e5;
  --red: #a23b3b;
  --red-soft: #fbeeee;
  --shadow: 0 14px 38px rgb(24 51 44 / 8%);
  --radius: 10px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgb(18 111 105 / 24%);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-header {
  height: 64px;
  padding: 0 clamp(20px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { color: var(--teal-dark); font-size: 15px; letter-spacing: .05em; }
.brand-lockup small { margin-top: 1px; color: var(--muted); font-size: 12px; }
.brand-mark { width: 30px; height: 30px; padding: 6px; display: flex; align-items: end; gap: 3px; border-radius: 7px; background: var(--teal-dark); }
.brand-mark span { flex: 1; border-radius: 1px; background: #9ee3d8; }
.brand-mark span:nth-child(1) { height: 55%; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 70%; }
.tenant-label { color: var(--muted); font-size: 13px; }

.product-nav {
  height: 51px;
  padding: 0 clamp(20px, 3vw, 48px);
  display: flex;
  align-items: end;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.nav-tab {
  height: 51px;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.nav-tab:hover { color: var(--ink); }
.nav-tab.is-active { border-bottom-color: var(--teal); color: var(--teal-dark); }
.nav-tab span { margin-left: 5px; color: #88958f; font-weight: 500; }

main { width: min(1500px, 100%); margin: 0 auto; padding: 29px clamp(20px, 3vw, 48px) 42px; }
.view { display: none; }
.view.is-active { display: block; }
.page-heading, .agent-heading { min-height: 62px; margin-bottom: 22px; display: flex; align-items: start; justify-content: space-between; gap: 24px; }
h1 { margin: 0; color: #172a26; font-size: clamp(24px, 2.2vw, 32px); line-height: 1.18; letter-spacing: -.025em; }
.page-heading p, .agent-heading p { max-width: 720px; margin: 7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.primary-button, .analyze-button, .commit-button, .answer-button, .receipt button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.primary-button:hover, .analyze-button:hover, .commit-button:hover, .answer-button:hover, .receipt button:hover { border-color: var(--teal-dark); background: var(--teal-dark); }
.primary-button:active, .analyze-button:active, .commit-button:active, .answer-button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .48; transform: none !important; }

.explorer-shell {
  min-height: 620px;
  height: calc(100vh - 230px);
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.collection-pane { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface-soft); }
.collection-toolbar { padding: 15px; display: grid; grid-template-columns: minmax(150px, 1fr) 100px 120px; gap: 9px; border-bottom: 1px solid var(--line); background: var(--surface); }
.search-field input, .filter-field select {
  width: 100%; height: 40px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); font-size: 13px;
}
.search-field input { padding: 0 12px; }
.search-field input::placeholder { color: #89958f; }
.filter-field { position: relative; }
.filter-field > span { position: absolute; left: 9px; top: 5px; z-index: 1; color: #7e8c86; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; pointer-events: none; }
.filter-field select { padding: 14px 24px 0 8px; }
.collection-meta { min-height: 39px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.collection-meta strong { color: var(--ink); font-size: 12px; }
.rule-list { min-height: 0; overflow: auto; }
.rule-row {
  position: relative;
  width: 100%;
  padding: 16px 16px 15px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.rule-row::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--amber); opacity: .7; }
.rule-row.blocker::before { background: var(--red); }
.rule-row:hover { background: #f1f6f3; }
.rule-row.is-selected { background: var(--teal-soft); box-shadow: inset 3px 0 var(--teal); }
.rule-row.is-selected::before { display: none; }
.rule-row-top { display: flex; justify-content: space-between; gap: 12px; color: #77847f; font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .035em; }
.rule-row > strong { display: block; margin: 7px 0 5px; font-size: 14px; line-height: 1.35; }
.rule-summary { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); font-size: 12px; line-height: 1.5; }
.rule-meta { display: block; margin-top: 8px; color: #72817b; font-size: 10px; }
.empty-state { padding: 48px 20px; color: var(--muted); text-align: center; font-size: 13px; }

.rule-detail { min-width: 0; overflow: auto; background: var(--surface); }
.detail-empty { height: 100%; display: grid; place-items: center; padding: 32px; color: var(--muted); text-align: center; }
.detail-header { padding: 30px clamp(24px, 3vw, 44px) 27px; border-bottom: 1px solid var(--line); border-top: 3px solid var(--amber); background: linear-gradient(180deg, #fff 0, #fafcfb 100%); }
.detail-header.blocker { border-top-color: var(--red); }
.detail-kicker { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.detail-header h2 { max-width: 840px; margin: 10px 0 8px; font-size: clamp(21px, 2vw, 28px); line-height: 1.25; letter-spacing: -.02em; }
.detail-header p { max-width: 900px; margin: 0; color: #53645e; font-size: 14px; line-height: 1.65; }
.detail-body { max-width: 980px; padding: 28px clamp(24px, 3vw, 44px) 52px; }
.detail-grid, .proposal-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.detail-grid > div, .proposal-meta > div { min-width: 0; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.detail-grid > div:nth-child(odd), .proposal-meta > div:nth-child(odd) { border-right: 1px solid var(--line); }
.detail-grid > div:nth-last-child(-n+2), .proposal-meta > div:nth-last-child(-n+2) { border-bottom: 0; }
.detail-grid span, .proposal-meta span { display: block; margin-bottom: 4px; color: #71807a; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.detail-grid strong, .proposal-meta strong { display: block; overflow-wrap: anywhere; font-size: 13px; line-height: 1.4; }
.detail-block { margin-top: 26px; }
.detail-block h3, .audit-details h4, .validation-layout h4 { margin: 0 0 10px; font-size: 13px; }
.detail-block ul, .audit-details ul { margin: 0; padding-left: 20px; color: #4f605a; font-size: 13px; line-height: 1.6; }
.detail-block li + li, .audit-details li + li { margin-top: 5px; }
code { padding: 2px 5px; border-radius: 4px; background: #eef2ef; color: #29433d; font-family: "SFMono-Regular", Consolas, monospace; font-size: .9em; }
.decision-table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.decision-table > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: start; border-bottom: 1px solid var(--line); }
.decision-table > div:last-child { border-bottom: 0; }
.decision-table h4 { min-height: 100%; margin: 0; padding: 13px; background: var(--surface-soft); color: var(--teal-dark); font-size: 11px; text-transform: uppercase; letter-spacing: .045em; }
.decision-table p { margin: 0; padding: 10px 13px; color: #50615b; font-size: 12px; line-height: 1.5; }
.decision-table p + p { grid-column: 2; border-top: 1px solid var(--line); }
.decision-table p span { margin: 0 5px; color: #75847e; }
.audit-details { margin-top: 28px; border-top: 1px solid var(--line); }
.audit-details summary { padding: 17px 0; color: var(--teal-dark); font-size: 13px; font-weight: 700; cursor: pointer; }
.audit-grid { margin: 3px 0 22px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.audit-grid div { min-width: 0; padding: 12px; background: #fff; }
.audit-grid dt { color: var(--muted); font-size: 10px; }
.audit-grid dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 650; }
.audit-details h4 { margin-top: 20px; }
.audit-details > p { color: var(--muted); font-size: 13px; }
.audit-impact { list-style: none; padding: 0 !important; }
.audit-impact li { display: flex; justify-content: space-between; gap: 12px; }
.outcome-text { color: var(--green); font-size: 11px; white-space: nowrap; }
.outcome-text.warning, .outcome-text.required-change { color: var(--amber); }
.outcome-text.blocked { color: var(--red); }

.agent-heading { margin-bottom: 17px; }
.workflow-strip {
  height: 46px;
  margin: 0;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(8, minmax(78px, 1fr));
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  list-style: none;
}
.workflow-strip li { position: relative; padding: 16px 8px 12px; color: #8a9691; font-size: 10px; font-weight: 650; text-align: center; white-space: nowrap; }
.workflow-strip li::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.workflow-strip li.is-complete { color: var(--green); }
.workflow-strip li.is-complete::after { background: #9fcdbb; }
.workflow-strip li.is-current { color: var(--teal-dark); }
.workflow-strip li.is-current::after { background: var(--teal); }
.agent-workspace { min-height: 650px; height: calc(100vh - 249px); display: grid; grid-template-columns: minmax(390px, .86fr) minmax(520px, 1.14fr); overflow: hidden; border: 1px solid var(--line-strong); border-radius: 0 0 var(--radius) var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.conversation-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.panel-bar { min-height: 58px; padding: 0 18px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.panel-bar > div { display: flex; align-items: center; gap: 10px; }
.panel-bar strong, .panel-bar small { display: block; }
.panel-bar strong { font-size: 13px; }
.panel-bar small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.agent-orb, .message-avatar { display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); }
.agent-orb { width: 31px; height: 31px; border-radius: 50%; font-size: 13px; }
.conversation { min-height: 0; flex: 1; overflow: auto; padding: 20px 20px 28px; background: #fbfcfb; }
.message { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; max-width: 660px; margin-bottom: 19px; }
.message-avatar { width: 30px; height: 30px; border-radius: 50%; font-size: 11px; font-weight: 700; }
.user-message { margin-left: auto; grid-template-columns: minmax(0, 1fr) 30px; }
.user-message .message-avatar { grid-column: 2; grid-row: 1; color: #fff; background: #395d57; }
.user-message .message-body { grid-column: 1; grid-row: 1; }
.message-meta { margin: 0 2px 5px; display: flex; justify-content: space-between; gap: 10px; color: #87928e; font-size: 10px; }
.message-meta strong { color: #52615c; font-size: 11px; }
.message-body > p { margin: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 3px 9px 9px 9px; background: #fff; color: #3d4f49; font-size: 13px; line-height: 1.58; white-space: pre-wrap; }
.user-message .message-body > p { border-color: #345b55; border-radius: 9px 3px 9px 9px; background: #345b55; color: #fff; }

.progress-panel { margin: 4px 0 22px 40px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.progress-panel.warning { border-color: #ebd2ad; }
.progress-panel.blocker { border-color: #e5bcbc; }
.progress-panel summary { min-height: 58px; padding: 10px 13px; display: grid; grid-template-columns: 30px minmax(0, 1fr) 18px; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.progress-panel summary::-webkit-details-marker { display: none; }
.progress-summary-icon, .progress-event-icon { display: grid; place-items: center; color: var(--teal); }
.progress-summary-icon { width: 30px; height: 30px; border-radius: 7px; background: var(--teal-soft); }
.progress-summary-icon svg { width: 17px; height: 17px; }
.progress-panel summary strong, .progress-panel summary small { display: block; }
.progress-panel summary strong { font-size: 12px; line-height: 1.35; }
.progress-panel summary small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.progress-chevron { color: #82908a; transition: transform .15s ease; }
.progress-panel[open] .progress-chevron { transform: rotate(180deg); }
.progress-list { max-height: 315px; overflow: auto; border-top: 1px solid var(--line); }
.progress-event { min-height: 55px; padding: 9px 12px; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: start; gap: 9px; border-bottom: 1px solid #edf1ef; }
.progress-event:last-child { border-bottom: 0; }
.progress-event-icon { width: 25px; height: 25px; border-radius: 6px; background: #f0f4f2; }
.progress-event-icon svg { width: 14px; height: 14px; }
.progress-event.warning .progress-event-icon { color: var(--amber); background: var(--amber-soft); }
.progress-event.blocker .progress-event-icon { color: var(--red); background: var(--red-soft); }
.progress-event.working .progress-event-icon svg { animation: soft-pulse 1.4s ease-in-out infinite; }
.progress-event-copy strong, .progress-event-copy small { display: block; }
.progress-event-copy strong { color: #344640; font-size: 11px; line-height: 1.35; }
.progress-event-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.progress-event time { padding-top: 2px; color: #96a09c; font-size: 9px; }

.composer { padding: 15px 17px 16px; border-top: 1px solid var(--line); background: #fff; }
.composer.is-locked { opacity: .72; }
.composer.is-locked textarea { pointer-events: none; background: #f6f8f6; }
.composer-intro, .composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.composer-intro { margin-bottom: 8px; }
.composer-intro label { font-size: 12px; font-weight: 700; }
.text-button { padding: 0; border: 0; border-bottom: 1px solid #9db9b3; background: transparent; color: var(--teal); font-size: 11px; font-weight: 650; cursor: pointer; }
.composer textarea { width: 100%; min-height: 105px; max-height: 220px; resize: vertical; padding: 12px 13px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); font-size: 13px; line-height: 1.5; }
.composer textarea::placeholder { color: #88958f; }
.composer-footer { margin-top: 9px; }
.composer-footer > span { color: #87938e; font-size: 10px; }

.analysis-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.approval-summary { min-height: 84px; padding: 14px 17px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: #fbfcfb; }
.readiness-copy { min-width: 0; display: flex; align-items: center; gap: 11px; }
.readiness-icon { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--muted); font-size: 14px; font-weight: 800; }
.readiness-copy strong { display: block; font-size: 13px; }
.readiness-copy p { max-width: 560px; margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.approval-summary.is-ready { background: var(--green-soft); }
.approval-summary.is-ready .readiness-icon { border-color: #8ebfa9; color: var(--green); background: #fff; }
.approval-summary.is-blocked { background: var(--red-soft); }
.approval-summary.is-blocked .readiness-icon { border-color: #d9a3a3; color: var(--red); background: #fff; }
.commit-button { min-width: 133px; flex: 0 0 auto; }
.analysis-scroll { min-height: 0; overflow: auto; }
.analysis-section { border-bottom: 1px solid var(--line); }
.section-heading { min-height: 48px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #fbfcfb; }
.section-heading span { font-size: 12px; font-weight: 720; }
.section-heading b { color: #7b8983; font-size: 10px; font-weight: 650; }
.section-content { padding: 17px; }
.analysis-placeholder { min-height: 72px; display: grid; place-items: center; color: var(--muted); text-align: center; font-size: 12px; }
.research-summary { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.research-summary div { padding: 11px; text-align: center; border-right: 1px solid var(--line); }
.research-summary div:last-child { border-right: 0; }
.research-summary strong, .research-summary span { display: block; }
.research-summary strong { font-size: 19px; }
.research-summary span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.similar-rules { margin-top: 15px; display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 11px; }
.similar-rules button { padding: 3px 0; border: 0; border-bottom: 1px solid #98b8b1; background: transparent; color: var(--teal); font-size: 11px; font-weight: 700; cursor: pointer; }
.finding-list { margin-top: 14px; display: grid; gap: 7px; }
.finding { padding: 9px 11px; border-left: 3px solid #a6c4bb; background: #f4f8f6; color: #455650; font-size: 11px; line-height: 1.5; }
.finding.warning { border-color: #d79a43; background: var(--amber-soft); }
.finding.success { border-color: #66a78e; background: var(--green-soft); }
.question-card { margin: 0 0 14px; padding: 0 0 16px; border: 0; border-bottom: 1px solid var(--line); }
.question-card legend { padding: 0; font-size: 13px; font-weight: 720; line-height: 1.45; }
.question-card > p { margin: 5px 0 11px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.question-options { display: grid; gap: 6px; }
.question-options label { padding: 8px 10px; display: flex; align-items: start; gap: 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; cursor: pointer; }
.question-options label:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.custom-answer { margin-top: 10px; display: block; }
.custom-answer span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.custom-answer input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 12px; }
.answer-button { margin-top: 2px; }
.proposal-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.proposal-heading strong { font-size: 15px; line-height: 1.4; }
.proposal-heading span { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.proposal-meta { margin-top: 15px; }
.proposal-meta > div { padding: 10px 12px; }
.proposal-rule-text { margin: 16px 0; color: #43554f; font-size: 12px; line-height: 1.6; }
.proposal-change > strong { display: block; margin-bottom: 9px; font-size: 12px; }
.validation-layout { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.2fr); gap: 20px; }
.validation-list, .simulation-list { margin: 0; padding: 0; list-style: none; }
.validation-list li { padding: 7px 0; display: grid; grid-template-columns: 19px minmax(0, 1fr); gap: 6px; border-bottom: 1px solid #edf1ef; color: #485b55; font-size: 11px; }
.validation-list li > span { color: var(--green); font-weight: 800; }
.validation-list li.failed > span { color: var(--red); }
.validation-list p { margin: 0; line-height: 1.45; }
.simulation-list { max-height: 410px; overflow: auto; border-top: 1px solid var(--line); }
.simulation-list li { padding: 10px 0; display: flex; justify-content: space-between; gap: 13px; border-bottom: 1px solid var(--line); }
.simulation-list strong, .simulation-list small { display: block; }
.simulation-list strong { font-size: 11px; }
.simulation-list small { max-width: 430px; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.receipt { margin: -17px -17px 18px; padding: 15px 17px; border-bottom: 1px solid #a8cdbd; background: var(--green-soft); }
.receipt strong { display: block; color: var(--green); font-size: 13px; }
.receipt p { margin: 4px 0 11px; color: #466459; font-size: 11px; }
.receipt button { min-height: 34px; padding: 0 12px; }

.toast-region { position: fixed; z-index: 50; right: 22px; bottom: 22px; width: min(390px, calc(100vw - 32px)); display: grid; gap: 8px; }
.toast { padding: 12px 14px; border: 1px solid #8cbdab; border-radius: 7px; background: #eff9f4; box-shadow: var(--shadow); color: #285546; font-size: 12px; line-height: 1.45; }
.toast.error { border-color: #d7a3a3; background: #fff3f3; color: #843131; }

@keyframes soft-pulse { 50% { opacity: .38; transform: scale(.88); } }

@media (max-width: 1080px) {
  main { padding-inline: 22px; }
  .explorer-shell { grid-template-columns: minmax(320px, 390px) minmax(0, 1fr); }
  .agent-workspace { grid-template-columns: minmax(350px, .8fr) minmax(460px, 1.2fr); }
  .validation-layout { grid-template-columns: 1fr; }
}

@media (max-width: 840px) {
  .app-header, .product-nav { padding-inline: 18px; }
  main { padding: 22px 14px 30px; }
  .page-heading, .agent-heading { min-height: 0; }
  .explorer-shell, .agent-workspace { height: auto; min-height: 0; grid-template-columns: 1fr; overflow: visible; }
  .collection-pane, .conversation-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .rule-list { max-height: 430px; }
  .rule-detail { max-height: none; overflow: visible; }
  .agent-workspace { display: flex; flex-direction: column; }
  .conversation-panel { min-height: 600px; }
  .analysis-panel { min-height: 620px; }
  .workflow-strip { grid-template-columns: repeat(8, minmax(94px, 1fr)); }
}

@media (max-width: 560px) {
  .app-header { height: 58px; }
  .tenant-label { font-size: 11px; }
  .product-nav { height: 48px; gap: 22px; }
  .nav-tab { height: 48px; }
  .page-heading { align-items: end; }
  .page-heading p { max-width: 230px; font-size: 12px; }
  h1 { font-size: 24px; }
  .primary-button { min-height: 38px; padding: 0 13px; }
  .explorer-shell { border-radius: 8px; }
  .collection-toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .collection-meta span { display: none; }
  .detail-header { padding: 24px 18px 21px; }
  .detail-body { padding: 22px 18px 40px; }
  .detail-grid, .proposal-meta { grid-template-columns: 1fr; }
  .detail-grid > div:nth-child(odd), .proposal-meta > div:nth-child(odd) { border-right: 0; }
  .detail-grid > div:nth-last-child(-n+2), .proposal-meta > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .detail-grid > div:last-child, .proposal-meta > div:last-child { border-bottom: 0; }
  .decision-table > div { grid-template-columns: 72px minmax(0, 1fr); }
  .audit-grid { grid-template-columns: 1fr; }
  .agent-heading p { font-size: 12px; }
  .workflow-strip { border-radius: 8px 8px 0 0; }
  .agent-workspace { border-radius: 0 0 8px 8px; }
  .conversation-panel { min-height: 560px; }
  .conversation { padding: 17px 13px 22px; }
  .progress-panel { margin-left: 40px; }
  .progress-panel summary small { max-width: 220px; }
  .composer { padding: 14px 13px; }
  .composer textarea, .custom-answer input, .search-field input, .filter-field select { font-size: 16px; }
  .approval-summary { align-items: stretch; flex-direction: column; gap: 11px; }
  .commit-button { width: 100%; }
  .section-content { padding: 15px 13px; }
  .research-summary span { font-size: 8px; }
  .proposal-heading { flex-direction: column; gap: 5px; }
  .toast-region { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
