/* IBV style — sourced from ibvgroup.com (Red Hat Display, amber hero,
   brand red CTAs, cream sections). */

:root {
    --bg: #ffffff;
    --bg-cream: #fffcf1;
    --bg-amber: #fbb504;
    --ink: #222222;
    --ink-soft: #333333;
    --ink-muted: #6b6f78;
    --rule: #ececec;
    --brand-red: #dd000f;
    --brand-red-hover: #b3000c;
    --on-amber: #ffffff;
    --shell-max: 1200px;
    --gutter: 2rem;
    --header-h: 90px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink-soft);
    font-family: 'Red Hat Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--ink);
    text-decoration: none;
}
a:hover { color: var(--brand-red); }

h1, h2, h3, h4 {
    font-family: 'Red Hat Display', sans-serif;
    font-weight: 300;
    color: var(--ink);
    margin: 0 0 0.5em;
    letter-spacing: -0.005em;
}
h1 { font-size: 4.4rem; line-height: 1.0; }
h2 { font-size: 3rem;   line-height: 1.08; }
h3 { font-size: 1.5rem; line-height: 1.2;  font-weight: 500; }
h4 { font-size: 1rem;   line-height: 1.3;  font-weight: 600; }

p  { margin: 0 0 1em; max-width: 65ch; }
.muted { color: var(--ink-muted); }
strong { font-weight: 600; }

.eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-muted);
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: block;
}

/* Shell */
.shell {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* Header — fixed, transparent over hero, amber/cream-friendly */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
}
.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--ink);
}
.site-brand img { display: block; height: 32px; width: auto; }
.site-brand .brand-divider {
    width: 1px;
    height: 22px;
    background: rgba(0, 0, 0, 0.18);
}
.site-brand .brand-product {
    font-size: 0.875rem;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    font-weight: 400;
}

.site-nav {
    display: flex;
    gap: 2.5rem;
    align-items: center;
    font-size: 0.9375rem;
}
.site-nav a {
    color: var(--ink);
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.8125rem;
}
.site-nav a:hover,
.site-nav a.is-active { color: var(--brand-red); }
.site-nav a.cta-link { color: var(--brand-red); }
.site-nav a.cta-link:hover { color: var(--brand-red-hover); }

/* User menu — username dropdown trigger + panel, far right of header. */
.user-menu {
    position: relative;
    padding-left: 1.75rem;
    border-left: 1px solid rgba(0, 0, 0, 0.12);
}
.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 0;
    padding: 0.25rem 0;
    margin: 0;
    cursor: pointer;
    color: var(--ink);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.4;
}
.user-menu-trigger:hover,
.user-menu-trigger[aria-expanded="true"] { color: var(--brand-red); }
.user-menu-name {
    max-width: 22ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-caret {
    transition: transform 140ms ease;
    flex-shrink: 0;
}
.user-menu-trigger[aria-expanded="true"] .user-menu-caret {
    transform: rotate(180deg);
}
.user-menu-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 180px;
    background: #ffffff;
    border: 1px solid var(--rule);
    border-top: 2px solid var(--bg-amber);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 0;
    z-index: 60;
}
.user-menu-form { margin: 0; }
.user-menu-item {
    display: block;
    width: 100%;
    background: none;
    border: 0;
    padding: 0.65rem 1.25rem;
    text-align: left;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
    cursor: pointer;
}
.user-menu-item:hover {
    background: var(--bg-cream);
    color: var(--brand-red);
}

/* Push content below the fixed header. */
main { padding-top: var(--header-h); }

/* Hero — amber band, white type, large light heading. */
.hero {
    background: var(--bg-amber);
    color: var(--on-amber);
    padding: 6rem 0 5rem;
    position: relative;
    overflow: hidden;
}
.hero .eyebrow { color: rgba(255, 255, 255, 0.85); }
.hero h1 { color: var(--on-amber); max-width: 22ch; }
.hero p  { color: rgba(255, 255, 255, 0.92); font-size: 1.125rem; max-width: 56ch; }
.hero .muted { color: rgba(255, 255, 255, 0.75); }
.hero .btn-row { margin-top: 2rem; }

/* Sub-hero variant (used on Inputs / Preview / Export — keeps the amber
   wash but tightens vertical rhythm). */
.hero.compact { padding: 4rem 0 3rem; }

/* Hero on cream — used when we want a softer landing band. */
.hero.cream { background: var(--bg-cream); color: var(--ink); }
.hero.cream h1 { color: var(--ink); }
.hero.cream p  { color: var(--ink-soft); }
.hero.cream .eyebrow { color: var(--ink-muted); }

