  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --navy:        #1B2D3E;
    --navy-hover:  #243D52;
    --brass:       #B5893A;
    --brass-light: #F5EDD8;
    --brass-hover: #9A7230;
    --bg:          #EFECE7;
    --white:       #FFFFFF;
    --card-bg:     #FAFAF8;
    --border:      rgba(0,0,0,0.10);
    --border-light:rgba(0,0,0,0.06);
    --text:        #1A1A1A;
    --text-mid:    #555;
    --text-light:  #717171;
    --danger:      #C0392B;
    --danger-hover:#A93226;
    --success:     #2E7D52;
    --success-bg:  #EBF5EE;
    --warning-bg:  #FDF6E3;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.05);
    --shadow-lift: 0 4px 12px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.05);
    --radius:      8px;
  }

  body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }

  /* ── HEADER ── */
  .app-header {
    background: var(--navy);
    color: white;
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }
  .app-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .app-header-logo {
    display: flex;
    align-items: center;
  }
  .app-header-logo img {
    height: 40px;
    width: 40px;
    display: block;
    border-radius: 6px;
  }
  .app-header-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.15);
  }
  .app-header h1 {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: rgba(255,255,255,0.85);
  }
  .app-header .subtitle { display: none; }

  /* ── LAYOUT ── */
  .container {
    max-width: 1460px;
    margin: 0 auto;
    padding: 24px 24px 48px;
  }
  .workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-areas: "main rail";
    gap: 20px;
    align-items: start;
  }
  .workspace-main {
    grid-area: main;
    min-width: 0;
    display: grid;
    gap: 0;
  }
  .workspace-rail {
    grid-area: rail;
    position: sticky;
    top: 80px;
    min-width: 0;
    align-self: start;
    max-height: calc(100vh - 104px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .workflow-stage {
    display: grid;
    gap: 12px;
  }
  /* Stage separators — visual division between workflow steps */
  .workflow-stage {
    padding-top: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
  }
  .workflow-stage:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .workflow-stage:first-child {
    padding-top: 0;
  }
  .workflow-stage-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 2px 4px 0;
  }
  .workflow-stage-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    min-height: 28px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(181,137,58,0.12);
    color: var(--brass-hover);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
  }
  .workflow-stage-title {
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--navy);
    margin: 0;
  }
  .workflow-stage-copy {
    margin-top: 6px;
    max-width: 680px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-mid);
  }
  .workflow-stage-grid {
    display: grid;
    gap: 14px;
  }
  .workflow-stage-grid-2 {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    align-items: start;
  }
  .workflow-stage-grid-2 > * {
    min-width: 0;
  }
  .source-workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
  }
  .source-intake-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
    gap: 14px;
    align-items: start;
  }
  .source-tool {
    display: grid;
    gap: 12px;
    overflow: hidden;
    min-width: 0;
  }
  .source-tool-wide {
    grid-column: 1 / -1;
  }
  .source-tool-copy {
    margin-top: -6px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-mid);
  }
  #pdf-import-section #import-inputs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  /* Hide invoice paste panel inside Render Packet — #pdf-import-section is renamed by JS so use stable parent */
  #pdf-import-section .invoice-paste-panel,
  .source-workspace .invoice-paste-panel {
    display: none;
  }
  .invoice-paste-panel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }
  .import-stage-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
  }
  .import-stage-note {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(245, 237, 216, 0.56);
    border: 1px solid rgba(181,137,58,0.14);
  }
  .import-stage-note strong {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--navy);
  }
  .import-stage-note span {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-mid);
  }
  /* .commercial-layout removed — unused dead CSS from prior restructure */
  .commercial-stage-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    align-items: start;
  }
  .commercial-main-stack {
    display: grid;
    gap: 14px;
    align-content: start;
    min-width: 0;
  }
  .commercial-side-stack {
    display: grid;
    gap: 14px;
    align-content: start;
    min-width: 0;
  }
  .commercial-metrics {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .commercial-section {
    background: rgba(255,255,255,0.8);
    box-shadow: none;
    border: 1px solid rgba(0,0,0,0.06);
    height: auto;
  }
  /* Higher specificity needed to beat .form-section { margin-bottom: 12px } */
  .form-section.commercial-section,
  .form-section.commercial-metrics,
  .form-section.source-tool {
    margin-bottom: 0;
  }
  .commercial-section h2 {
    margin-bottom: 12px;
  }
  .commercial-section .hint {
    font-size: 10.5px;
  }
  .workflow-stage-grid > .form-section,
  .workflow-stage > .form-section {
    margin-bottom: 0;
  }
  .workflow-stage-span {
    grid-column: 1 / -1;
  }
  .rail-stack {
    display: grid;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
    padding-bottom: 2px;
  }
  .rail-card {
    background: linear-gradient(180deg, #fcfbf8 0%, #f7f3ec 100%);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    padding: 12px;
  }
  .rail-card-accent {
    background: linear-gradient(180deg, #132638 0%, #1d3650 100%);
    color: white;
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 14px 32px rgba(18,38,58,0.2);
  }
  .rail-card-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
  }
  .rail-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 6px;
  }
  .rail-card-accent .rail-kicker {
    color: rgba(255,255,255,0.56);
  }
  .rail-card h3 {
    font-size: 15px;
    line-height: 1.15;
    color: var(--navy);
  }
  .rail-card-accent h3 {
    color: white;
  }
  .rail-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: var(--brass-light);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .rail-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }
  .rail-summary-item {
    display: grid;
    gap: 4px;
    padding: 8px 9px;
    border-radius: 10px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.08);
  }
  .rail-summary-item span,
  .rail-meta-row span {
    font-size: 10px;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.52);
  }
  .rail-summary-item strong {
    font-size: 14px;
    line-height: 1.25;
    color: white;
  }
  .rail-meta-list {
    display: grid;
    gap: 4px;
  }
  .rail-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .rail-meta-row strong {
    font-size: 11px;
    line-height: 1.4;
    text-align: right;
    color: white;
  }
  .rail-link-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
  }
  .rail-link-list a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 7px 9px;
    border-radius: 10px;
    background: white;
    border: 1px solid rgba(0,0,0,0.06);
    color: var(--navy);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
  }
  .rail-link-list a:hover {
    border-color: rgba(27,45,62,0.16);
    background: rgba(27,45,62,0.03);
  }
  .rail-note {
    margin-top: 8px;
    font-size: 10px;
    line-height: 1.45;
    color: var(--text-mid);
  }

  /* ── SECTIONS ── */
  .form-section {
    background: var(--white);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    padding: 16px 18px;
    margin-bottom: 12px;
    min-width: 0;
  }
  .form-section h2 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: var(--text-light);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .form-section h2::before {
    content: '';
    display: block;
    width: 3px;
    height: 14px;
    background: var(--brass);
    border-radius: 2px;
    flex-shrink: 0;
  }
  .room-builder-shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }
  .room-builder-nav {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fcfaf6 0%, #f7f1e7 100%);
    border: 1px solid rgba(0,0,0,0.06);
  }
  .room-builder-nav-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
  }
  .room-builder-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 4px;
  }
  .room-builder-nav h3 {
    font-size: 18px;
    line-height: 1.15;
    color: var(--navy);
  }
  .room-builder-note {
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-mid);
  }
  .room-builder-empty {
    padding: 12px;
    border-radius: 10px;
    border: 1px dashed rgba(27,45,62,0.2);
    background: rgba(255,255,255,0.68);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-mid);
  }
  .room-builder-list {
    display: grid;
    gap: 8px;
  }
  .room-list-item {
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.9);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  }
  .room-list-item:hover {
    border-color: rgba(27,45,62,0.18);
    box-shadow: 0 8px 20px rgba(18,38,58,0.08);
    transform: translateY(-1px);
  }
  .room-list-item.is-active {
    border-color: rgba(181,137,58,0.45);
    background: #fff;
    box-shadow: 0 10px 24px rgba(18,38,58,0.08);
  }
  .room-list-order {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-light);
  }
  .room-list-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--navy);
  }
  .room-list-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: var(--text-mid);
  }
  .room-list-status {
    display: inline-flex;
    align-items: center;
    align-self: start;
    min-height: 22px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
  }
  .room-list-status[data-tone="ready"] {
    background: rgba(46,125,82,0.12);
    color: var(--success);
  }
  .room-list-status[data-tone="warning"] {
    background: rgba(198,138,43,0.12);
    color: #9a6b11;
  }
  .room-builder-editor {
    min-width: 0;
  }

  /* ── FORM ELEMENTS ── */
  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }
  .form-row.single  { grid-template-columns: 1fr; }
  .form-row.triple  { grid-template-columns: 1fr 1fr 1fr; }
  .form-row.quad    { grid-template-columns: 1fr 1fr 1fr 1fr; }
  /* Prevent grid items from overflowing their columns */
  .form-row > * { min-width: 0; }

  .field {
    display: flex;
    flex-direction: column;
  }
  .field label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-light);
    margin-bottom: 5px;
  }
  .field input,
  .field select,
  .field textarea {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .field input:focus,
  .field select:focus,
  .field textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(27,45,62,0.08);
    background: var(--white);
  }
  .field textarea {
    resize: vertical;
    min-height: 72px;
    line-height: 1.5;
  }
  .field input.input-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(185,28,28,0.08);
  }
  .field-error-hint {
    font-size: 11px;
    color: var(--danger);
    margin-top: 3px;
    display: none;
  }
  .field .hint {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
  }

  /* ── BUTTONS ── */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    letter-spacing: 0.1px;
  }
  .btn:active { transform: scale(0.98); }
  .btn:disabled { opacity: 0.45; cursor: not-allowed; }
  .btn-primary {
    background: var(--navy);
    color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  }
  .btn-primary:hover:not(:disabled) {
    background: var(--navy-hover);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  }
  .btn-secondary {
    background: var(--white);
    color: var(--text-mid);
    border: 1px solid var(--border);
  }
  .btn-secondary:hover:not(:disabled) {
    background: var(--card-bg);
    color: var(--text);
  }
  .btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(192,57,43,0.3);
    padding: 6px 12px;
    font-size: 12px;
  }
  .btn-danger:hover:not(:disabled) { background: #fdf0ef; }
  .btn-small { padding: 6px 12px; font-size: 12px; }
  .btn-add {
    background: transparent;
    color: var(--navy);
    border: 1px dashed rgba(27,45,62,0.35);
    padding: 7px 14px;
    font-size: 12px;
  }
  .btn-add:hover:not(:disabled) {
    background: rgba(27,45,62,0.04);
    border-color: var(--navy);
  }

  /* ── CLOSET ENTRY ── */
  .closet-entry {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 0;
    background: var(--card-bg);
    position: relative;
    border-left: 3px solid var(--navy);
    transition: box-shadow 0.2s;
    display: none;
  }
  .closet-entry.is-room-active { display: block; }
  .closet-entry:hover { box-shadow: var(--shadow-lift); }
  .closet-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
  }
  .closet-entry-header h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 0.2px;
  }
  .closet-entry-controls { display: flex; gap: 4px; align-items: center; }
  .move-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--white);
    color: var(--text-mid);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    padding: 0;
  }
  .move-btn:hover { border-color: var(--navy); color: var(--navy); }
  .move-btn:disabled { opacity: 0.2; cursor: default; border-color: var(--border); color: var(--text-light); }

  /* ── DRAG HANDLE ── */
  .drag-handle {
    display: flex;
    align-items: center;
    padding: 4px 6px 4px 2px;
    color: var(--text-light);
    cursor: grab;
    opacity: 0.35;
    transition: opacity 0.15s;
    flex-shrink: 0;
    touch-action: none;
    user-select: none;
  }
  .drag-handle:hover { opacity: 0.8; }
  .drag-handle:active { cursor: grabbing; opacity: 1; }

  .closet-entry.is-dragging {
    opacity: 0.4;
    box-shadow: 0 12px 28px rgba(0,0,0,0.15);
  }
  .closet-entry.drop-before { border-top: 2px solid var(--brass) !important; }
  .closet-entry.drop-after  { border-bottom: 2px solid var(--brass) !important; }
  .closet-entry.is-dragging {
    transform: scale(0.97);
  }
  .drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.85;
    background: var(--white);
    border: 2px solid var(--brass);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── COLLAPSE/EXPAND ── */
  .closet-entry-body { transition: max-height 0.3s ease, opacity 0.2s ease; overflow: hidden; }
  .closet-entry-body.collapsed { max-height: 0; opacity: 0; padding: 0; margin: 0; }
  .collapse-toggle {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    transition: transform 0.2s;
    line-height: 1;
  }
  .collapse-toggle.collapsed { transform: rotate(-90deg); }

  /* ── SUB-PRICES ── */
  .sub-prices-container {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 6px;
  }
  .sub-price-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 7px;
  }
  .sub-price-row input {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    background: var(--card-bg);
    transition: border-color 0.15s;
  }
  .sub-price-row input:focus { outline: none; border-color: var(--navy); }
  .sub-price-row .sub-name { flex: 2; }
  .sub-price-row .sub-amt  { flex: 1; max-width: 130px; }
  .btn-remove-inline {
    background: transparent; border: none; color: var(--text-light);
    cursor: pointer; font-size: 17px; padding: 3px 7px; line-height: 1;
    transition: color 0.1s;
  }
  .btn-remove-inline:hover { color: var(--danger); }

  /* ── HIGHLIGHTS ── */
  .highlights-container { margin-top: 10px; }
  .highlight-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 7px;
  }
  .highlight-row input {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    background: var(--card-bg);
    transition: border-color 0.15s;
  }
  .highlight-row input:focus { outline: none; border-color: var(--navy); }
  .highlight-row .hl-title { flex: 1; }
  .highlight-row .hl-desc  { flex: 2; }

  /* ── AUTO-FILL BUTTON ── */
  .btn-autofill {
    background: none;
    border: 1px solid var(--brass);
    color: var(--brass);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.8;
  }
  .btn-autofill:hover { background: var(--brass); color: #fff; }

  /* ── RENDER UPLOADS ── */
  .render-upload-area { margin-top: 10px; }
  .render-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-size: 13px;
  }
  .render-drop-zone:hover, .render-drop-zone.dragover {
    border-color: var(--navy);
    background: rgba(27,45,62,0.03);
  }
  .render-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
  }
  .render-preview {
    position: relative;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    overflow: hidden;
    background: #F0EDE8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  }
  .render-preview img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
  }
  .render-preview .render-meta { padding: 5px 7px; }
  .render-preview .render-meta input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    color: var(--text-mid);
    background: var(--card-bg);
  }
  .render-preview .render-meta input:focus { outline: none; border-color: var(--navy); }
  .render-preview .render-remove {
    position: absolute;
    top: 5px; right: 5px;
    width: 22px; height: 22px;
    background: rgba(0,0,0,0.55);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s;
  }
  .render-preview .render-remove:hover { background: var(--danger); }

  /* ── ACTIONS BAR ── */
  .actions-bar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-card);
    margin-top: 8px;
  }
  .actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .actions-group-secondary .btn {
    flex: 1;
  }
  .actions-group-primary .btn {
    flex: 1;
  }
  .actions-bar .btn {
    min-height: 38px;
    padding: 0 16px;
  }

  /* ── STATUS DISPLAY ── */
  .status-box {
    margin-top: 14px;
    padding: 14px 18px;
    border-radius: 6px;
    display: none;
    position: relative;
    z-index: 91;
  }
  .status-box.show { display: block; }
  .status-box.success { background: var(--success-bg); border: 1px solid #A3D9B1; animation: successPulse 0.4s ease; }
  .status-box.error   { background: #FDF0EF; border: 1px solid #E6A8A1; color: var(--danger); }
  .status-box .url-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
  }
  .status-box .url-row input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 13px;
    font-family: 'DM Mono', monospace;
    background: var(--white);
    color: var(--text);
  }

  /* ── TOAST ── */
  .toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--navy);
    color: white;
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 1000;
    transform: translateY(60px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  }
  .toast.show { transform: translateY(0); opacity: 1; }

  /* ── LOADING OVERLAY ── */
  .loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(239,236,231,0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
  }
  .loading-overlay.show { display: flex; }
  .spinner {
    width: 22px; height: 22px;
    border: 2.5px solid var(--border);
    border-top-color: var(--brass);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 12px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── QUICK PREVIEW ── */
  .preview-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
  }
  .preview-modal-backdrop.open { display: block; }
  .preview-modal {
    position: fixed;
    top: 3vh;
    left: 50%;
    transform: translateX(-50%);
    width: 90vw;
    max-width: 860px;
    height: 94vh;
    background: white;
    border-radius: 10px;
    z-index: 501;
    display: none;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
    overflow: hidden;
  }
