        :root {
            --bg: #eef3fa;
            --panel: #ffffff;
            --ink: #142133;
            --muted: #5f6f86;
            --line: #dbe4f1;
            --brand: #0f5fd8;
            --brand-2: #14b8a6;
            --accent: #0a3d92;
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            font-family: 'Google Sans', sans-serif;
            color: var(--ink);
            background:
                radial-gradient(circle at 10% 20%, rgba(20, 184, 166, 0.12), transparent 40%),
                radial-gradient(circle at 90% 10%, rgba(15, 95, 216, 0.13), transparent 35%),
                var(--bg);
            min-height: 100vh;
        }

        h1,
        h2,
        h3,
        h4,
        h5,
        h6 {
            font-family: 'Google Sans', sans-serif;
            font-weight: 500;
        }

        .topbar {
            position: sticky;
            top: 0;
            z-index: 10;
            backdrop-filter: blur(8px);
            background: rgba(238, 243, 250, 0.88);
            border-bottom: 1px solid var(--line);
            padding: 14px 18px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 800;
            letter-spacing: 0.3px;
        }

        .logo-mark {
            width: 34px;
            height: 34px;
            border-radius: 10px;
            background: linear-gradient(140deg, var(--brand), var(--brand-2));
            color: #fff;
            display: grid;
            place-items: center;
            font-weight: 800;
            box-shadow: 0 8px 16px rgba(15, 95, 216, 0.25);
        }

        .topbar-actions {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .btn {
            border: 1px solid transparent;
            border-radius: 10px;
            padding: 9px 14px;
            font-weight: 700;
            font-size: 13px;
            cursor: pointer;
            transition: 0.2s ease;
        }

        .btn.primary {
            background: linear-gradient(120deg, var(--brand), #2679ee);
            color: #fff;
            box-shadow: 0 10px 20px rgba(15, 95, 216, 0.25);
        }

        .btn.primary:hover {
            filter: brightness(1.05);
            transform: translateY(-1px);
        }

        .btn.ghost {
            border-color: var(--line);
            background: #fff;
            color: var(--accent);
        }

        .btn.ghost:hover {
            border-color: #afc4e6;
            background: #f7faff;
        }

        .layout {
            display: flex;
            flex-direction: column;
            gap: 16px;
            padding: 16px;
            max-width: 1400px;
            margin: 0 auto;
        }

        .panel {
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(24, 41, 66, 0.08);
        }

        .panel-header {
            padding: 16px;
            border-bottom: 1px solid var(--line);
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .control-pane {
            padding: 0;
            max-height: calc(100vh - 94px);
            overflow: auto;
        }

        .panel-title {
            font-size: 16px;
            font-weight: 800;
            margin: 0;
            color: var(--ink);
        }

        .panel-sub {
            margin: 0;
            color: var(--muted);
            font-size: 13px;
        }

        .tab-buttons {
            background: #f5f8fc;
            padding: 8px;
            border-radius: 8px;
            display: inline-flex;
            gap: 6px;
            border: 1px solid var(--line);
            width: fit-content;
        }

        .tab-btn {
            padding: 8px 16px;
            border-radius: 6px;
            border: none;
            background: transparent;
            cursor: pointer;
            font-weight: 600;
            font-size: 13px;
            color: #5f6f86;
            transition: 0.2s ease;
        }

        .tab-btn.active {
            background: var(--brand);
            color: #fff;
            box-shadow: 0 2px 8px rgba(15, 95, 216, 0.25);
        }

        .tab-content {
            display: none;
            padding: 16px;
        }

        .tab-content.active {
            display: block;
        }

        .block {
            border: 1px solid var(--line);
            border-radius: 12px;
            padding: 12px;
            background: #fcfdff;
        }

        .fields {
            display: grid;
            gap: 12px;
        }

        .field {
            display: grid;
            gap: 6px;
        }

        .field label {
            font-size: 12px;
            font-weight: 700;
            color: #27405f;
            text-transform: uppercase;
            letter-spacing: 0.35px;
        }

        .field input,
        .field textarea,
        .field select {
            width: 100%;
            border: 1px solid #cedaed;
            border-radius: 8px;
            font: inherit;
            font-size: 13px;
            padding: 10px 12px;
            color: var(--ink);
            background: #fff;
            outline: none;
        }

        .field textarea {
            min-height: 80px;
            resize: vertical;
        }

        .field input:focus,
        .field textarea:focus,
        .field select:focus {
            border-color: #83aee9;
            box-shadow: 0 0 0 3px rgba(15, 95, 216, 0.12);
        }

        .field-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .module-card {
            border: 1px solid var(--line);
            border-radius: 10px;
            padding: 14px;
            margin-bottom: 12px;
            background: #fafbfc;
        }

        .module-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 12px;
            margin-bottom: 12px;
        }

        .module-name {
            margin: 0;
            font-size: 14px;
            font-weight: 800;
            color: var(--ink);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .module-desc {
            margin: 4px 0 0 0;
            font-size: 12px;
            color: var(--muted);
            line-height: 1.5;
            flex: 1;
        }

        .toggle-btn {
            padding: 6px 14px;
            border-radius: 20px;
            border: 1px solid var(--line);
            background: #fff;
            color: var(--accent);
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            white-space: nowrap;
            transition: 0.2s ease;
        }

        .toggle-btn.active {
            background: var(--brand);
            color: #fff;
            border-color: var(--brand);
            box-shadow: 0 4px 12px rgba(15, 95, 216, 0.25);
        }

        .toggle-btn:hover {
            transform: translateY(-1px);
            border-color: #9ec0f3;
        }

        .feature-list {
            display: grid;
            gap: 8px;
            margin-top: 12px;
        }

        .feature-item {
            border: 1px solid #e8ecf5;
            border-radius: 6px;
            background: #fff;
            padding: 10px;
            display: grid;
            grid-template-columns: 1fr 110px;
            gap: 8px;
            align-items: flex-start;
        }

        .feature-name {
            margin: 0;
            font-size: 13px;
            font-weight: 700;
            color: var(--ink);
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .tag-badge {
            display: inline-block;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 9px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .tag-badge.core {
            background: #e3f2fd;
            color: #0d47a1;
        }

        .tag-badge.advanced {
            background: #f3e5f5;
            color: #4a148c;
        }

        .tag-badge.optional {
            background: #fff8e1;
            color: #e65100;
        }

        .feature-desc {
            margin: 3px 0 0 0;
            color: var(--muted);
            font-size: 12px;
            line-height: 1.4;
        }

        .feature-toggle-btn {
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid #c7d9f5;
            background: #f3f8ff;
            color: #1f4a8f;
            font-size: 11px;
            font-weight: 800;
            cursor: pointer;
            transition: all 0.2s ease;
            width: fit-content;
            justify-self: end;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .feature-toggle-btn.active {
            background: linear-gradient(135deg, #0f5fd8, #1b77f0);
            border-color: #0f5fd8;
            color: #fff;
            box-shadow: 0 3px 8px rgba(15, 95, 216, 0.2);
        }

        .feature-toggle-btn:hover {
            transform: translateY(-1px);
        }

        .inline-form {
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px dashed var(--line);
            display: grid;
            gap: 8px;
        }

        .inline-form .row {
            display: grid;
            grid-template-columns: 1fr 1fr 80px;
            gap: 8px;
        }

        .inline-form input {
            border: 1px solid #d2deef;
            border-radius: 6px;
            padding: 8px 10px;
            font-size: 12px;
            outline: none;
        }

        .inline-form input:focus {
            border-color: #83aee9;
            box-shadow: 0 0 0 2px rgba(15, 95, 216, 0.1);
        }

        .inline-form .mini {
            padding: 8px 10px;
            border-radius: 6px;
            border: 1px solid #b8cdef;
            background: #f1f6ff;
            font-size: 11px;
            font-weight: 800;
            color: #1a4a98;
            cursor: pointer;
            transition: 0.2s ease;
        }

        .inline-form .mini:hover {
            background: #e8f0ff;
        }

        .module-add-wrap {
            border-top: 1px solid var(--line);
            margin-top: 32px;
            padding-top: 24px;
            background: linear-gradient(180deg, rgba(15, 95, 216, 0.03), rgba(15, 95, 216, 0));
            border-radius: 10px;
        }

        .module-add-title {
            margin: 0 0 12px;
            font-size: 14px;
            font-weight: 700;
            color: #1f2f44;
        }

        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(20, 33, 51, 0.4);
            backdrop-filter: blur(4px);
            z-index: 1000;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal-content {
            background: #fff;
            border-radius: 12px;
            padding: 24px;
            width: 400px;
            max-width: 90vw;
            box-shadow: 0 10px 30px rgba(15, 95, 216, 0.15);
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .modal-title {
            margin: 0;
            font-size: 16px;
            font-weight: 800;
            color: var(--ink);
        }

        .modal-close {
            background: transparent;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: var(--muted);
            line-height: 1;
        }

        .modal-close:hover {
            color: #f5989a;
        }

        .module-add-btn {
            width: 100%;
            justify-content: center;
        }

        .module-add-btn:hover {
            filter: brightness(1.1);
            transform: translateY(-1px);
        }

        .custom-section-card {
            border: 1px solid #d8e4f5;
            border-radius: 10px;
            padding: 12px;
            margin-top: 12px;
            background: linear-gradient(180deg, #fbfdff, #f7faff);
            box-shadow: 0 3px 10px rgba(15, 95, 216, 0.08);
        }

        .markdown-add-wrap {
            border: 1px dashed #b7cbeb;
            border-radius: 10px;
            padding: 12px;
            background: #f8fbff;
        }

        .markdown-add-title {
            margin: 0 0 8px;
            font-size: 13px;
            font-weight: 700;
            color: #1f3f6c;
        }

        .markdown-add-sub {
            margin: 0 0 10px;
            font-size: 12px;
            color: #5f6f86;
        }

        .markdown-add-btn {
            width: 100%;
            justify-content: center;
            font-weight: 800;
        }

        .policy-section-card {
            border: 1px solid #d8e4f5;
            border-radius: 10px;
            padding: 12px;
            margin-top: 12px;
            background: #fff;
        }

        .policy-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 8px;
        }

        .policy-include {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 11px;
            color: #2a4d7b;
            font-weight: 700;
            white-space: nowrap;
        }

        .policy-body {
            width: 100%;
            min-height: 88px;
            border: 1px solid #d2deef;
            border-radius: 6px;
            padding: 8px 10px;
            font-size: 12px;
            font-family: inherit;
            resize: vertical;
            outline: none;
            color: #1f2f44;
        }

        .policy-body:focus {
            border-color: #83aee9;
            box-shadow: 0 0 0 2px rgba(15, 95, 216, 0.1);
        }

        .custom-section-head {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
        }

        .custom-section-title {
            width: 100%;
            border: 1px solid #d2deef;
            border-radius: 6px;
            padding: 8px 10px;
            font-size: 12px;
            font-weight: 700;
            outline: none;
        }

        .custom-section-title:focus {
            border-color: #83aee9;
            box-shadow: 0 0 0 2px rgba(15, 95, 216, 0.1);
        }

        .btn-delete {
            padding: 5px 8px;
            border-radius: 4px;
            border: 1px solid #f5989a;
            background: #fde5e6;
            color: #c53030;
            font-size: 11px;
            font-weight: 700;
            cursor: pointer;
        }

        .btn-delete:hover {
            background: #fbcec0;
        }

        .btn-icon {
            padding: 5px 8px;
            border-radius: 4px;
            border: 1px solid #d2deef;
            background: #f1f6ff;
            color: #1a4a98;
            font-size: 11px;
            font-weight: 700;
            cursor: pointer;
        }

        .btn-icon:hover {
            background: #e8f0ff;
        }

        .preview-wrap {
            padding: 16px;
            max-height: calc(100vh - 100px);
            overflow: auto;
        }

        .srs-document {
            position: relative;
            max-width: 980px;
            margin: 0 auto;
            background: #fff;
            border: 1px solid #d5e0ef;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(20, 34, 56, 0.08);
            padding: 0;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            min-height: calc(100vh - 84px);
            /* Pushes footer to bottom */
        }

        .layout-table {
            width: 100%;
            flex-grow: 1;
            /* Pushes the footer image down */
        }

        .doc-header-img {
            width: 100%;
            height: auto;
            max-height: 240px;
            object-fit: contain;
            display: block;
            background: #fff;
        }

        .doc-content {
            padding: 24px 28px;
            position: relative;
            z-index: 1;
        }

        .doc-head {
            border-bottom: 2px solid #dbe6f6;
            padding-bottom: 12px;
            margin-bottom: 16px;
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 14px;
        }

        .doc-title-block {
            min-width: 0;
            padding-top: 10px;
        }

        .doc-title-block h1 {
            color: var(--ink);
            font-size: 20px;
            font-weight: 800;
            line-height: 1.25;
            margin: 0;
        }

        .doc-subtitle {
            font-size: 12px;
            color: #456289;
            margin-top: 4px;
            font-weight: 700;
            letter-spacing: 0.2px;
            text-transform: uppercase;
        }

        .doc-meta-panel {
            min-width: 275px;
            border: 1px solid #d9e5f7;
            border-radius: 8px;
            background: #f7fbff;
            padding: 10px 12px;
        }

        .doc-meta-title {
            margin: 0 0 8px;
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.8px;
            text-transform: uppercase;
            color: #3a5f92;
        }

        .doc-meta-row {
            display: grid;
            grid-template-columns: 110px 1fr;
            gap: 8px;
            align-items: baseline;
            font-size: 11px;
            color: #20354f;
            line-height: 1.45;
        }

        .doc-meta-row+.doc-meta-row {
            margin-top: 4px;
        }

        .doc-meta-label {
            font-weight: 700;
            color: #4d6484;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            font-size: 10px;
        }

        .doc-meta-value {
            font-weight: 700;
            color: #152a44;
            word-break: break-word;
        }

        .doc-body {
            position: relative;
            z-index: 1;
            display: grid;
            gap: 16px;
        }

        .doc-section h2 {
            margin: 0 0 8px;
            font-size: 15px;
            color: #123f7d;
            border-left: 4px solid #2a7ddf;
            padding-left: 8px;
        }

        .doc-section p {
            font-size: 12px;
            color: #1f2f44;
            line-height: 1.6;
            margin: 0 0 8px 0;
        }

        .doc-section li {
            font-size: 12px;
            color: #1f2f44;
            line-height: 1.6;
            margin: 0 0 4px 0;
        }

        .doc-section ul,
        .doc-section ol {
            margin: 8px 0 0;
            padding-left: 32px;
            display: block;
        }

        .doc-section ul li {
            list-style-type: disc;
            margin-bottom: 5px;
            display: list-item;
        }

        .doc-section ol li {
            list-style-type: decimal;
            margin-bottom: 5px;
            display: list-item;
        }

        .module-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 8px;
            font-size: 12px;
        }

        .module-table th,
        .module-table td {
            border: 1px solid #d8e4f5;
            padding: 10px;
            vertical-align: top;
            text-align: left;
        }

        .module-table th {
            background: #eff5ff;
            color: #1f4a8f;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.4px;
        }

        .module-table tr:nth-child(even) {
            background: #f9fbff;
        }

        .module-col-name {
            font-weight: 700;
            color: #0f5fd8;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 6px;
        }

        .module-col-desc {
            font-size: 11px;
            color: #5f6f86;
            margin-bottom: 8px;
        }

        .doc-footer-img {
            width: 100%;
            height: auto;
            max-height: 130px;
            object-fit: contain;
            display: block;
            margin-top: 0;
            background: #fff;
        }

        .print-page-header,
        .print-page-footer {
            display: none;
        }

        .doc-foot {
            border-top: 2px solid #dbe6f6;
            margin-top: 18px;
            padding-top: 10px;
            font-size: 11px;
            color: #5f6f86;
            display: flex;
            justify-content: space-between;
            gap: 8px;
            flex-wrap: wrap;
        }

        .empty-note {
            margin-top: 8px;
            color: #7a8ea8;
            font-size: 12px;
            font-style: italic;
        }

        .EasyMDEContainer .CodeMirror {
            min-height: 140px;
            border: 1px solid #d2deef;
            border-radius: 0 0 10px 10px;
        }

        .editor-toolbar {
            border: 1px solid #d2deef;
            border-bottom: 0;
            border-radius: 10px 10px 0 0;
            background: #f7faff;
        }

        .layout-table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            border: none;
        }

        .layout-table>thead>tr>td,
        .layout-table>tfoot>tr>td {
            border: none;
            padding: 0;
        }

        .layout-table>tbody>tr>td {
            padding: 0;
            border: none;
            vertical-align: top;
        }

        .print-header-space,
        .print-footer-space {
            display: none;
        }

        .search-highlight {
            background-color: rgba(253, 224, 71, 0.8);
            border-radius: 2px;
            padding: 0 2px;
        }

        @media print {
            @page {
                size: A4 portrait;
                margin: 0 !important;
            }

            html,
            body {
                margin: 0 !important;
                padding: 0 !important;
            }

            body {
                background: #fff;
            }

            .no-print,
            .topbar {
                display: none !important;
            }

            .layout {
                display: block;
                padding: 0;
                gap: 0;
            }

            .panel {
                display: none;
            }

            .panel.print-visible {
                display: block;
                border: 0;
                box-shadow: none;
                padding: 0;
            }

            .preview-wrap {
                max-height: none;
                overflow: visible;
                padding: 0;
            }

            .layout-table {
                display: table;
            }

            .layout-table thead {
                display: table-header-group;
            }

            .layout-table tfoot {
                display: table-footer-group;
            }

            .layout-table tbody {
                display: table-row-group;
            }

            .print-header-space {
                display: block !important;
                padding-top: 28mm !important;
                /* Header image height + breathing room */
                visibility: hidden;
            }

            .print-footer-space {
                display: block !important;
                padding-bottom: 23mm !important;
                /* Footer image height + breathing room */
                visibility: hidden;
            }

            .print-page-header,
            .print-page-footer {
                display: block !important;
                position: fixed !important;
                left: 0 !important;
                width: 100% !important;
                margin: 0 !important;
                padding: 0 !important;
                z-index: 9999 !important;
                background: transparent;
            }

            .print-page-header {
                top: 0 !important;
            }

            .print-page-footer {
                bottom: 0 !important;
            }

            .print-page-header img,
            .print-page-footer img {
                display: block !important;
                width: 100% !important;
                max-width: 100% !important;
                height: auto !important;
                margin: 0 !important;
                padding: 0 !important;
                border: none !important;
            }

            .srs-document {
                display: block;
                /* Disable flex on print to allow smooth page breaks */
                border: 0;
                box-shadow: none;
                border-radius: 0;
                width: 100%;
                max-width: none;
                margin: 0;
                padding: 0;
                overflow: visible;
            }

            .doc-content {
                padding: 0 12mm;
                margin: 0;
            }

            /* Professional Print Typography & Colors */
            .doc-content * {
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }

            .doc-head {
                border-bottom: 2px solid #e2e8f0;
                margin-bottom: 6mm;
                padding-bottom: 4mm;
                display: flex;
                align-items: flex-start;
                justify-content: space-between;
                gap: 14px;
            }

            .doc-title-block h1 {
                font-size: 20pt;
                color: #0f172a;
                margin: 0 0 4px;
                line-height: 1.2;
                margin-top: 10px;
            }

            .doc-subtitle {
                font-size: 11pt;
                color: #64748b;
                letter-spacing: 0.5px;
            }

            .doc-meta-panel {
                background: transparent !important;
                border: 1px solid #cbd5e1;
                padding: 12px 16px;
                break-inside: avoid;
            }

            .doc-meta-title {
                color: #0f172a;
                font-size: 9pt;
            }

            .doc-meta-label {
                color: #64748b;
                font-size: 8.5pt;
            }

            .doc-meta-value {
                color: #1e293b;
                font-size: 9.5pt;
            }

            .doc-section h2 {
                border-left: none;
                border-bottom: 1px solid #cbd5e1;
                padding-left: 0;
                padding-bottom: 6px;
                color: #0f172a;
                font-size: 14pt;
                margin-top: 8mm;
                margin-bottom: 4mm;
            }

            .doc-section p,
            .doc-section li {
                font-size: 10.5pt;
                color: #334155;
                line-height: 1.6;
            }

            .module-table th {
                background: transparent !important;
                color: #0f172a;
                border-bottom: 2px solid #cbd5e1;
                font-size: 10pt;
                padding: 8px 12px;
            }

            .module-table td {
                border-color: #e2e8f0;
                padding: 10px 12px;
            }

            .module-table tr:nth-child(even) {
                background: #f8fafc !important;
            }

            .module-col-name {
                color: #0f172a;
                font-size: 10.5pt;
            }

            .module-col-desc {
                color: #475569;
                font-size: 9pt;
            }

            .doc-foot {
                border-top: 1px solid #cbd5e1;
                color: #64748b;
                font-size: 9pt;
                margin-top: 6mm;
                padding-top: 4mm;
                page-break-inside: avoid;
                break-inside: avoid;
            }

            .module-table {
                page-break-inside: auto;
                margin-bottom: 2mm;
            }

            .module-table thead {
                display: table-header-group;
            }

            .module-table tr,
            .module-table td,
            .module-table th {
                page-break-inside: avoid;
                break-inside: avoid;
            }

            .doc-section,
            .doc-foot {
                break-inside: avoid-page;
            }

            .doc-meta-panel {
                break-inside: avoid;
            }

            .doc-header-img,
            .doc-footer-img {
                display: none !important;
            }
        }