/* Sections */
section.block {
    padding: 5rem 0;
    border-top: 1px solid var(--rule);
    background: var(--bg);
}
section.block.cream { background: var(--bg-cream); border-top-color: transparent; }
section.block:first-of-type { border-top: 0; }
section.block .block-head {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    gap: 3rem;
    margin-bottom: 2.5rem;
    align-items: start;
}
@media (max-width: 720px) {
    section.block { padding: 3rem 0; }
    section.block .block-head { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* Vertical list (home) */
.vertical-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--rule);
}
.vertical-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2rem;
    padding: 2rem 0;
    border-bottom: 1px solid var(--rule);
    transition: padding-left 160ms ease;
}
.vertical-list li:hover { padding-left: 0.5rem; }
.vertical-list .name { font-size: 1.5rem; font-weight: 400; color: var(--ink); }
.vertical-list .actions { display: flex; gap: 1.75rem; font-size: 0.8125rem; }
.vertical-list .actions a {
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
}
.vertical-list .actions a:hover { color: var(--brand-red); }

/* New vertical-row classes (template + user verticals on home) */
.vertical-list .vertical-row { padding: 1.5rem 0; gap: 2rem; }
.vertical-list .vertical-row-template {
    background: var(--bg-cream);
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--rule);
}
.vertical-list .vertical-row-template:hover { padding-left: 1rem; }
.vertical-name {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
}
.vertical-badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    background: var(--bg-amber);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    line-height: 1.4;
}
.vertical-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.8125rem;
    flex-wrap: wrap;
}
.vertical-actions a,
.vertical-actions .cta-link {
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
    font-size: 0.75rem;
}
.vertical-actions a:hover,
.vertical-actions .cta-link:hover { color: var(--brand-red); }
.vertical-actions .cta-link::after { content: ""; }
.vertical-actions .cta-link-danger { color: var(--brand-red); }
.vertical-actions .cta-link-danger:hover { color: var(--brand-red-hover); }
.vertical-actions .cta-link-muted { color: var(--ink-muted); }

.inline-form {
    margin: 0;
    display: inline-flex;
}
/* Reset only applies to UNSTYLED buttons inside inline forms (e.g. the
   header user menu's "Logout" button which is link-styled). Buttons with
   .btn / .btn-ghost / .btn-small keep their proper button styling. */
.inline-form button:not(.btn) {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

/* Read-only template banner above the input pages */
.template-banner {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: rgba(251, 181, 4, 0.16);
    border-left: 3px solid var(--bg-amber);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--ink);
    flex-wrap: wrap;
    max-width: 720px;
}
.template-banner .btn {
    padding: 0.55rem 1.1rem;
    font-size: 0.7rem;
}

/* Buttons — solid red CTA on amber, outlined on cream/white. */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.95rem 1.75rem;
    background: var(--brand-red);
    color: #ffffff;
    border: 1px solid var(--brand-red);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.btn:hover { background: var(--brand-red-hover); border-color: var(--brand-red-hover); color: #ffffff; }
.btn-secondary {
    background: transparent;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.85);
}
.btn-secondary:hover { background: #ffffff; color: var(--ink); border-color: #ffffff; }
.hero.cream .btn-secondary,
section.block .btn-secondary {
    color: var(--ink);
    border-color: var(--ink);
}
.hero.cream .btn-secondary:hover,
section.block .btn-secondary:hover {
    background: var(--ink); color: #ffffff; border-color: var(--ink);
}
.btn-row { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Text-link CTA with arrow ("READ MORE →" style on ibvgroup.com). */
.cta-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--brand-red);
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.cta-link::after { content: "→"; transition: transform 160ms ease; }
.cta-link:hover { color: var(--brand-red-hover); }
.cta-link:hover::after { transform: translateX(3px); }

/* Sub-nav (breadcrumb-ish) */
.subnav {
    display: flex;
    gap: 2rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
    color: var(--ink-muted);
    padding: 1.75rem 0 0;
}
.subnav a { color: var(--ink-muted); }
.subnav a:hover, .subnav a.is-active { color: var(--brand-red); }

/* Scenario columns (preview) */
.scenarios {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    background: var(--bg);
}
.scenarios .col {
    padding: 2rem 1.5rem;
    border-right: 1px solid var(--rule);
}
.scenarios .col:last-child { border-right: 0; }
.scenarios .col h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-muted);
    margin-bottom: 1.25rem;
    font-weight: 600;
}
.scenarios .metric {
    display: flex;
    justify-content: space-between;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--rule);
    font-size: 0.9375rem;
}
.scenarios .metric:last-child { border-bottom: 0; }
.scenarios .metric .label { color: var(--ink-muted); }
.scenarios .metric .value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--ink);
}

@media (max-width: 720px) {
    .scenarios { grid-template-columns: 1fr; }
    .scenarios .col { border-right: 0; border-bottom: 1px solid var(--rule); }
    .scenarios .col:last-child { border-bottom: 0; }
    h1 { font-size: 2.75rem; }
    h2 { font-size: 2rem; }
}

/* Footer — dark band, amber chevron logo accent. */
.site-footer {
    background: var(--bg-cream);
    border-top: 1px solid var(--rule);
    padding: 3rem 0;
    color: var(--ink-muted);
    font-size: 0.8125rem;
}
.site-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}
.site-footer img { height: 28px; width: auto; opacity: 0.9; }

/* Auth — centered card on a cream page-fill. Used by sign-in and
   password-change. Sits inside <main> so the site header still shows. */