.preview-modal.open { display: flex; }
.send-modal {
  max-width: 1180px;
  height: min(90vh, 860px);
}
.preview-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
    padding: 12px 18px;
    background: var(--navy);
    color: white;
    flex-shrink: 0;
  }
.preview-modal-header h3 {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
}
.send-header-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-top: 4px;
}
.preview-modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
  }
  .preview-modal-close:hover { color: white; }
  .preview-modal iframe {
    flex: 1;
    border: none;
    width: 100%;
  }
.dialog-modal-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}
.dialog-note {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.5;
}
.send-modal-body {
  padding: 0;
  overflow: hidden;
}
.send-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  min-height: 0;
  flex: 1;
}
.send-compose-panel {
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  background: linear-gradient(180deg, #ffffff 0%, #fbf9f4 100%);
}
.send-preview-panel {
  border-left: 1px solid var(--border-light);
  background:
    radial-gradient(circle at top right, rgba(176,141,87,0.14), transparent 38%),
    linear-gradient(180deg, #f8f4ed 0%, #f2ece2 100%);
  padding: 24px;
  overflow: auto;
}
.send-summary-card {
  border: 1px solid rgba(18,38,58,0.08);
  border-radius: 16px;
  padding: 16px 18px;
  background: rgba(18,38,58,0.03);
}
.send-summary-kicker,
.send-preview-kicker {
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-light);
  font-weight: 700;
}
.send-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 12px;
}
.send-summary-item {
  display: grid;
  gap: 4px;
}
.send-summary-label {
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.send-summary-item strong {
  font-size: 14px;
  color: var(--navy);
  line-height: 1.4;
}
.send-message-row {
  flex: 1;
  min-height: 260px;
}
.send-message-field {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.send-message-field textarea {
  min-height: 280px;
  flex: 1;
  resize: vertical;
}
.send-preview-shell {
  display: grid;
  gap: 14px;
}
.send-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.send-preview-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18,38,58,0.08);
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.send-preview-card {
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(18,38,58,0.14);
  border: 1px solid rgba(18,38,58,0.08);
  background: #fff;
}
.send-preview-brand {
  background: linear-gradient(135deg, #12263a 0%, #1d3550 100%);
  color: #f7f3ec;
  padding: 24px 24px 22px;
  display: grid;
  gap: 10px;
}
.send-preview-brand span {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.75;
}
.send-preview-brand strong {
  font-size: 28px;
  line-height: 1.08;
  font-weight: 700;
}
.send-preview-brand p {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(247,243,236,0.82);
}
.send-preview-body {
  padding: 22px 24px;
  display: grid;
  gap: 16px;
  background: #fff;
}
.send-preview-greeting,
.send-preview-copy {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
}
.send-preview-total {
  border: 1px solid rgba(176,141,87,0.18);
  background: linear-gradient(180deg, #fbf8f1 0%, #f7f2e7 100%);
  border-radius: 18px;
  padding: 18px 18px 16px;
  display: grid;
  gap: 6px;
}
.send-preview-total span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7f7467;
}
.send-preview-total strong {
  font-size: 30px;
  line-height: 1.05;
  color: var(--navy);
  font-weight: 700;
}
.send-preview-total em {
  font-size: 13px;
  color: #5d5449;
  font-style: normal;
}
.send-preview-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border-radius: 999px;
  background: var(--brass);
  color: white;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
}
.send-preview-link {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-light);
  word-break: break-word;
}
.send-preview-footer {
  padding: 16px 24px 18px;
  border-top: 1px solid var(--border-light);
  background: #fcfaf6;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #5d5449;
}
.send-preview-footer span:first-child {
  font-weight: 700;
  color: var(--navy);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
  }
  .dialog-actions.spread {
    justify-content: space-between;
  }
  .revision-list {
    display: grid;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
  }
  .revision-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--card-bg);
    display: grid;
    gap: 8px;
  }
  .revision-card.active {
    border-color: var(--brass);
    box-shadow: 0 0 0 1px rgba(181,137,58,0.18);
  }
  .revision-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .revision-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
  }
  .revision-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: var(--text-light);
  }
  .revision-compare {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    background: var(--card-bg);
    display: grid;
    gap: 10px;
  }
  .revision-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .revision-compare-card {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    background: var(--white);
  }
  .revision-compare-card h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-light);
    margin-bottom: 8px;
  }
  .revision-compare-card p {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
  }
  .revision-delta-list {
    display: grid;
    gap: 8px;
  }
  .revision-delta-item {
    font-size: 12px;
    color: var(--text-mid);
  }
