          :root {
            --bg: #4d6935;
            --surface: #3b4d27;
            --surface2: #5d7843;
            --border: rgba(255, 255, 255, .28);
            --divider: rgba(255, 255, 255, .18);
            --text: #ffffff;
            --heading: #ffffff;
            --muted: #e0e0e0;
            --faint: #c5d0bd;
            --primary: #81c784;
            --primary-h: #a5d6a7;
            --primary-hi: rgba(129, 199, 132, .25);
            --err: #ff8a80;
            --shadow: 0 4px 14px rgba(0, 0, 0, .28);
            --r: .6rem;
            --body: 'Lato', system-ui, sans-serif;
            --display: 'Lato', system-ui, sans-serif;
        }

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

        html {
            scroll-behavior: smooth;
            -webkit-font-smoothing: antialiased;
        }

        html,
        body {
            min-height: 100%;
            overflow-x: hidden;
        }

        body {
            font-family: var(--body);
            font-size: 16px;
            line-height: 1.55;
            color: var(--text);
            background: var(--bg);
        }

        button,
        input,
        textarea {
            font: inherit;
        }

        button {
            cursor: pointer;
            border: 0;
            background: none;
            color: inherit;
        }

        input,
        textarea {
            color: var(--text);
        }

        .app {
            min-height: 100dvh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            background: var(--bg);
        }

        .app-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 10px clamp(12px, 3vw, 24px);
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 9px;
            min-width: 0;
        }

        .logo-icon {
            width: 36px;
            height: 36px;
            flex: none;
        }

        .logo-text {
            font-family: var(--display);
            font-weight: 900;
            font-size: 1rem;
            line-height: 1.15;
            color: var(--heading);
        }

        .logo-sub {
            font-size: .75rem;
            color: var(--muted);
            white-space: nowrap;
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .badge-ref {
            font-size: .72rem;
            color: var(--text);
            background: rgba(255, 255, 255, .14);
            border: 1px solid rgba(255, 255, 255, .25);
            border-radius: 99px;
            padding: 3px 9px;
            white-space: nowrap;
        }

        .panels {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
            flex: 1;
            min-height: 0;
            overflow: hidden;
        }

        .panel {
            display: flex;
            flex-direction: column;
            min-width: 0;
            min-height: 0;
            overflow: hidden;
            background: var(--bg);
        }

        #left-panel {
            border-right: 1px solid var(--border);
        }

        .panel-head {
            padding: 14px clamp(12px, 2vw, 20px) 10px;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            flex: none;
        }

        .panel-title {
            font-family: var(--display);
            font-size: .98rem;
            font-weight: 900;
            color: var(--heading);
            margin-bottom: 9px;
        }

        .count-pill {
            display: inline-block;
            background: var(--primary);
            color: #1f3823;
            border-radius: 99px;
            font: 700 .7rem var(--body);
            padding: 2px 7px;
            vertical-align: middle;
        }

        .search-wrap {
            position: relative;
            margin-bottom: 9px;
        }

        .search-input {
            width: 100%;
            min-height: 42px;
            padding: 8px 12px 8px 36px;
            border: 1px solid var(--border);
            border-radius: var(--r);
            background: var(--surface2);
            color: var(--text);
            font-size: .9rem;
        }

        .search-input::placeholder,
        .field-input::placeholder,
        .personal-textarea::placeholder {
            color: var(--faint);
        }

        .search-input:focus,
        .field-input:focus,
        .personal-textarea:focus {
            outline: 2px solid rgba(129, 199, 132, .7);
            outline-offset: 1px;
            border-color: var(--primary);
        }

        .search-icon {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--faint);
            pointer-events: none;
        }

        .cat-tabs {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            overflow: visible;
            padding: 1px 1px 3px;
        }

        .cat-btn {
            min-height: 36px;
            padding: 6px 11px;
            border: 1.5px solid var(--border);
            border-radius: 99px;
            background: var(--surface2);
            color: var(--muted);
            font-size: .78rem;
            white-space: nowrap;
            flex: 0 0 auto;
            transition: .15s ease;
        }

        .cat-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .cat-btn.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #1f3823;
        }

        .cat-btn.active:hover,
        .btn-primary:hover {
            background: var(--primary-h);
            border-color: var(--primary-h);
        }

        .panel-scroll {
            flex: 1;
            min-height: 0;
            overflow-y: auto;
            padding: 14px clamp(12px, 2vw, 20px);
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
        }

        .panel-scroll::-webkit-scrollbar {
            width: 6px;
        }

        .panel-scroll::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, .28);
            border-radius: 99px;
        }

        .evidence-section {
            margin-bottom: 16px;
        }

        .section-label {
            margin: 0 2px 6px;
            font-size: .7rem;
            font-weight: 700;
            letter-spacing: .08em;
            text-transform: uppercase;
            color: var(--faint);
        }

        .card {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 12px;
            margin-bottom: 7px;
            border: 1px solid var(--border);
            border-radius: var(--r);
            background: var(--surface2);
            color: var(--text);
            cursor: pointer;
            transition: .15s ease;
        }

        .card:hover,
        .card.selected {
            border-color: var(--primary);
            box-shadow: var(--shadow);
        }

        .card.selected {
            background: var(--primary-hi);
        }

        .card-text,
        .draft-block-text {
            flex: 1;
            min-width: 0;
            font-size: .86rem;
            line-height: 1.5;
        }

        .card-label,
        .draft-block-label {
            display: block;
            margin-bottom: 4px;
            color: var(--primary);
            font-size: .66rem;
            font-weight: 700;
            letter-spacing: .05em;
            text-transform: uppercase;
        }

        .add-btn {
            width: 32px;
            height: 32px;
            flex: none;
            display: grid;
            place-items: center;
            border-radius: 50%;
            background: var(--primary-hi);
            color: var(--primary);
            font-size: 1.15rem;
            border: 1.5px solid transparent;
        }

        .add-btn:hover {
            border-color: var(--primary);
        }

        .card.selected .add-btn {
            background: var(--primary);
            color: #1f3823;
        }

        .draft-meta {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-bottom: 2px;
        }

        .field-wrap {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .field-full {
            grid-column: 1 / -1;
        }

        .field-label {
            font-size: .7rem;
            font-weight: 600;
            color: #666666;
            letter-spacing: .05em;
            text-transform: uppercase;
        }

        .field-input,
        .personal-textarea {
            width: 100%;
            padding: 9px 10px;
            border: 1px solid #ddd9cc;
            border-radius: var(--r);
            background: #faf9f5;
            color: #555555;
            font-size: .86rem;
        }

        .personal-textarea {
            min-height: 68px;
            resize: vertical;
            line-height: 1.45;
        }

        .field-input::placeholder,
        .personal-textarea::placeholder {
            color: #9aa1a5;
        }

        .draft-blocks {
            display: flex;
            flex-direction: column;
            gap: 7px;
        }

        .draft-block {
            display: flex;
            align-items: flex-start;
            gap: 9px;
            padding: 11px 12px;
            border: 1px solid #ddd9cc;
            border-radius: var(--r);
            background: #faf9f5;
            color: #555555;
        }

        .draft-block-text {
            color: #555555;
        }

        .remove-btn {
            width: 30px;
            height: 30px;
            flex: none;
            border-radius: 50%;
            color: #9aa1a5;
            font-size: 1rem;
        }

        .remove-btn:hover {
            background: rgba(255, 138, 128, .15);
            color: var(--err);
        }

        .empty-draft {
            text-align: center;
            padding: 32px 12px;
            color: #666666;
        }

        .empty-draft svg {
            display: block;
            margin: 0 auto 12px;
            color: #9aa1a5;
        }

        .empty-draft p {
            font-size: .9rem;
        }

        .empty-draft small {
            font-size: .78rem;
            color: #9aa1a5;
        }

        #right-panel {
            background: #f3f6fa;
        }

        #right-panel .panel-head,
        #right-panel .panel-scroll,
        #right-panel .action-bar {
            background: #ffffff;
        }

        #right-panel .panel-title {
            color: #2c3e50;
        }

        .action-bar {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            padding: 10px clamp(12px, 2vw, 20px);
            border-top: 1px solid #ddd9cc;
            flex: none;
        }

        .btn {
            min-height: 40px;
            padding: 8px 13px;
            border-radius: var(--r);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-size: .83rem;
            font-weight: 600;
            transition: .15s ease;
        }

        .btn-primary {
            background: var(--primary);
            color: #1f3823;
        }

        .btn-outline {
            border: 1.5px solid #ddd9cc;
            background: #ffffff;
            color: #555555;
        }

        .btn-outline:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        #btn-clear {
            margin-left: auto;
            color: var(--err);
        }

        .no-results {
            text-align: center;
            padding: 32px 12px;
            color: var(--muted);
            font-size: .88rem;
        }

        @media (max-width: 767px) {

            html,
            body {
                min-height: 100%;
                overflow-x: hidden;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }

            body {
                font-size: 16px;
            }

            .app {
                height: auto;
                min-height: 100dvh;
                display: block;
                overflow: visible;
            }

            .app-header {
                position: sticky;
                top: 0;
                z-index: 10;
            }



            .badge-ref {
                font-size: .68rem;
            }

            .panels {
                display: flex;
                flex-direction: column;
                height: auto;
                min-height: 0;
                overflow: visible;
            }

            .panel {
                display: flex;
                flex-direction: column;
                height: auto;
                min-height: 0;
                max-height: none;
                overflow: visible;
            }

            #left-panel {
                height: 52dvh;
                min-height: 280px;
                max-height: 52dvh;
                border-right: 0;
                border-bottom: 1px solid var(--border);
                overflow: hidden;
            }

            #left-panel .panel-head {
                height: auto;
                max-height: none;
                overflow: visible;
                flex: none;
            }

            #left-panel .panel-scroll {
                flex: 1;
                height: auto;
                max-height: none;
                min-height: 0;
                overflow-y: auto;
                overscroll-behavior: contain;
                -webkit-overflow-scrolling: touch;
            }

            #right-panel {
                height: auto;
                min-height: 48dvh;
                max-height: none;
                overflow: visible;
                background: #f3f6fa;
            }

            #right-panel .panel-head {
                position: static;
                background: #ffffff;
            }

            #right-panel .panel-scroll {
                height: auto;
                max-height: none;
                min-height: 0;
                overflow: visible;
                background: #ffffff;
            }

            .panel-head,
            .panel-scroll {
                padding-left: 12px;
                padding-right: 12px;
            }

            .cat-tabs {
                display: flex;
                flex-wrap: wrap;
                overflow: visible;
                max-height: none;
                padding-bottom: 4px;
            }

            .cat-btn {
                min-height: 38px;
                font-size: .76rem;
                padding: 7px 10px;
            }

            .draft-meta {
                grid-template-columns: 1fr;
            }

            .field-full {
                grid-column: auto;
            }

            .action-bar {
                position: sticky;
                bottom: 0;
                z-index: 5;
                padding: 10px 12px;
                padding-bottom: calc(10px + env(safe-area-inset-bottom));
                box-shadow: 0 -4px 14px rgba(0, 0, 0, .15);
                background: #ffffff;
            }

            .btn {
                flex: 1;
                min-width: 0;
            }

            .btn svg {
                display: none;
            }

            #btn-clear {
                margin-left: 0;
                flex-basis: 100%;
            }

            .draft-block,
            .card {
                padding: 13px;
            }

            .card-text,
            .draft-block-text {
                font-size: .88rem;
            }

            .add-btn {
                width: 36px;
                height: 36px;
            }

            .search-input,
            .field-input,
            .personal-textarea {
                min-height: 44px;
                font-size: 16px;
            }

            .personal-textarea {
                min-height: 90px;
            }
        }

        @media (max-width: 480px) {
            #left-panel {
                height: 58dvh;
                max-height: 58dvh;
            }

            #right-panel {
                min-height: 42dvh;
            }
        }

        @media (min-width: 768px) and (max-width: 1050px) {
            .draft-meta {
                grid-template-columns: 1fr;
            }

            .field-full {
                grid-column: auto;
            }
        }

        @media (min-width: 768px) {

            html,
            body {
                height: 100%;
                overflow: hidden;
            }

            .app {
                height: 100dvh;
                min-height: 0;
                overflow: hidden;
            }

            .panels {
                flex: 1 1 auto;
                height: auto;
                min-height: 0;
                overflow: hidden;
            }

            .panel {
                height: 100%;
                min-height: 0;
                overflow: hidden;
            }

            .panel-scroll {
                height: 0;
                min-height: 0;
                flex: 1 1 auto;
                overflow-y: auto;
                overflow-x: hidden;
                -webkit-overflow-scrolling: touch;
                overscroll-behavior: contain;
            }
        }

        .category-select {
            display: none;
        }

        @media (max-width: 767px) {
            .cat-tabs {
                display: none !important;
            }

            .category-select {
                display: block;
                width: 100%;
                min-height: 44px;
                padding: 9px 12px;
                border: 1.5px solid rgba(255, 255, 255, .28);
                border-radius: var(--r);
                background: var(--surface2);
                color: var(--text);
                font-size: 16px;
            }

            .category-select:focus {
                outline: 2px solid rgba(129, 199, 132, .7);
                outline-offset: 1px;
                border-color: var(--primary);
            }
        }

        .help-btn {
            width: 36px;
            height: 36px;
            display: grid;
            place-items: center;
            border: 1.5px solid rgba(255, 255, 255, .35);
            border-radius: 50%;
            background: rgba(255, 255, 255, .12);
            color: #ffffff;
            font-size: 1.1rem;
            font-weight: 900;
        }

        .help-btn:hover,
        .help-btn:focus-visible {
            background: var(--primary);
            border-color: var(--primary);
            color: #1f3823;
            outline: none;
        }

        .help-modal[hidden] {
            display: none;
        }

        .help-modal {
            position: fixed;
            inset: 0;
            z-index: 1000;

            place-items: center;
            padding: 20px;
        }

        .help-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(20, 35, 20, .68);
        }

        .help-card {
            position: relative;
            z-index: 1;
            width: min(100%, 520px);
            max-height: min(90dvh, 720px);
            overflow-y: auto;
            padding: 28px;
            border-radius: 12px;
            background: #ffffff;
            color: #555555;
            box-shadow: 0 16px 50px rgba(0, 0, 0, .3);
        }

        .help-close {
            position: absolute;
            top: 10px;
            right: 12px;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            color: #666666;
            font-size: 1.7rem;
            line-height: 1;
        }

        .help-close:hover,
        .help-close:focus-visible {
            background: #e7edde;
            color: #4d6935;
            outline: none;
        }

        .help-kicker {
            margin-bottom: 4px;
            color: #4d6935;
            font-size: .72rem;
            font-weight: 900;
            letter-spacing: .1em;
            text-transform: uppercase;
        }

        .help-card h2 {
            margin-bottom: 18px;
            color: #2c3e50;
            font-family: var(--display);
            font-size: 1.45rem;
        }

        .help-steps {
            padding-left: 22px;
        }

        .help-steps li {
            margin-bottom: 13px;
            padding-left: 5px;
            line-height: 1.5;
        }

        .help-steps strong,
        .help-note strong {
            color: #2c3e50;
        }

        .help-note {
            margin-top: 20px;
            padding: 13px 14px;
            border-left: 4px solid #4d6935;
            border-radius: 6px;
            background: #e7edde;
            line-height: 1.5;
        }

        .help-done {
            width: 100%;
            margin-top: 20px;
            background: #4d6935;
            color: #ffffff;
        }

        .help-done:hover {
            background: #3b4d27;
        }

        body.help-open {
            overflow: hidden;
        }

        @media (max-width: 767px) {
            .help-modal {
                align-items: end;
                padding: 0;
            }

            .help-card {
                width: 100%;
                max-height: 88dvh;
                padding: 26px 20px calc(20px + env(safe-area-inset-bottom));
                border-radius: 16px 16px 0 0;
            }

            .help-btn {
                width: 38px;
                height: 38px;
            }
        }

        /* Editable draft paragraphs */
        .draft-block {
            align-items: stretch;
        }

        .draft-block-content {
            flex: 1;
            min-width: 0;
        }

        .draft-block-label {
            cursor: text;
        }

        .draft-editable {
            width: 100%;
            min-height: 120px;
            padding: 8px 0;
            border: 0;
            outline: 0;
            resize: vertical;
            background: transparent;
            color: #555555;
            font: inherit;
            line-height: 1.5;
        }

        .draft-editable:focus {
            outline: 2px solid rgba(77, 105, 53, .35);
            outline-offset: 4px;
            border-radius: 4px;
        }

        .edit-hint {
            display: block;
            margin-top: 5px;
            color: #9aa1a5;
            font-size: .7rem;
            font-style: italic;
        }

        @media (min-width: 768px) {
            .help-card {
                width: min(90vw, 760px);
                max-width: 760px;
                padding: 36px 42px;
            }

            .help-steps {
                max-width: 680px;
                margin: 0 auto;
            }

            .help-note {
                max-width: 680px;
                margin-left: auto;
                margin-right: auto;
            }

            .help-done {
                max-width: 680px;
                margin-left: auto;
                margin-right: auto;
            }
        }

        .draft-opening-wrap {
            margin-top: 10px;
        }

        #inp-opening {
            min-height: 100px;
        }

        @media (max-width: 767px) {
            #inp-opening {
                min-height: 120px;
            }
        }

        .draft-closing-wrap {
            margin-top: 10px;
        }

        #inp-closing {
            min-height: 100px;
        }

        @media (max-width: 767px) {
            #inp-closing {
                min-height: 120px;
            }
        }

        .submit-help-btn {
            min-height: 36px;
            padding: 6px 12px;
            border: 1.5px solid rgba(255, 255, 255, .35);
            border-radius: var(--r);
            background: rgba(255, 255, 255, .12);
            color: #ffffff;
            font-size: .8rem;
            font-weight: 700;
        }

        .submit-help-btn:hover,
        .submit-help-btn:focus-visible {
            background: var(--primary);
            border-color: var(--primary);
            color: #1f3823;
            outline: none;
        }

        .submit-help-modal[hidden] {
            display: none;
        }

        .submit-help-modal {
            position: fixed;
            inset: 0;
            z-index: 1000;
            display: grid;
            place-items: center;
            padding: 20px;
        }

        .submit-help-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(20, 35, 20, .72);
        }

        .submit-help-card {
            position: relative;
            z-index: 1;
            width: min(92vw, 820px);
            max-height: 90dvh;
            overflow-y: auto;
            padding: 34px 42px;
            border-radius: 12px;
            background: #ffffff;
            color: #555555;
            box-shadow: 0 16px 50px rgba(0, 0, 0, .3);
        }

        .submit-help-close {
            position: absolute;
            top: 10px;
            right: 13px;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            color: #666666;
            font-size: 1.7rem;
            line-height: 1;
        }

        .submit-help-close:hover,
        .submit-help-close:focus-visible {
            background: #e7edde;
            color: #4d6935;
            outline: none;
        }

        .submit-help-kicker {
            margin-bottom: 4px;
            color: #4d6935;
            font-size: .72rem;
            font-weight: 900;
            letter-spacing: .1em;
            text-transform: uppercase;
        }

        .submit-help-card h2 {
            margin-bottom: 12px;
            color: #2c3e50;
            font-family: var(--display);
            font-size: 1.55rem;
        }

        .submit-help-intro {
            margin-bottom: 20px;
            line-height: 1.5;
        }

        .submit-method {
            margin-top: 14px;
            padding: 15px 17px;
            border-left: 4px solid #4d6935;
            border-radius: 6px;
            background: #faf9f5;
        }

        .submit-method h3 {
            margin-bottom: 8px;
            color: #2c3e50;
            font-size: 1rem;
        }

        .submit-method ol {
            margin: 0;
            padding-left: 21px;
        }

        .submit-method li {
            margin-bottom: 6px;
            line-height: 1.45;
        }

        .submit-method a {
            color: #4d6935;
        }

        .submit-help-note {
            margin-top: 20px;
            padding: 13px 14px;
            border-left: 4px solid #ffb74d;
            border-radius: 6px;
            background: #fff8e8;
            line-height: 1.5;
        }

        .submit-help-done {
            width: 100%;
            margin-top: 20px;
            background: #4d6935;
            color: #ffffff;
        }

        .submit-help-done:hover {
            background: #3b4d27;
        }

        @media (max-width: 767px) {
            .submit-help-btn {
                font-size: .72rem;
                padding: 6px 8px;
            }

            .submit-help-modal {
                align-items: end;
                padding: 0;
            }

            .submit-help-card {
                width: 100%;
                max-height: 90dvh;
                padding: 28px 20px calc(20px + env(safe-area-inset-bottom));
                border-radius: 16px 16px 0 0;
            }
        }

        .card-rating {
            display: flex;
            align-items: center;
            gap: 0.45rem;
            margin-bottom: 0.35rem;
            font-size: 0.82rem;
        }

        .stars {
            position: relative;
            display: inline-block;
            letter-spacing: 0.08em;
            line-height: 1;
            white-space: nowrap;
        }

        .stars-empty {
            color: #d9dde3;
        }

        .stars-filled {
            position: absolute;
            inset: 0 auto 0 0;
            overflow: hidden;
            width: 0;
            color: #d79b18;
            white-space: nowrap;
        }

        .rating-number {
            color: var(--muted);
            font-size: 0.75rem;
        }

        .legal-basis {
            margin-top: .7rem;
            padding-top: .55rem;
            border-top: 1px solid var(--border, #e5e7eb);
            font-size: .85rem;
        }

        .legal-basis summary {
            cursor: pointer;
            color: var(--primary);
            font-weight: 600;
        }

        .legal-basis-detail {
            margin-top: .45rem;
            color: var(--muted, #667085);
            line-height: 1.5;
        }
        .form-message {
    margin-top: .75rem;
    padding: .8rem 1rem;
    border: 1px solid #e7b8b8;
    border-left: 4px solid #b42318;
    border-radius: 10px;
    background: #fff3f2;
    color: #8f1d16;
    font-size: .9rem;
    line-height: 1.45;
}

.form-message strong {
    display: block;
    margin-bottom: .2rem;
}


.ai-reword-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid #c9d8ee;
    border-radius: 999px;
    padding: 0.5rem 0.85rem;
    background: #f3f7fd;
    color: #24558f;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ai-reword-btn:hover {
    background: #e5effc;
    border-color: #a3c2e8;
}

.ai-reword-btn:focus-visible {
    outline: 3px solid #9cc4f3;
    outline-offset: 2px;
}

.ai-hint {
    display: block;
    margin-top: 0.45rem;
    color: black;
    font-size: 0.8rem;
    line-height: 1.4;
}