.auth-page {
    background: var(--bg-cream);
    min-height: calc(100vh - var(--header-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}
.auth-card {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem 2.5rem;
    border-top: 3px solid var(--bg-amber);
    border-bottom: 1px solid var(--rule);
    border-left: 1px solid var(--rule);
    border-right: 1px solid var(--rule);
}
@media (max-width: 480px) {
    .auth-card { padding: 2.25rem 1.5rem 2rem; }
}
.auth-card-head { margin-bottom: 2rem; }
.auth-logo {
    display: block;
    height: 32px;
    width: auto;
    margin-bottom: 1.5rem;
}
.auth-eyebrow {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.auth-headline {
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 300;
    color: var(--ink);
    margin: 0 0 0.5rem;
    letter-spacing: -0.005em;
}
.auth-sub {
    font-size: 0.9375rem;
    color: var(--ink-muted);
    margin: 0;
}

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; margin: 0; }
.auth-field { display: flex; flex-direction: column; }
.auth-field label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-soft);
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.auth-field input {
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: #ffffff;
    border: 1px solid var(--rule);
    border-radius: 0;
    padding: 0.85rem 0.95rem;
    transition: border-color 140ms ease, box-shadow 140ms ease;
    width: 100%;
}
.auth-field input:hover { border-color: rgba(0, 0, 0, 0.32); }
.auth-field input:focus {
    outline: none;
    border-color: var(--bg-amber);
    box-shadow: 0 0 0 3px rgba(251, 181, 4, 0.22);
}
.auth-field input[aria-invalid="true"],
.auth-field-error + input {
    border-color: var(--brand-red);
}

.auth-help-text {
    display: block;
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-top: 0.5rem;
    line-height: 1.5;
}
.auth-field-error {
    font-size: 0.8125rem;
    color: var(--brand-red);
    margin-top: 0.4rem;
    font-weight: 500;
}

.auth-error {
    background: rgba(221, 0, 15, 0.06);
    border-left: 3px solid var(--brand-red);
    padding: 0.75rem 1rem;
    color: var(--brand-red);
    font-size: 0.875rem;
}
.auth-error p { margin: 0; max-width: none; }
.auth-error p + p { margin-top: 0.25rem; }

.auth-submit {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

.auth-help {
    margin: 1.75rem 0 0;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--ink-muted);
    max-width: none;
}

/* =========================================================================
   Returns Model — input pages
   Layout: hero (cream, compact) + section.block.model-page containing a
   12-col-ish flex with .model-sidenav (left) + .model-body (right).
   ========================================================================= */

.model-page { padding-top: 2.5rem; padding-bottom: 5rem; }
.model-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 3rem;
    align-items: flex-start;
}
@media (max-width: 920px) {
    .model-shell { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* Side nav --------------------------------------------------------------- */
.model-sidenav {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    border-top: 2px solid var(--bg-amber);
    background: #fff;
    padding: 1.25rem 0 1rem;
}
.model-sidenav-head {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-muted);
    font-weight: 600;
    padding: 0 1rem 0.75rem;
}
.model-sidenav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--rule);
}
.model-sidenav li { border-bottom: 1px solid var(--rule); }
.model-sidenav a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    font-size: 0.9375rem;
    color: var(--ink);
    border-left: 2px solid transparent;
}
.model-sidenav a:hover { color: var(--brand-red); }
.model-sidenav a.is-active {
    color: var(--brand-red);
    border-left-color: var(--brand-red);
    background: var(--bg-cream);
    font-weight: 500;
}
.model-sidenav-num {
    font-size: 0.75rem;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.06em;
    min-width: 1.5rem;
}
.model-sidenav-foot { padding: 1rem 1rem 0; font-size: 0.8125rem; }
/* Section groups (Inputs / Outputs / Reference) — stack the per-group
   header + list with vertical breathing room so the eye can chunk the nav. */
.model-sidenav-group { margin-bottom: 1.25rem; }
.model-sidenav-group:last-child { margin-bottom: 0; }
.model-sidenav-group .model-sidenav-head { padding-top: 0; }

/* Body / form chrome ---------------------------------------------------- */
.model-body { min-width: 0; }

.model-flash { margin-bottom: 1.5rem; }
.model-flash-item {
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--bg-amber);
    background: #fff;
    border-top: 1px solid var(--rule);
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    font-size: 0.875rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
}
.model-flash-success { border-left-color: var(--bg-amber); }
.model-flash-error { border-left-color: var(--brand-red); color: var(--brand-red); }

.model-form { margin: 0; }
.model-form-head,
.model-form-foot {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--rule);
    flex-wrap: wrap;
}
.model-form-head h2 {
    font-size: 1.75rem;
    line-height: 1.15;
    margin: 0 0 0.4rem;
}
.model-form-head p { margin: 0; max-width: 60ch; }
.model-form-foot {
    border-bottom: 0;
    border-top: 1px solid var(--rule);
    margin-top: 2rem;
    align-items: center;
}
.model-form-actions { flex-shrink: 0; }

