:root {
  --teal-950: #002f36;
  --teal-900: #003942;
  --teal-800: #174f57;
  --teal-700: #23656d;
  --teal-100: #e4efef;
  --gold-600: #9b7b52;
  --gold-400: #c5a880;
  --gold-100: #f7f0e7;
  --paper: #f4f5f3;
  --surface: #ffffff;
  --ink: #172124;
  --muted: #5d6a6c;
  --line: #c8d2d3;
  --success: #236644;
  --success-bg: #e8f4ed;
  --danger: #8b2e2e;
  --danger-bg: #fff0ee;
  --warning: #7b5d22;
  --warning-bg: #fff8e8;
  --shadow: 0 18px 50px rgba(0, 47, 54, .09);
  font-family: "Segoe UI", "Avenir Next", Avenir, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, .header-title, .eyebrow, .mode-title, .upload-title {
  font-family: Montserrat, "Avenir Next", "Segoe UI", sans-serif;
}
h1 { margin: .3rem 0 .65rem; font-size: clamp(2rem, 4vw, 3.3rem); line-height: 1.04; font-weight: 430; }
h2 { margin: 0; font-size: clamp(1.28rem, 2vw, 1.7rem); font-weight: 520; }
h3 { margin: 0; font-size: 1.02rem; }
p { margin: 0; }
a { color: var(--teal-900); }
:focus-visible { outline: 3px solid rgba(197, 168, 128, .58); outline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.eyebrow { color: var(--gold-600); font-size: .72rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(13rem, 1fr) auto minmax(18rem, 1fr);
  gap: 1rem;
  align-items: center;
  min-height: 5.5rem;
  padding: .75rem clamp(1rem, 4vw, 3.5rem);
  background: var(--teal-900);
  color: white;
}
.brand-lockup { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.official-logo { display: block; width: 9.5rem; height: auto; max-width: 100%; filter: brightness(0) invert(1); }
.brand-fallback { display: none; color: white; font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; }
.brand-header.without-msg-logo .official-logo { display: none; }
.brand-header.without-msg-logo .brand-fallback { display: inline; }
.header-title { font-size: .78rem; letter-spacing: .14em; text-align: center; text-transform: uppercase; }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: .55rem; }
.pilot-pill { padding: .42rem .7rem; border: 1px solid rgba(255,255,255,.7); border-radius: 999px; font-size: .72rem; white-space: nowrap; }
.top-link { padding: .5rem .7rem; border: 1px solid transparent; background: transparent; color: white; cursor: pointer; }
.top-link[aria-current="page"] { border-color: var(--gold-400); background: rgba(255,255,255,.07); }

.shell { width: min(1460px, 100%); margin: 0 auto; padding: 1.4rem clamp(1rem, 3.2vw, 3rem) 2.5rem; }
.gold-rule { height: 1px; margin-bottom: 1.7rem; background: var(--gold-400); }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; }
.hero-copy { max-width: 58rem; }
.hero-copy > .muted { max-width: 50rem; font-size: 1rem; line-height: 1.55; }
.prototype-flag { flex: 0 0 auto; padding: .7rem .85rem; border-left: 3px solid var(--gold-400); background: var(--gold-100); color: var(--teal-900); font-size: .82rem; }

.workflow-stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.workflow-step { display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: center; padding: .7rem .8rem; border: 1px solid var(--line); background: #eef1ef; color: var(--muted); }
.workflow-step strong { display: grid; width: 1.8rem; height: 1.8rem; place-items: center; border-radius: 50%; background: white; color: var(--teal-900); font-size: .72rem; }
.workflow-step span { font-size: .78rem; font-weight: 700; }
.workflow-step.is-complete { border-color: #9bc3ac; background: var(--success-bg); color: var(--success); }
.workflow-step.is-current { border-color: var(--gold-400); background: var(--gold-100); color: var(--teal-900); }

.setup-panel { margin-bottom: 1rem; padding: 1.1rem; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.setup-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.setup-heading p { margin-top: .35rem; line-height: 1.45; }
.setup-controls { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: .7rem; margin-bottom: .9rem; }
label { display: grid; gap: .36rem; color: var(--teal-900); font-size: .72rem; font-weight: 700; letter-spacing: .03em; }
input, select, textarea { width: 100%; min-height: 2.55rem; padding: .55rem .65rem; border: 1px solid #91a4a7; border-radius: 0; background: white; color: var(--ink); }
textarea { min-height: 5.5rem; resize: vertical; }
.profile-restriction { color: var(--teal-800); font-weight: 700; }

.upload-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.upload-slot { position: relative; display: grid; grid-template-columns: auto 1fr; gap: .35rem .65rem; min-height: 9.4rem; padding: .9rem; border: 1px solid var(--line); background: #fbfcfb; cursor: pointer; }
.upload-slot:hover, .upload-slot:focus-within { border-color: var(--teal-700); background: var(--teal-100); }
.upload-slot.has-file { border-color: #9bc3ac; background: var(--success-bg); }
.upload-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.upload-index { display: grid; grid-row: 1 / span 2; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; background: var(--teal-900); color: white; font-size: .7rem; }
.upload-title { color: var(--teal-900); font-weight: 700; }
.upload-format { grid-column: 2; color: var(--muted); font-size: .74rem; }
.upload-file-line { display: grid; grid-column: 1 / -1; gap: .2rem; align-self: end; padding-top: .65rem; border-top: 1px solid var(--line); }
.upload-file-name { overflow: hidden; color: var(--teal-900); font-size: .8rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.upload-state { color: var(--muted); font-size: .72rem; }
.upload-slot.has-file .upload-state { color: var(--success); }
.upload-button { grid-column: 1 / -1; justify-self: start; color: var(--teal-900); font-size: .75rem; font-weight: 700; text-decoration: underline; text-underline-offset: .2rem; }
.setup-action { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; margin-top: .9rem; }
.source-validation { display: grid; gap: .18rem; padding: .7rem .8rem; border-left: 3px solid var(--gold-600); background: var(--warning-bg); }
.source-validation span { color: var(--muted); font-size: .78rem; }
.source-pill { flex: 0 0 auto; padding: .45rem .65rem; border: 1px solid var(--line); color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }

.primary-button, .secondary-button, .outline-button, .ghost-button, .text-button {
  min-height: 2.45rem;
  padding: .55rem .8rem;
  border: 1px solid var(--teal-900);
  background: transparent;
  color: var(--teal-900);
  text-decoration: none;
  cursor: pointer;
}
.primary-button { display: inline-flex; align-items: center; justify-content: center; background: var(--teal-900); color: white; }
.primary-button:hover { background: var(--teal-800); }
.secondary-button:hover, .outline-button:hover { background: var(--teal-100); }
.ghost-button, .text-button { min-height: auto; border-color: transparent; border-bottom-color: currentColor; padding: .2rem; }
button:disabled { opacity: .5; cursor: wait; }

.message { margin: 1rem 0; padding: .9rem 1rem; border-left: 3px solid var(--gold-400); background: white; }
.message.error { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.operation-status { display: flex; align-items: center; gap: .55rem; margin: .55rem 0 0; color: var(--teal-900); font-size: .84rem; font-weight: 650; }
.operation-status::before { width: .9rem; height: .9rem; flex: 0 0 auto; border: 2px solid var(--teal-100); border-top-color: var(--teal-900); border-radius: 50%; content: ""; animation: operation-spin .8s linear infinite; }
.operation-status[data-state="choice"]::before { border: 0; border-radius: 0; background: var(--gold-400); animation: none; }
.operation-status[data-state="connection"]::before { border-top-color: var(--danger); }
@keyframes operation-spin { to { transform: rotate(360deg); } }
.setup-action > .operation-status, .final-action > .operation-status, .proposal-actions > .operation-status, .field-row > .operation-status { grid-column: 1 / -1; }
.dialog-actions > .operation-status, .summary-list li > .operation-status { flex-basis: 100%; }
.summary-list li:has(> .operation-status), .dialog-actions:has(> .operation-status) { flex-wrap: wrap; }
.draft-notice { position: fixed; right: 1rem; bottom: 1rem; z-index: 20; display: grid; gap: .7rem; width: min(31rem, calc(100vw - 2rem)); padding: 1rem; border: 1px solid var(--gold-400); border-left: 4px solid var(--teal-900); background: var(--surface); box-shadow: var(--shadow); color: var(--teal-900); }
.draft-notice[hidden] { display: none; }
.draft-notice > div:first-child { display: grid; gap: .2rem; }
.draft-notice-detail, #draft-notice-detail { color: var(--ink); font-size: .84rem; overflow-wrap: anywhere; }
.draft-notice-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.draft-notice-actions button { min-height: 2.35rem; }
.draft-notice:not([hidden]) ~ #back-to-top { bottom: 11rem; }
.overlap-candidate-label { display: flex; align-items: flex-start; gap: .65rem; width: 100%; cursor: pointer; }
.overlap-candidate-label input { flex: 0 0 1rem; width: 1rem; height: 1rem; min-height: 1rem; margin-top: .28rem; padding: 0; accent-color: var(--teal-900); }
.overlap-candidate-label input:disabled { cursor: not-allowed; }
.overlap-candidate-label span { display: grid; gap: .18rem; min-width: 0; overflow-wrap: anywhere; }
.overlap-candidate-label small { color: var(--muted); font-weight: 400; }
.overlap-candidate-label .comparison-unavailable { color: var(--danger); font-weight: 650; }
.overlap-comparison { display: grid; gap: .65rem; margin: .5rem 0; }
.overlap-comparison section { padding: .65rem .8rem; border: 1px solid var(--line); background: var(--surface); }
.overlap-comparison h3 { margin: 0 0 .4rem; color: var(--teal-900); font-size: .9rem; }
.overlap-comparison dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .8rem; margin: 0; font-size: .84rem; }
.overlap-comparison dt, .overlap-comparison dd { margin: 0; }
.overlap-comparison dd { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.overlap-comparison .comparison-total { padding-top: .3rem; border-top: 1px solid var(--line); font-weight: 700; }
.overlap-comparison p { margin: .4rem 0 0; font-size: .82rem; }
.overlap-comparison .scope-note { border-left: 3px solid var(--gold-400); padding-left: .65rem; }
.action-error { width: 100%; margin: .55rem 0 0; font-size: .86rem; }
.action-error:focus, .message.error:focus { outline: 2px solid var(--danger); outline-offset: 2px; }
.setup-action > .action-error, .action-row > .action-error { grid-column: 1 / -1; }
.dialog-actions > .action-error, .summary-list li > .action-error, .prototype-footer > .action-error { flex-basis: 100%; }
.proposal-actions > .action-error, .field-row > .action-error { grid-column: 1 / -1; }
.summary-list li:has(> .action-error), .prototype-footer:has(> .action-error), .dialog-actions:has(> .action-error) { flex-wrap: wrap; }
.provisional-options { display: grid; gap: .65rem; min-width: 0; margin: 1rem 0; padding: 0; border: 0; }
.provisional-options legend { margin-bottom: .6rem; font-weight: 700; }
.provisional-option { display: flex; gap: .7rem; align-items: flex-start; min-width: 0; padding: .8rem; border: 1px solid var(--line); background: var(--surface); font-size: .88rem; font-weight: 400; letter-spacing: 0; cursor: pointer; }
.provisional-option:has(input:checked) { border-color: var(--teal-900); box-shadow: 0 0 0 1px var(--teal-900); }
.provisional-option:has(input:disabled) { border-style: dashed; background: #f1f3f2; cursor: default; }
.provisional-option input { flex: 0 0 auto; width: auto; min-height: auto; margin-top: .2rem; padding: 0; }
.provisional-option > span { display: grid; gap: .18rem; min-width: 0; overflow-wrap: anywhere; }
.provisional-option small { color: var(--muted); font-size: .78rem; }
.provisional-total { color: var(--teal-900); font-size: .84rem; font-weight: 700; }
#provisional-note-wrap[hidden] { display: none; }
.adjustment-section { margin-top: 1rem; }
.context-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1rem; border: 1px solid var(--line); background: var(--surface); }
.context-item { min-width: 0; padding: .85rem 1rem; }
.context-item + .context-item { border-left: 1px solid var(--line); }
.context-label { display: block; margin-bottom: .24rem; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.context-value { display: block; overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.transition-note { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .85rem; margin-bottom: 1rem; padding: .9rem 1rem; border: 1px solid #d6c5a8; background: #fffaf3; }
.note-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; background: var(--gold-400); color: var(--teal-950); font-weight: 800; }
.transition-note strong { color: var(--teal-900); }
.transition-note .small { display: block; margin-top: .2rem; line-height: 1.4; }

.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1rem; padding: .45rem; border: 1px solid var(--line); background: #e9ecea; }
.mode-button { display: grid; grid-template-columns: 1fr auto; gap: .4rem .8rem; padding: .95rem 1rem; border: 1px solid transparent; background: transparent; color: var(--teal-900); text-align: left; cursor: pointer; }
.mode-button[aria-selected="true"], .mode-button.is-active { border-color: var(--gold-400); background: var(--surface); box-shadow: 0 6px 20px rgba(0, 47, 54, .07); }
.mode-title { font-size: 1rem; font-weight: 650; }
.mode-description { grid-column: 1 / -1; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.count-badge { align-self: start; min-width: 1.75rem; padding: .2rem .45rem; border-radius: 999px; background: var(--teal-100); color: var(--teal-900); font-size: .72rem; font-weight: 800; text-align: center; }
.adjustment-overview { margin-bottom: .8rem; }
.adjustment-overview .panel-heading { margin-bottom: 0; }
.adjustment-mode-panel { margin-bottom: 1rem; }
.manual-source-switch { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; margin: .75rem 0; padding: .85rem 1rem; border: 1px solid var(--line); background: #f8faf9; }
.manual-source-switch > span { flex-basis: 100%; }
.source-choice { min-height: 2.4rem; padding: .45rem .8rem; border: 1px solid var(--teal-900); background: white; color: var(--teal-900); font-weight: 650; cursor: pointer; }
.source-choice.is-active, .source-choice[aria-pressed="true"] { border-color: var(--gold-400); background: var(--teal-900); color: white; }
.manual-workflow .panel-heading { margin-bottom: 1.2rem; }
.manual-step { display: grid; gap: .85rem; margin-top: .9rem; padding: 1rem; border: 1px solid var(--line); background: #f8faf9; }
.manual-step-heading { display: flex; gap: .75rem; align-items: start; }
.manual-step-heading p { margin-top: .25rem; }
.step-number { display: grid; flex: 0 0 1.8rem; height: 1.8rem; place-items: center; border-radius: 50%; background: var(--teal-900); color: white; font-size: .8rem; font-weight: 700; }
.manual-all-rows { padding: .75rem .85rem; border: 1px solid var(--line); background: white; }
.manual-all-rows summary { cursor: pointer; color: var(--teal-900); font-size: .85rem; font-weight: 700; }
.manual-all-rows[open] summary { margin-bottom: .7rem; }
.manual-all-rows label { display: grid; gap: .35rem; }
.manual-all-rows select { min-height: 11rem; width: 100%; }
#manual-search-count { min-height: 1.25rem; }
.manual-auto-heading { margin: .85rem 0 .45rem; padding-top: .75rem; border-top: 1px solid var(--line); color: var(--teal-900); font-size: .8rem; font-weight: 700; }
.manual-auto-results { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.manual-auto-item { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .6rem .7rem; border: 1px solid var(--line); background: #f8faf9; color: var(--ink); font-size: .78rem; line-height: 1.4; }
.manual-auto-item span { min-width: 0; overflow-wrap: anywhere; }
.manual-auto-jump { flex: 0 0 auto; min-height: 2rem; padding: .35rem .55rem; font-size: .74rem; font-weight: 700; }
@media (max-width: 720px) { .manual-auto-item { align-items: stretch; flex-direction: column; } .manual-auto-jump { align-self: flex-start; } }

.manual-facts { min-height: 3rem; padding: .85rem; border: 1px solid var(--line); background: white; color: var(--muted); font-size: .85rem; }
.manual-facts .preview-grid { gap: .9rem 1.2rem; }
.manual-facts .preview-grid dd { color: var(--ink); }

.panel { padding: clamp(1rem, 2vw, 1.4rem); border: 1px solid var(--gold-400); background: var(--surface); box-shadow: var(--shadow); }
.panel-heading, .section-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-heading-copy { max-width: 58rem; }
.panel-heading-copy p { margin-top: .45rem; line-height: 1.5; }
.manual-picker-card { display: grid; gap: .85rem; margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--line); background: #f8faf9; }
.manual-picker-card > div:first-child p { margin-top: .25rem; }
.manual-row-picker { display: grid; align-content: start; gap: .42rem; }
.registration-match-count { min-height: 1.05rem; }
.manual-all-rows { padding: .65rem .8rem; border: 1px solid var(--line); background: white; }
.manual-all-rows summary { cursor: pointer; color: var(--teal-900); font-weight: 650; }
.manual-all-rows label { display: grid; gap: .35rem; margin-top: .75rem; }
.manual-all-rows select { min-height: 12rem; width: 100%; }
.preview-card { min-height: 7rem; padding: 1rem; border: 1px solid var(--line); background: white; }
.preview-placeholder { padding: 1.6rem 0; text-align: center; }
.preview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 0; }
.preview-grid div { min-width: 0; }
.preview-grid dt { color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.preview-grid dd { margin: .25rem 0 0; overflow-wrap: anywhere; font-size: .88rem; }

.manual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.manual-card { display: grid; align-content: start; gap: .9rem; padding: 1.1rem; border: 1px solid var(--line); background: #fbfcfb; }
.manual-card .tag { width: max-content; padding: .22rem .45rem; background: var(--teal-100); color: var(--teal-900); font-size: .7rem; font-weight: 700; }
.manual-card p { line-height: 1.48; }
.movement { display: grid; grid-template-columns: 1fr auto 1fr; gap: .55rem; align-items: center; padding: .75rem; background: var(--paper); }
.movement-box { padding: .55rem; border: 1px solid var(--line); background: white; }
.movement-box strong { display: block; margin-top: .2rem; color: var(--teal-900); font-size: .82rem; }
.movement-arrow { color: var(--gold-600); font-size: 1.3rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.manual-summary { margin-top: 1rem; padding: 1rem; border-top: 1px solid var(--line); background: #fbfcfb; }
.manual-summary-detail { display: grid; gap: .22rem; }
.manual-summary-detail strong { color: var(--teal-900); font-size: .86rem; }
.manual-summary-meta { color: var(--muted); font-size: .75rem; }
.manual-summary-period { font-size: .8rem; font-weight: 650; }
.manual-summary-time { color: var(--muted); font-size: .68rem; }

.competence-review { margin: 0; }
.competence-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: .65rem; flex-wrap: wrap; }
.prototype-note { margin: .85rem 0 1rem; padding: .8rem .9rem; border-left: 3px solid var(--gold-400); background: var(--gold-100); color: var(--teal-900); font-size: .86rem; line-height: 1.45; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.stat { padding: .8rem; border: 1px solid var(--line); background: #fbfcfb; }
.stat strong { display: block; color: var(--teal-900); font-size: 1.35rem; }
.stat span { color: var(--muted); font-size: .74rem; }
.stat.pending { border-top: 3px solid var(--gold-400); }
.automatic-list { margin-bottom: 1rem; padding: .75rem .85rem; border: 1px solid var(--line); background: #f8faf9; }
.automatic-list > summary { cursor: pointer; color: var(--teal-900); font-weight: 700; }
.automatic-list > summary strong { display: inline-block; min-width: 1.6rem; margin-left: .35rem; padding: .1rem .4rem; border-radius: 1rem; background: var(--teal-100); text-align: center; font-variant-numeric: tabular-nums; }
.automatic-list[open] > summary { margin-bottom: .85rem; }
.automatic-list .proposal-filters { margin-bottom: .75rem; background: white; }
.back-to-top { position: fixed; right: clamp(.9rem, 2.5vw, 2rem); bottom: clamp(.9rem, 2.5vw, 2rem); z-index: 20; display: grid; width: 2.8rem; height: 2.8rem; place-items: center; border: 1px solid var(--teal-900); border-radius: 50%; background: var(--teal-900); box-shadow: 0 4px 14px rgba(0, 47, 54, .22); color: white; font-size: 1.45rem; line-height: 1; cursor: pointer; }
.back-to-top:hover, .back-to-top:focus-visible { background: var(--teal-700); }
.proposal-filters { margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--line); background: #f8faf9; }
.filter-heading, .proposal-filter-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.filter-heading p { margin-top: .25rem; }
.filter-fields { display: grid; grid-template-columns: 1fr 1.25fr; gap: .7rem; margin-top: .8rem; }
.filter-status { margin-top: .65rem; color: var(--muted); font-size: .78rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.proposal-table { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); }
.proposal-table th:nth-child(1) { width: 14%; }
.proposal-table th:nth-child(2) { width: 25%; }
.proposal-table th:nth-child(3) { width: 12%; }
.proposal-table th:nth-child(4) { width: 12%; }
.proposal-table th:nth-child(5) { width: 20%; }
.proposal-table th:nth-child(6) { width: 17%; }
.proposal-table th { padding: .8rem .75rem; background: var(--teal-900); color: white; font-size: .68rem; letter-spacing: .065em; text-align: left; text-transform: uppercase; }
.proposal-table th:nth-child(3) { text-align: right; }
.proposal-sort-button { display: inline-flex; align-items: center; justify-content: space-between; gap: .3rem; width: 100%; min-height: 2.1rem; margin: -.2rem 0; padding: .1rem 0; border: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-align: inherit; text-transform: inherit; cursor: pointer; }
.proposal-table th:nth-child(3) .proposal-sort-button { justify-content: flex-end; }
.proposal-sort-button span { flex: 0 0 auto; font-size: .95rem; opacity: .6; }
.proposal-sort-button[data-active="true"] span { color: var(--gold-400); opacity: 1; }
.proposal-sort-button:hover { color: var(--gold-400); }
.proposal-sort-button:focus-visible { outline: 2px solid var(--gold-400); outline-offset: 3px; }
.proposal-sort-button:disabled { cursor: wait; opacity: .65; }
.proposal-sort-mobile { display: none; }
.proposal-sort-status { margin: .5rem 0 0; color: var(--muted); font-size: .78rem; }
.proposal-table td { padding: .78rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .84rem; line-height: 1.4; overflow-wrap: anywhere; }
.proposal-summary-row:hover { background: #fbf8f2; }
.proposal-summary-row td { height: 4.35rem; }
.proposal-account { font-weight: 650; }
.proposal-account small { display: block; margin-top: .18rem; color: var(--muted); font-size: .76rem; font-weight: 400; }
.proposal-identity { color: var(--teal-900); font-weight: 700; }
.proposal-amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 750; }
.proposal-period { color: var(--teal-800); }
.proposal-status .pending-state { display: block; margin-bottom: .25rem; color: var(--teal-900); font-size: .76rem; font-weight: 700; }
.pending-state::before { display: inline-block; width: .48rem; height: .48rem; margin-right: .38rem; border-radius: 50%; background: var(--gold-400); content: ""; vertical-align: middle; }
.proposal-toggle { min-height: 1.6rem; padding: .08rem 0; font-size: .77rem; font-weight: 700; }
.proposal-detail-row td { padding: 0; border-bottom: 2px solid var(--gold-400); background: #f8faf9; }
.proposal-detail { display: grid; grid-template-columns: 1fr 1.15fr minmax(15rem, 1fr); gap: 1rem; padding: 1rem 1.1rem; }
.proposal-detail-block { padding: .25rem .85rem .25rem 0; border-right: 1px solid var(--line); }
.proposal-detail-block strong { color: var(--teal-900); font-size: .8rem; }
.proposal-detail-block p { margin: .4rem 0; color: var(--muted); font-size: .79rem; line-height: 1.45; }
.plan-detail-button { min-height: 1.8rem; padding: .1rem 0; font-size: .78rem; font-weight: 700; }
.proposal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: .4rem; }
.proposal-actions button { min-height: 2.15rem; padding: .4rem .55rem; font-size: .75rem; }
.proposal-actions button:first-child, .proposal-actions .exclusion-action { grid-column: 1 / -1; }
.proposal-actions .exclusion-action { border-color: #b9847f; color: var(--danger); font-weight: 700; }
.proposal-actions .exclusion-action:hover { background: var(--danger-bg); }

.archive-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-top: 1rem; }
details.archive, .existing-adjustments { padding: .75rem .8rem; border: 1px solid var(--line); background: #fbfcfb; }
details.archive summary, .existing-adjustments summary { cursor: pointer; font-size: .82rem; font-weight: 700; }
.existing-adjustments[open] summary { margin-bottom: .75rem; }
.existing-adjustment-detail { flex: 1; min-width: 0; }
.status-chip { display: inline-block; margin-left: .35rem; padding: .12rem .35rem; border: 1px solid var(--line); color: var(--muted); font-size: .68rem; }
.status-chip.is-active { border-color: var(--gold-400); color: var(--teal-900); }
.competence-chronology, .competence-reference, .competence-reason { display: block; margin-top: .35rem; color: var(--muted); }
.competence-reason { color: var(--danger); }

.decision-summary { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); background: #f8faf9; }
.summary-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.summary-list { display: grid; gap: .55rem; margin: .8rem 0 0; padding: 0; list-style: none; }
.summary-list li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem; border: 1px solid var(--line); background: white; font-size: .8rem; line-height: 1.45; }
.selection-overview { margin: .65rem 0; padding: .65rem .8rem; border: 1px solid var(--line); background: var(--teal-100); color: var(--teal-900); font-weight: 700; }
#unreviewed-note:not(:empty) { margin: .7rem 0; padding: .55rem .7rem; border-left: 3px solid var(--gold-400); background: var(--gold-100); }
.decision-entry { display: grid; flex: 1; min-width: 0; gap: .2rem; }
.decision-entry > span { color: var(--muted); overflow-wrap: anywhere; }
.decision-entry > button { justify-self: start; }
.empty-state { margin-top: .7rem; padding: 1rem; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.confirmation, .confirm-check { display: flex; align-items: start; gap: .6rem; margin-top: .9rem; color: var(--ink); font-size: .82rem; font-weight: 500; letter-spacing: 0; }
.confirmation input, .confirm-check input { width: auto; min-height: auto; margin-top: .18rem; }
.decision-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .85rem; }
.decision-totals span { padding: .7rem .8rem; border: 1px solid var(--line); background: white; }
.decision-totals strong { display: block; margin-top: .2rem; color: var(--teal-900); font-size: 1rem; }
.exclusion-confirmation { padding: .8rem; border-left: 3px solid var(--danger); background: var(--danger-bg); }
.cancellation-summary { margin-top: 1rem; padding: .9rem; border-left: 3px solid var(--danger); background: var(--danger-bg); }

.history-panel { margin-top: 1rem; padding: 1.1rem; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.history-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.history-heading p { margin-top: .35rem; line-height: 1.45; }
.history-controls { min-width: 12rem; }
.history-scroll { overflow-x: auto; margin-top: .9rem; border: 1px solid var(--line); }
.history-table { width: 100%; min-width: 930px; border-collapse: collapse; }
.history-table th, .history-table td { padding: .68rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: .78rem; }
.history-table th { background: var(--teal-900); color: white; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
.history-table tr:last-child td { border-bottom: 0; }
.history-status { display: inline-block; min-width: 6.8rem; padding: .25rem .45rem; font-size: .67rem; font-weight: 800; text-align: center; }
.history-status.approved { background: var(--success-bg); color: var(--success); }
.history-status.modified { background: var(--warning-bg); color: var(--warning); }
.history-status.rejected, .history-status.cancelled, .history-status.excluded { background: var(--danger-bg); color: var(--danger); }
.history-origin { color: var(--teal-900); font-weight: 700; }
.history-sequence { display: block; margin-top: .15rem; color: var(--muted); font-size: .68rem; }

.final-action { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; margin-top: 1rem; padding: 1.1rem; border: 1px solid var(--gold-400); background: var(--gold-100); }
.final-action p { margin-top: .35rem; line-height: 1.45; }
.result-panel { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; margin-top: 1rem; padding: 1.1rem; border: 1px solid #9bc3ac; background: var(--success-bg); }
.result-panel p { margin-top: .3rem; }
.warnings { margin: .7rem 0 0; padding-left: 1.2rem; color: var(--danger); font-size: .86rem; }

.wiki-layout { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 1.5rem; align-items: start; margin-top: 1.25rem; }
.wiki-nav { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1rem; border: 1px solid var(--line); background: white; }
.wiki-nav strong { display: block; margin-bottom: .65rem; color: var(--teal-900); }
.wiki-nav a { display: block; padding: .55rem .25rem; border-top: 1px solid #e3e8e7; color: var(--teal-900); font-size: .88rem; line-height: 1.4; text-decoration: none; }
.wiki-nav a:hover, .wiki-nav a:focus-visible { background: var(--teal-100); text-decoration: underline; }
.wiki-article { padding: clamp(1.1rem, 3vw, 2.2rem); border: 1px solid var(--line); background: white; box-shadow: var(--shadow); }
.wiki-article > section { scroll-margin-top: 1rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.wiki-article > section:last-child { border-bottom: 0; padding-bottom: 0; }
.wiki-article h1 { padding-bottom: .7rem; border-bottom: 1px solid var(--line); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3rem); }
.wiki-meta { margin-bottom: 1.2rem; color: var(--muted); font-size: .78rem; }
.wiki-article h2 { margin-top: 1.7rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); font-family: Georgia, "Times New Roman", serif; }
.wiki-article h3 { margin-top: 1.25rem; color: var(--teal-900); font-size: 1.1rem; }
.wiki-article section section { scroll-margin-top: 1rem; }
.wiki-article p, .wiki-article li { line-height: 1.65; }
.wiki-article p { margin-top: .75rem; }
.wiki-article ul, .wiki-article ol { margin: .65rem 0 0; }
.wiki-base-workflow { max-width: 58rem; margin-top: 1.25rem; }
.wiki-base-workflow p { margin-top: .85rem; line-height: 1.6; }
.wiki-toc { width: min(28rem, 100%); margin: 1rem 0; padding: 1rem 1.2rem; border: 1px solid var(--line); background: #f8faf9; }
.wiki-toc strong { display: block; margin-bottom: .4rem; }
.wiki-toc ol { margin: 0; }
.comparison { width: 100%; margin-top: .8rem; border-collapse: collapse; }
.comparison th, .comparison td { padding: .65rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.comparison th { background: var(--teal-100); color: var(--teal-900); }
.callout { margin-top: 1rem; padding: .85rem 1rem; border-left: 3px solid var(--gold-400); background: var(--gold-100); }

.prototype-footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.6rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .74rem; }
.footer-link { color: var(--teal-900); }

dialog { width: min(34rem, calc(100% - 2rem)); padding: 0; border: 0; box-shadow: 0 24px 70px rgba(0, 30, 35, .35); }
dialog::backdrop { background: rgba(0, 30, 35, .68); }
.dialog-body, dialog form { display: grid; gap: .85rem; padding: 1.3rem; background: var(--paper); }
dialog .dialog-logo { width: 12rem; height: auto; max-width: 100%; margin: 0 auto .5rem; }
.cancellation-dialog { width: min(42rem, calc(100% - 2rem)); max-height: calc(100% - 2rem); overflow-y: auto; }
#provisional-dialog { box-sizing: border-box; max-width: calc(100vw - 2rem); }
#provisional-dialog .dialog-body { grid-template-columns: minmax(0, 1fr); min-width: 0; }
#provisional-dialog .dialog-body > * { min-width: 0; }
#provisional-dialog .decision-context { overflow-wrap: anywhere; }
.plan-dialog { width: min(38rem, calc(100% - 2rem)); max-height: calc(100% - 2rem); overflow-y: auto; }
.plan-table-wrap { max-height: min(50vh, 28rem); overflow-y: auto; border: 1px solid var(--line); background: white; }
.plan-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.plan-table th, .plan-table td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); text-align: left; }
.plan-table td:last-child, .plan-table th:last-child { text-align: right; }
.plan-table thead { background: var(--teal-100); color: var(--teal-900); }
.plan-table tbody tr:last-child td { border-bottom: 0; }
.plan-total { display: flex; justify-content: space-between; margin: 0; padding: .65rem .8rem; border-top: 2px solid var(--teal-900); background: var(--teal-100); color: var(--teal-900); font-variant-numeric: tabular-nums; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.dialog-heading h2 { margin: 0; }
.help-button { flex: none; width: 2.15rem; height: 2.15rem; border: 1px solid var(--teal-900); border-radius: 50%; background: white; color: var(--teal-900); font-weight: 800; cursor: pointer; }
.help-button:hover, .help-button:focus-visible { background: var(--teal-100); }
.decision-context { margin: 0; padding: .75rem .9rem; border-left: 3px solid var(--gold-400); background: white; font-weight: 600; }
.decision-fields { display: grid; gap: .7rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.decision-fields[hidden] { display: none; }
.historical-dialog { box-sizing: border-box; width: min(56rem, calc(100% - 2rem)); }
.historical-dialog .dialog-body { grid-template-columns: minmax(0, 1fr); }
.historical-dialog .dialog-body > * { min-width: 0; }
.historical-dialog .decision-context, .historical-month-choice small { overflow-wrap: anywhere; }
.historical-dialog .dialog-actions { flex-wrap: wrap; }
.historical-dialog .dialog-actions button { flex: 1 1 12rem; }
.historical-dialog #historical-status:empty { display: none; }
.historical-months, .historical-effects { min-width: 0; overflow-x: auto; border: 1px solid var(--line); background: white; }
.historical-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.historical-table th, .historical-table td { padding: .55rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.historical-table th { background: var(--teal-100); color: var(--teal-900); font-size: .8rem; }
.historical-table th[data-amount], .historical-table td[data-amount] { text-align: right; white-space: nowrap; }
.historical-table tbody tr:last-child td { border-bottom: 0; }
.historical-voice { display: grid; gap: .2rem; }
.historical-voice small { color: var(--muted); font-size: .75rem; }
.historical-month-choice { display: grid; gap: .35rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.historical-month-choice:last-child { border-bottom: 0; }
.historical-month-choice strong { color: var(--teal-900); }
.historical-month-choice select, .historical-month-choice input { max-width: 18rem; }
.historical-month-choice small { display: block; color: var(--muted); }
.historical-effects { padding: .7rem; }
.historical-effects h3 { margin: 0 0 .5rem; color: var(--teal-900); font-size: .95rem; }
.historical-effects p { margin: .5rem 0 0; }
.field-hint { margin: -.45rem 0 0; color: var(--muted); font-size: .78rem; }
.help-content { max-height: min(55vh, 30rem); overflow-y: auto; }
.help-content h2 { font-family: Georgia, "Times New Roman", serif; }
.help-content p, .help-content li { line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .65rem; margin-top: .3rem; }
.dialog-actions button { flex: 1; }
.form-error { color: var(--danger); font-size: .84rem; }

@media (max-width: 960px) {
  .topbar { grid-template-columns: 1fr auto; }
  .top-title {
    grid-column: 1 / -1;
    grid-row: 2;
    line-height: 1.5;
    text-align: left;
  }
  .hero { align-items: stretch; flex-direction: column; }
  .prototype-flag { align-self: flex-start; }
  .manual-grid, .wiki-layout { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
  .wiki-nav { position: static; }
  .archive-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 961px) and (max-width: 1280px) {
  .topbar { grid-template-columns: 1fr auto; }
  .top-title { grid-column: 1 / -1; grid-row: 2; text-align: left; }
}

@media (max-width: 720px) {
  .historical-dialog .dialog-actions button { flex: 0 0 auto; }
  .historical-months, .historical-effects { overflow-x: visible; }
  .historical-table, .historical-table tbody { display: block; }
  .historical-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .historical-table tr { display: block; padding: .4rem 0; border-bottom: 1px solid var(--line); }
  .historical-table tr:last-child { border-bottom: 0; }
  .historical-table td, .historical-table td[data-amount] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: .75rem; padding: .35rem .65rem; border: 0; text-align: right; white-space: normal; overflow-wrap: anywhere; }
  .historical-table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: left; }
  .proposal-sort-mobile { display: grid; gap: .3rem; margin-top: .65rem; }
  .topbar { grid-template-columns: 1fr; }
  .top-actions { justify-content: flex-start; flex-wrap: wrap; }
  .context-bar, .stats, .mode-switch { grid-template-columns: 1fr 1fr; }
  .context-item:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .transition-note { grid-template-columns: auto 1fr; }
  .transition-note .ghost-button { grid-column: 1 / -1; justify-self: start; }
  .field-row, .filter-fields, .setup-controls { grid-template-columns: 1fr; }
  .workflow-stepper { grid-template-columns: 1fr 1fr; }
  .setup-action, .final-action, .result-panel { grid-template-columns: 1fr; align-items: stretch; }
  .movement { grid-template-columns: 1fr; }
  .movement-arrow { transform: rotate(90deg); justify-self: center; }
  .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-wrap { overflow: visible; border: 0; }
  .proposal-table { display: block; min-width: 0; }
  .proposal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .proposal-table tbody, .proposal-table tr { display: block; }
  .proposal-summary-row { display: grid !important; grid-template-columns: 1fr auto; margin-top: .8rem; border: 1px solid var(--line); background: white; }
  .proposal-summary-row td { display: block; height: auto; padding: .5rem .75rem; border: 0; }
  .proposal-summary-row td::before { display: block; margin-bottom: .15rem; color: var(--muted); font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; content: attr(data-label); }
  .proposal-summary-row .proposal-identity { grid-column: 1; grid-row: 1; padding-top: .8rem; }
  .proposal-summary-row .proposal-account { grid-column: 1 / -1; grid-row: 2; }
  .proposal-summary-row .proposal-amount { grid-column: 2; grid-row: 1; padding-top: .8rem; text-align: right; }
  .proposal-summary-row .proposal-period { grid-column: 1; }
  .proposal-summary-row .proposal-status { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: .5rem; border-top: 1px solid var(--line); }
  .proposal-summary-row .proposal-status::before { display: none; }
  .proposal-detail-row { margin-top: 0; border: 1px solid var(--gold-400); border-top: 0; }
  .proposal-detail-row td { display: block; }
  .proposal-detail { grid-template-columns: 1fr; }
  .proposal-detail-block { padding: 0 0 .75rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .proposal-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }

}

@media (max-width: 520px) {
  .context-bar, .workflow-stepper, .archive-grid, .decision-totals { grid-template-columns: 1fr; }
  .mode-switch { gap: .35rem; padding: .35rem; }
  .mode-button { padding: .65rem .5rem; }
  .mode-title { font-size: .85rem; }
  .mode-description { font-size: .68rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .context-item + .context-item { border-top: 1px solid var(--line); border-left: 0; }
  .context-item:nth-child(3) { grid-column: auto; }
  .panel-heading, .section-heading, .summary-heading, .history-heading, .prototype-footer, .setup-heading, .filter-heading { flex-direction: column; align-items: stretch; }
  .preview-grid { grid-template-columns: 1fr; }
  .summary-list li { align-items: flex-start; flex-direction: column; }
  .dialog-actions { flex-direction: column-reverse; }
  #parent-manual-choices { flex-direction: column-reverse; }
}

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

/* Shared report values are displayed as returned by the server. */
.report-preview { border-top: 3px solid var(--teal-800); }
.base-review-notice { display: grid; gap: .55rem; margin-top: 1rem; padding: .9rem 1rem; border-left: 3px solid var(--gold-600); background: var(--warning-bg); color: var(--ink); font-size: .86rem; line-height: 1.5; }
.base-review-notice strong { color: var(--teal-900); }
.preview-status { margin: 1rem 0; color: var(--teal-800); font-size: .9rem; }
.preview-status.error { color: var(--danger); }
.adjustment-section.is-preparing > :not(#report-preview-section) { display: none; }
.preview-status.is-loading { display: flex; align-items: center; gap: .9rem; padding: 1.2rem; border: 1px solid var(--teal-800); background: var(--teal-100); font-size: 1rem; font-weight: 650; }
.preview-status.is-loading::before { content: ""; flex: 0 0 1.75rem; width: 1.75rem; height: 1.75rem; border: 3px solid var(--teal-100); border-top-color: var(--teal-800); border-right-color: var(--teal-800); border-radius: 50%; animation: operation-spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .preview-status.is-loading::before { animation: none; } }
.preview-filter-label { display: block; max-width: 24rem; margin-top: 1rem; font-weight: 600; }
.preview-filter-label input { display: block; width: 100%; margin-top: .35rem; }
#report-preview-count { margin-top: .4rem; }
.report-preview-scroll { overflow: auto; max-height: 34rem; border: 1px solid var(--line); border-radius: .5rem; margin-top: 1rem; }
.report-preview-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.report-preview-table caption { text-align: left; padding: .8rem 1rem; color: var(--teal-900); font-weight: 650; background: var(--teal-100); }
.report-preview-table th, .report-preview-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.report-preview-table thead th { position: sticky; top: 0; background: var(--teal-900); color: white; text-align: right; z-index: 1; }
.report-preview-table thead th:first-child { text-align: left; }
.report-preview-table tbody th { text-align: left; font-weight: 450; min-width: 14rem; }
.report-preview-table .preview-source { display: block; margin-top: .25rem; color: var(--muted); font-size: .74rem; font-weight: 450; }
.report-preview-table td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 8rem; }
.report-preview-table .preview-total { background: var(--teal-100); font-weight: 650; }
.report-preview-table .preview-total th { font-weight: 650; }
.report-preview-table .preview-unavailable { color: var(--muted); font-size: .78rem; white-space: normal; }
.preview-row-action { display: block; margin-top: .35rem; padding: .15rem 0; font-size: .8rem; font-weight: 650; }
.report-preview-table .outsourced-attention, .report-preview-table .outsourced-attention th { background: var(--warning-bg); }
.outsourced-state { display: inline-block; margin: .3rem .45rem .1rem 0; padding: .15rem .4rem; border: 1px solid var(--gold-600); border-radius: .25rem; color: var(--warning); background: var(--warning-bg); font-size: .72rem; font-weight: 700; }
.outsourced-info { display: inline-grid; width: 1.6rem; height: 1.6rem; place-items: center; border: 1px solid var(--teal-800); border-radius: 50%; color: var(--teal-900); background: var(--surface); font-family: Georgia, serif; font-size: .9rem; font-weight: 700; cursor: pointer; }
.outsourced-info:hover, .outsourced-info:focus-visible { background: var(--teal-100); }
.outsourced-context { margin: .7rem 0; padding: .8rem; border: 1px solid var(--gold-400); border-left: 4px solid var(--gold-600); background: var(--warning-bg); }
.outsourced-note { margin: .4rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.outsourced-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem 1rem; margin: .75rem 0; }
.outsourced-facts dt { color: var(--muted); font-size: .72rem; font-weight: 650; }
.outsourced-facts dd { margin: .15rem 0 0; font-size: .88rem; font-weight: 700; overflow-wrap: anywhere; }
.outsourced-source-list { display: grid; gap: .4rem; margin: .65rem 0 0; padding: 0; list-style: none; }
.outsourced-source-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; padding: .55rem .65rem; border: 1px solid var(--line); background: var(--surface); overflow-wrap: anywhere; }
.outsourced-form-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; margin: .65rem 0 1rem; padding: .75rem .85rem; border-left: 4px solid var(--gold-600); background: var(--warning-bg); }
.outsourced-form-notice p { flex: 1 1 18rem; margin: 0; }
.report-preview-table .preview-context-row > td { padding: 0; background: var(--teal-100); text-align: left; white-space: normal; }
.preview-context { padding: 1rem; color: var(--ink); font-variant-numeric: normal; }
.preview-context-heading { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: .5rem 1rem; }
.preview-context-heading h3 { color: var(--teal-900); }
.preview-context > .small { margin: .4rem 0 .8rem; }
.preview-context-values { position: sticky; top: 2.6rem; z-index: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; margin: 0 0 .7rem; padding: .55rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--surface); }
.preview-context-values dt { color: var(--muted); font-size: .72rem; font-weight: 650; }
.preview-context-values dd { margin: .2rem 0 0; font-size: .88rem; font-weight: 650; overflow-wrap: anywhere; }
.preview-context-back { margin-bottom: .45rem; }
.preview-context-group { padding: .8rem 0; border-top: 1px solid var(--line); }
.preview-context-group h4 { margin: 0 0 .4rem; color: var(--teal-900); font-size: .9rem; }
.preview-context-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.preview-context-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .5rem .65rem; background: var(--surface); border: 1px solid var(--line); border-radius: .4rem; overflow-wrap: anywhere; }
.preview-context-copy { flex: 1; min-width: 0; }
.preview-context-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem 1rem; margin: .7rem 0 0; }
.preview-context-facts dt { color: var(--muted); font-size: .73rem; font-weight: 600; }
.preview-context-facts dd { margin: .15rem 0 0; font-size: .85rem; overflow-wrap: anywhere; }
.preview-context-group > .small { margin: -.1rem 0 .7rem; }
.preview-context-table { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--surface); }
.report-preview-table .preview-context-table th,
.report-preview-table .preview-context-table td { min-width: 0; padding: .65rem .55rem; white-space: normal; text-align: left; vertical-align: top; font-size: .82rem; overflow-wrap: anywhere; }
.report-preview-table .preview-context-table thead th { position: static; color: var(--teal-900); background: #edf2f2; font-size: .74rem; font-weight: 650; }
.preview-context-table th:nth-child(1) { width: 13%; }
.preview-context-table th:nth-child(2) { width: 25%; }
.preview-context-table th:nth-child(3) { width: 13%; }
.preview-context-table th:nth-child(4) { width: 16%; }
.preview-context-table th:nth-child(5) { width: 18%; }
.preview-context-table th:nth-child(6) { width: 15%; }
.report-preview-table .preview-context-table td:nth-child(3),
.report-preview-table .preview-context-table th:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
.preview-context-table td small { display: block; margin-top: .25rem; color: var(--muted); }
.preview-context-table td button { max-width: 100%; font-size: .78rem; padding: .3rem .4rem; white-space: normal; }
.preview-context-summary:hover { background: #f6f9f9; }
.report-preview-table .preview-context-proposal-detail > td { padding: .65rem; background: var(--teal-100); }
.preview-context-actions { display: flex; flex-wrap: wrap; min-width: 0; gap: .4rem; }
.preview-context-actions button { max-width: 100%; padding: .35rem .6rem; font-size: .78rem; white-space: normal; }
.preview-context-editor { margin-top: .8rem; }
.preview-context-editor > .manual-source-switch { display: none; }
.preview-context-editor > .panel { margin-top: .5rem; }
.preview-value-reason { display: block; max-width: 15rem; margin-top: .25rem; font-size: .75rem; font-weight: normal; white-space: normal; color: var(--muted); }
.preview-scroll-hint { display: none; }
.actual-forecast-view { margin-top: 1.4rem; padding-top: 1.15rem; border-top: 2px solid var(--teal-900); }
.actual-forecast-heading h3 { color: var(--teal-900); }
.actual-forecast-view > .small { margin-top: .45rem; }
.actual-forecast-source { color: var(--teal-900); font-weight: 650; }
.actual-forecast-scope-note { padding: .6rem .8rem; border-left: 3px solid var(--teal-900); background: #f1f5f4; color: var(--ink); }
.actual-forecast-message { margin: .8rem 0; padding: .7rem .85rem; border-left: 3px solid var(--gold-400); background: var(--gold-100); color: var(--ink); }
.actual-forecast-legend { display: flex; flex-wrap: wrap; gap: .55rem 1.4rem; margin-top: .85rem; font-size: .78rem; font-weight: 650; }
.actual-forecast-legend span { display: inline-flex; align-items: center; gap: .45rem; }
.actual-forecast-swatch { display: inline-block; width: .9rem; height: .9rem; border: 1px solid var(--line); }
.actual-forecast-swatch.actual { background: var(--surface); }
.actual-forecast-swatch.forecast { background: #EAF4FF; }
.actual-forecast-scroll { max-height: 38rem; }
.actual-forecast-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); font-size: .79rem; }
.actual-forecast-table caption { padding: .75rem .9rem; background: var(--teal-100); color: var(--teal-900); font-weight: 700; text-align: left; }
.actual-forecast-table th, .actual-forecast-table td { padding: .65rem .75rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.actual-forecast-table thead th { position: sticky; top: 0; z-index: 2; background: var(--teal-900); color: white; text-align: right; }
.actual-forecast-table thead th:first-child { left: 0; z-index: 3; text-align: left; }
.actual-forecast-table tbody th { position: sticky; left: 0; z-index: 1; min-width: 14rem; max-width: 20rem; background: var(--surface); text-align: left; font-weight: 500; overflow-wrap: anywhere; }
.actual-forecast-table td { min-width: 7.6rem; max-width: 7.6rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.actual-forecast-table .forecast-month { background: #EAF4FF; color: var(--ink); }
.actual-forecast-table thead .forecast-month { border-bottom: 3px solid var(--teal-900); }
.actual-forecast-table .actual-forecast-kind, .actual-forecast-table .actual-forecast-month-label { display: block; }
.actual-forecast-table .actual-forecast-kind { font-size: .69rem; font-weight: 750; }
.actual-forecast-table .actual-forecast-month-label { margin-top: .15rem; }
.actual-forecast-table .actual-forecast-summary-header { background: var(--teal-800); }
.actual-forecast-table .actual-forecast-summary-cell { background: #f1f5f4; font-weight: 650; }
.actual-forecast-table .actual-forecast-total th, .actual-forecast-table .actual-forecast-total .actual-month { background: var(--teal-100); font-weight: 750; }
.actual-forecast-table .actual-forecast-total .forecast-month, .actual-forecast-table .actual-forecast-total .actual-forecast-summary-cell { font-weight: 750; }
.actual-forecast-table .preview-unavailable { color: #46565b; font-size: .75rem; white-space: normal; }
.actual-forecast-table .actual-forecast-reason { width: 100%; white-space: normal; text-align: left; font-variant-numeric: normal; }
.actual-forecast-table .actual-forecast-reason summary { width: max-content; max-width: 100%; margin-top: .25rem; color: var(--teal-900); font-size: .73rem; font-weight: 650; cursor: pointer; }
.actual-forecast-table .actual-forecast-reason summary:focus-visible { outline: 2px solid var(--teal-900); outline-offset: 2px; }
.actual-forecast-table .preview-value-reason { width: 100%; max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 720px) { .actual-forecast-table tbody th { min-width: 8rem; max-width: 9rem; } .actual-forecast-table td { min-width: 7rem; } .actual-forecast-view .preview-scroll-hint { display: block; } }
.report-preview-history { margin-top: 1rem; }
.report-preview-history summary { cursor: pointer; color: var(--teal-900); font-weight: 600; padding: .8rem 0; }
.preview-ytd { margin-top: .6rem; padding-top: .4rem; border-top: 2px solid var(--teal-900); }
.preview-ytd > summary { font-weight: 750; }
.filename-check { margin: .8rem 0 0; padding: .75rem .85rem; border-left: 3px solid var(--teal-900); background: var(--teal-100); overflow-wrap: anywhere; }
.filename-check.is-warning { border-color: var(--gold-600); color: var(--warning); background: var(--warning-bg); }
#report-preview-limits { margin-top: 1rem; padding-left: 1.3rem; }
.epoca-comparison { margin-top: 1.35rem; padding: 1rem; border: 1px solid var(--line); border-left: 3px solid var(--teal-700); border-radius: .35rem; background: #fbfcfb; }
.epoca-comparison-jump { display: inline-block; margin: .2rem 0 .7rem; font-weight: 650; }
.epoca-comparison-jump[hidden] { display: none; }
.epoca-comparison h3 { margin: 0 0 .4rem; font-size: 1.16rem; color: var(--teal-900); }
#epoca-comparison-status { margin-top: .75rem; line-height: 1.45; }
#epoca-comparison-status[data-state="processing"] { color: var(--teal-800); }
#epoca-comparison-status[data-state="error"] { color: var(--danger); }
.epoca-comparison-sources { margin-top: 1rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); }
.epoca-comparison-sources > strong { display: block; margin-bottom: .35rem; color: var(--teal-900); font-size: .86rem; }
.epoca-comparison-sources ul { display: grid; gap: .4rem; margin: 0; padding-left: 1.15rem; font-size: .82rem; }
.epoca-comparison-sources li span { display: block; color: var(--muted); overflow-wrap: anywhere; }
.epoca-comparison-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.epoca-comparison-table caption { padding: .8rem 1rem; text-align: left; font-weight: 650; color: var(--teal-900); background: var(--teal-100); }
.epoca-comparison-table th, .epoca-comparison-table td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.epoca-comparison-table thead th { position: sticky; top: 0; z-index: 1; background: var(--teal-900); color: white; text-align: right; white-space: nowrap; }
.epoca-comparison-table thead th:first-child, .epoca-comparison-table thead th:last-child { text-align: left; }
.epoca-comparison-table tbody th { min-width: 13rem; text-align: left; font-weight: 580; }
.epoca-comparison-table tbody td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.epoca-comparison-table .comparison-source { display: block; margin-top: .25rem; color: var(--muted); font-size: .75rem; font-weight: 400; line-height: 1.4; overflow-wrap: anywhere; }
.epoca-comparison-table .comparison-detail { white-space: normal; text-align: left; min-width: 17rem; max-width: 25rem; line-height: 1.4; overflow-wrap: anywhere; }
.epoca-comparison-table .comparison-detail strong { display: block; color: var(--teal-900); }
.epoca-comparison-table .comparison-key { background: var(--teal-100); }
.epoca-comparison-table .comparison-unavailable { color: var(--muted); white-space: normal; }
.epoca-comparison-table .comparison-difference { color: var(--warning); font-weight: 650; }
#epoca-comparison-bookings-table { max-height: 21rem; }
#epoca-comparison-bookings-table .epoca-comparison-table tbody td:nth-child(2) { text-align: left; }
#epoca-comparison-bookings-table .epoca-comparison-table tbody td:last-child { text-align: left; white-space: normal; }
@media (max-width: 720px) {
  .epoca-comparison-table, .epoca-comparison-table tbody, .epoca-comparison-table caption { display: block; }
  .epoca-comparison-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .epoca-comparison-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: .65rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); }
  .epoca-comparison-table tbody th { grid-column: 1 / -1; min-width: 0; padding: .45rem .3rem; }
  .epoca-comparison-table tbody td { min-width: 0; padding: .45rem .3rem; border-bottom: 0; text-align: left; white-space: normal; }
  .epoca-comparison-table tbody td::before { content: attr(data-label); display: block; margin-bottom: .1rem; color: var(--muted); font-size: .7rem; font-weight: 650; }
  .epoca-comparison-table .comparison-detail { grid-column: 1 / -1; min-width: 0; max-width: none; }
  .epoca-comparison-table .comparison-key { border-left: 3px solid var(--gold-400); }
  #epoca-comparison-bookings-table .epoca-comparison-table tbody td:nth-child(2) { text-align: left; }
}
.revenue-reminders { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.revenue-reminders-heading { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: .5rem 1rem; }
.revenue-reminders-heading h3 { margin: 0; color: var(--teal-900); }
.revenue-reminders > .small { margin: .5rem 0 .85rem; }
.revenue-reminders-list { display: grid; gap: .65rem; margin: .6rem 0 0; padding: 0; list-style: none; }
.revenue-reminders-list li { min-width: 0; padding: .75rem .85rem; border: 1px solid var(--line); background: var(--surface); overflow-wrap: anywhere; }
.revenue-reminders-list li.is-open { border-left: 4px solid var(--gold-600); background: var(--warning-bg); }
.revenue-reminders-list li.is-scheduled { border-left: 4px solid var(--teal-900); }
.revenue-reminders-list li.is-pending { border-left: 4px solid var(--gold-600); background: var(--teal-100); }
.revenue-reminders-list li.is-closed { color: var(--muted); }
.revenue-reminder-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .7rem; }
.revenue-reminder-title strong { color: var(--teal-900); }
.revenue-reminder-title span { font-size: .76rem; font-weight: 700; }
.revenue-reminder-facts { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .45rem 0 0; color: var(--muted); font-size: .8rem; }
.revenue-reminder-note { margin: .55rem 0 0; white-space: pre-wrap; }
.revenue-reminder-pending { display: inline-block; margin: .5rem 0 0; padding: .28rem .45rem; background: var(--teal-100); color: var(--teal-900); font-size: .76rem; font-weight: 700; }
.revenue-reminder-actions { display: flex; flex-wrap: wrap; gap: .4rem .8rem; margin-top: .65rem; }
.revenue-reminders .archive { margin-top: .85rem; }
.revenue-reminder-option { margin: .7rem 0; padding: .8rem; border: 1px solid var(--line); background: var(--teal-100); }
.revenue-reminder-option .small { margin: .35rem 0 .7rem; }
.revenue-reminder-option > label:last-child { display: block; }
.revenue-reminder-option textarea { width: 100%; }
@media (max-width: 720px) {
  .report-preview-table th, .report-preview-table td { padding: .65rem .7rem; }
  .preview-scroll-hint { display: block; }
  .report-preview-table tbody th { min-width: 12rem; max-width: 12rem; position: sticky; left: 0; background: var(--surface); z-index: 1; }
  .report-preview-table .preview-total th { background: var(--teal-100); }
  .report-preview-table .outsourced-attention th { background: var(--warning-bg); }
  .outsourced-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .outsourced-source-list li { display: grid; }
  .report-preview-table thead th:first-child { left: 0; z-index: 2; }
  .report-preview-table td { min-width: 7.5rem; }
  .report-preview-table .preview-context-row > td { position: sticky; left: 0; z-index: 1; min-width: 0; }
  .preview-context { width: min(100%, calc(100vw - 6.5rem)); min-width: 0; padding: .65rem; }
  .preview-context-heading h3, .preview-context-heading .preview-context-actions { width: 100%; }
  .preview-context-values { top: 2.5rem; grid-template-columns: minmax(0, 1fr); gap: .2rem; padding: .35rem; }
  .preview-context-values > div { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
  .preview-context-values dd { margin: 0; font-size: .78rem; text-align: right; overflow-wrap: normal; word-break: normal; white-space: nowrap; }
  .preview-context-list li { display: block; }
  .preview-context-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-context-table, .preview-context-table tbody { display: block; }
  .preview-context-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .preview-context-table .preview-context-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: .65rem; border: 1px solid var(--line); border-radius: .4rem; }
  .report-preview-table .preview-context-table .preview-context-summary td { display: block; padding: .5rem .6rem; border: 0; text-align: left; }
  .preview-context-summary td::before { content: attr(data-label); display: block; color: var(--muted); font-size: .7rem; font-weight: 650; margin-bottom: .15rem; }
  .preview-context-summary td:nth-child(2), .preview-context-summary td:nth-child(5), .preview-context-summary td:nth-child(6) { grid-column: 1 / -1; }
  .preview-context-table .preview-context-proposal-detail { display: block; margin: -.65rem 0 .65rem; }
  .report-preview-table .preview-context-proposal-detail > td { display: block; }
  .preview-context-facts dd { font-size: .82rem; }
  .preview-context-actions { margin-top: .5rem; }
}
