:root {
      /* Warm Architectural Light Palette */
      --bg: #f8f6f2;
      --bg-subtle: #f0ebe1;
      --panel: #ffffff;
      --panel-surface: #fbf9f6;
      --panel-elevated: #ffffff;
      
      --text-main: #181614;
      --text-body: #45403a;
      --text-muted: #736b63;
      --text-subtle: #968e85;
      
      --border: #e6dfd5;
      --border-subtle: #f0ebe3;
      --border-active: #c58657;

      /* Ochre Bronze Accent & Semantic */
      --accent: #b86e3b;
      --accent-hover: #985527;
      --accent-deep: #7a3e16;
      --accent-light: #faefe6;
      --accent-gradient: linear-gradient(135deg, #b86e3b 0%, #985527 100%);
      
      --success: #2e7a55;
      --success-bg: #eaf5ee;
      --danger: #b83d34;
      --danger-bg: #faeae8;
      
      --shadow-sm: 0 2px 8px rgba(35, 27, 20, 0.04);
      --shadow-md: 0 10px 30px rgba(35, 27, 20, 0.06);
      --shadow-lg: 0 24px 60px rgba(35, 27, 20, 0.09);
      
      --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
      --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
      --radius-sm: 8px;
      --radius-md: 14px;
      --radius-lg: 20px;
    }

    body.dark {
      /* Deep Obsidian & Warm Copper Dark Palette */
      --bg: #111313;
      --bg-subtle: #171a19;
      --panel: #1b1f1e;
      --panel-surface: #222726;
      --panel-elevated: #282e2c;
      
      --text-main: #f5f3ef;
      --text-body: #cfc8be;
      --text-muted: #9c9488;
      --text-subtle: #6e675d;
      
      --border: #2e3633;
      --border-subtle: #242b28;
      --border-active: #e2945d;

      --accent: #de8d54;
      --accent-hover: #eaa472;
      --accent-deep: #f7c39f;
      --accent-light: #2c211a;
      --accent-gradient: linear-gradient(135deg, #de8d54 0%, #c47239 100%);
      
      --success: #52ba85;
      --success-bg: #14281e;
      --danger: #e26257;
      --danger-bg: #2d1816;
      
      --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
      --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.45);
      --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.65);
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }
    html { scroll-behavior: smooth; font-size: 15px; }
    body {
      background-color: var(--bg);
      color: var(--text-body);
      font-family: var(--font-body);
      line-height: 1.6;
      transition: background-color 0.3s ease, color 0.3s ease;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    button, input, select {
      font-family: inherit;
      color: inherit;
    }
    button { cursor: pointer; border: none; background: none; }
    button:focus-visible, input:focus-visible, select:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    /* HEADER */
    .site-header {
      background: var(--panel);
      border-bottom: 1px solid var(--border);
      position: sticky;
      top: 0;
      z-index: 50;
      transition: background-color 0.3s, border-color 0.3s;
    }
    .header-inner {
      max-width: 1440px;
      margin: 0 auto;
      padding: 0 2rem;
      height: 76px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .brand {
      display: flex;
      align-items: center;
      gap: 14px;
      text-decoration: none;
    }
    .brand-mark {
      width: 44px;
      height: 44px;
      border-radius: var(--radius-sm);
      background: var(--accent-gradient);
      color: #ffffff;
      font-family: var(--font-heading);
      font-weight: 700;
      font-size: 1.15rem;
      letter-spacing: -0.04em;
      display: grid;
      place-items: center;
      box-shadow: 0 4px 14px rgba(184, 110, 59, 0.3);
    }
    .brand-mark span { color: #fdf5ea; }
    .brand-info strong {
      display: block;
      font-family: var(--font-heading);
      font-size: 1.1rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      color: var(--text-main);
      line-height: 1.2;
    }
    .brand-info small {
      display: block;
      font-size: 0.68rem;
      font-weight: 600;
      letter-spacing: 0.16em;
      color: var(--text-muted);
      text-transform: uppercase;
      margin-top: 2px;
    }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 0 16px;
      height: 42px;
      border-radius: var(--radius-sm);
      font-size: 0.85rem;
      font-weight: 600;
      transition: all 0.2s ease;
      white-space: nowrap;
    }
    .btn-ghost {
      background: var(--panel-surface);
      color: var(--text-main);
      border: 1px solid var(--border);
    }
    .btn-ghost:hover {
      background: var(--panel-elevated);
      border-color: var(--text-muted);
    }
    .btn-primary {
      background: var(--accent-gradient);
      color: #ffffff;
      box-shadow: 0 4px 14px rgba(184, 110, 59, 0.25);
    }
    .btn-primary:hover {
      opacity: 0.94;
      transform: translateY(-1px);
      box-shadow: 0 6px 18px rgba(184, 110, 59, 0.35);
    }
    .btn-text {
      color: var(--accent);
      font-weight: 600;
      padding: 6px 10px;
      height: auto;
      border-radius: 6px;
    }
    .btn-text:hover {
      background: var(--accent-light);
    }

    /* MAIN CONTAINER */
    .page-shell {
      max-width: 1440px;
      margin: 0 auto;
      padding: 2.2rem 2rem 4rem;
      width: 100%;
      flex: 1;
    }

    /* PAGE INTRO */
    .page-intro {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      gap: 2rem;
      margin-bottom: 2.2rem;
      padding-bottom: 1.6rem;
      border-bottom: 1px solid var(--border);
    }
    .eyebrow {
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--accent);
      margin-bottom: 0.4rem;
    }
    .page-intro h1 {
      font-family: var(--font-heading);
      font-size: 2.2rem;
      font-weight: 700;
      letter-spacing: -0.03em;
      color: var(--text-main);
      line-height: 1.2;
    }
    .page-intro p.desc {
      color: var(--text-muted);
      font-size: 0.95rem;
      margin-top: 0.4rem;
      max-width: 650px;
    }
    .intro-badge {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 14px;
      border-radius: 999px;
      background: var(--panel-surface);
      border: 1px solid var(--border);
      font-family: var(--font-heading);
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--text-muted);
      letter-spacing: 0.05em;
    }
    .intro-badge span { color: var(--accent); }

    /* WORKSPACE GRID */
    .workspace {
      display: grid;
      grid-template-columns: 420px minmax(0, 1fr);
      gap: 2rem;
      align-items: start;
    }

    /* CARDS & PANELS */
    .panel {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-sm);
      overflow: hidden;
      transition: background-color 0.3s, border-color 0.3s;
    }
    .config-panel {
      position: sticky;
      top: 96px;
      max-height: calc(100vh - 120px);
      display: flex;
      flex-direction: column;
    }
    .panel-heading {
      padding: 1.5rem 1.6rem 1.2rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--border-subtle);
    }
    .section-kicker {
      font-size: 0.68rem;
      font-weight: 700;
      letter-spacing: 0.16em;
      color: var(--accent);
      text-transform: uppercase;
      margin-bottom: 4px;
    }
    .panel-heading h2 {
      font-family: var(--font-heading);
      font-size: 1.35rem;
      font-weight: 700;
      color: var(--text-main);
      letter-spacing: -0.02em;
    }
    .config-body {
      padding: 1.4rem 1.6rem 2rem;
      overflow-y: auto;
      scrollbar-width: thin;
      scrollbar-color: var(--border) transparent;
    }

    /* FORM ELEMENTS */
    .field {
      margin-bottom: 1.15rem;
    }
    .field label {
      display: block;
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--text-main);
      margin-bottom: 0.45rem;
    }
    .field label span {
      font-weight: 500;
      color: var(--text-muted);
    }
    .field input, .field select {
      width: 100%;
      height: 44px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      background: var(--panel-surface);
      color: var(--text-main);
      padding: 0 14px;
      font-size: 0.88rem;
      transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
    }
    .field input:focus, .field select:focus {
      background: var(--panel);
      border-color: var(--border-active);
      box-shadow: 0 0 0 3px var(--accent-light);
    }
    .field-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    /* ITEM SELECTION GROUPS */
    .group {
      margin-top: 1.4rem;
      padding-top: 1.4rem;
      border-top: 1px solid var(--border);
    }
    .group h3 {
      font-family: var(--font-heading);
      font-size: 0.82rem;
      font-weight: 700;
      color: var(--accent);
      letter-spacing: 0.08em;
      text-transform: uppercase;
      margin-bottom: 0.9rem;
    }
    .choice-subgroup {
      margin-bottom: 1.1rem;
    }
    .choice-subgroup > h4 {
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--text-main);
      margin-bottom: 0.5rem;
    }
    .choice-list {
      display: grid;
      gap: 7px;
    }
    .choice {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 10px 14px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      background: var(--panel-surface);
      cursor: pointer;
      transition: all 0.18s ease;
      position: relative;
    }
    .choice:hover {
      border-color: var(--border-active);
      background: var(--panel);
    }
    .choice:has(input:checked) {
      border-color: var(--accent);
      background: var(--accent-light);
    }
    .choice input {
      accent-color: var(--accent);
      margin-top: 3px;
      flex-shrink: 0;
      width: 16px;
      height: 16px;
    }
    .choice-copy strong {
      display: block;
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--text-main);
      line-height: 1.35;
    }
    .choice-copy small {
      display: block;
      font-size: 0.72rem;
      color: var(--text-muted);
      line-height: 1.4;
      margin-top: 2px;
    }
    .inline-level {
      display: flex;
      align-items: center;
      gap: 12px;
      margin: 8px 0 2px 26px;
      font-size: 0.76rem;
      color: var(--text-muted);
    }
    .inline-level label {
      display: flex;
      align-items: center;
      gap: 4px;
      font-weight: 600;
      color: var(--text-body);
      cursor: pointer;
    }
    .inline-level input {
      accent-color: var(--accent);
    }

    /* RIGHT COLUMN: RESULTS */
    .results-column {
      display: grid;
      gap: 2rem;
    }
    .live-tag {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--success);
      background: var(--success-bg);
      padding: 4px 10px;
      border-radius: 999px;
    }
    .live-tag span {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--success);
      animation: pulse 2s infinite;
    }
    @keyframes pulse {
      0% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.4; transform: scale(0.85); }
      100% { opacity: 1; transform: scale(1); }
    }
    .project-summary {
      font-size: 0.88rem;
      color: var(--text-muted);
      padding: 0 1.6rem 1.2rem;
      line-height: 1.5;
    }

    /* TOTAL BANNER */
    .total-card {
      margin: 0 1.6rem 1.5rem;
      background: linear-gradient(135deg, var(--panel-surface) 0%, var(--accent-light) 100%);
      border: 1px solid var(--accent);
      border-radius: var(--radius-md);
      padding: 1.5rem 1.8rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1.5rem;
      box-shadow: 0 8px 24px rgba(184, 110, 59, 0.08);
    }
    .total-card-meta span {
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.14em;
      color: var(--accent);
      text-transform: uppercase;
      display: block;
    }
    .total-card-meta small {
      font-size: 0.85rem;
      color: var(--text-muted);
      margin-top: 5px;
      display: block;
    }
    .total-card-price strong {
      font-family: var(--font-heading);
      font-size: 2.3rem;
      font-weight: 700;
      color: var(--text-main);
      letter-spacing: -0.04em;
      white-space: nowrap;
    }

    /* TABLES */
    .table-wrap {
      overflow-x: auto;
      scrollbar-width: thin;
    }
    .cost-table, .schedule-table, .compare-table {
      width: 100%;
      border-collapse: collapse;
      text-align: left;
    }
    .cost-table th, .schedule-table th, .compare-table th {
      background: var(--panel-surface);
      color: var(--text-muted);
      font-family: var(--font-heading);
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      padding: 12px 1.6rem;
      border-top: 1px solid var(--border-subtle);
      border-bottom: 1px solid var(--border);
    }
    .cost-table td, .schedule-table td, .compare-table td {
      padding: 14px 1.6rem;
      border-bottom: 1px solid var(--border-subtle);
      font-size: 0.84rem;
      vertical-align: middle;
    }
    .cost-table tr:hover td, .schedule-table tr:hover td {
      background: var(--panel-surface);
    }
    .cost-table td:first-child {
      font-weight: 600;
      color: var(--text-main);
      width: 32%;
    }
    .cost-table td:nth-child(2) {
      color: var(--text-muted);
    }
    .cost-table td:last-child {
      text-align: right;
      font-family: var(--font-heading);
      font-weight: 700;
      color: var(--text-main);
      white-space: nowrap;
    }
    .cost-table tfoot td {
      background: var(--panel-surface);
      border-top: 2px solid var(--border);
      border-bottom: none;
      font-family: var(--font-heading);
      font-weight: 700;
      font-size: 0.95rem;
      color: var(--accent);
      padding: 16px 1.6rem;
    }
    .cost-table tfoot td:last-child {
      font-size: 1.15rem;
      color: var(--text-main);
    }
    .fine-print {
      padding: 1.2rem 1.6rem;
      color: var(--text-subtle);
      font-size: 0.74rem;
      line-height: 1.5;
    }

    /* SCHEDULE STATS */
    .schedule-stats {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin: 0 1.6rem 1.4rem;
      background: var(--panel-surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 1.2rem;
    }
    .stat-item strong {
      display: block;
      font-family: var(--font-heading);
      font-size: 1.35rem;
      font-weight: 700;
      color: var(--text-main);
      letter-spacing: -0.02em;
    }
    .stat-item span {
      display: block;
      font-size: 0.68rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      color: var(--text-muted);
      text-transform: uppercase;
      margin-top: 4px;
    }

    /* PROGRESS TRACK */
    .progress-caption {
      display: flex;
      justify-content: space-between;
      margin: 0 1.6rem 8px;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--text-muted);
    }
    .progress-track {
      height: 8px;
      margin: 0 1.6rem 1.4rem;
      background: var(--border);
      border-radius: 999px;
      overflow: hidden;
      display: flex;
    }
    .progress-track span {
      display: block;
      height: 100%;
      background: var(--accent-gradient);
      transition: width 0.4s ease;
    }
    .disclosure-button {
      width: calc(100% - 3.2rem);
      margin: 0 1.6rem 1.4rem;
      padding: 10px 16px;
      border-radius: var(--radius-sm);
      background: var(--panel-surface);
      border: 1px solid var(--border);
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--text-body);
      display: flex;
      justify-content: space-between;
      align-items: center;
      transition: background 0.2s, border-color 0.2s;
    }
    .disclosure-button:hover {
      background: var(--panel-elevated);
      border-color: var(--border-active);
    }
    .schedule-table td:first-child {
      font-weight: 600;
      color: var(--text-main);
      min-width: 240px;
    }
    .schedule-table td:nth-child(2) {
      color: var(--text-muted);
      font-size: 0.78rem;
    }

    /* SAVED PLANS & COMPARISON */
    .saved-list {
      display: grid;
      gap: 12px;
      margin: 0 1.6rem;
    }
    .saved-empty {
      margin: 0 1.6rem;
      border: 1.5px dashed var(--border);
      border-radius: var(--radius-md);
      padding: 2.2rem 1.5rem;
      text-align: center;
      color: var(--text-muted);
      font-size: 0.85rem;
    }
    .saved-empty strong {
      display: block;
      color: var(--text-main);
      font-size: 0.95rem;
      margin-bottom: 6px;
    }
    .plan-card {
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 1.1rem 1.2rem;
      background: var(--panel-surface);
      transition: border-color 0.2s, transform 0.2s;
    }
    .plan-card:hover {
      border-color: var(--border-active);
    }
    .plan-card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .plan-card input {
      font-family: var(--font-heading);
      font-size: 0.95rem;
      font-weight: 700;
      color: var(--text-main);
      background: transparent;
      border: 1px solid transparent;
      border-radius: 4px;
      padding: 3px 6px;
      max-width: 220px;
    }
    .plan-card input:focus {
      background: var(--panel);
      border-color: var(--accent);
    }
    .plan-actions {
      display: flex;
      gap: 6px;
    }
    .plan-actions button {
      padding: 5px 10px;
      border-radius: 6px;
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--text-body);
      font-size: 0.74rem;
      font-weight: 600;
      transition: all 0.15s ease;
    }
    .plan-actions button:hover {
      border-color: var(--accent);
      color: var(--accent);
    }
    .plan-card p {
      font-size: 0.78rem;
      color: var(--text-muted);
      margin-top: 8px;
      line-height: 1.5;
    }
    .plan-card p strong {
      font-family: var(--font-heading);
      color: var(--accent);
      font-size: 1.05rem;
      margin-right: 8px;
    }
    .danger-link {
      margin: 1.2rem 1.6rem 0;
      color: var(--danger);
      font-size: 0.76rem;
      font-weight: 700;
      cursor: pointer;
    }
    .danger-link:hover {
      text-decoration: underline;
    }

    .comparison-wrap {
      margin: 0 1.6rem 1.6rem;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      overflow: hidden;
    }
    .comparison-heading {
      padding: 12px 1.4rem;
      background: var(--panel-surface);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 0.78rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      color: var(--text-main);
    }
    .compare-table td:first-child {
      font-weight: 700;
      color: var(--text-main);
      background: var(--panel-surface);
      min-width: 140px;
    }
    .compare-table td:not(:first-child) {
      text-align: right;
      font-family: var(--font-heading);
      font-weight: 600;
    }

    /* FOOTER */
    .site-footer {
      border-top: 1px solid var(--border);
      background: var(--panel);
      padding: 2.5rem 2rem;
      margin-top: 4rem;
      transition: background-color 0.3s, border-color 0.3s;
    }
    .footer-inner {
      max-width: 1440px;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 2rem;
      font-size: 0.82rem;
      color: var(--text-muted);
    }

    /* TOAST & FLOATING HELP */
    .toast {
      position: fixed;
      left: 50%;
      bottom: 24px;
      transform: translate(-50%, 20px);
      background: var(--text-main);
      color: var(--panel);
      padding: 10px 18px;
      border-radius: 999px;
      box-shadow: var(--shadow-lg);
      font-size: 0.82rem;
      font-weight: 600;
      opacity: 0;
      pointer-events: none;
      transition: 0.25s ease;
      z-index: 100;
    }
    .toast.show {
      opacity: 1;
      transform: translate(-50%, 0);
    }
    .help-fab {
      position: fixed;
      right: 24px;
      bottom: 24px;
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: var(--text-main);
      color: var(--panel);
      font-family: var(--font-heading);
      font-weight: 700;
      font-size: 1.1rem;
      box-shadow: var(--shadow-md);
      display: grid;
      place-items: center;
      z-index: 90;
      transition: transform 0.2s ease;
    }
    .help-fab:hover {
      transform: scale(1.06);
    }
    .help-panel {
      position: fixed;
      right: 24px;
      bottom: 84px;
      width: min(370px, calc(100vw - 32px));
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg);
      z-index: 91;
      overflow: hidden;
      animation: slideUp 0.2s ease-out;
    }
    @keyframes slideUp {
      from { opacity: 0; transform: translateY(12px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .help-heading {
      padding: 14px 18px;
      background: var(--panel-surface);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: var(--text-main);
      font-family: var(--font-heading);
      font-weight: 700;
      font-size: 0.9rem;
    }
    .help-messages {
      height: 240px;
      overflow-y: auto;
      padding: 14px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .help-messages p {
      max-width: 88%;
      padding: 10px 14px;
      border-radius: 12px;
      font-size: 0.8rem;
      line-height: 1.45;
    }
    .bot-message {
      background: var(--panel-surface);
      color: var(--text-body);
      align-self: flex-start;
      border: 1px solid var(--border-subtle);
    }
    .user-message {
      background: var(--accent-light);
      color: var(--text-main);
      align-self: flex-end;
      border: 1px solid var(--accent);
    }
    .help-panel form {
      display: flex;
      padding: 10px 14px;
      border-top: 1px solid var(--border);
      gap: 8px;
      background: var(--panel-surface);
    }
    .help-panel form input {
      flex: 1;
      height: 38px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--panel);
      color: var(--text-main);
      padding: 0 10px;
      font-size: 0.82rem;
    }
    .help-panel form button {
      width: 38px;
      height: 38px;
      border-radius: 6px;
      background: var(--accent);
      color: #ffffff;
      display: grid;
      place-items: center;
      font-weight: 700;
    }
    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0,0,0,0);
      border: 0;
    }
    [hidden] { display: none !important; }

    /* RESPONSIVE */
    @media (max-width: 1080px) {
      .workspace { grid-template-columns: 1fr; }
      .config-panel { position: static; max-height: none; }
      .intro-badge { display: none; }
    }
    @media (max-width: 680px) {
      .header-inner { padding: 0 1.2rem; height: 66px; }
      .page-shell { padding: 1.5rem 1.2rem 3rem; }
      .total-card { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
      .schedule-stats { grid-template-columns: 1fr 1fr; }
      .cost-table td:nth-child(2), .cost-table th:nth-child(2) { display: none; }
      .footer-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
      .page-intro h1 { font-size: 1.7rem; }
    }

    /* PRINT */
    @media print {
      body { background: #fff !important; color: #000 !important; font-size: 12px; }
      .site-header, .page-intro, .config-panel, .compare-panel, .help-fab, .help-panel, .toast, .disclosure-button { display: none !important; }
      .page-shell { padding: 0; max-width: 100%; }
      .workspace, .results-column { display: block; }
      .panel { border: none; box-shadow: none; border-radius: 0; }
      #scheduleDetails { display: block !important; }
      .total-card { border: 1px solid #000; background: #fafafa !important; }
      .cost-table th, .cost-table td, .schedule-table th, .schedule-table td { padding: 8px 10px; font-size: 11px; }
    }

/* D27 integration: keep the existing calculator and comparison markup. */
.brand-logo{display:block;flex:none;width:44px;height:44px;object-fit:cover;border-radius:7px;clip-path:inset(0 round 7px)}
.brand-mark{background:transparent;box-shadow:none;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;line-height:.82;width:36px;height:44px;border-radius:0}
.brand-mark b{font-family:var(--font-heading);font-size:28px;line-height:26px;font-weight:700;color:var(--text-main);font-style:normal}
.brand-mark i{font-family:var(--font-heading);font-size:15px;line-height:14px;font-weight:700;color:var(--accent);font-style:normal;letter-spacing:-.06em}
.page-intro p.desc{margin-top:.45rem}
.stage-badge{font-size:.7rem;padding:4px 10px;white-space:nowrap}
.total-card-price{min-width:0}
.empty-state{padding:2rem!important;text-align:center;color:var(--text-muted)!important;font-weight:500!important}
.comparison-heading button{border:1px solid var(--border);border-radius:6px;padding:5px 10px;color:var(--text-body);background:var(--panel);font-size:.74rem;font-weight:600;letter-spacing:0}
.compare-table th:not(:first-child){text-align:right}
.help-panel>small{display:block;padding:0 14px 12px;background:var(--panel-surface);color:var(--text-subtle);font-size:.68rem}
@media(max-width:680px){.header-actions .btn{width:42px;padding:0}.header-actions .btn span{display:none}.page-intro{padding-bottom:1rem;margin-bottom:1.4rem}.panel-heading{gap:1rem}.panel-heading h2{font-size:1.16rem}.compare-panel .panel-heading{align-items:flex-start;flex-direction:column}.cost-table td,.cost-table th{padding:11px 12px}.cost-table td:last-child{font-size:.78rem}.total-card-price strong{font-size:1.85rem}.progress-caption{gap:.8rem;font-size:.7rem}.progress-caption span:last-child{text-align:right}}
@media print{body.printing-compare .estimate-panel,body.printing-compare .schedule-panel{display:none!important}body.printing-compare .compare-panel{display:block!important}body.printing-compare .compare-panel .btn-primary,body.printing-compare .comparison-heading button,body.printing-compare .saved-list,body.printing-compare .danger-link,body.printing-compare #planCount{display:none!important}body.printing-compare .comparison-wrap{margin:0;border:0}body.printing-compare .compare-table{width:100%}}
.page-intro{justify-content:center;align-items:center;text-align:center}

/* Hồ sơ PDF: nội dung đen rõ nét, tiêu đề giữ màu nhấn D27. */
@page { size: A4 portrait; margin: 20mm 12mm 20mm 22mm; }
@media print {
  html, body, body.dark {
    --bg: #fff;
    --panel: #fff;
    --panel-surface: #fff;
    --panel-elevated: #fff;
    --text-main: #000;
    --text-body: #000;
    --text-muted: #000;
    --text-subtle: #000;
    --border: #777;
    --border-subtle: #d0d0d0;
    --accent: #a95625;
    --accent-light: #fff;
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .panel, .total-card, .schedule-stats, .comparison-wrap,
  .cost-table th, .cost-table td, .cost-table tfoot td,
  .schedule-table th, .schedule-table td,
  .compare-table th, .compare-table td {
    background: #fff !important;
    box-shadow: none !important;
  }
  .project-summary, .fine-print, .cost-table td,
  .schedule-table td, .compare-table td,
  .total-card-price strong, .schedule-stats strong,
  .schedule-stats span, .progress-caption,
  .total-card-meta small { color: #000 !important; }
  .section-kicker, .total-card-meta span,
  .cost-table th, .schedule-table th, .compare-table th,
  .cost-table tfoot td:first-child,
  .comparison-heading { color: var(--accent) !important; }
  .total-card { border: 1px solid #777 !important; }
  .cost-table th:nth-child(2), .cost-table td:nth-child(2) { display: table-cell !important; }
  table { width: 100%; }
  tr, .total-card, .schedule-stats { break-inside: avoid; }
}

/* Dàn trang A4 sát vùng nội dung hữu ích trong bản xem trước PDF. */
@media print {
  html, body, body.dark {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 10.8pt !important;
  }
  html { font-size: 12px !important; }
  body { display: block !important; line-height: 1.44 !important; }
  .page-shell, .workspace, .results-column,
  .estimate-panel, .schedule-panel,
  body.printing-compare .compare-panel {
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .page-shell { margin-top: 0 !important; padding-top: 0 !important; flex: none !important; }
  .panel-heading { padding: 0 0 3mm !important; }
  .panel-heading h2 { font-size: 14.4pt !important; }
  .section-kicker { font-size: 8pt !important; }
  .project-summary { padding: 0 0 3mm !important; font-size: 8.8pt !important; }
  .total-card { margin: 0 0 5mm !important; padding: 4mm 5mm !important; }
  .total-card-meta span { font-size: 8pt !important; }
  .total-card-meta small { font-size: 8.4pt !important; }
  .total-card-price strong { font-size: 18.4pt !important; }
  .table-wrap { width: 100% !important; overflow: visible !important; }
  .cost-table, .schedule-table, .compare-table { width: 100% !important; table-layout: fixed; }
  .cost-table th, .cost-table td,
  .schedule-table th, .schedule-table td,
  .compare-table th, .compare-table td {
    padding: 2.52mm 2mm !important;
    font-size: 9pt !important;
    line-height: 1.215 !important;
    overflow-wrap: anywhere;
  }
  .cost-table th:first-child, .cost-table td:first-child { width: 31% !important; }
  .cost-table th:nth-child(2), .cost-table td:nth-child(2) { width: 44% !important; }
  .cost-table th:last-child, .cost-table td:last-child { width: 25% !important; }
  .cost-table tfoot td:first-child { width: 75% !important; }
  .cost-table tfoot td:last-child { width: 25% !important; }
  .fine-print { padding: 4mm 0 0 !important; font-size: 8pt !important; line-height: 1.35 !important; }
  .schedule-panel { margin-top: 6mm !important; }
  .schedule-panel .panel-heading { break-after: avoid; }
  .schedule-stats { margin: 0 0 5mm !important; }
  .progress-caption, .progress-track { margin-left: 0 !important; margin-right: 0 !important; }
}

/* Nhãn trạng thái chỉ dùng viền xanh, không tô nền. */
.live-tag {
  background: transparent;
  border: 1.5px solid var(--success);
  color: var(--success);
  box-shadow: 0 0 0 0 rgba(46, 122, 85, .22);
  animation: live-outline 2.4s ease-in-out infinite;
}
.live-tag > span { display: none; }
@keyframes live-outline {
  50% { box-shadow: 0 0 0 3px rgba(46, 122, 85, .13); }
}
@media (prefers-reduced-motion: reduce) {
  .live-tag { animation: none; }
}
@media print {
  .live-tag {
    background: #fff !important;
    border-color: #2e7a55 !important;
    color: #2e7a55 !important;
    box-shadow: none !important;
    animation: none !important;
  }
}

/* Tiêu đề chính nằm giữa thanh đầu trang. */
.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 1.25rem;
}
.header-inner .brand { justify-self: start; }
.header-actions { justify-self: end; }
.header-title {
  margin: 0;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 1.65vw, 1.7rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.03em;
  text-align: center;
  white-space: nowrap;
}
@media (max-width: 1150px) {
  .header-inner {
    height: auto;
    min-height: 76px;
    padding-top: .6rem;
    padding-bottom: .6rem;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand actions" "title title";
    row-gap: .5rem;
  }
  .header-inner .brand { grid-area: brand; }
  .header-actions { grid-area: actions; }
  .header-title {
    grid-area: title;
    white-space: normal;
    font-size: 1.25rem;
  }
}
@media print { .header-title { display: none !important; } }