/* Section blocks -------------------------------------------------------- */
.model-section { padding: 2.25rem 0; border-bottom: 1px solid var(--rule); }
.model-section:last-child { border-bottom: 0; }
.model-section-head { margin-bottom: 1.5rem; }
.model-section-head .eyebrow { margin-bottom: 0.5rem; }
.model-section-head h3 { font-size: 1.25rem; margin: 0 0 0.4rem; }
.model-section-head p { margin: 0; }

/* Generic field grid ---------------------------------------------------- */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem 1.5rem;
}

.model-field { display: flex; flex-direction: column; min-width: 0; }
.model-field label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-soft);
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.model-field-input { position: relative; }
.model-field-input.has-unit::after {
    content: attr(data-unit);
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    pointer-events: none;
    line-height: 1;
}
.model-field-input.has-unit input { padding-right: 2.6rem; }

.model-field input,
.model-field select,
.model-field textarea {
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 0;
    padding: 0.55rem 0.7rem;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    width: 100%;
    font-variant-numeric: tabular-nums;
}
.model-field input:hover,
.model-field select:hover,
.model-field textarea:hover { border-color: rgba(0, 0, 0, 0.32); }
.model-field input:focus,
.model-field select:focus,
.model-field textarea:focus {
    outline: none;
    border-color: var(--bg-amber);
    box-shadow: 0 0 0 3px rgba(251, 181, 4, 0.22);
}
.model-field-help {
    display: block;
    font-size: 0.7rem;
    color: var(--ink-muted);
    margin-top: 0.35rem;
    line-height: 1.4;
}
.model-field-error {
    display: block;
    font-size: 0.7rem;
    color: var(--brand-red);
    margin-top: 0.35rem;
}
.model-field.has-error input,
.model-field.has-error select { border-color: var(--brand-red); }

.model-row-actions {
    margin-top: 0.85rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* Per-scenario triple-column table ------------------------------------- */
.scenario-table {
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.scenario-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) repeat(3, 1fr);
    align-items: center;
    gap: 1.25rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--rule);
}
.scenario-row:last-child { border-bottom: 0; }
.scenario-head {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
    font-weight: 600;
    padding: 0.85rem 0;
    background: var(--bg-cream);
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    border-bottom: 1px solid var(--rule);
}
.scenario-label {
    font-size: 0.875rem;
    color: var(--ink);
    font-weight: 500;
    padding-left: 0.75rem;
}
.scenario-row > div input,
.scenario-row > div select {
    font-family: inherit;
    font-size: 0.875rem;
    border: 1px solid var(--rule);
    background: #fff;
    padding: 0.4rem 0.55rem;
    width: 100%;
    font-variant-numeric: tabular-nums;
}
.scenario-row > div input:focus {
    outline: none;
    border-color: var(--bg-amber);
    box-shadow: 0 0 0 3px rgba(251, 181, 4, 0.22);
}

/* Acquisition slot table (and its cost / vcr / exit-cost siblings) ---- */
.slot-table { border-top: 1px solid var(--rule); }
.slot-row {
    display: grid;
    grid-template-columns: 36px 80px 70px 90px 70px 70px 70px 70px 70px 80px 80px 80px auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.8125rem;
}
.slot-row.is-removed { opacity: 0.45; text-decoration: line-through; }
.slot-head {
    background: var(--bg-cream);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    font-weight: 600;
    padding: 0.65rem 0.5rem;
}
.slot-num {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--ink-muted);
    text-align: center;
}
.slot-row > div input,
.slot-row > div select,
.cost-row > div input,
.cost-row > div select,
.vcr-row > div input,
.vcr-row > div select,
.exit-row > div input,
.exit-row > div select {
    font-family: inherit;
    font-size: 0.8125rem;
    border: 1px solid var(--rule);
    background: #fff;
    padding: 0.32rem 0.45rem;
    width: 100%;
    font-variant-numeric: tabular-nums;
}
.slot-row > div input:focus,
.cost-row > div input:focus,
.vcr-row > div input:focus,
.exit-row > div input:focus {
    outline: none;
    border-color: var(--bg-amber);
    box-shadow: 0 0 0 2px rgba(251, 181, 4, 0.22);
}
.slot-actions { display: flex; align-items: center; }
.slot-delete {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
    cursor: pointer;
}
.slot-delete:hover { color: var(--brand-red); }
.slot-delete input { width: auto; margin: 0; }

/* Cost table (Holding) ------------------------------------------------- */
.cost-table { border-top: 1px solid var(--rule); }
.cost-row {
    display: grid;
    grid-template-columns: 130px 1fr 130px 80px 80px 110px;
    gap: 0.6rem;
    align-items: center;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.875rem;
}
.cost-row.is-removed { opacity: 0.45; text-decoration: line-through; }
.cost-head {
    background: var(--bg-cream);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    font-weight: 600;
    padding: 0.65rem 0.5rem;
}