.action-status {
  font-size: 12px;
  color: var(--text-light);
}
@media (max-width: 1024px) {
  .send-modal {
    width: 94vw;
    height: min(92vh, 920px);
  }
  .send-modal-grid {
    grid-template-columns: 1fr;
  }
  .send-preview-panel {
    border-left: none;
    border-top: 1px solid var(--border-light);
  }
}
@media (max-width: 640px) {
  .send-summary-grid {
    grid-template-columns: 1fr;
  }
  .send-compose-panel,
  .send-preview-panel {
    padding: 18px 16px;
  }
  .send-preview-brand strong {
    font-size: 24px;
  }
}
  .intel-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
  }
  .intel-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--card-bg);
  }
  .intel-item strong {
    display: block;
    font-size: 11px;
    margin-bottom: 3px;
    color: var(--text);
  }
  .intel-item span {
    font-size: 11px;
    color: var(--text-mid);
    line-height: 1.42;
  }
  .intel-item.warning { border-color: rgba(192,57,43,0.28); }
  .intel-item.good { border-color: rgba(46,125,82,0.28); }
  .rail-card-readiness {
    border-color: rgba(27,45,62,0.12);
  }
  .readiness-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
  }
  .readiness-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .readiness-column-known .readiness-list,
  .readiness-column-missing .readiness-list {
    gap: 6px;
  }
  .readiness-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 700;
  }
  .readiness-list {
    display: grid;
    gap: 6px;
  }
  .readiness-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 9px;
    background: rgba(255,255,255,0.8);
    border: 1px solid var(--border);
    font-size: 10px;
    line-height: 1.36;
    color: var(--text);
  }
  .readiness-more {
    padding-left: 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light);
  }
  .readiness-item strong {
    display: block;
    font-size: 10px;
    margin-bottom: 1px;
  }
  .readiness-item::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    margin-top: 4px;
    background: var(--success);
    flex: 0 0 auto;
  }
  .readiness-list-missing .readiness-item::before {
    background: #C68A2B;
  }
  .readiness-list-missing .readiness-item {
    background: rgba(198,138,43,0.08);
    border-color: rgba(198,138,43,0.2);
  }
  .margin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 12px;
  }
  .margin-table th,
  .margin-table td {
    padding: 8px 8px 8px 0;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }
  .margin-table td:last-child,
  .margin-table th:last-child {
    text-align: right;
    padding-right: 0;
  }
  .margin-bad {
    color: var(--danger);
    font-weight: 700;
  }
  .margin-ok {
    color: var(--success);
    font-weight: 700;
  }

  /* ── RESPONSIVE ── */
  @media (max-width: 1220px) {
    .workspace-grid {
      grid-template-columns: 1fr;
      grid-template-areas: "rail" "main";
      gap: 16px;
    }
    .workspace-rail {
      position: static;
      order: -1;
      max-height: none;
      overflow: visible;
      display: block;
    }
    .rail-stack {
      overflow-y: visible;
    }
    .commercial-stage-shell {
      grid-template-columns: 1fr;
    }
    .commercial-metrics {
      grid-column: 1;
    }
    .rail-summary-grid { grid-template-columns: 1fr 1fr; }
    .rail-link-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .workflow-stage-grid-2,
    .source-workspace,
    .source-intake-grid,
    .room-builder-shell { grid-template-columns: 1fr; }
  }
  @media (max-width: 860px) {
    .container { padding: 18px 18px 110px; }
  }
  @media (max-width: 680px) {
    .container { padding: 14px 14px 80px; }
    .rail-summary-grid { grid-template-columns: 1fr 1fr; }
    .rail-link-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-section { padding: 16px; }
    .form-row, .form-row.triple, .form-row.quad { grid-template-columns: 1fr; }
    .closet-entry { padding: 14px 16px; }
    .actions-bar .btn {
      min-height: 40px;
      padding: 10px 10px;
      font-size: 13px;
    }
    .closet-section-footer { align-items: flex-start; }
    .workflow-stage-head { grid-template-columns: 1fr; gap: 10px; }
    .workflow-stage-title { font-size: 23px; }
    .workflow-stage-copy { font-size: 13px; }
    .commercial-stage-shell,
    .commercial-main-stack,
    .commercial-side-stack { gap: 12px; }
  }

  /* ── PDF IMPORT ── */
  .pdf-drop-zone {
    border: 2px dashed rgba(0,0,0,0.12);
    border-radius: var(--radius);
    padding: 18px 18px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: var(--card-bg);
    min-height: 160px;
  }
  #invoice-paste-text { min-height: 118px; }
  .pdf-drop-zone:hover, .pdf-drop-zone.dragover {
    border-color: var(--navy);
    background: rgba(27,45,62,0.03);
  }
  .pdf-drop-icon  { font-size: 26px; line-height: 1; }
  .pdf-drop-text  { font-size: 13px; color: var(--text-mid); font-weight: 500; line-height: 1.35; }
  .pdf-drop-link  { color: var(--navy); text-decoration: underline; cursor: pointer; }
  .pdf-drop-sub   { font-size: 11px; color: var(--text-light); }

  .pdf-progress-wrap  { margin-top: 14px; }
  .pdf-progress-bar   {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 7px;
  }
  .pdf-progress-fill  {
    height: 100%;
    background: var(--brass);
    border-radius: 2px;
    transition: width 0.25s ease;
    width: 0%;
  }
  .pdf-progress-label { font-size: 12px; color: var(--text-light); text-align: center; }

  .pdf-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 10px 14px;
    background: var(--success-bg);
    border: 1px solid rgba(46,125,82,0.2);
    border-radius: 6px;
  }
  .pdf-preview-header span { font-size: 13px; font-weight: 600; color: var(--text); }

  .pdf-section-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    margin-bottom: 5px;
    background: var(--white);
  }
  .pdf-section-thumb {
    width: 76px; height: 52px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg);
  }
  .pdf-section-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pdf-section-info  { flex: 1; min-width: 0; }
  .pdf-section-name  { font-size: 13px; font-weight: 600; color: var(--navy); }
  .pdf-section-price { font-size: 12px; color: var(--text-mid); margin-top: 2px; font-family: 'DM Mono', monospace; }
  .pdf-section-renders { font-size: 11px; color: var(--text-light); margin-top: 2px; }
  .pdf-section-remove {
    background: transparent; border: none; color: var(--text-light);
    cursor: pointer; font-size: 17px; padding: 3px 7px; line-height: 1; flex-shrink: 0;
    transition: color 0.1s;
  }
  .pdf-section-remove:hover { color: var(--danger); }

  /* ── PRICING ENGINE ── */
  .pricing-engine-box {
    margin-top: 14px;
    padding: 12px 14px;
    background: rgba(27,45,62,0.04);
    border: 1px solid rgba(27,45,62,0.10);
    border-radius: 6px;
  }
  .pricing-engine-box .peb-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    margin-bottom: 12px;
  }
  .input-affix-wrap { position: relative; display: flex; align-items: center; }
  .input-affix-wrap input {
    width: 100%;
    padding: 9px 28px 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .input-affix-wrap input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(27,45,62,0.08);
  }
  .input-suffix { position: absolute; right: 10px; font-size: 13px; color: var(--text-light); pointer-events: none; }

  .input-prefix-wrap { position: relative; display: flex; align-items: center; }
  .input-prefix-wrap input {
    width: 100%;
    padding: 9px 12px 9px 22px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .input-prefix-wrap input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(27,45,62,0.08);
  }
  .input-prefix { position: absolute; left: 9px; font-size: 13px; color: var(--text-light); pointer-events: none; }

  /* ── ROUNDING CONTROLS ── */
  .round-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
  }
  .round-btn {
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--text-mid);
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    white-space: nowrap;
  }
  .round-btn:hover { border-color: var(--navy); color: var(--navy); }
  .round-btn.active { background: var(--navy); color: white; border-color: var(--navy); }
  .round-sep {
    font-size: 10px;
    color: var(--text-light);
    margin: 0 1px;
  }
  .round-global {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.06);
  }
  .round-global-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.3px;
    white-space: nowrap;
  }

  /* ── CLOSET PRICING HINT ── */
  .closet-pricing-hint {
    font-size: 11px;
    color: #7A5F20;
    margin-top: 4px;
    padding: 4px 9px;
    background: var(--brass-light);
    border-radius: 4px;
    border: 1px solid rgba(181,137,58,0.25);
    display: none;
    font-family: 'DM Mono', monospace;
  }

  /* ── PDF STAGING ── */
  .pdf-stage-panel { margin-top: 10px; }
  .pdf-stage-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    margin-bottom: 5px;
    background: var(--white);
    font-size: 13px;
  }
  .pdf-stage-icon   { font-size: 17px; flex-shrink: 0; }
  .pdf-stage-type   { font-weight: 600; color: var(--navy); flex-shrink: 0; min-width: 130px; }
  .pdf-stage-name   { color: var(--text-mid); font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pdf-stage-missing { color: var(--text-light); font-style: italic; }
  .pdf-stage-add-zone {
    border: 2px dashed var(--border);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    margin-top: 5px;
  }
  .pdf-stage-add-zone:hover, .pdf-stage-add-zone.dragover {
    border-color: var(--navy);
    background: rgba(27,45,62,0.03);
    color: var(--navy);
  }
  .pdf-stage-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }

  /* ── PROPOSAL LIBRARY (side drawer) ── */
  .library-toggle {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    padding: 5px 12px;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: color 0.15s, border-color 0.15s;
  }
  .library-toggle:hover { color: white; border-color: rgba(255,255,255,0.35); }

  .library-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    z-index: 200;
  }
  .library-backdrop.open { display: block; }

  .library-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 90vw;
    background: var(--white);
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
  }
  .library-panel.open { transform: translateX(0); }

  .library-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
  }
  .library-panel-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
  }
  .library-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s;
  }
  .library-close:hover { background: rgba(0,0,0,0.05); color: var(--text); }

  .library-toolbar {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
  }
  .library-search {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
  }
  .library-search:focus { outline: none; border-color: var(--navy); }

  .library-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0;
  }

  /* Card-based list instead of table */
  .lib-card {
    display: block;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
    color: inherit;
  }
  .lib-card:hover { background: rgba(27,45,62,0.03); }
  .lib-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
  }
  .lib-card-client {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
  }
  .lib-card-total {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-family: 'DM Mono', monospace;
  }
  .lib-card-address {
    font-size: 12px;
    color: var(--text-mid);
    margin-bottom: 6px;
  }
  .lib-card-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 11px;
    color: var(--text-light);
  }
  .lib-status {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 3px;
  }
  .lib-status-draft    { background: #F0EDE6; color: #8A7A5A; }
  .lib-status-sent     { background: #E3F0FF; color: #2B6CB0; }
  .lib-status-viewed   { background: #EBF5EE; color: #2E7D52; }
  .lib-status-accepted { background: #D4EDDA; color: #155724; }
  .lib-status-expired  { background: #F5E6E6; color: #943030; }
  .lib-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
  }
  .lib-btn {
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--text-mid);
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.1s, color 0.1s, background 0.1s;
  }
  .lib-btn:hover { border-color: var(--navy); color: var(--navy); }
  .library-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 13px;
  }
  .library-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 13px;
  }

  /* ── DISCOUNTS ── */
  .discount-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
  }
  .discount-toggle-row label {
    font-size: 13px;
    color: var(--text-mid);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .discount-body { display: none; }
  .discount-body.open { display: block; }
  .discount-preset-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
  }
  .discount-preset-row select {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
  }
  .discount-was-now {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 6px;
    background: linear-gradient(135deg, #1E2D3B 0%, #2A3F52 100%);
    color: white;
    text-align: center;
  }
  .discount-was-now .dwn-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    margin-bottom: 6px;
  }
  .discount-was-now .dwn-prices {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
  }
  .discount-was-now .dwn-was {
    font-size: 18px;
    text-decoration: line-through;
    color: rgba(255,255,255,0.4);
  }
  .discount-was-now .dwn-now {
    font-size: 28px;
    font-weight: 700;
    color: var(--brass-light);
  }
  .discount-was-now .dwn-save {
    font-size: 12px;
    color: #7CDB8A;
    margin-top: 4px;
  }
  .tier-config {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(27,45,62,0.04);
    border: 1px solid rgba(27,45,62,0.08);
    border-radius: 6px;
  }
  .tier-config-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 8px;
  }
  .tier-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
  }
  .tier-row input {
    width: 55px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    text-align: center;
  }
  .tier-row span { color: var(--text-mid); }
  .tier-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    background: #EBF5EE;
    color: #2E7D52;
    margin-left: 6px;
  }
  .closet-discount-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
    padding: 8px 12px;
    background: rgba(181,137,58,0.06);
    border: 1px solid rgba(181,137,58,0.15);
    border-radius: 6px;
  }
  .closet-discount-row label { font-size: 12px; color: var(--text-mid); white-space: nowrap; }
  .closet-discount-row input, .closet-discount-row select {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
  }
  .closet-discount-row input[type="text"] { flex: 1; min-width: 0; }
  .closet-discount-row input[type="number"] { width: 70px; }
  .closet-discount-row select { width: 60px; }
  .bundle-box {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(181,137,58,0.06);
    border: 1px solid rgba(181,137,58,0.15);
    border-radius: 6px;
  }
  .bundle-box .form-row { margin-top: 8px; }

  /* ── PROFIT DASHBOARD ── */
  .profit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
  }
  .profit-row:last-child { border-bottom: none; }
  .profit-label { font-size: 12px; color: var(--text-mid); }
  .profit-value {
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Mono', monospace;
    color: var(--text);
    letter-spacing: -0.3px;
  }
  .profit-total-row {
    padding-top: 10px;
    border-top: 1px solid var(--border) !important;
    border-bottom: none !important;
    margin-top: 4px;
  }
  .profit-total-row .profit-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
  }
  .profit-total-row .profit-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
  }
  .profit-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-light);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
  }

  /* ── DARK MODE ── */
  /* ── DARK MODE (class-based toggle) ── */
  html.dark {
    --bg: #1A1A1E;
    --white: #242428;
    --card-bg: #2A2A2E;
    --border: rgba(255,255,255,0.10);
    --border-light: rgba(255,255,255,0.06);
    --text: #E8E8E8;
    --text-mid: #B0B0B0;
    --text-light: #909090;
    --danger: #E05A4F;
    --success: #5CB87A;
    --success-bg: #1A2E1F;
    --warning-bg: #2E2A1A;
    --brass-light: #3A3020;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.05);
    --shadow-lift: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
  }
  html.dark .app-header { box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
  html.dark .field input,
  html.dark .field select,
  html.dark .field textarea { background: var(--card-bg); color: var(--text); border-color: var(--border); }
  html.dark .field input:focus,
  html.dark .field select:focus,
  html.dark .field textarea:focus { background: #303035; }
  html.dark .field input::placeholder,
  html.dark .field textarea::placeholder { color: #606060; }
  html.dark .btn-secondary { background: var(--card-bg); color: var(--text-mid); border-color: var(--border); }
  html.dark .btn-add { color: var(--text-mid); border-color: var(--border); }
  html.dark .lib-status-draft { background: #333; color: #B0A080; }
  html.dark .lib-status-sent { background: #1A2A40; color: #6EA8D8; }
  html.dark .lib-status-viewed { background: #1A2E1F; color: #5CB87A; }
  html.dark .lib-status-accepted { background: #1A301A; color: #5CB87A; }
  html.dark .lib-status-expired { background: #301A1A; color: #D06060; }
  html.dark .pdf-drop-zone { background: var(--card-bg); border-color: var(--border); }
  html.dark .closet-entry { background: var(--card-bg); border-color: var(--border); }
  html.dark .round-btn { background: var(--card-bg); color: var(--text-mid); border-color: var(--border); }
  html.dark .actions-bar { background: var(--card-bg); border-color: var(--border); box-shadow: var(--shadow-card); }
  html.dark .status-box.error { background: #2E1A1A; border-color: #5A3030; }
  html.dark .pricing-engine-box { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
  html.dark .tier-config { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
  html.dark .closet-discount-row { background: rgba(181,137,58,0.1); border-color: rgba(181,137,58,0.2); }
  html.dark .bundle-box { background: rgba(181,137,58,0.1); border-color: rgba(181,137,58,0.2); }
  html.dark .workflow-stage-title { color: #F4EEDF; }
  html.dark .workflow-stage-copy { color: rgba(232,232,232,0.72); }
  html.dark .workflow-stage-step {
    background: rgba(181,137,58,0.18);
    color: #E8C98A;
  }
  /* Rail cards */
  html.dark .rail-card { background: var(--card-bg); border-color: var(--border); }
  html.dark .rail-card h3 { color: var(--text); }
  html.dark .rail-card-readiness { border-color: var(--border); }
  html.dark .rail-link-list a { background: var(--card-bg); color: var(--text); border-color: var(--border); }
  html.dark .rail-link-list a:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }
  /* Room builder */
  html.dark .room-builder-nav { background: var(--card-bg); border-color: var(--border); }
  html.dark .room-builder-nav h3 { color: var(--text); }
  html.dark .room-builder-empty { background: rgba(255,255,255,0.04); border-color: var(--border); }
  html.dark .room-list-item { background: var(--card-bg); border-color: var(--border); }
  html.dark .room-list-item:hover { border-color: rgba(255,255,255,0.15); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
  html.dark .room-list-item.is-active { background: rgba(181,137,58,0.15); border-color: rgba(181,137,58,0.4); }
  html.dark .room-list-title { color: var(--text); }
  /* Readiness */
  html.dark .readiness-item { background: rgba(255,255,255,0.05); }
  /* Profit totals */
  html.dark .profit-total-row .profit-label,
  html.dark .profit-total-row .profit-value { color: var(--text); }
  /* Modals */
  html.dark .preview-modal { background: var(--white); }
  html.dark .send-compose-panel { background: var(--white); }
  html.dark .send-preview-panel {
    background:
      radial-gradient(circle at top right, rgba(181,137,58,0.08), transparent 38%),
      linear-gradient(180deg, #252522 0%, #201e1a 100%);
  }
  html.dark .send-preview-chip { background: rgba(255,255,255,0.08); color: var(--text-mid); }
  html.dark .send-summary-item strong { color: var(--text); }
  html.dark .send-summary-card { background: rgba(255,255,255,0.04); border-color: var(--border); }

  /* ── CLOSETS EMPTY STATE ── */
  .closets-empty {
    text-align: center;
    padding: 32px 20px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
  }

  /* ── SUCCESS PULSE ── */
  @keyframes successPulse {
    0% { transform: scale(0.98); opacity: 0; }
    50% { transform: scale(1.01); }
    100% { transform: scale(1); opacity: 1; }
  }

  /* ── THEME TOGGLE ── */
  .theme-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: border-color 0.15s;
    color: rgba(255,255,255,0.6);
  }
  .theme-toggle:hover { border-color: rgba(255,255,255,0.35); color: white; }
