@font-face {
            font-family: 'DitbevisOrnaments';
            src: url('./NotoSansSymbols2-Regular.ttf') format('truetype');
            font-style: normal;
            font-weight: 400;
            font-display: swap;
        }

:root {
            --gold: #c9a87c;
            --gold-light: #e8d5b7;
            --gold-dark: #8b7355;
            --brown: #5a4a3a;
            --brown-dark: #3d3028;
            --cream: #fdfbf7;
            --cream-dark: #f8f4ed;
            --parchment: #f5f0e6;
            --border: #e0d5c7;
            --red-accent: #8b3a3a;
            --sidebar-bg: #2c2420;
            --sidebar-text: #e8ddd0;
            --sidebar-accent: #d4a96a;
            --ornament-text-gap: 16px;
        }

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

        button,
        a,
        [role="button"] {
            -webkit-tap-highlight-color: transparent;
        }

        button:focus,
        button:focus-visible,
        a:focus,
        a:focus-visible,
        [role="button"]:focus,
        [role="button"]:focus-visible {
            outline: none;
        }

        body {
            font-family: 'Inter', -apple-system, sans-serif;
            background: #1a1512;
            color: var(--sidebar-text);
            height: 100vh;
            overflow: hidden;
            overflow-x: hidden;
        }

        html, body {
            width: 100%;
            max-width: 100%;
        }

        /* --- APP LAYOUT --- */
        .app-layout {
            display: grid;
            grid-template-columns: 440px 1fr;
            height: 100vh;
            overflow: hidden;
        }

        /* --- SIDEBAR --- */
        .sidebar {
            background: var(--sidebar-bg);
            border-right: 1px solid rgba(212, 169, 106, 0.15);
            overflow: hidden;
            padding: 0;
            position: relative;
            display: flex;
            flex-direction: column;
            height: 100vh;
        }

        .sidebar-header {
            padding: 20px 24px 14px;
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 100%);
            flex-shrink: 0;
            border-bottom: 1px solid rgba(212, 169, 106, 0.14);
            position: relative;
        }

        .sidebar-header::after {
            content: '';
            position: absolute;
            left: 24px;
            right: 24px;
            bottom: -1px;
            height: 1px;
            background: linear-gradient(90deg, rgba(212, 169, 106, 0) 0%, rgba(212, 169, 106, 0.65) 50%, rgba(212, 169, 106, 0) 100%);
        }

        .logo {
            font-family: 'Playfair Display', serif;
            font-size: 26px;
            font-weight: 600;
            color: var(--sidebar-accent);
            letter-spacing: 1px;
            margin-bottom: 0;
            line-height: 1;
        }

        .logo span {
            font-weight: 400;
            color: var(--gold-light);
            font-size: 12px;
            display: block;
            letter-spacing: 2px;
            text-transform: uppercase;
            margin-top: 2px;
            font-family: 'Inter', sans-serif;
            width: 100%;
            white-space: normal;
            overflow: visible;
            text-overflow: initial;
            overflow-wrap: anywhere;
            line-height: 1.25;
        }

        .intro-text {
            font-size: 12px;
            color: rgba(232, 221, 208, 0.72);
            line-height: 1.5;
            margin-top: 16px;
            font-family: 'Inter', sans-serif;
        }

        .intro-text strong {
            color: var(--sidebar-accent);
            font-size: 14px;
            display: block;
            margin-bottom: 2px;
            font-weight: 600;
        }

        .intro-text .intro-subline {
            display: block;
            margin-bottom: 1px;
            color: rgba(232, 221, 208, 0.9);
        }

        .intro-text .intro-help {
            display: block;
            color: rgba(232, 221, 208, 0.76);
        }

        .intro-steps {
            display: block;
            color: var(--sidebar-accent);
            font-weight: 600;
            font-size: 11px;
            margin: 4px 0;
            letter-spacing: 0.2px;
        }

        .quick-guide {
            margin-top: 10px;
            border: 1px solid rgba(212, 169, 106, 0.15);
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.03);
            overflow: hidden;
        }

        .quick-guide summary {
            list-style: none;
            cursor: pointer;
            padding: 9px 11px;
            font-size: 12px;
            font-weight: 600;
            color: var(--sidebar-accent);
        }

        .quick-guide summary::-webkit-details-marker {
            display: none;
        }

        .quick-guide-content {
            padding: 0;
            font-size: 13px;
            color: rgba(232, 221, 208, 0.7);
            line-height: 1.5;
        }

        .quick-guide-list {
            margin: 6px 0 8px 16px;
            padding: 0;
        }

        .quick-guide-list li {
            margin-bottom: 4px;
        }

        .quick-guide-note {
            display: block;
            margin-top: 6px;
            color: rgba(232, 221, 208, 0.58);
            font-size: 11px;
        }

        .sidebar-content {
            padding: 14px 24px 18px;
            border-top: 1px solid rgba(212, 169, 106, 0.1);
            flex: 1;
            overflow-y: auto;
        }

        /* --- CONTROL SECTIONS --- */
        .section {
            margin-bottom: 10px;
            border: 1px solid rgba(212, 169, 106, 0.12);
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.02);
            overflow: hidden;
        }

        .section-title {
            width: 100%;
            border: none;
            background: transparent;
            font-family: 'Inter', sans-serif;
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 2.5px;
            color: var(--sidebar-accent);
            padding: 12px 14px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            cursor: pointer;
            text-align: left;
        }

        .section.expanded .section-title {
            border-bottom: 1px solid rgba(212, 169, 106, 0.12);
        }

        .section-title:hover {
            background: rgba(212, 169, 106, 0.05);
        }

        .section-body {
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-height: 900px;
            opacity: 1;
            overflow: hidden;
            transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
        }

        .section-body .control-group,
        .section-body .radio-group,
        .section-body .btn-random,
        .section-body .category-pills,
        .section-body .action-bw-toggle,
        .section-body .btn-action {
            margin-bottom: 0;
        }

        .section-flavor-text {
            font-size: 12px;
            line-height: 1.45;
            color: rgba(232, 221, 208, 0.6);
            letter-spacing: 0.2px;
        }

        .section.collapsed .section-body {
            max-height: 0;
            opacity: 0;
            padding-top: 0;
            padding-bottom: 0;
            pointer-events: none;
        }

        .accordion-icon {
            font-size: 18px;
            color: rgba(212, 169, 106, 0.85);
            transition: transform 0.2s ease;
            flex-shrink: 0;
        }

        .section.expanded .accordion-icon {
            transform: rotate(180deg);
        }

        .control-group {
            margin-bottom: 12px;
        }

        .control-group label {
            display: block;
            font-size: 13px;
            font-weight: 500;
            color: rgba(232, 221, 208, 0.7);
            margin-bottom: 5px;
            letter-spacing: 0.3px;
        }

        .control-group label small {
            font-size: 12px;
            font-weight: 400;
            color: rgba(232, 221, 208, 0.56);
        }

        select, input[type="text"], input[type="date"] {
            width: 100%;
            padding: 9px 12px;
            min-height: 40px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(212, 169, 106, 0.2);
            border-radius: 8px;
            color: var(--sidebar-text);
            font-family: 'Inter', sans-serif;
            font-size: 14px;
            transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
            outline: none;
        }

        select {
            appearance: none;
            -webkit-appearance: none;
            padding-right: 38px;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23d4a96a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 14px center;
            transition-property: border-color, background-color, box-shadow, color;
            cursor: pointer;
        }

        .mobile-select-enhanced {
            position: relative;
        }

        .mobile-select-trigger {
            display: none;
            width: 100%;
            min-height: 40px;
            padding: 9px 36px 9px 12px;
            border: 1px solid rgba(212, 169, 106, 0.2);
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.05);
            color: var(--sidebar-text);
            font-family: 'Inter', sans-serif;
            font-size: 14px;
            text-align: left;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            position: relative;
            cursor: pointer;
            transition: all 0.2s ease;
            -webkit-tap-highlight-color: transparent;
        }

        .mobile-select-trigger::after {
            content: 'expand_more';
            font-family: 'Material Icons Outlined';
            font-size: 18px;
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            color: rgba(212, 169, 106, 0.85);
            pointer-events: none;
        }

        .mobile-select-trigger:hover {
            border-color: rgba(212, 169, 106, 0.35);
        }

        .mobile-select-trigger:focus-visible {
            outline: none;
            border-color: var(--sidebar-accent);
            background: rgba(255, 255, 255, 0.08);
            box-shadow: 0 0 0 3px rgba(212, 169, 106, 0.1);
        }

        .mobile-select-trigger:focus {
            outline: none;
        }

        select:hover, input[type="text"]:hover, input[type="date"]:hover {
            border-color: rgba(212, 169, 106, 0.35);
        }

        select:focus, input[type="text"]:focus, input[type="date"]:focus {
            border-color: var(--sidebar-accent);
            background-color: rgba(255, 255, 255, 0.08);
            box-shadow: 0 0 0 3px rgba(212, 169, 106, 0.1);
        }

        .btn-action .material-icons-outlined {
            font-size: 18px;
        }

        /* Date input calendar icon color */
        input[type="date"]::-webkit-calendar-picker-indicator {
            filter: invert(72%) sepia(20%) saturate(700%) hue-rotate(350deg) brightness(90%);
            cursor: pointer;
        }

        select option {
            background: var(--sidebar-bg);
            color: var(--sidebar-text);
            padding: 8px;
        }

        input::placeholder {
            color: rgba(232, 221, 208, 0.3);
            font-style: italic;
        }

        /* --- CATEGORY PILLS --- */
        .category-pills {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 14px;
        }

        .pill {
            padding: 5px 12px;
            border: 1px solid rgba(212, 169, 106, 0.2);
            border-radius: 8px;
            font-size: 12px;
            font-family: 'Inter', sans-serif;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            background: transparent;
            color: rgba(232, 221, 208, 0.6);
            letter-spacing: 0.3px;
        }

        .pill:hover {
            border-color: rgba(212, 169, 106, 0.4);
            color: var(--sidebar-text);
            background: rgba(212, 169, 106, 0.08);
        }

        .pill.active {
            background: rgba(212, 169, 106, 0.15);
            border-color: var(--sidebar-accent);
            color: var(--sidebar-accent);
        }

        /* --- RANDOM BUTTON --- */
        .btn-random {
            width: 100%;
            padding: 9px;
            min-height: 40px;
            background: linear-gradient(135deg, rgba(139, 58, 58, 0.3), rgba(139, 58, 58, 0.15));
            border: 1px solid rgba(139, 58, 58, 0.4);
            border-radius: 8px;
            color: #e8a0a0;
            font-family: 'Inter', sans-serif;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.25s ease;
            letter-spacing: 0.3px;
            margin-bottom: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-random:hover {
            background: linear-gradient(135deg, rgba(139, 58, 58, 0.45), rgba(139, 58, 58, 0.25));
            border-color: rgba(139, 58, 58, 0.6);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(139, 58, 58, 0.2);
        }

        .btn-random:active {
            transform: translateY(0);
        }

        /* --- CHECKBOX --- */
        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 10px;
            cursor: pointer;
        }

        .checkbox-group input[type="checkbox"] {
            appearance: none;
            width: 18px;
            height: 18px;
            border: 1px solid rgba(212, 169, 106, 0.3);
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.05);
            cursor: pointer;
            position: relative;
            transition: all 0.2s;
            flex-shrink: 0;
        }

        .checkbox-group input[type="checkbox"]:checked {
            background: var(--sidebar-accent);
            border-color: var(--sidebar-accent);
        }

        .checkbox-group input[type="checkbox"]:checked::after {
            content: '\2713';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: var(--brown-dark);
            font-size: 12px;
            font-weight: 700;
        }

        .checkbox-group span {
            font-size: 13px;
            color: rgba(232, 221, 208, 0.7);
        }

        /* --- RADIO OPTIONS --- */
        .radio-group {
            display: flex;
            gap: 8px;
            margin-bottom: 10px;
        }

        .radio-option {
            flex: 1;
            padding: 7px 8px;
            min-height: 40px;
            border: 1px solid rgba(212, 169, 106, 0.2);
            border-radius: 8px;
            font-size: 13px;
            font-family: 'Inter', sans-serif;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            background: transparent;
            color: rgba(232, 221, 208, 0.6);
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .radio-option:hover {
            border-color: rgba(212, 169, 106, 0.35);
            color: var(--sidebar-text);
        }

        .radio-option.active {
            background: rgba(212, 169, 106, 0.12);
            border-color: var(--sidebar-accent);
            color: var(--sidebar-accent);
        }

        /* --- ACTION BUTTONS --- */
        .action-buttons {
            padding: 14px 24px 18px;
            border-top: 1px solid rgba(212, 169, 106, 0.1);
            background: linear-gradient(0deg, rgba(212, 169, 106, 0.05) 0%, transparent 100%);
            flex-shrink: 0;
        }

        .action-bw-toggle {
            margin-bottom: 10px;
            padding: 8px 10px;
            border: 1px solid rgba(212, 169, 106, 0.15);
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.02);
            min-height: 40px;
            display: flex;
            align-items: center;
        }

        .action-bw-toggle span {
            color: rgba(232, 221, 208, 0.82);
            font-size: 12px;
        }

        .btn-action {
            width: 100%;
            padding: 11px;
            border: none;
            border-radius: 8px;
            font-family: 'Inter', sans-serif;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.25s ease;
            letter-spacing: 0.3px;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .btn-download {
            background: transparent;
            border: 1px solid rgba(212, 169, 106, 0.3) !important;
            color: var(--sidebar-accent);
        }

        .btn-download:hover {
            background: rgba(212, 169, 106, 0.08);
            border-color: var(--sidebar-accent) !important;
        }

        .btn-print {
            background: transparent;
            border: 1px solid rgba(212, 169, 106, 0.3) !important;
            color: var(--sidebar-accent);
        }

        .btn-print:hover {
            background: rgba(212, 169, 106, 0.08);
            border-color: var(--sidebar-accent) !important;
        }

        .btn-share {
            background: rgba(139, 58, 58, 0.15);
            border: 1px solid rgba(139, 58, 58, 0.3) !important;
            color: #e8a0a0;
            font-size: 12px !important;
        }

        .btn-share:hover {
            background: rgba(139, 58, 58, 0.25);
            border-color: rgba(139, 58, 58, 0.5) !important;
        }

        .btn-donate {
            background: rgba(139, 58, 58, 0.15);
            border: 1px solid rgba(139, 58, 58, 0.3) !important;
            color: #e8a0a0;
            text-decoration: none;
            font-size: 12px !important;
        }

        .btn-donate:hover {
            background: rgba(70, 132, 82, 0.34);
            border-color: rgba(126, 196, 139, 0.64) !important;
            color: #e9f7ec;
        }

        .btn-donate .material-icons-outlined {
            display: inline-block;
            transform-origin: center center;
            color: inherit;
            transition: color 0.2s ease;
        }

        .btn-donate:hover .material-icons-outlined {
            color: #ff7a7a;
        }

        .btn-donate:hover .material-icons-outlined {
            animation: donateHeartPulse 0.95s ease-in-out infinite;
        }

        @media (prefers-reduced-motion: reduce) {
            .btn-donate:hover .material-icons-outlined {
                animation: none;
            }
        }

        @keyframes donateHeartPulse {
            0% { transform: scale(1); }
            35% { transform: scale(1.2); }
            70% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }

        .btn-action:active {
            transform: translateY(0);
        }

        .quick-actions-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
            margin-top: 0;
            margin-bottom: 14px;
        }

        .quick-actions-grid .btn-action {
            margin-bottom: 0;
            min-height: 44px;
            white-space: nowrap;
            padding: 11px;
        }

        /* --- RESCUE COUNTER --- */
        .rescue-counter {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            padding: 11px;
            margin-top: 2px;
            min-height: 44px;
            border-radius: 8px;
            background: rgba(139, 58, 58, 0.1);
            border: 1px solid rgba(139, 58, 58, 0.2);
        }

        .counter-text {
            font-family: 'Inter', sans-serif;
            font-size: 12px;
            font-weight: 600;
            color: #e8a0a0;
            letter-spacing: 0.3px;
        }

        #counter-number {
            font-size: 13px;
            font-weight: 700;
        }

        .counter-bump {
            animation: bump 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .counter-label-fade {
            animation: counterLabelFade 0.6s ease;
        }

        @keyframes bump {
            0% { transform: scale(1); }
            40% { transform: scale(1.25); }
            100% { transform: scale(1); }
        }

        @keyframes counterLabelFade {
            0% { opacity: 0.35; }
            100% { opacity: 1; }
        }

        /* --- PREVIEW AREA --- */
        .preview-area {
            background: #1a1512;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px 40px;
            position: relative;
            height: 100vh;
            overflow: hidden;
            background-image:
                radial-gradient(ellipse at 30% 20%, rgba(212, 169, 106, 0.03) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(139, 58, 58, 0.02) 0%, transparent 50%);
        }

        .preview-boot-overlay {
            position: absolute;
            inset: 0;
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 3;
            background:
                linear-gradient(180deg, rgba(20, 16, 14, 0.75) 0%, rgba(20, 16, 14, 0.9) 100%);
            backdrop-filter: blur(3px);
        }

        .preview-boot-text {
            font-family: 'Inter', sans-serif;
            font-size: 14px;
            font-weight: 600;
            color: var(--sidebar-accent);
            letter-spacing: 0.8px;
            text-transform: uppercase;
            animation: previewBootPulse 1.2s ease-in-out infinite;
        }

        @keyframes previewBootPulse {
            0% { opacity: 0.45; }
            50% { opacity: 1; }
            100% { opacity: 0.45; }
        }

        .preview-area.is-booting .preview-boot-overlay {
            display: flex;
        }

        .preview-area.is-booting .preview-wrapper {
            opacity: 0;
            transform: scale(0.992);
            pointer-events: none;
        }

        .preview-wrapper {
            transform-origin: center center;
            filter: drop-shadow(0 8px 40px rgba(0, 0, 0, 0.4));
            transition: transform 0.3s ease, opacity 0.28s ease;
            flex-shrink: 0;
        }

        .preview-footer {
            position: absolute;
            bottom: 10px;
            left: 0;
            right: 0;
            font-size: 11px;
            color: rgba(232, 221, 208, 0.2);
            text-align: center;
            letter-spacing: 0.3px;
            line-height: 1.5;
            font-family: 'Inter', sans-serif;
        }

        .preview-footer a {
            color: rgba(212, 169, 106, 0.3);
            text-decoration: none;
            transition: color 0.2s;
        }

        .preview-footer a:hover {
            color: var(--sidebar-accent);
        }

        .mobile-full-footer {
            display: none;
            font-size: 11px;
            color: rgba(232, 221, 208, 0.32);
            text-align: center;
            letter-spacing: 0.3px;
            line-height: 1.5;
            font-family: 'Inter', sans-serif;
            margin-top: 10px;
        }

        .mobile-full-footer a {
            color: rgba(212, 169, 106, 0.45);
            text-decoration: none;
            transition: color 0.2s;
        }

        .mobile-full-footer a:hover {
            color: var(--sidebar-accent);
        }

        /* --- THE CERTIFICATE --- */
        .certificate {
            width: 210mm;
            height: 297mm;
            background: #fff;
            position: relative;
            overflow: hidden;
            flex-shrink: 0;
        }

        .cert-inner {
            position: absolute;
            top: 12mm;
            left: 12mm;
            right: 12mm;
            bottom: 12mm;
            border: 3px double var(--gold-dark);
            background: linear-gradient(to bottom, var(--cream) 0%, var(--cream-dark) 100%);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            text-align: center;
            padding: 20mm 25mm;
            overflow: hidden;
        }

        .ornament-top {
            font-family: 'DitbevisOrnaments', 'Noto Sans Symbols 2', 'Segoe UI Symbol', serif;
            font-size: 44px;
            color: var(--gold);
            margin-bottom: var(--ornament-text-gap);
            line-height: 1;
            letter-spacing: 0;
            display: inline-block;
            transform: translateX(-0.06em) rotate(90deg);
        }

        .cert-title {
            font-family: 'Playfair Display', serif;
            font-size: 40px;
            color: var(--brown);
            font-weight: 600;
            line-height: 1;
            letter-spacing: 4px;
            text-transform: uppercase;
            margin-bottom: 6px;
        }

        .cert-occasion {
            font-family: 'EB Garamond', serif;
            font-size: 15px;
            color: var(--gold-dark);
            letter-spacing: 3px;
            text-transform: uppercase;
            font-weight: 500;
            margin-bottom: 28px;
        }

        .cert-recipient-label {
            font-size: 14px;
            color: var(--gold-dark);
            font-style: italic;
            margin-bottom: 4px;
        }

        .cert-recipient {
            font-family: 'Playfair Display', serif;
            font-size: 28px;
            color: var(--brown);
            font-weight: 500;
            font-style: italic;
            margin-bottom: 24px;
            min-height: 38px;
        }

        .cert-divider {
            width: 80px;
            height: 1px;
            background: var(--gold);
            margin: 0 auto 24px;
            opacity: 0.6;
        }

        .cert-subtitle {
            font-size: 17px;
            color: var(--gold-dark);
            font-style: italic;
            margin-bottom: 20px;
            font-weight: 400;
        }

        .cert-message {
            font-size: 19px;
            color: var(--brown);
            line-height: 1.9;
            max-width: 420px;
            margin-bottom: 16px;
        }

        .cert-message small {
            font-size: 15px;
            color: var(--gold-dark);
            font-style: italic;
        }

        .cert-signature-area {
            margin-top: 36px;
            display: flex;
            flex-direction: column;
            align-items: center;
            position: relative;
        }

        .cert-signature-name {
            font-family: 'Great Vibes', cursive;
            font-size: 34px;
            color: var(--brown);
            display: inline-block;
            width: max-content;
            max-width: 100%;
            white-space: nowrap;
            min-height: 0;
            margin-bottom: 0;
            position: relative;
            z-index: 1;
        }

        .cert-signature-name.has-name {
            min-height: 40px;
            margin-bottom: -8px;
        }

        .cert-signature-name.font-great-vibes { font-family: 'Great Vibes', cursive; }
        .cert-signature-name.font-alex-brush { font-family: 'Alex Brush', cursive; }
        .cert-signature-name.font-pinyon { font-family: 'Pinyon Script', cursive; }

        .cert-signature-line {
            width: var(--sig-line-width, 260px);
            max-width: 360px;
            border-top: 1.5px solid var(--brown);
            padding-top: 8px;
        }

        .cert-signature-label {
            font-size: 12px;
            color: var(--gold-dark);
            letter-spacing: 2px;
            text-transform: uppercase;
        }

        .cert-date {
            font-size: 15px;
            color: var(--gold-dark);
            font-style: italic;
            line-height: 1;
            margin-top: 24px;
        }

        .ornament-bottom {
            font-family: 'DitbevisOrnaments', 'Noto Sans Symbols 2', 'Segoe UI Symbol', serif;
            font-size: 32px;
            color: var(--gold);
            margin-top: var(--ornament-text-gap);
            line-height: 1;
            letter-spacing: 0;
            display: inline-block;
            transform: translateX(-0.04em);
        }

        /* --- BLACK & WHITE MODE --- */
        .certificate.bw-mode .cert-inner {
            background: #fff;
            border-color: #333;
        }

        .certificate.bw-mode .ornament-top,
        .certificate.bw-mode .ornament-bottom {
            font-family: 'DitbevisOrnaments', 'Noto Sans Symbols 2', 'Segoe UI Symbol', serif;
            color: #555;
        }

        .certificate.bw-mode .cert-title {
            color: #111;
        }

        .certificate.bw-mode .cert-occasion,
        .certificate.bw-mode .cert-recipient-label,
        .certificate.bw-mode .cert-subtitle,
        .certificate.bw-mode .cert-date,
        .certificate.bw-mode .cert-signature-label {
            color: #555;
        }

        .certificate.bw-mode .cert-recipient,
        .certificate.bw-mode .cert-message,
        .certificate.bw-mode .cert-signature-name {
            color: #111;
        }

        .certificate.bw-mode .cert-message small {
            color: #666;
        }

        .certificate.bw-mode .cert-divider {
            background: #555;
        }

        .certificate.bw-mode .cert-signature-line {
            border-color: #222;
        }

        /* --- FONT CLASSES FOR CERTIFICATE BODY --- */
        .cert-font-cormorant .cert-inner { font-family: 'Cormorant Garamond', serif; }
        .cert-font-crimson .cert-inner { font-family: 'Crimson Text', serif; }
        .cert-font-eb-garamond .cert-inner { font-family: 'EB Garamond', serif; }
        .cert-font-playfair .cert-inner { font-family: 'Playfair Display', serif; }
        .cert-font-baskerville .cert-inner { font-family: 'Libre Baskerville', serif; }

        /* --- TOAST --- */
        .toast {
            position: fixed;
            bottom: 30px;
            right: 30px;
            background: var(--sidebar-bg);
            border: 1px solid rgba(212, 169, 106, 0.3);
            color: var(--sidebar-text);
            padding: 14px 24px;
            border-radius: 10px;
            font-family: 'Inter', sans-serif;
            font-size: 15px;
            font-weight: 600;
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
            transform: translateY(100px);
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            z-index: 1000;
        }

        .toast.show {
            transform: translateY(0);
            opacity: 1;
        }

        /* --- LOADING OVERLAY --- */
        .loading-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(26, 21, 18, 0.85);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 999;
            backdrop-filter: blur(4px);
        }

        .loading-overlay.show { display: flex; }

        .loading-text {
            font-family: 'Inter', sans-serif;
            font-size: 20px;
            color: var(--sidebar-accent);
            letter-spacing: 2px;
        }

        /* --- PRINT STYLES --- */
        @page {
            size: A4;
            margin: 0;
        }

        @media print {
            * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
            body { background: white !important; margin: 0 !important; padding: 0 !important; }
            .sidebar, .action-buttons, .toast, .loading-overlay, .cookie-banner, .modal-overlay, .preview-footer { display: none !important; }
            .app-layout { display: block !important; }
            .preview-area {
                background: none !important;
                padding: 0 !important;
                display: block !important;
            }
            .preview-wrapper {
                transform: none !important;
                filter: none !important;
                margin: 0 !important;
            }
            .certificate {
                width: 210mm !important;
                height: 297mm !important;
                margin: 0 !important;
                page-break-after: avoid;
            }
            .cert-inner {
                position: absolute !important;
                top: 12mm !important;
                left: 12mm !important;
                right: 12mm !important;
                bottom: 12mm !important;
            }
            #print-root { display: none !important; }
        }

        /* --- RESPONSIVE --- */
        @media (max-width: 900px) {
            body {
                height: auto;
                overflow-y: auto;
                overflow-x: hidden;
            }

            .app-layout {
                grid-template-columns: 1fr;
                height: auto;
                overflow-y: visible;
                overflow-x: hidden;
            }

            .sidebar {
                height: auto;
                overflow: visible;
                border-right: none;
                border-bottom: 1px solid rgba(212, 169, 106, 0.15);
            }

            .sidebar-content {
                overflow: visible;
            }

            .section-title {
                padding-top: 14px;
                padding-bottom: 14px;
                min-height: 46px;
            }

            .action-buttons .btn-action,
            .action-buttons .rescue-counter {
                min-height: 46px;
            }

            .section-body .btn-action {
                min-height: 46px;
            }

            .action-bw-toggle {
                min-height: 46px;
            }

            .btn-random {
                min-height: 46px;
            }

            .section-flavor-text {
                font-size: 13px;
            }

            .action-buttons {
                position: static;
                background: var(--sidebar-bg);
            }

            .preview-area {
                height: auto;
                min-height: auto;
                padding: 20px 12px 8px;
                flex-direction: column;
                justify-content: flex-start;
            }

            .preview-wrapper {
                transform-origin: top center;
            }

            .preview-footer {
                display: none;
            }

            .mobile-full-footer {
                display: block;
            }

            input[type="text"],
            textarea {
                font-size: 16px;
            }

            select,
            input[type="date"] {
                font-size: 14px;
            }

            .mobile-select-enhanced select {
                display: none;
            }

            .mobile-select-enhanced .mobile-select-trigger {
                display: block;
                min-height: 46px;
                font-size: 13px;
            }

            #recipient-name,
            #sig-name {
                font-size: 14px;
            }

            #occasion-select,
            #text-select,
            #occasion-select option,
            #text-select option {
                font-size: 13px;
            }

            select,
            input[type="text"],
            input[type="date"],
            .radio-option {
                min-height: 46px;
            }

            .welcome-modal h2 {
                font-size: 19px;
            }

            .welcome-kicker {
                font-size: 10px !important;
            }

            .welcome-line {
                font-size: 14px !important;
            }

            .welcome-line-lead {
                font-size: 16px !important;
            }
        }

        @media (max-width: 600px) {
            .sidebar-header { padding: 16px 18px 12px; }
            .sidebar-content { padding: 14px 18px; }
            .action-buttons { padding: 12px 18px 14px; }
            .quick-actions-grid { gap: 6px; }
            .quick-actions-grid .btn-action {
                font-size: 12px;
                min-height: 46px;
                padding: 9px 8px;
            }

            .logo { font-size: 23px; }

            .pill { padding: 4px 10px; font-size: 11px; }
            .category-pills { gap: 5px; }

            .preview-area {
                min-height: auto;
                padding: 14px 8px 14px;
            }

            .mobile-full-footer {
                font-size: 10px;
                line-height: 1.45;
                margin-top: 9px;
            }

            .toast {
                left: 16px;
                right: 16px;
                bottom: 16px;
                font-size: 13px;
                text-align: center;
            }

            .cookie-banner {
                flex-direction: column;
                gap: 12px;
                padding: 14px 18px;
                text-align: center;
            }

            .modal {
                padding: 24px;
                margin: 10px;
            }
        }

        /* --- SCROLLBAR --- */
        .sidebar-content::-webkit-scrollbar { width: 6px; }
        .sidebar-content::-webkit-scrollbar-track { background: transparent; }
        .sidebar-content::-webkit-scrollbar-thumb {
            background: rgba(212, 169, 106, 0.15);
            border-radius: 3px;
        }
        .sidebar-content::-webkit-scrollbar-thumb:hover {
            background: rgba(212, 169, 106, 0.25);
        }

        /* Textarea for custom text */
        textarea {
            width: 100%;
            padding: 9px 12px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(212, 169, 106, 0.2);
            border-radius: 8px;
            color: var(--sidebar-text);
            font-family: 'Inter', sans-serif;
            font-size: 14px;
            transition: all 0.2s ease;
            outline: none;
            resize: vertical;
            min-height: 80px;
        }

        textarea:focus {
            border-color: var(--sidebar-accent);
            background: rgba(255, 255, 255, 0.08);
            box-shadow: 0 0 0 3px rgba(212, 169, 106, 0.1);
        }

        textarea::placeholder {
            color: rgba(232, 221, 208, 0.3);
            font-style: italic;
        }

        .hidden { display: none !important; }

        /* --- COOKIE BANNER --- */
        .cookie-banner {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: var(--sidebar-bg);
            border-top: 1px solid rgba(212, 169, 106, 0.2);
            padding: 18px 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 20px;
            z-index: 1001;
            font-family: 'Inter', sans-serif;
            box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
        }

        .cookie-banner p {
            font-size: 14px;
            color: rgba(232, 221, 208, 0.7);
            margin: 0;
            line-height: 1.5;
        }

        .cookie-banner a {
            color: var(--sidebar-accent);
            text-decoration: underline;
            cursor: pointer;
        }

        .cookie-banner-buttons {
            display: flex;
            gap: 10px;
            flex-shrink: 0;
        }

        .cookie-btn {
            padding: 8px 20px;
            border-radius: 8px;
            font-family: 'Inter', sans-serif;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            border: none;
            transition: all 0.2s;
        }

        .cookie-btn-accept {
            background: var(--sidebar-accent);
            color: var(--brown-dark);
        }

        .cookie-btn-accept:hover {
            filter: brightness(1.1);
        }

        .cookie-btn-decline {
            background: transparent;
            border: 1px solid rgba(212, 169, 106, 0.3);
            color: rgba(232, 221, 208, 0.6);
        }

        .cookie-btn-decline:hover {
            border-color: rgba(212, 169, 106, 0.5);
            color: var(--sidebar-text);
        }

        /* --- PRIVACY MODAL --- */
        .modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(26, 21, 18, 0.9);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1002;
            backdrop-filter: blur(4px);
            padding: 20px;
        }

        .mobile-picker-overlay {
            position: fixed;
            inset: 0;
            background: rgba(26, 21, 18, 0.82);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1003;
            padding: 12px;
            backdrop-filter: blur(3px);
        }

        .mobile-picker-overlay.show {
            display: flex;
        }

        body.mobile-picker-open {
            overflow: hidden !important;
        }

        .mobile-picker {
            width: min(560px, 100%);
            max-height: 74vh;
            background: var(--sidebar-bg);
            border: 1px solid rgba(212, 169, 106, 0.24);
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
            display: flex;
            flex-direction: column;
        }

        .mobile-picker-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 12px 14px;
            border-bottom: 1px solid rgba(212, 169, 106, 0.14);
        }

        .mobile-picker-header h3 {
            margin: 0;
            font-size: 14px;
            color: var(--sidebar-accent);
            letter-spacing: 0.4px;
            font-family: 'Inter', sans-serif;
        }

        .mobile-picker-close {
            border: 1px solid rgba(212, 169, 106, 0.3);
            background: transparent;
            color: rgba(232, 221, 208, 0.85);
            border-radius: 8px;
            min-height: 34px;
            padding: 6px 12px;
            font-family: 'Inter', sans-serif;
            font-size: 13px;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
        }

        .mobile-picker-list {
            overflow-y: auto;
            padding: 6px;
        }

        .mobile-picker-option {
            width: 100%;
            border: 1px solid transparent;
            background: transparent;
            color: rgba(232, 221, 208, 0.9);
            border-radius: 8px;
            min-height: 42px;
            padding: 10px 12px;
            text-align: left;
            font-family: 'Inter', sans-serif;
            font-size: 13px;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
        }

        .mobile-picker-option:hover {
            background: rgba(212, 169, 106, 0.07);
        }

        .mobile-picker-option.active {
            border-color: rgba(212, 169, 106, 0.45);
            background: rgba(212, 169, 106, 0.1);
            color: var(--sidebar-accent);
        }

        .mobile-picker-option[disabled] {
            opacity: 0.6;
            cursor: default;
        }

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

        .modal {
            background: var(--sidebar-bg);
            border: 1px solid rgba(212, 169, 106, 0.2);
            border-radius: 12px;
            max-width: 600px;
            width: 100%;
            max-height: 80vh;
            overflow-y: auto;
            padding: 36px;
            font-family: 'Inter', sans-serif;
            color: var(--sidebar-text);
        }

        .modal h2 {
            font-family: 'Playfair Display', serif;
            font-size: 22px;
            color: var(--sidebar-accent);
            margin-bottom: 20px;
        }

        .modal h3 {
            font-size: 16px;
            color: var(--sidebar-accent);
            margin: 18px 0 8px;
            font-weight: 600;
        }

        .modal p {
            font-size: 15px;
            line-height: 1.7;
            color: rgba(232, 221, 208, 0.7);
            margin-bottom: 10px;
        }

        .modal-close {
            margin-top: 24px;
            padding: 10px 28px;
            background: var(--sidebar-accent);
            color: var(--brown-dark);
            border: none;
            border-radius: 8px;
            font-family: 'Inter', sans-serif;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
        }

        .modal::-webkit-scrollbar { width: 6px; }
        .modal::-webkit-scrollbar-track { background: transparent; }
        .modal::-webkit-scrollbar-thumb { background: rgba(212, 169, 106, 0.15); border-radius: 3px; }

        .welcome-modal {
            max-width: 520px;
            text-align: center;
            border-color: rgba(212, 169, 106, 0.36);
            background:
                radial-gradient(circle at 50% -20%, rgba(212, 169, 106, 0.18), transparent 55%),
                var(--sidebar-bg);
            box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
        }

        .welcome-modal .modal-close {
            margin-top: 16px;
        }

        .welcome-kicker {
            display: inline-block;
            margin: 0 0 10px;
            padding: 5px 10px;
            border-radius: 999px;
            border: 1px solid rgba(212, 169, 106, 0.38);
            background: rgba(212, 169, 106, 0.1);
            color: var(--sidebar-accent) !important;
            font-size: 11px !important;
            font-weight: 700;
            letter-spacing: 1.6px;
            text-transform: uppercase;
        }

        .welcome-line {
            font-size: 16px !important;
            color: rgba(232, 221, 208, 0.84) !important;
            margin-bottom: 8px !important;
        }

        .welcome-line-lead {
            font-size: 19px !important;
            line-height: 1.35;
            color: rgba(232, 221, 208, 0.92) !important;
            margin-bottom: 10px !important;
        }

        /* Custom text badge */
        .custom-badge {
            display: inline-block;
            font-size: 10px;
            padding: 2px 8px;
            border-radius: 10px;
            background: rgba(212, 169, 106, 0.15);
            color: var(--sidebar-accent);
            font-weight: 600;
            letter-spacing: 1px;
            text-transform: uppercase;
            margin-left: 8px;
        }

        /* Mobile override (placed late so it wins in cascade) */
        @media (max-width: 900px) {
            .welcome-modal h2 {
                font-size: 19px !important;
            }

            .welcome-kicker {
                font-size: 10px !important;
            }

            .welcome-line {
                font-size: 14px !important;
            }

            .welcome-line-lead {
                font-size: 16px !important;
            }
        }

        /* Usynlig render-root til html2canvas (aldrig scaled) */
        #print-root {
            position: fixed;
            left: -10000px;
            top: 0;
            width: 210mm;
            height: 297mm;
            background: white;
            z-index: -1;
            overflow: hidden;
        }