/* Value-creation table ------------------------------------------------- */
.vcr-table { border-top: 1px solid var(--rule); }
.vcr-row {
    display: grid;
    grid-template-columns: 60px 90px 80px 110px 90px 90px 90px 110px 110px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.8125rem;
}
.vcr-row.is-removed { opacity: 0.45; text-decoration: line-through; }
.vcr-head {
    background: var(--bg-cream);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    font-weight: 600;
    padding: 0.65rem 0.5rem;
}

/* Exit-cost tier table ------------------------------------------------- */
.exit-table { border-top: 1px solid var(--rule); }
.exit-row {
    display: grid;
    grid-template-columns: 130px 110px 100px 130px 130px 110px;
    gap: 0.6rem;
    align-items: center;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.875rem;
}
.exit-row.is-removed { opacity: 0.45; text-decoration: line-through; }
.exit-head {
    background: var(--bg-cream);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    font-weight: 600;
    padding: 0.65rem 0.5rem;
}

/* Operating segments grid (label + 3 segment cols) -------------------- */
.seg-grid { border-top: 1px solid var(--rule); }
.seg-grid-head,
.seg-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) repeat(3, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.875rem;
}
.seg-grid-head {
    background: var(--bg-cream);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
    font-weight: 600;
    padding: 0.85rem 0.5rem;
}
.seg-row-label {
    font-size: 0.875rem;
    color: var(--ink);
    font-weight: 500;
    padding-left: 0.5rem;
}
.seg-row > div input,
.seg-row > div select {
    font-family: inherit;
    font-size: 0.8125rem;
    border: 1px solid var(--rule);
    background: #fff;
    padding: 0.32rem 0.45rem;
    width: 100%;
    font-variant-numeric: tabular-nums;
}
.seg-row > div input:focus,
.seg-row > div select:focus {
    outline: none;
    border-color: var(--bg-amber);
    box-shadow: 0 0 0 2px rgba(251, 181, 4, 0.22);
}
.seg-spacer {
    grid-column: 1 / -1;
    background: var(--bg-cream);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
    font-weight: 600;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--rule);
}

/* =========================================================================
   Output - Summ preview — three-scenario summary table
   ========================================================================= */

.summ {
    /* All numbers right-aligned in 4-col grid: label + 3 scenarios */
    --summ-cols: minmax(260px, 2fr) repeat(3, 1fr);
}

.summ-head {
    display: grid;
    grid-template-columns: var(--summ-cols);
    gap: 0;
    background: var(--ink);
    color: #fff;
    border-top: 2px solid var(--bg-amber);
    margin-bottom: 0;
    position: sticky;
    top: var(--header-h);
    z-index: 5;
}
.summ-head-cell {
    padding: 1rem 1.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 600;
    text-align: right;
}
.summ-head-cell.summ-head-label { text-align: left; }

.summ-block { margin-top: 0; }

.summ-band {
    background: var(--bg-cream);
    color: var(--ink);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 600;
    padding: 0.85rem 1.25rem;
    margin: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.summ-band-amber {
    background: var(--bg-amber);
    color: #fff;
    border-color: transparent;
}

.summ-sub {
    padding: 0.85rem 1.25rem 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
    color: var(--ink-muted);
    margin-top: 0.5rem;
    border-top: 1px solid var(--rule);
}

.summ-row {
    display: grid;
    grid-template-columns: var(--summ-cols);
    align-items: center;
    border-bottom: 1px solid var(--rule);
    font-size: 0.9375rem;
    color: var(--ink);
}
.summ-row > div {
    padding: 0.55rem 1.25rem;
}
.summ-row > div:first-child {
    color: var(--ink-soft);
}
.summ-row > div:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    border-left: 1px solid var(--rule);
}
.summ-row.summ-row-detail > div {
    font-size: 0.875rem;
    color: var(--ink-muted);
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}
.summ-row.summ-row-detail > div:first-child { padding-left: 2.25rem; }
.summ-row.summ-row-detail > div:not(:first-child) { color: var(--ink-muted); }

.summ-row.summ-row-strong {
    background: rgba(251, 181, 4, 0.06);
}
.summ-row.summ-row-strong > div {
    font-weight: 600;
    color: var(--ink);
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.summ-row.summ-row-headline {
    background: rgba(221, 0, 15, 0.04);
    border-bottom-color: rgba(221, 0, 15, 0.18);
}
.summ-row.summ-row-headline > div {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--brand-red);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}
.summ-row.summ-row-headline > div:first-child {
    color: var(--ink);
}

.summ-row.summ-row-total {
    background: var(--bg-cream);
    border-top: 1px solid var(--rule);
}
.summ-row.summ-row-total > div {
    font-weight: 600;
}

/* Sources & Uses — two columns side by side -------------------------- */
.summ-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1rem 0;
}
.summ-pair-col { border: 1px solid var(--rule); }
.summ-pair-head {
    background: var(--ink);
    color: #fff;
    padding: 0.65rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 600;
}
.summ-pair-col .summ-row {
    grid-template-columns: 1.6fr 1fr;
}

@media (max-width: 920px) {
    .summ-pair { grid-template-columns: 1fr; }
}

