:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --border: #dfe5e2;
  --border-strong: #c9d2ce;
  --text: #17221d;
  --muted: #64716b;
  --green: #16784a;
  --green-dark: #0d5b37;
  --green-soft: #e8f5ee;
  --amber: #9a6507;
  --amber-soft: #fff4d8;
  --red: #b42318;
  --red-soft: #fff0ee;
  --blue: #2667a8;
  --blue-soft: #edf5fc;
  --shadow: 0 14px 40px rgba(26, 42, 34, 0.12);
  --sidebar: 248px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; background: var(--bg); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; background: #eef2f0; }
.auth-brand { position: fixed; top: 28px; left: 32px; display: flex; align-items: center; gap: 12px; }
.auth-brand img, .brand-lockup img { width: 38px; height: 38px; object-fit: contain; }
.auth-brand div, .brand-lockup div { display: flex; flex-direction: column; }
.auth-brand strong, .brand-lockup strong { font-size: 15px; }
.auth-brand span, .brand-lockup span { color: var(--muted); font-size: 12px; }
.auth-panel { width: min(100%, 420px); padding: 34px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.auth-heading { margin-bottom: 4px; }
.auth-heading h1 { margin: 4px 0 8px; font-size: 28px; line-height: 1.15; }
.auth-heading p:last-child { color: var(--muted); margin: 0; }
.eyebrow { margin: 0; color: var(--green); font-size: 11px; font-weight: 750; text-transform: uppercase; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar); height: 100vh; background: #15251e; color: #e8efeb; display: flex; flex-direction: column; padding: 22px 14px 14px; z-index: 20; }
.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.brand-lockup img { filter: brightness(0) invert(1); }
.brand-lockup span { color: #9fb0a8; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item, .account-button, .account-menu button { border: 0; background: transparent; color: inherit; text-align: left; }
.nav-item { min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 11px; border-radius: 6px; color: #bfcac5; font-weight: 580; }
.nav-item:hover { background: #20352c; color: white; }
.nav-item.active { background: #e8f5ee; color: #105e3a; }
.nav-item svg, .account-button svg, .account-menu svg { width: 17px; height: 17px; flex: none; }
.nav-label { margin: 20px 12px 5px; color: #70867b; font-size: 10px; font-weight: 750; text-transform: uppercase; }
.sidebar-footer { margin-top: auto; position: relative; border-top: 1px solid #2b3c35; padding-top: 12px; }
.account-button { width: 100%; padding: 8px; display: flex; align-items: center; gap: 9px; border-radius: 6px; }
.account-button:hover { background: #20352c; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #d9efe2; color: #105e3a; font-weight: 800; }
.account-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.account-copy strong, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { color: #8fa399; margin-top: 2px; }
.account-menu { position: absolute; left: 0; right: 0; bottom: 58px; padding: 6px; background: white; color: var(--text); border: 1px solid var(--border); border-radius: 7px; box-shadow: var(--shadow); }
.account-menu button { width: 100%; padding: 10px; display: flex; gap: 9px; align-items: center; border-radius: 5px; }
.account-menu button:hover { background: var(--surface-soft); }

.main-area { min-width: 0; grid-column: 2; }
.topbar { height: 82px; padding: 0 32px; background: rgba(255,255,255,0.94); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 3px 0 0; font-size: 22px; line-height: 1.2; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.service-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: none; }
.status-dot.ready, .status-dot.success { background: #20a464; box-shadow: 0 0 0 3px #def2e7; }
.status-dot.running, .status-dot.queued { background: #d58c10; box-shadow: 0 0 0 3px #fff0c9; }
.status-dot.failed { background: #d13a2f; box-shadow: 0 0 0 3px #ffe4e1; }
.content { padding: 28px 32px 48px; max-width: 1540px; margin: 0 auto; }

.button { min-height: 38px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.button:hover { border-color: #9ca9a3; background: var(--surface-soft); }
.button.primary { background: var(--green); border-color: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.button.danger { color: var(--red); border-color: #edb8b2; }
.button.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.button.wide { width: 100%; }
.button svg { width: 16px; height: 16px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.icon-button:hover { color: var(--text); border-color: var(--border-strong); }
.icon-button svg { width: 17px; height: 17px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat { min-height: 108px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-head { color: var(--muted); display: flex; align-items: center; justify-content: space-between; }
.stat-head svg { width: 18px; }
.stat strong { font-size: 29px; line-height: 1; }
.stat small { color: var(--muted); }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
.section-header h2 { margin: 0; font-size: 17px; }
.section-header p { margin: 4px 0 0; color: var(--muted); }
.segmented { display: flex; gap: 3px; padding: 3px; background: #e8ecea; border-radius: 6px; overflow-x: auto; }
.segmented button { border: 0; border-radius: 4px; background: transparent; padding: 7px 11px; color: var(--muted); white-space: nowrap; }
.segmented button.active { background: white; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.runner-list { background: var(--surface); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.runner-row { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: white; display: grid; grid-template-columns: 42px minmax(220px, 1.2fr) minmax(260px, 2fr) 130px 105px 28px; gap: 14px; align-items: center; padding: 14px 16px; text-align: left; color: var(--text); }
.runner-row:last-child { border-bottom: 0; }
.runner-row:hover { background: #f9fbfa; }
.runner-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; background: var(--green-soft); color: var(--green); }
.runner-icon svg { width: 18px; height: 18px; }
.runner-title { min-width: 0; }
.runner-title strong, .runner-title small { display: block; }
.runner-title small { margin-top: 3px; color: var(--muted); }
.runner-desc { color: var(--muted); line-height: 1.45; }
.status-pill { width: fit-content; display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--green-soft); color: var(--green-dark); }
.status-pill.failed { background: var(--red-soft); color: var(--red); }
.status-pill.running, .status-pill.queued { background: var(--amber-soft); color: var(--amber); }
.reserve-badge { display: inline-flex; padding: 3px 6px; margin-left: 6px; border-radius: 4px; background: var(--amber-soft); color: var(--amber); font-size: 10px; font-weight: 750; vertical-align: 1px; }
.last-run { color: var(--muted); font-size: 12px; }

.form-shell { max-width: 1040px; }
.form-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.form-intro h2 { margin: 0 0 6px; font-size: 19px; }
.form-intro p { margin: 0; color: var(--muted); }
.offer-form { display: grid; gap: 14px; }
.form-section { background: var(--surface); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.form-section > header { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.form-section > header h3 { margin: 0; font-size: 15px; }
.form-section > header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.field-grid { padding: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 18px; }
label { display: grid; gap: 7px; color: #34443c; font-size: 12px; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; color: var(--text); background: white; border: 1px solid var(--border-strong); border-radius: 5px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,120,74,.1); }
textarea { min-height: 84px; resize: vertical; }
select[multiple] { min-height: 120px; }
.check-field { min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.check-field input { width: 18px; height: 18px; min-height: 0; accent-color: var(--green); }
.check-field span { font-size: 13px; font-weight: 570; }
.field-help { margin: -10px 0 0; color: var(--muted); font-size: 11px; }
.form-error { min-height: 18px; color: var(--red); margin: 0; font-size: 12px; }
.form-note { margin: 0; color: var(--green); font-size: 12px; line-height: 1.5; }
.auth-alt { margin: -4px 0 0; text-align: center; }
.auth-link { background: none; border: 0; padding: 4px; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.auth-link:hover { color: var(--text); }
.advanced-toggle { border: 0; background: transparent; color: var(--green); font-weight: 650; display: flex; align-items: center; gap: 6px; }
.advanced-toggle svg { width: 15px; }
.form-actions { position: sticky; bottom: 12px; z-index: 4; padding: 12px; background: rgba(255,255,255,.96); border: 1px solid var(--border); border-radius: 7px; box-shadow: 0 8px 30px rgba(20,40,30,.12); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.publish-field { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.publish-field input { width: 17px; height: 17px; min-height: 0; accent-color: var(--green); }
.repeatable-wrap { padding: 16px 18px; display: grid; gap: 10px; }
.extra-row { padding: 14px; border: 1px solid var(--border); border-radius: 6px; display: grid; grid-template-columns: 1.5fr 1fr .6fr .8fr .8fr auto; gap: 10px; align-items: end; }

.users-panel, .activity-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: var(--surface-soft); color: var(--muted); font-size: 11px; text-transform: uppercase; }
.table tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; gap: 7px; justify-content: flex-end; }

.dialog { width: min(760px, calc(100vw - 30px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 8px; box-shadow: var(--shadow); overflow: auto; }
.dialog::backdrop { background: rgba(13, 25, 19, .52); }
.runner-dialog { width: min(880px, calc(100vw - 30px)); }
.dialog-header { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; position: sticky; top: 0; background: white; z-index: 2; }
.dialog-header h2 { margin: 0 0 5px; font-size: 19px; }
.dialog-header p { margin: 0; color: var(--muted); line-height: 1.45; }
.dialog-body { padding: 20px 22px; display: grid; gap: 22px; }
.dialog-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: white; }
.detail-block h3 { margin: 0 0 9px; font-size: 13px; }
.copy-field { display: flex; gap: 7px; }
.copy-field input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: #405048; background: var(--surface-soft); }
.run-list { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.run-entry { padding: 12px 13px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: start; }
.run-entry:last-child { border-bottom: 0; }
.run-entry time, .run-entry small { color: var(--muted); font-size: 11px; }
.run-entry strong { display: block; margin-bottom: 3px; font-size: 12px; }
.error-box, .result-box { margin-top: 8px; padding: 10px; border-radius: 5px; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; line-height: 1.5; }
.error-box { background: var(--red-soft); color: #8f1c14; }
.result-box { background: var(--surface-soft); color: #405048; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

.toast-region { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; }
.toast { width: min(360px, calc(100vw - 40px)); padding: 12px 14px; background: #18271f; color: white; border-radius: 6px; box-shadow: var(--shadow); display: flex; gap: 9px; align-items: flex-start; }
.toast.error { background: #8d241c; }
.toast svg { width: 17px; height: 17px; margin-top: 1px; }
.mobile-only { display: none; }

@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .runner-row { grid-template-columns: 42px minmax(170px, 1fr) minmax(220px, 1.5fr) 115px 28px; }
  .last-run { display: none; }
  .extra-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: var(--sidebar); transition: transform .2s ease; box-shadow: var(--shadow); }
  .main-area { grid-column: 1; }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: grid; }
  .topbar { height: 72px; padding: 0 16px; gap: 12px; justify-content: flex-start; }
  .topbar-actions { margin-left: auto; }
  .service-state { display: none; }
  .content { padding: 20px 14px 40px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { min-height: 96px; padding: 14px; }
  .stat strong { font-size: 24px; }
  .section-header { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; }
  .runner-row { grid-template-columns: 38px 1fr 24px; gap: 10px; }
  .runner-desc, .runner-row > .status-pill, .runner-row > .last-run { display: none; }
  .field-grid { grid-template-columns: 1fr; padding: 15px; }
  .form-intro { flex-direction: column; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .extra-row { grid-template-columns: 1fr 1fr; }
  .table-wrap { overflow-x: auto; }
  .auth-brand { position: static; margin-bottom: 24px; }
  .auth-screen { display: flex; flex-direction: column; justify-content: center; }
  .auth-panel { padding: 26px 20px; }
  .run-entry { grid-template-columns: 1fr auto; }
  .run-entry time { grid-column: 1 / -1; }
}

/* Guided offer workspace */
.offer-workspace { max-width: 1240px; margin: 0 auto; }
.offer-hero { margin: 2px 0 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.offer-hero h2 { margin: 7px 0 5px; font-size: 25px; line-height: 1.2; }
.offer-hero p { margin: 0; color: var(--muted); font-size: 14px; }
.offer-hero-actions { display: flex; align-items: center; gap: 10px; }
.offer-hero-actions > .button { white-space: nowrap; }
.offer-kicker { color: var(--green); display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 780; text-transform: uppercase; }
.offer-kicker svg { width: 15px; height: 15px; }
.sync-chip { min-width: 265px; padding: 9px 9px 9px 12px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; }
.sync-chip > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; }
.sync-chip strong { font-size: 12px; }
.sync-chip small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.sync-chip .icon-button { width: 32px; height: 32px; }
.sync-chip.warning { border-color: #ecd49e; background: #fffaf0; }

.offer-form-wizard { display: grid; gap: 16px; }
.form-steps { padding: 7px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; background: #e9eeeb; border-radius: 8px; }
.form-step { min-width: 0; min-height: 58px; padding: 9px 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: flex; align-items: center; gap: 10px; text-align: left; }
.form-step:hover { background: rgba(255,255,255,.55); color: var(--text); }
.form-step.active { background: white; color: var(--text); box-shadow: 0 1px 4px rgba(20,40,30,.1); }
.form-step.done { color: var(--green-dark); }
.form-step > span { width: 28px; height: 28px; border: 1px solid #bdc8c2; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 750; }
.form-step.active > span { color: white; background: var(--green); border-color: var(--green); }
.form-step.done > span { color: var(--green); background: var(--green-soft); border-color: #b8ddc8; }
.form-step svg { width: 14px; height: 14px; }
.form-step div { min-width: 0; display: flex; flex-direction: column; }
.form-step strong { font-size: 13px; }
.form-step small { margin-top: 2px; font-size: 10px; color: inherit; opacity: .78; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.offer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
.form-stage { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 10px rgba(24,44,34,.035); overflow: visible; }
.step-panel { min-height: 470px; }
.form-group-block { padding: 26px 28px 30px; border-bottom: 1px solid var(--border); }
.form-group-block:last-child { border-bottom: 0; }
.form-group-block.subtle { background: #fbfcfb; }
.group-heading { margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.group-heading > div { display: flex; align-items: flex-start; gap: 12px; }
.group-heading h3 { margin: 1px 0 4px; font-size: 16px; }
.group-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.group-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: none; color: var(--green); background: var(--green-soft); border-radius: 6px; }
.group-icon svg { width: 17px; height: 17px; }
.auto-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 4px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 750; white-space: nowrap; }
.auto-badge svg { width: 13px; height: 13px; }

.smart-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.smart-field-grid > .span-2, .span-2 { grid-column: 1 / -1; }
.field-label { min-width: 0; position: relative; display: flex; flex-direction: column; gap: 7px; color: #324139; font-size: 12px; font-weight: 680; }
.field-label > span:first-child { min-height: 17px; }
.field-label input, .field-label select, .field-label textarea { min-height: 44px; border-color: #cbd5d0; border-radius: 6px; transition: border-color .15s, box-shadow .15s; }
.field-label input::placeholder { color: #9ba6a0; font-weight: 450; }
.field-label textarea { min-height: 92px; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 88px; }
.input-metric { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); padding: 3px 6px; color: var(--green-dark); background: var(--green-soft); border-radius: 4px; font-size: 10px; font-weight: 750; }

.choice-tile { min-height: 46px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 6px; background: white; cursor: pointer; font-size: 12px; font-weight: 620; transition: border-color .15s, background .15s; }
.choice-tile:hover { border-color: #aec1b7; }
.choice-tile:has(input:checked) { border-color: #85c3a3; background: #f2faf6; color: var(--green-dark); }
.choice-tile input, .confirmation-row input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.choice-check { width: 19px; height: 19px; border: 1px solid #b8c3bd; border-radius: 4px; display: grid; place-items: center; flex: none; background: white; color: transparent; }
.choice-check svg { width: 13px; height: 13px; }
.choice-tile input:checked + .choice-check, .confirmation-row input:checked + .choice-check { color: white; border-color: var(--green); background: var(--green); }
.choice-tile > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.choice-tile > span:last-child strong { font-size: 12px; }
.choice-tile > span:last-child small { color: var(--muted); font-size: 10px; font-weight: 480; line-height: 1.4; }

.segment-field { margin: 0; padding: 0; border: 0; grid-column: 1 / -1; }
.segment-field legend { margin-bottom: 7px; color: #324139; font-size: 12px; font-weight: 680; }
.segment-options { width: fit-content; min-width: min(100%, 420px); padding: 4px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(110px, 1fr); gap: 3px; background: #edf1ef; border-radius: 7px; }
.segment-options label { cursor: pointer; }
.segment-options input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.segment-options span { min-height: 36px; padding: 0 13px; display: grid; place-items: center; border-radius: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.segment-options input:checked + span { background: white; color: var(--green-dark); font-weight: 720; box-shadow: 0 1px 4px rgba(20,40,30,.1); }

.module-picker { margin: 0; padding: 0; border: 0; grid-column: 1 / -1; }
.module-picker legend { margin-bottom: 8px; color: #324139; font-size: 12px; font-weight: 680; }
.module-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.module-option { min-width: 0; cursor: pointer; }
.module-option.reserve { grid-column: 1 / -1; }
.module-option > input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.module-option-body { min-height: 112px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; border: 1px solid var(--border); border-radius: 7px; background: white; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.module-option:hover .module-option-body { border-color: #8fc6aa; }
.module-option > input:focus-visible + .module-option-body { outline: 3px solid rgba(24,121,75,.18); outline-offset: 2px; }
.module-option > input:checked + .module-option-body { border-color: var(--green); background: #f4faf7; box-shadow: 0 0 0 1px var(--green); }
.module-option.reserve .module-option-body { min-height: 78px; background: #fafcfb; }
.module-option-head { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.module-option-head > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.module-option-head strong { overflow-wrap: anywhere; color: #24332b; font-size: 12px; }
.module-option-head small { overflow-wrap: anywhere; color: var(--muted); font-size: 9px; }
.module-option-head em { align-self: start; padding: 4px 6px; border-radius: 4px; color: var(--green-dark); background: var(--green-soft); font-size: 8px; font-style: normal; font-weight: 760; text-transform: uppercase; }
.module-option.reserve .module-option-head em { color: #665c3d; background: #f2eee1; }
.module-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; color: var(--green); background: var(--green-soft); }
.module-icon svg { width: 17px; height: 17px; }
.module-option-specs { display: flex; align-items: baseline; gap: 13px; color: var(--muted); font-size: 9px; }
.module-option-specs span:first-child { margin-right: auto; color: #24332b; }
.module-option-specs strong { font-size: 15px; }
.module-picker > .field-help { display: block; margin-top: 8px; }

.switch-row { margin-top: 22px; padding: 14px 15px; min-height: 64px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 7px; background: #fafcfb; cursor: pointer; }
.switch-row input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.switch-control { width: 38px; height: 22px; padding: 3px; border-radius: 999px; background: #bdc6c1; flex: none; transition: background .18s; }
.switch-control::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 2px rgba(0,0,0,.18); transition: transform .18s; }
.switch-row input:checked + .switch-control { background: var(--green); }
.switch-row input:checked + .switch-control::after { transform: translateX(16px); }
.switch-row > span:last-child { display: flex; flex-direction: column; }
.switch-row strong { font-size: 12px; }
.switch-row small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 480; }
.conditional-panel { margin-top: 18px; padding: 18px; border-left: 3px solid #b7dcca; background: #f7faf8; border-radius: 0 6px 6px 0; }

.project-field, .smart-multi { position: relative; }
.select-trigger, .multi-trigger { min-height: 44px; width: 100%; padding: 0 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid #cbd5d0; border-radius: 6px; background: white; color: #8b9690; text-align: left; font-weight: 500; }
.select-trigger.has-value { color: var(--text); font-weight: 650; }
.select-trigger svg, .multi-trigger svg { width: 16px; height: 16px; }
.select-popover, .multi-popover { position: absolute; top: 69px; left: 0; right: 0; z-index: 30; padding: 7px; background: white; border: 1px solid var(--border-strong); border-radius: 7px; box-shadow: var(--shadow); }
.select-search { position: relative; margin-bottom: 6px; }
.select-search svg { position: absolute; width: 15px; height: 15px; left: 10px; top: 13px; color: var(--muted); }
.select-search input { min-height: 40px; padding-left: 32px; }
.select-options, .multi-options { max-height: 240px; overflow-y: auto; }
.select-options button { min-height: 38px; width: 100%; padding: 0 10px; border: 0; border-radius: 4px; background: white; display: flex; align-items: center; justify-content: space-between; text-align: left; }
.select-options button:hover { background: var(--green-soft); color: var(--green-dark); }
.select-options button svg { width: 14px; opacity: 0; }
.multi-option-row { min-height: 38px; padding: 0 7px 0 0; display: flex; align-items: center; border-radius: 4px; }
.multi-options label { min-width: 0; min-height: 38px; padding: 0 9px; display: flex; align-items: center; gap: 9px; border-radius: 4px; cursor: pointer; flex: 1; font-size: 11px; font-weight: 560; }
.multi-options label:hover { background: #f4f7f5; }
.multi-options label.recommended { background: #f3faf6; }
.multi-options input { width: 16px; height: 16px; min-height: 0; accent-color: var(--green); }
.multi-option-label { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.multi-recommendation { margin-left: auto; padding: 3px 5px; border-radius: 4px; background: var(--green-soft); color: var(--green-dark); font-size: 8px; font-style: normal; font-weight: 760; white-space: nowrap; }
.multi-options svg { width: 14px; margin-left: 0; color: var(--green); opacity: 0; flex: none; }
.multi-options input:checked ~ svg { opacity: 1; }
.multi-quantity { height: 28px; margin-left: 4px; display: grid; grid-template-columns: 27px 25px 27px; align-items: center; flex: none; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; background: white; }
.multi-quantity button { width: 27px; height: 27px; padding: 0; display: grid; place-items: center; border: 0; background: white; color: var(--green-dark); }
.multi-quantity button:hover:not(:disabled) { background: var(--green-soft); }
.multi-quantity button:disabled { color: #b4bdb8; cursor: default; }
.multi-quantity button svg { width: 12px; height: 12px; opacity: 1; }
.multi-quantity output { text-align: center; color: var(--text); font-size: 10px; font-weight: 750; }
.selected-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.selected-chips:empty { display: none; }
.selected-chips button { max-width: 100%; min-height: 28px; padding: 3px 7px 3px 9px; border: 1px solid #badbc9; border-radius: 4px; background: var(--green-soft); color: var(--green-dark); display: flex; align-items: center; gap: 5px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
.selected-chips svg { width: 12px; height: 12px; flex: none; }

.price-table { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.price-row { min-height: 48px; padding: 7px 10px; display: grid; grid-template-columns: minmax(150px, 1fr) 150px 150px 70px; gap: 9px; align-items: center; border-bottom: 1px solid var(--border); }
.price-row:last-child { border-bottom: 0; }
.price-row strong { font-size: 11px; }
.price-row input[type="number"] { min-height: 34px; font-size: 11px; }
.price-head { min-height: 36px; background: #f4f6f5; color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.mini-check { width: 28px; height: 28px; margin: auto; display: grid; place-items: center; }
.mini-check input { position: absolute; opacity: 0; }
.mini-check span { width: 17px; height: 17px; border: 1px solid #b9c5bf; border-radius: 4px; }
.mini-check input:checked + span { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px white; }
.compact-costs { margin-top: 17px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.price-override-list { display: grid; gap: 7px; }
.price-override-item { border: 1px solid var(--border); border-radius: 6px; background: white; overflow: hidden; }
.price-override-toggle { min-height: 46px; padding: 0 12px; display: grid; grid-template-columns: 19px minmax(0, 1fr) auto; gap: 10px; align-items: center; cursor: pointer; }
.price-override-toggle input, .price-optional input { position: absolute; opacity: 0; pointer-events: none; }
.price-override-toggle input:checked + .choice-check, .price-optional input:checked + .choice-check { color: white; border-color: var(--green); background: var(--green); }
.price-override-toggle strong { font-size: 11px; }
.price-override-toggle small { color: var(--muted); font-size: 9px; }
.price-override-fields { padding: 12px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; background: #f7f9f8; border-top: 1px solid var(--border); }
.price-override-fields > label:not(.price-optional) { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 680; }
.price-override-fields input[type="number"] { width: 100%; min-height: 38px; border: 1px solid #cbd5d0; border-radius: 6px; padding: 0 10px; }
.price-optional { min-height: 38px; padding: 0 9px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 10px; font-weight: 650; }
.active-costs { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.active-costs:empty { display: none; }
.manual-cost-list { margin-top: 7px; display: grid; gap: 7px; }
.manual-cost-field { padding: 12px; background: #f7f9f8; border-top: 1px solid var(--border); }

.service-price-list { display: grid; gap: 8px; }
.service-price-item { border: 1px solid var(--border); border-radius: 7px; background: white; overflow: hidden; }
.service-price-item:has(.service-price-toggle input:checked) { border-color: #8fc6aa; }
.service-price-toggle { min-height: 52px; padding: 0 14px; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 11px; cursor: pointer; }
.service-price-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.service-price-toggle input:checked + .choice-check { color: white; border-color: var(--green); background: var(--green); }
.service-price-toggle strong { font-size: 12px; }
.service-price-toggle small { color: var(--muted); font-size: 9px; }
.service-price-fields { padding: 13px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--border); background: #f7f9f8; }
.service-price-fields:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
.service-optional { grid-column: 1 / -1; min-height: 48px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 6px; background: white; cursor: pointer; }
.service-optional > input { position: absolute; opacity: 0; pointer-events: none; }
.service-optional > input:checked + .choice-check { color: white; border-color: var(--green); background: var(--green); }
.service-optional > span:last-child { min-width: 0; display: grid; gap: 2px; }
.service-optional strong { font-size: 11px; }
.service-optional small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.option-secondary { margin-top: 16px; }

.component-variant-tabs { width: fit-content; margin-bottom: 13px; }
.component-variant-tabs button { min-height: 37px; padding: 0 16px; display: inline-flex; align-items: center; gap: 7px; border: 0; color: var(--muted); background: transparent; font: inherit; font-size: 11px; font-weight: 680; cursor: pointer; }
.component-variant-tabs button.active { color: var(--green-dark); background: white; border-radius: 5px; box-shadow: 0 1px 4px rgba(20,40,30,.1); }
.component-variant-tabs svg { width: 14px; height: 14px; }
.component-variant-panel { padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: white; }
.variant-panel-head { margin-bottom: 13px; display: flex; align-items: baseline; gap: 9px; }
.variant-panel-head strong { font-size: 12px; }
.variant-panel-head span { color: var(--muted); font-size: 10px; }
.component-checks { margin-top: 14px; display: grid; gap: 7px; }
.component-fit { min-height: 52px; padding: 9px 11px; display: flex; align-items: center; gap: 10px; border-left: 3px solid var(--border-strong); background: #f7f9f8; }
.component-fit-icon { width: 27px; height: 27px; display: grid; place-items: center; flex: none; border-radius: 50%; background: white; color: var(--muted); }
.component-fit-icon svg { width: 15px; height: 15px; }
.component-fit div { min-width: 0; }
.component-fit strong { font-size: 10px; }
.component-fit p { margin: 2px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.component-fit.good { border-color: var(--green); background: var(--green-soft); }
.component-fit.good .component-fit-icon, .smart-multi[data-fit-state="good"] > span:first-child { color: var(--green-dark); }
.component-fit.warning { border-color: #d5961b; background: var(--amber-soft); }
.component-fit.warning .component-fit-icon, .smart-multi[data-fit-state="warning"] > span:first-child { color: var(--amber); }
.component-fit.danger { border-color: var(--red); background: var(--red-soft); }
.component-fit.danger .component-fit-icon, .smart-multi[data-fit-state="danger"] > span:first-child { color: var(--red); }
.smart-multi[data-fit-state="good"] .multi-trigger { border-color: #67ad87; }
.smart-multi[data-fit-state="warning"] .multi-trigger { border-color: #d6a138; }
.smart-multi[data-fit-state="danger"] .multi-trigger { border-color: #d97d75; }

.subheading { margin: 20px 0 9px; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.included-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.included-item { min-height: 42px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border: 1px solid #cce2d5; border-radius: 6px; background: #f5fbf7; cursor: pointer; }
.included-item > span { display: flex; align-items: center; gap: 7px; color: var(--green-dark); font-size: 11px; }
.included-item svg { width: 14px; height: 14px; }
.included-item input { width: 15px; height: 15px; min-height: 0; accent-color: var(--red); }
.included-item small { color: var(--muted); font-size: 9px; }
.included-item:has(input:checked) { border-color: #efc1bc; background: var(--red-soft); }
.included-item:has(input:checked) > span { color: var(--red); text-decoration: line-through; }
.material-grid { display: grid; gap: 7px; }
.material-item { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.material-item > .check-field { min-height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 9px; cursor: pointer; }
.material-item > .check-field input { width: 17px; height: 17px; min-height: 0; accent-color: var(--green); }
.material-details { padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: #f7f9f8; border-top: 1px solid var(--border); }

.repeatable-wrap { padding: 0; }
.dynamic-position { margin-bottom: 10px; padding: 16px; border: 1px solid var(--border); border-radius: 7px; background: white; }
.dynamic-position-head { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.dynamic-position-head strong { font-size: 12px; }
.dynamic-position-head .icon-button { width: 32px; height: 32px; color: var(--red); }
.add-position { width: 100%; min-height: 48px; padding: 0 14px; border: 1px dashed #aabbb2; border-radius: 6px; background: #fafcfb; color: var(--green-dark); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 680; }
.add-position:hover { border-color: var(--green); background: var(--green-soft); }
.add-position svg { width: 16px; height: 16px; }
.add-position small { margin-left: 3px; color: var(--muted); font-weight: 480; }

.wizard-actions { min-height: 70px; padding: 13px 16px; display: flex; align-items: center; gap: 10px; justify-content: space-between; border-top: 1px solid var(--border); background: #fafcfb; border-radius: 0 0 8px 8px; }
.wizard-actions .button.primary { margin-left: auto; }
.preview-actions { margin-left: auto; display: flex; gap: 7px; }
.wizard-actions:has(.preview-actions) .button.primary { margin-left: 0; }
.save-draft-button { margin-left: 0; }
.draft-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.draft-state svg { width: 14px; height: 14px; color: var(--green); }
.offer-summary { position: sticky; top: 100px; padding: 17px; background: #1a2c24; color: white; border-radius: 8px; }
.summary-head { padding-bottom: 13px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.12); font-size: 11px; font-weight: 750; text-transform: uppercase; color: #b7c8bf; }
.summary-head svg { width: 16px; }
.summary-list { margin: 4px 0 0; }
.summary-list div { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.summary-list dt { color: #91a69b; font-size: 9px; text-transform: uppercase; }
.summary-list dd { margin: 4px 0 0; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.publish-switch { margin-top: 14px; padding: 11px; display: flex; gap: 9px; align-items: flex-start; background: rgba(255,255,255,.07); border-radius: 6px; cursor: pointer; }
.publish-switch input { width: 16px; height: 16px; min-height: 0; accent-color: #5fd397; }
.publish-switch span { display: flex; flex-direction: column; }
.publish-switch strong { color: #f3f8f5; font-size: 10px; opacity: 1; }
.publish-switch small { margin-top: 2px; color: #c5d3cc; font-size: 9px; opacity: 1; }

.review-block { min-height: 470px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.review-block > div:nth-child(2) { max-width: 590px; }
.review-block h3 { margin: 0 0 8px; font-size: 20px; }
.review-block p { margin: 0; color: var(--muted); line-height: 1.55; }
.review-mark { width: 54px; height: 54px; margin-bottom: 16px; display: grid; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 50%; }
.review-mark svg { width: 24px; height: 24px; }
#review-details { width: 100%; margin-top: 25px; }
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.review-grid > div { padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: #fafcfb; }
.review-grid span { color: var(--muted); display: block; font-size: 9px; text-transform: uppercase; }
.review-grid strong { margin-top: 4px; display: block; font-size: 11px; }
.confirmation-row { margin-top: 18px; padding: 12px 14px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 11px; }
.confirmation-row:has(input:checked) { border-color: #8bc4a6; background: #f2faf6; }
.field-invalid { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(180,35,24,.1) !important; }

.preview-dialog { width: min(1180px, calc(100vw - 28px)); height: min(860px, calc(100vh - 28px)); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 8px; background: #eef1ef; box-shadow: 0 22px 70px rgba(10,24,17,.28); overflow: hidden; }
.preview-dialog::backdrop { background: rgba(10,22,16,.62); }
.preview-dialog.fullscreen { width: 100vw; height: 100vh; margin: 0; border-radius: 0; }
#preview-dialog-content { height: 100%; }
.preview-shell { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.preview-toolbar { min-height: 72px; padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: white; border-bottom: 1px solid var(--border); }
.preview-toolbar h2 { margin: 3px 0 0; font-size: 18px; }
.preview-safe { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 9px; font-weight: 760; text-transform: uppercase; }
.preview-safe svg { width: 13px; height: 13px; }
.preview-toolbar-actions { display: flex; gap: 7px; }
.preview-controls { min-height: 54px; padding: 9px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #fafcfb; border-bottom: 1px solid var(--border); }
.preview-mode button { display: inline-flex; align-items: center; gap: 6px; }
.preview-mode svg { width: 14px; height: 14px; }
.preview-variant-label { padding: 6px 9px; color: var(--green-dark); background: var(--green-soft); border-radius: 4px; font-size: 10px; font-weight: 720; }
.preview-viewport { min-height: 0; padding: 24px; overflow: auto; }

.offer-document { width: min(820px, 100%); min-height: 1040px; margin: 0 auto; padding: 56px 62px 44px; background: white; box-shadow: 0 6px 24px rgba(20,38,29,.12); color: #202824; }
.document-letterhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 28px; border-bottom: 2px solid #18794b; }
.document-brand { display: flex; align-items: center; gap: 10px; }
.document-brand > span { width: 38px; height: 38px; display: grid; place-items: center; color: white; background: #18794b; font-size: 20px; font-weight: 820; }
.document-brand div, .document-meta, .document-address { display: flex; flex-direction: column; }
.document-brand strong { font-size: 16px; letter-spacing: 0; }
.document-brand small { color: #607069; font-size: 8px; }
.document-meta { align-items: flex-end; gap: 4px; color: #69756f; font-size: 9px; }
.document-meta strong { color: #18794b; font-size: 10px; }
.document-address { width: 48%; margin: 50px 0 42px; gap: 4px; font-size: 11px; line-height: 1.45; }
.document-address small { padding-bottom: 8px; border-bottom: 1px solid #d9e0dc; color: #76827c; font-size: 7px; }
.document-title > span { color: #18794b; font-size: 10px; font-weight: 760; text-transform: uppercase; }
.document-title h1 { margin: 5px 0 12px; font-size: 25px; }
.document-title p { margin: 0 0 28px; color: #56635d; font-size: 11px; line-height: 1.55; }
.document-lines { border-top: 1px solid #cfd8d3; }
.document-line { min-height: 58px; padding: 12px 7px; display: grid; grid-template-columns: minmax(0, 1fr) 100px 110px; gap: 15px; align-items: start; border-bottom: 1px solid #e4e8e6; font-size: 10px; }
.document-line > span, .document-line > strong:last-child { text-align: right; }
.document-line div > strong { display: block; font-size: 10px; }
.document-line p { margin: 5px 0 0; color: #6b7771; font-size: 8px; line-height: 1.45; white-space: pre-line; }
.document-line.document-head { min-height: 34px; padding-block: 9px; color: #69756f; background: #f4f7f5; font-size: 8px; font-weight: 760; text-transform: uppercase; }
.document-section-label { padding: 12px 7px 5px; color: #18794b; font-size: 8px; font-weight: 760; text-transform: uppercase; }
.document-totals { width: 310px; margin: 26px 0 0 auto; }
.document-totals div { padding: 7px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #66736c; font-size: 9px; }
.document-totals .document-total { margin-top: 5px; padding-top: 11px; border-top: 2px solid #18794b; color: #18231d; font-size: 12px; }
.document-footer { margin-top: 60px; padding-top: 18px; border-top: 1px solid #dfe5e2; }
.document-footer p { margin: 0 0 6px; font-size: 9px; }
.document-footer small { color: #7a8680; font-size: 8px; }

.calculation-preview { width: min(1040px, 100%); margin: 0 auto; }
.calculation-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.calculation-metrics article { min-height: 92px; padding: 15px; display: flex; flex-direction: column; justify-content: space-between; background: white; border: 1px solid var(--border); border-radius: 7px; }
.calculation-metrics span { color: var(--muted); font-size: 9px; font-weight: 720; text-transform: uppercase; }
.calculation-metrics strong { margin-top: 8px; font-size: 20px; }
.calculation-metrics article.profit { border-color: #a8d5bd; background: #f2faf6; }
.calculation-metrics article.profit strong { color: var(--green-dark); }
.calculation-metrics small { margin-top: 5px; color: var(--green); font-size: 9px; }
.calculation-metrics small.negative { color: var(--red); }
.calculation-table { background: white; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.calculation-row { min-height: 58px; padding: 10px 14px; display: grid; grid-template-columns: minmax(240px, 1fr) 130px 130px 130px; gap: 12px; align-items: center; border-bottom: 1px solid var(--border); font-size: 10px; }
.calculation-row:last-child { border-bottom: 0; }
.calculation-row > span, .calculation-row > strong:last-child { text-align: right; }
.calculation-row div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.calculation-row div > strong { font-size: 11px; }
.calculation-row small, .calculation-row em { color: var(--muted); font-size: 8px; font-style: normal; line-height: 1.35; }
.calculation-row.optional { background: #fafcfb; color: #68746e; }
.calculation-head { min-height: 38px; color: var(--muted); background: #f3f6f4; font-size: 8px; font-weight: 760; text-transform: uppercase; }
.material-calculation { margin-top: 12px; padding: 0 15px; background: white; border: 1px solid var(--border); border-radius: 7px; }
.material-calculation summary { padding: 14px 0; cursor: pointer; color: var(--green-dark); font-size: 10px; font-weight: 720; }
.material-calculation p { margin: 0; padding: 9px 0; display: grid; grid-template-columns: minmax(0, 1fr) 100px minmax(180px, 1fr); gap: 12px; border-top: 1px solid var(--border); font-size: 9px; }
.material-calculation p span { text-align: right; }
.material-calculation p small { color: var(--muted); }
.preview-warnings { margin-top: 12px; padding: 12px; background: var(--amber-soft); border: 1px solid #ead39b; border-radius: 7px; }
.preview-warnings p { margin: 5px 0; display: flex; gap: 7px; color: #6e4a08; font-size: 10px; }
.preview-warnings svg { width: 14px; height: 14px; flex: none; }

.offer-library { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #f4f6f5; }
.library-body { padding: 22px; overflow: auto; }
.library-section + .library-section { margin-top: 24px; }
.library-section-head { margin-bottom: 9px; display: flex; align-items: center; gap: 8px; }
.library-section-head h3 { margin: 0; font-size: 14px; }
.library-section-head span { min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 11px; background: #e5ebe8; color: var(--muted); font-size: 9px; }
.record-list { display: grid; gap: 7px; }
.record-row { min-height: 66px; padding: 10px 12px; display: grid; grid-template-columns: 35px minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 7px; background: white; }
.record-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 6px; color: var(--green); background: var(--green-soft); }
.record-icon svg { width: 17px; height: 17px; }
.record-row > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.record-row > div strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.record-row > div small { color: var(--muted); font-size: 9px; }
.record-type { padding: 5px 7px; border-radius: 4px; color: #52615a; background: #edf1ef; font-size: 8px; font-weight: 760; text-transform: uppercase; }
.record-type.created { color: var(--green-dark); background: var(--green-soft); }
.library-empty { padding: 22px; border: 1px dashed #b7c2bc; border-radius: 7px; color: var(--muted); text-align: center; font-size: 10px; }
.library-loading { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }

/* Lexware-nahe A4-Vorschau */
.offer-document { width: min(794px, 100%); min-height: 1123px; padding: 46px 74px 34px; color: #111; font-family: Arial, Helvetica, sans-serif; }
.document-letterhead { padding: 0; border: 0; align-items: flex-start; }
.document-letterhead img { width: 145px; height: 82px; object-fit: contain; object-position: left top; }
.document-letterhead address { display: flex; flex-direction: column; align-items: flex-end; font-size: 10px; line-height: 1.45; font-style: normal; }
.document-letterhead address strong { font-weight: 400; }
.document-recipient { min-height: 142px; margin-top: 35px; display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 30px; }
.document-address { width: auto; margin: 0; gap: 2px; font-size: 10px; }
.document-address small { margin-bottom: 13px; padding: 0; border: 0; color: #111; font-size: 7px; text-decoration: underline; }
.document-meta { margin: 0; align-items: stretch; color: #111; font-size: 10px; }
.document-meta div { display: grid; grid-template-columns: 92px 1fr; gap: 10px; }
.document-meta dt { text-align: right; }
.document-meta dd { margin: 0; text-align: right; }
.document-title h1 { margin: 0 0 9px; font-size: 17px; font-weight: 400; }
.document-title p { margin: 0 0 20px; color: #111; font-size: 10px; }
.document-lines { border: 1px solid #111; border-bottom: 0; }
.document-line { min-height: 45px; padding: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr) 62px 66px 70px 83px; gap: 0; border-bottom: 1px solid #111; font-size: 9px; }
.document-line > * { min-width: 0; padding: 8px 7px; border-right: 1px solid #111; text-align: right; }
.document-line > *:last-child { border-right: 0; }
.document-line > div { text-align: left; }
.document-line > div > strong { font-size: 9px; }
.document-line > span.document-position { text-align: center; }
.document-line p { margin: 4px 0 0; color: #111; font-size: 8px; line-height: 1.4; white-space: pre-line; }
.document-line em { display: block; margin-bottom: 3px; font-style: normal; font-weight: 400; }
.document-line.document-head { min-height: 30px; padding: 0; color: #111; background: #fafafa; font-size: 9px; text-transform: none; }
.document-line.document-head > * { display: flex; align-items: center; font-weight: 700; }
.document-line.document-head > *:not(:nth-child(2)) { justify-content: flex-end; }
.document-line.document-head > *:first-child { justify-content: center; }
.document-totals { width: 310px; margin: 0 0 0 auto; border: 1px solid #111; border-top: 0; }
.document-totals div { padding: 7px 9px; color: #111; font-size: 9px; }
.document-totals .document-total { margin: 0; padding: 10px 9px; border-top: 1px solid #111; font-size: 10px; }
.document-footer { margin-top: 18px; padding: 0; border: 0; }
.document-footer p { font-size: 9px; line-height: 1.45; }
.document-company-footer { margin-top: 48px; padding-top: 9px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-top: 1px solid #999; font-size: 7px; line-height: 1.35; }
.document-company-footer span + span { padding-left: 10px; border-left: 1px solid #999; }
.document-footer > small { display: block; margin-top: 9px; text-align: center; font-size: 7px; }

@media (max-width: 1050px) {
  .offer-layout { grid-template-columns: minmax(0, 1fr) 230px; }
  .price-row { grid-template-columns: minmax(120px, 1fr) 120px 120px 60px; }
}

@media (max-width: 860px) {
  .offer-layout { grid-template-columns: 1fr; }
  .offer-summary { position: static; order: -1; padding: 13px 16px; }
  .summary-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .publish-switch { max-width: 280px; }
  .offer-hero { align-items: flex-start; flex-direction: column; }
  .offer-hero-actions { width: 100%; flex-wrap: wrap; }
  .sync-chip { width: 100%; }
  .form-step small { display: none; }
  .calculation-metrics { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .offer-hero h2 { font-size: 21px; }
  .form-steps { gap: 2px; }
  .form-step { padding: 7px 5px; justify-content: center; }
  .form-step > div { display: none; }
  .form-step > span { width: 31px; height: 31px; }
  .form-group-block { padding: 21px 16px 24px; }
  .group-heading { margin-bottom: 18px; }
  .group-heading > div { gap: 9px; }
  .group-icon { width: 31px; height: 31px; }
  .smart-field-grid, .component-grid, .compact-costs, .active-costs, .included-grid, .material-details, .review-grid, .price-override-fields, .service-price-fields { grid-template-columns: 1fr; }
  .segment-options { width: 100%; min-width: 0; grid-auto-flow: row; grid-template-columns: 1fr; }
  .module-options { grid-template-columns: 1fr; }
  .module-option.reserve { grid-column: auto; }
  .module-option-specs { flex-wrap: wrap; }
  .price-table { overflow-x: auto; }
  .price-row { width: 650px; }
  .summary-list { grid-template-columns: 1fr 1fr; }
  .wizard-actions { flex-wrap: wrap; }
  .draft-state { order: 3; width: 100%; justify-content: center; }
  .wizard-actions .button { flex: 1; }
  .preview-actions { width: 100%; order: 3; display: grid; grid-template-columns: 1fr 1fr; }
  .wizard-actions:has(.preview-actions) .draft-state { order: 4; }
  .preview-dialog { width: 100vw; height: 100vh; margin: 0; border-radius: 0; }
  .preview-controls { align-items: stretch; flex-direction: column; }
  .preview-controls .segmented { width: 100%; }
  .preview-controls .segmented button { flex: 1; justify-content: center; }
  .preview-viewport { padding: 10px; }
  .offer-document { min-width: 700px; min-height: 980px; padding: 44px 48px; }
  .record-row { grid-template-columns: 35px minmax(0, 1fr) auto; }
  .record-row .record-type { display: none; }
  .record-row > .button { grid-column: 2; }
  .calculation-metrics { grid-template-columns: 1fr; }
  .calculation-table { overflow-x: auto; }
  .calculation-row { min-width: 760px; }
  .auto-badge { display: none; }
  .conditional-panel { padding: 14px 12px; }
  .select-popover, .multi-popover { position: fixed; left: 12px; right: 12px; top: 120px; max-height: calc(100vh - 150px); }
}
