        :root {
            --bg: #f4f7fb;
            --card: #ffffff;
            --line: #d9e1ea;
            --text: #16202a;
            --muted: #5f6b76;
            --accent: #0f5ea8;
            --warn-bg: #fff7e6;
            --warn-line: #f2cf7a;
            --danger-bg: #fff0f0;
            --danger-line: #d84c4c;
            --danger-text: #8f1f1f;
        }
        * { box-sizing: border-box; }
        body {
            margin: 0;
            font-family: Arial, Helvetica, sans-serif;
            background: linear-gradient(180deg, var(--bg), #ffffff);
            color: var(--text);
        }
        .page { 
            max-width: 1440px; 
            margin: 0 auto; 
            padding: 20px 20px 40px; 
        }
        .grid { 
            display: grid; 
            gap: 1rem;  /* Reduced from 20px → one em-width for cleaner, tighter panel spacing */
        }
        .top-grid { 
            grid-template-columns: repeat(2, minmax(0, 1fr)); 
            gap: 1rem;
        }
        .two-col { 
            grid-template-columns: repeat(2, minmax(0, 1fr)); 
            gap: 1rem;
        }
        .sidebar-layout { 
            grid-template-columns: 500px minmax(0, 1fr);  /* Widened from 440px → reduces the abrupt width jump after the top panels while keeping the sidebar usable */
            align-items: start;
            gap: 1rem;
        }
        .sidebar-stack, .main-stack { 
            display: grid; 
            gap: 1rem;
        }
        .card {
            background: var(--card);
            border: 1px solid var(--line);
            border-radius: 20px;
            padding: 20px;
            box-shadow: 0 4px 18px rgba(15, 40, 70, 0.05);
        }
        /* Tighter visual connection between the hero header card and the first content panels (payload/fuel + profile) */
        .hero {
            margin-bottom: 0.5rem;
        }
        .hero { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
        .hero h1 { margin: 8px 0 12px; font-size: 2.2rem; }
        .hero p, .muted { color: var(--muted); line-height: 1.5; }
        .eyebrow { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
        button {
            border: 1px solid var(--line);
            background: var(--accent);
            color: white;
            border-radius: 12px;
            padding: 11px 16px;
            cursor: pointer;
            font-size: 0.95rem;
        }
        button.secondary { background: white; color: var(--text); }
        h2 { margin-top: 0; margin-bottom: 14px; font-size: 1.15rem; }
        label { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 600; }
        input, select {
            width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line);
            border-radius: 12px; font-size: 0.95rem; background: white;
        }
        input[readonly] { background: #f7f9fc; color: var(--muted); }
        input[type=range] { padding: 0; border: 0; }
        .value-pill { display: inline-block; margin-left: 6px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--accent); font-weight: 700; }
        .form-grid, .notes, .summary-list, .slider-stack { display: grid; gap: 1rem; }
        .field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
        .summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
        .metric { border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
        .metric.danger { border-color: var(--danger-line); background: var(--danger-bg); }
        .metric-label { color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }
        .metric-value { font-size: 1.5rem; font-weight: 700; }
        .metric-note { margin-top: 8px; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
        .metric.danger .metric-note, .metric.danger .metric-value { color: var(--danger-text); }
        .notes div, .summary-list div { color: var(--muted); line-height: 1.45; }
        .notes-panel { grid-column: 1 / -1; }
        .notes-panel ol { margin: 0; padding-left: 22px; color: var(--muted); line-height: 1.55; }
        .notes-panel li { margin: 10px 0; }
        sup a { color: var(--accent); text-decoration: none; }
        sup a:hover { text-decoration: underline; }

        .small { font-size: 0.84rem; }
        .warning-box { border: 1px solid var(--warn-line); background: var(--warn-bg); border-radius: 16px; padding: 14px 16px; }
        .table-wrap { overflow-x: auto; }
        table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: 0.92rem; }
        th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; }
        th { color: var(--muted); font-weight: 700; }
        .badge { display: inline-block; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.8rem; white-space: nowrap; }
        .checkbox-field { align-items: start; }
        .checkbox-stack { display: grid; gap: 10px; }
        .checkline { display: flex; align-items: center; gap: 10px; font-weight: 500; }
        .checkline input { width: auto; }
        @media (max-width: 1120px) {
            .sidebar-layout, .top-grid, .two-col { 
                grid-template-columns: 1fr; 
            }
        }
        @media (max-width: 640px) {
            .page { 
                padding: 14px; 
            }
            .hero { 
                flex-direction: column; 
            }
            .field-pair, .summary-grid { 
                grid-template-columns: 1fr; 
            }
        }

        /* v6 additions */
        .single-row { grid-template-columns: 1fr; margin: 20px 0; }
        .fineprint-window {
            border: 1px solid var(--line);
            border-radius: 12px;
            background: #f7f9fc;
            padding: 10px 12px;
            max-height: 120px;
            overflow: auto;
            color: var(--muted);
            font-family: Helvetica, Arial, sans-serif;
            font-size: 10pt;
            line-height: 1.35;
        }

        .section-head {
            display: flex;
            align-items: end;
            justify-content: space-between;
            gap: 1rem;
            flex-wrap: wrap;
        }
        .inline-control {
            max-width: 260px;
        }
        .hidden {
            display: none !important;
        }

        .collapsed-card summary {
            cursor: pointer;
            font-size: 1.05rem;
            font-weight: 700;
            color: var(--text);
            list-style-position: outside;
        }

        .collapsed-card .collapsible-content {
            margin-top: 14px;
        }

        /* v26/v27 additions */
        .button-row {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }
        .solver-buttons button {
            min-width: 130px;
        }

        /* v27 additions */
        .payload-fuel-grid > label { margin-bottom: -8px; }
        .input-action-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
        .input-action-row button { white-space: nowrap; }
        .hero p { margin: 0 0 10px; }
        .hero h1 { margin-top: 0; }
        @media (max-width: 640px) { .input-action-row { grid-template-columns: 1fr; } }

        .units-row th { font-size: 0.72rem; font-weight: 600; color: var(--muted); background: #f8fafc; }