/* Value Creation Bridge --------------------------------------------- */
.summ-vcb { margin: 1.25rem 0 1.75rem; border: 1px solid var(--rule); }
.summ-vcb-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    align-items: center;
    border-bottom: 1px solid var(--rule);
}
.summ-vcb-row > div { padding: 0.55rem 1.25rem; }
.summ-vcb-row > div:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
    border-left: 1px solid var(--rule);
}
.summ-vcb-head {
    background: var(--bg-cream);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
    font-weight: 600;
}
.summ-vcb-total {
    background: rgba(251, 181, 4, 0.12);
    border-bottom: 0;
}
.summ-vcb-total > div { font-weight: 600; }

.summ-vcb-headline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-top: 2px solid var(--bg-amber);
    border-bottom: 1px solid var(--rule);
    background: #fff;
    margin-bottom: 1rem;
}
.summ-vcb-stat {
    padding: 1.25rem 1.5rem;
    border-right: 1px solid var(--rule);
}
.summ-vcb-stat:last-child { border-right: 0; }
.summ-vcb-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.summ-vcb-stat-value {
    font-size: 1.75rem;
    font-weight: 300;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.summ-vcb-stat-unit {
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-left: 0.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

@media (max-width: 920px) {
    .summ-vcb-headline { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================================
   Time-series (year-by-year) table — used by Per-Target P&L and the
   Integrated P&L + Cash Flow pages. Label column on the left, year
   columns to the right, scrolls horizontally on narrow viewports.
   ========================================================================= */

.per-target-toolbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0 1.5rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 1.5rem;
}
.per-target-picker {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    flex-wrap: wrap;
}
.per-target-picker label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
    font-weight: 600;
}
.per-target-picker select {
    font-family: inherit;
    font-size: 0.875rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--rule);
    background: #fff;
    color: var(--ink);
}
.per-target-picker select:focus {
    outline: none;
    border-color: var(--bg-amber);
    box-shadow: 0 0 0 2px rgba(251, 181, 4, 0.22);
}

.ts-section-head {
    font-size: 1.125rem;
    margin: 0 0 0.75rem;
    color: var(--ink);
    font-weight: 500;
}

.ts {
    width: 100%;
    overflow-x: auto;
    border-top: 2px solid var(--bg-amber);
    background: #fff;
    margin-bottom: 1.5rem;
}

.ts-row {
    display: grid;
    grid-template-columns: minmax(260px, 1.6fr) repeat(10, minmax(80px, 1fr));
    align-items: center;
    border-bottom: 1px solid var(--rule);
    font-size: 0.875rem;
    color: var(--ink);
    min-width: max-content;
}
.ts.ts-cols-10 .ts-row {
    grid-template-columns: minmax(260px, 1.6fr) repeat(10, minmax(80px, 1fr));
}
.ts.ts-cols-6 .ts-row {
    grid-template-columns: minmax(260px, 1.6fr) repeat(6, minmax(100px, 1fr));
}
.ts-row > div { padding: 0.5rem 0.85rem; }
.ts-row > div:first-child { color: var(--ink-soft); }
.ts-row > div:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
    border-left: 1px solid var(--rule);
}

