.lisp-hub, .lisp-app { width: min(1280px, calc(100% - 40px)); margin: 0 auto; }
.lisp-page { min-width: 0; }
.lisp-tool-hero {
  width: min(1540px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 30px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 34px;
}
.lisp-tool-hero > div:first-child { max-width: 780px; }
.lisp-tool-hero .lisp-back-link {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px;
  color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 700;
}
.lisp-tool-hero .lisp-back-link:hover { color: var(--accent-strong); }
.lisp-tool-hero h1 { margin: 8px 0 12px; }
.lisp-tool-hero > div:first-child > p:last-child { margin: 0; color: var(--muted); line-height: 1.65; }
.lisp-hero-facts { display: flex; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.lisp-hero-facts span { min-width: 118px; padding: 16px 18px; border-left: 1px solid var(--line); }
.lisp-hero-facts span:first-child { border-left: 0; }
.lisp-hero-facts b, .lisp-hero-facts small { display: block; }
.lisp-hero-facts b { color: var(--accent-strong); font-size: 1.18rem; }
.lisp-hero-facts small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.lisp-hero { padding: 56px 0 28px; }
.lisp-kicker { margin: 0; color: var(--accent-strong); font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.lisp-hero h1, .lisp-side h1 { margin: 12px 0 16px; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.04em; line-height: 1.08; }
.lisp-side h1 { max-width: 20ch; font-size: clamp(2rem, 2.8vw, 2.75rem); line-height: 1.06; letter-spacing: -.035em; text-wrap: balance; }
.lisp-hero p, .lisp-side p, .lisp-grid p, .lisp-note { color: var(--muted); line-height: 1.65; max-width: 46rem; }
/* Kicker text is a small interface label, so it stays solid blue rather than using the display-title gradient. */
.lisp-hero .lisp-kicker, .lisp-side .lisp-kicker { color: var(--accent-strong); }
.lisp-facts { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); width: fit-content; margin-top: 28px; }
.lisp-facts span { background: var(--surface); padding: 16px 22px; min-width: 140px; }
.lisp-facts b, .lisp-facts small { display: block; }
.lisp-facts b { color: var(--accent-strong); font-size: 1.4rem; }
.lisp-facts small { color: var(--muted); margin-top: 4px; }
.lisp-grid { display: grid; gap: 18px; padding: 20px 0 80px; }
@media (min-width: 800px) { .lisp-grid { grid-template-columns: 1fr 1fr; } }
.lisp-grid article { padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.lisp-grid span { color: var(--accent-strong); font-weight: 800; }
.lisp-grid h2 { margin: 10px 0; font-size: 1.5rem; }
.lisp-grid a, .lisp-side a { color: var(--accent-strong); font-weight: 700; }
.lisp-price { margin-top: 18px; font-size: .9rem; color: var(--muted); }
.lisp-price b { color: var(--text); }
.lisp-app { display: grid; gap: 28px; padding: 28px 0 80px; align-items: start; }
@media (min-width: 1100px) { .lisp-app { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); } }
.ladder-approval-page .lisp-app { width: min(1540px, calc(100% - 32px)); }
.stair-approval-page .lisp-app { width: min(1540px, calc(100% - 32px)); }
@media (min-width: 1180px) { .ladder-approval-page .lisp-app { grid-template-columns: minmax(0, 470px) minmax(0, 1fr); } }
@media (min-width: 1180px) { .stair-approval-page .lisp-app { grid-template-columns: minmax(0, 470px) minmax(0, 1fr); } }
.lisp-side, .lisp-work { min-width: 0; }
.lisp-side { display: grid; align-content: start; gap: 12px; position: relative; z-index: 1; }
.lisp-form { display: grid; gap: 16px; min-width: 0; }
.lisp-form *, .lisp-form { box-sizing: border-box; }
/* Fieldsets default to min-width: min-content, which lets number inputs overflow the next panel. */
.lisp-form fieldset {
  display: grid; gap: 10px; min-width: 0; width: 100%; margin: 0;
  border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 14px; background: var(--surface);
}
.lisp-form legend {
  float: none; width: auto; margin: 0; padding: 0 8px; line-height: 1.2;
  color: var(--accent-strong); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.lisp-form label { display: grid; gap: 5px; min-width: 0; font-size: .8rem; font-weight: 650; color: var(--muted); }
.lisp-form input, .lisp-form select {
  width: 100%; max-width: 100%; min-width: 0; min-height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text);
}
.lisp-pair, .lisp-triple { display: grid; gap: 10px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) {
  .lisp-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lisp-triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.lisp-field-help { margin: 8px 0 0 !important; font-size: .76rem; line-height: 1.45 !important; }
.lisp-settings { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: clip; }
.lisp-settings summary { padding: 15px; color: var(--accent-strong); cursor: pointer; font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.lisp-settings-body { display: grid; gap: 10px; padding: 0 14px 14px; }
.ladder-approval-page .lisp-settings > summary, .stair-approval-page .lisp-settings > summary { text-transform: none; font-size: 14px; font-weight: 650; letter-spacing: 0; }
.ladder-approval-page .lisp-form legend, .stair-approval-page .lisp-form legend { text-transform: none; font-size: 14px; font-weight: 650; letter-spacing: 0; }
.designer-approval-note { color: var(--text) !important; font-size: 13px; font-weight: 600; line-height: 1.55; }
[data-ladder-hidden="true"] { display: none !important; }
.lisp-actions { display: grid; gap: 8px; }
.lisp-actions button, .primary-action {
  min-height: 46px; padding: 0 16px; border: 0; border-radius: 12px; font-weight: 750; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.lisp-actions .preview, .primary-action { background: linear-gradient(135deg, #0b57d0, #1a73e8); color: #fff; box-shadow: 0 10px 24px rgba(26, 115, 232, .18); }
.lisp-actions .pay { background: var(--text); color: var(--surface); }
.lisp-actions .pay[disabled] { opacity: .45; cursor: not-allowed; }
.lisp-work { display: grid; gap: 14px; align-content: start; min-width: 0; overflow: hidden; position: relative; z-index: 0; }
@media (min-width: 1100px) {
  .lisp-work {
    position: sticky;
    top: calc(var(--header-height) + 16px);
    max-height: calc(100dvh - var(--header-height) - 32px);
    overflow: auto;
  }
}
.ladder-approval-page .lisp-work {
  max-height: none; overflow: visible; padding: 16px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow);
}
.stair-approval-page .lisp-work {
  max-height: none; overflow: visible; padding: 16px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow);
}
.ladder-approval-page .lisp-preview {
  min-height: 360px; height: clamp(360px, calc(100dvh - var(--header-height) - 250px), 660px); max-height: none;
}
.stair-approval-page .lisp-preview {
  min-height: 360px; height: clamp(360px, calc(100dvh - var(--header-height) - 250px), 660px); max-height: none;
}
.lisp-drawing-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.lisp-drawing-tabs[hidden] { display: none; }
.lisp-drawing-tabs button {
  display: grid; gap: 2px; flex: 1 1 160px; min-width: 0; padding: 10px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer;
}
.lisp-drawing-tabs button[aria-selected="true"] {
  border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent);
}
.lisp-drawing-tabs span { font-weight: 750; }
.lisp-drawing-tabs small { color: var(--muted); }
.lisp-preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lisp-preview-toolbar b, .lisp-preview-toolbar span { display: block; }
.lisp-preview-toolbar span { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.lisp-preview-bg { display: grid; gap: 5px; margin: 0; color: var(--muted); font-size: .74rem; font-weight: 700; }
.lisp-preview-bg select {
  min-height: 36px; min-width: 140px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--text);
}
.lisp-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.lisp-metrics div { padding: 14px; border-radius: 14px; background: var(--accent-soft); }
.lisp-metrics span { display: block; color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.lisp-metrics b { font-size: 1.05rem; }
.lisp-metrics small { display: block; color: var(--muted); font-weight: 500; font-size: .78rem; margin-top: 3px; }
.lisp-work .cad-preview-footer { min-height: 20px; }
/* Preview stays letterboxed: millimetre SVGs fit the pane and cannot be zoomed to 1:1. */
.lisp-preview {
  position: relative; isolation: isolate; contain: size layout paint;
  width: 100%; min-width: 0; box-sizing: border-box;
  min-height: 280px; height: min(68vh, 720px); max-height: calc(100dvh - var(--header-height) - 180px);
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); overflow: hidden;
  display: grid; place-items: center; padding: 8px;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.lisp-preview[data-bg="paper"] { background: #efece4; }
.lisp-preview[data-bg="gray"] { background: #d5d8de; }
.lisp-preview[data-bg="dark"] { background: #2a3140; }
.lisp-preview[data-bg="theme"],
.lisp-preview:not([data-bg]) { background: var(--surface-2); }
.lisp-preview > * { max-width: 100%; max-height: 100%; pointer-events: none; }
.lisp-preview .cad-preview-empty { max-width: 320px; }
.lisp-preview svg {
  display: block; margin: 0 auto; box-sizing: border-box;
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  background: #fff; box-shadow: none;
}
@media print {
  .lisp-preview, .lisp-preview * { display: none !important; }
  .lisp-print-block {
    display: block !important; padding: 28px; border: 1px dashed var(--line); border-radius: 14px;
    color: var(--text); font-size: 1rem;
  }
}
.lisp-print-block { display: none; }
.lisp-status { color: var(--muted); font-size: .88rem; }
.lisp-status.error { color: #b4233c; }
.lisp-notes { margin: 0; padding-left: 18px; color: var(--muted); }
html[data-theme="dark"] .lisp-actions .pay { background: var(--accent-strong); color: #0a1020; }
@media (max-width: 1099px) {
  .lisp-app, .ladder-approval-page .lisp-app, .stair-approval-page .lisp-app { grid-template-columns: 1fr; width: min(1280px, calc(100% - 24px)); }
  .lisp-tool-hero { width: min(1280px, calc(100% - 24px)); }
  .lisp-work { order: -1; position: static; max-height: none; overflow: visible; }
  .lisp-preview { height: min(52vh, 480px); max-height: 52vh; }
  .ladder-approval-page .lisp-preview { min-height: 280px; height: min(52vh, 480px); max-height: 52vh; }
  .stair-approval-page .lisp-preview { min-height: 280px; height: min(52vh, 480px); max-height: 52vh; }
}
@media (max-width: 700px) {
  .lisp-hero { padding-top: 36px; }
  .lisp-tool-hero { display: grid; padding-top: 20px; }
  .lisp-hero-facts { width: 100%; }
  .lisp-hero-facts span { flex: 1 1 0; min-width: 0; padding: 13px 10px; }
  .lisp-side h1 { max-width: none; }
  .lisp-preview { min-height: 200px; height: min(46vh, 360px); padding: 8px; }
  .ladder-approval-page .lisp-work { padding: 12px; border-radius: 16px; }
  .stair-approval-page .lisp-work { padding: 12px; border-radius: 16px; }
  .ladder-approval-page .lisp-preview { min-height: 220px; height: min(44vh, 340px); max-height: 44vh; }
  .stair-approval-page .lisp-preview { min-height: 220px; height: min(44vh, 340px); max-height: 44vh; }
  .lisp-preview-toolbar { flex-wrap: wrap; }
  .lisp-metrics { grid-template-columns: 1fr 1fr; }
}