.ts-row.ts-head {
    background: var(--ink);
    color: #fff;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
    position: sticky;
    top: var(--header-h);
    z-index: 5;
}
.ts-row.ts-head > div:first-child,
.ts-row.ts-head > div:not(:first-child) { color: #fff; }

.ts-row.ts-subhead {
    background: var(--bg-cream);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
    color: var(--ink-muted);
}
.ts-row.ts-subhead > div { color: var(--ink-muted); }

.ts-row.ts-row-detail > div {
    font-size: 0.8125rem;
    color: var(--ink-muted);
}
.ts-row.ts-row-detail > div:first-child { padding-left: 1.6rem; }

.ts-row.ts-row-strong {
    background: rgba(251, 181, 4, 0.06);
}
.ts-row.ts-row-strong > div {
    font-weight: 600;
    color: var(--ink);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.ts-row.ts-row-headline {
    background: rgba(221, 0, 15, 0.05);
}
.ts-row.ts-row-headline > div {
    font-weight: 600;
    color: var(--brand-red);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    font-size: 0.9375rem;
}
.ts-row.ts-row-headline > div:first-child { color: var(--ink); }

.ts-band {
    padding: 0.85rem 0.85rem;
    background: var(--bg-cream);
    color: var(--ink);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 600;
    border-bottom: 1px solid var(--rule);
    border-top: 1px solid var(--rule);
}

/* `min-width: max-content` on rows + overflow-x:auto on the wrapper means
   wide tables scroll horizontally instead of wrapping cells. */


/* ─────────────────────────────────────────────────────────────────────────
   Resi rollup model builder — Phase C inputs UI
   ───────────────────────────────────────────────────────────────────────── */

.rf-section { margin: 2.5rem 0; }
.rf-section-head { margin-bottom: 1rem; }

.rf-section-head h2 { margin-bottom: 0.25rem; font-weight: 400; font-size: 1.5rem; }
.rf-section-head .muted { font-size: 0.95rem; }

/* Vertical accordion */
.rf-vertical-list { margin-bottom: 1rem; }
.rf-vertical-card {
    border: 1px solid var(--rule);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: #fff;
}
.rf-vertical-card[open] { border-color: var(--ink); }
.rf-vertical-card > summary {
    list-style: none;
    padding: 0.9rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: baseline;
    gap: 1rem;
    user-select: none;
}
.rf-vertical-card > summary::-webkit-details-marker { display: none; }
.rf-vertical-card > summary::before {
    content: '▸';
    color: var(--ink-muted);
    font-size: 0.85rem;
    transition: transform 0.15s ease;
}
.rf-vertical-card[open] > summary::before { transform: rotate(90deg); }
.rf-vertical-key {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    background: var(--bg-cream);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}
.rf-vertical-name { font-weight: 500; }
.small { font-size: 0.85rem; }

.rf-vertical-body { padding: 0 1.25rem 0.5rem; }
.rf-subsection { margin-bottom: 1.25rem; }
.rf-subsection:last-child { margin-bottom: 0; }
.rf-subsection-head {
    margin: 1rem 0 0.6rem;
    padding-bottom: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--rule);
}
.rf-subsection:first-child .rf-subsection-head { margin-top: 0.25rem; }
.rf-subsection-note {
    margin: -0.2rem 0 0.85rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
    line-height: 1.45;
    max-width: 720px;
}
.rf-subsection-note em { font-style: italic; color: var(--ink); }

/* "Not applicable" placeholder in tabular cells (e.g. debt schedule columns
   that the engine ignores for the current amortStyle / rateBasis). */
.rf-cell-na {
    color: #b0b3b9;
    font-size: 0.9rem;
    cursor: help;
}

/* Capital-structure phases — sentence-style trigger input. */
.rf-phase-trigger-sentence {
    margin: 1rem 0;
    font-size: 0.95rem;
    line-height: 2;
}
.rf-trigger-inline {
    display: inline-block;
    width: 180px;
    vertical-align: middle;
    margin: 0 0.25rem;
}
.rf-trigger-inline input {
    width: 100%;
    box-sizing: border-box;
}

/* "Computed" cells — read-only derived percentages styled to look like a
   calculation rather than a missing input. */
.rf-computed-cell {
    color: var(--ink-muted);
    font-style: italic;
    background: #fafafa;
    cursor: help;
}
/* Derived sanity-check blocks under the vertical editor — visually distinct
   from the editable subsections above so the user knows these are read-only. */
.rf-derived-block {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-cream);
    border-left: 3px solid var(--bg-amber);
    border-radius: 0 4px 4px 0;
}
.rf-derived-block .rf-subsection-head { margin-top: 0; }

/* Sub-grid for explicit-year € inputs (Adjustments with computation = explicit_eur).
   Stacks the per-year inputs compactly inside the table cell. */
.rf-explicit-years {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.rf-explicit-year {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 90px;
}
.rf-explicit-year input {
    width: 90px;
    text-align: right;
}
.rf-explicit-year .small {
    font-size: 0.7rem;
    text-align: center;
}

.rf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem 1.25rem;
    padding: 0;
}
.rf-vertical-body .rf-grid { padding: 0; }
.rf-field { display: flex; flex-direction: column; gap: 0.25rem; }
.rf-field-label {
    font-size: 0.8rem;
    color: var(--ink-muted);
    letter-spacing: 0.02em;
}
.rf-field input,
.rf-field select {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--rule);
    border-radius: 3px;
    font: inherit;
    font-size: 0.95rem;
    background: #fff;
}
.rf-field input:focus,
.rf-field select:focus { outline: 2px solid var(--bg-amber); outline-offset: -1px; }
.rf-field input:disabled,
.rf-field select:disabled { background: #f6f6f6; color: var(--ink-muted); }

/* Slot table */
.rf-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: #fff;
}
.rf-slot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.rf-slot-table thead th {
    background: var(--bg-cream);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 500;
    color: var(--ink);
    border-bottom: 1px solid var(--rule);
    position: sticky; top: 0; z-index: 1;
}
.rf-slot-table thead th.num { text-align: right; }
.rf-slot-table tbody tr:nth-child(even) { background: #fafafa; }
.rf-slot-table tbody td {
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid #eee;
}
.rf-slot-table tbody td.num { text-align: right; }
.rf-slot-table input,
.rf-slot-table select {
    width: 100%;
    padding: 0.3rem 0.45rem;
    border: 1px solid transparent;
    border-radius: 2px;
    font: inherit;
    font-size: 0.9rem;
    background: transparent;
}
/* Per-type minimum widths so wide tables overflow horizontally rather than
   squash each cell to the point where text gets clipped. The wrapper has
   overflow-x: auto, so users can scroll the table laterally. */
.rf-slot-table input[type="text"]    { min-width: 170px; }
.rf-slot-table input[type="number"]  { min-width: 95px; }
.rf-slot-table select                { min-width: 135px; }
/* Unit-decorated inputs need room for the prefix/suffix too. */
.rf-slot-table .rf-unit-wrap         { min-width: 140px; display: block; }
.rf-slot-table .rf-unit-wrap input   { min-width: 0; }
/* Per-cell minima for the table header — keeps header text from wrapping
   below the column width when the body inputs would let it shrink. */
.rf-slot-table thead th              { white-space: nowrap; }
.rf-slot-table td.num input { text-align: right; }
.rf-slot-table input:hover,
.rf-slot-table select:hover { border-color: var(--rule); background: #fff; }
.rf-slot-table input:focus,
.rf-slot-table select:focus { outline: 2px solid var(--bg-amber); background: #fff; }
.rf-slot-table input:disabled,
.rf-slot-table select:disabled { color: var(--ink-muted); }

/* Form actions */
.rf-actions {
    display: flex;
    gap: 0.75rem;
    margin: 2rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}

/* Scenario list (home) — small additions on top of generic .btn / .scenario-* */
.scenario-card { border: 1px solid var(--rule); border-radius: 6px; padding: 1.5rem; margin-bottom: 1.5rem; background: #fff; }
.scenario-template { border-left: 3px solid var(--bg-amber); }
.scenario-card-head { margin-bottom: 0.5rem; }
.scenario-card-head h3 { margin: 0.25rem 0; font-weight: 400; }
.scenario-card-actions { margin-top: 1rem; display: flex; gap: 0.75rem; }
.scenario-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; background: #fff; }
.scenario-table th { text-align: left; padding: 0.6rem 0.75rem; background: var(--bg-cream); border-bottom: 1px solid var(--rule); font-weight: 500; }
.scenario-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #eee; }
.scenario-table .actions-col { width: 220px; text-align: right; }
.scenario-table .actions-col .inline-form { display: inline-block; margin-left: 0.4rem; }

.btn-small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn-ghost:hover { background: var(--bg-cream); }
.btn-danger { color: var(--brand-red); border-color: var(--brand-red); }
.btn-danger:hover { background: var(--brand-red); color: #fff; }

.mt-large { margin-top: 2.5rem; }

/* Unit decoration on input fields (€ prefix, % suffix, etc.) */
.rf-unit-wrap {
    position: relative;
    display: block;
}
.rf-unit-wrap input { width: 100%; box-sizing: border-box; }
.rf-unit-wrap-prefix input { padding-left: 1.6rem; }
.rf-unit-wrap-suffix input { padding-right: 1.6rem; }
.rf-unit {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-muted);
    font-size: 0.9rem;
    pointer-events: none;
    user-select: none;
}
.rf-unit-prefix { left: 0.6rem; }
.rf-unit-suffix { right: 0.6rem; }
.rf-unit-soft { color: #b0b3b9; font-size: 0.8rem; }

/* Output sheet rows: highlight subtotals + section breaks */
.rf-slot-table tr.rf-row-emphasis td {
    background: var(--bg-cream);
    border-top: 1px solid var(--ink);
}

/* Stronger read-only state — template scenarios should look noticeably
   "locked" so users understand to replicate before editing. */
.rf-field input:disabled,
.rf-field select:disabled,
.rf-unit-wrap input:disabled,
.rf-slot-table input:disabled,
.rf-slot-table select:disabled {
    background: #f0f0f0 !important;
    color: #888 !important;
    cursor: not-allowed !important;
    border-color: #e0e0e0 !important;
}

/* Big, friendly "you're on the template" banner with inline replicate CTA. */
.rf-template-banner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-amber);
    border-radius: 6px;
    color: var(--ink);
}
.rf-template-banner-text { flex: 1; font-size: 0.95rem; line-height: 1.5; }
.rf-template-banner-text strong { display: inline-block; margin-right: 0.4rem; }
.rf-template-banner-cta {
    background: var(--ink);
    color: #fff;
    border: none;
    white-space: nowrap;
}
.rf-template-banner-cta:hover { background: #000; }
/* Native <dialog> for replicate / rename flows. Click the trigger button
   to open; ESC or Cancel closes. Form inside posts as normal. */
.rf-dialog {
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 0;
    background: #fff;
    color: var(--ink);
    max-width: 480px;
    width: 90vw;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
}
.rf-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.rf-dialog-form { padding: 1.75rem 1.75rem 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.rf-dialog-title { margin: 0; font-weight: 500; font-size: 1.25rem; }
.rf-dialog-input {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: #fff;
    font: inherit;
    color: var(--ink);
    width: 100%;
    box-sizing: border-box;
}
.rf-dialog-input:focus { outline: 2px solid var(--brand-red); outline-offset: -2px; }
.rf-dialog-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.5rem; }
/* Pencil icon button for inline rename on the scenarios table. */
.rf-icon-btn {
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--ink-muted);
    font-size: 0.9rem;
    padding: 0 0.25rem;
    margin-left: 0.4rem;
    line-height: 1;
}
.rf-icon-btn:hover { color: var(--brand-red); }
.rf-tranche-block {
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: #fff;
}
.rf-tranche-block h3 {
    margin: 0 0 0.75rem;
    font-weight: 500;
    font-size: 1.05rem;
}
.rf-tranche-block .small { font-weight: 400; }

