
        /* ---------- RESET & GLOBAL ---------- */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #0f172a;
            min-height: 100dvh;
        }

        /* ---------- LOADER ---------- */
        .loader {
            position: fixed;
            inset: 0;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            transition: opacity 0.5s;
        }
        .loader.hide {
            opacity: 0;
            visibility: hidden;
        }
        .spinner {
            width: 50px;
            height: 50px;
            border: 4px solid rgba(255,255,255,0.3);
            border-top-color: #fff;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }
        .loader p {
            color: #fff;
            margin-top: 15px;
            font-weight: 600;
        }

        /* ---------- HEADER & DRAWER ---------- */
        .header {
            background: rgba(255,255,255,0.95);
            backdrop-filter: blur(10px);
            padding: 1rem 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
            position: sticky;
            top: 0;
            z-index: 1000;
        }
        .logo {
            display: flex;
            align-items: center;
            gap: 7px;
            text-decoration: none;
            color: #0f172a;
            font-weight: 800;
            font-size: 1.3rem;
            font-family: 'Poppins', sans-serif;
        }
        .logo img {
            width: 65px;
            height: 65px;
            border-radius: 50%;
            border: 1px solid #6366f1;
            margin-left: -10px;
        }
        .badge {
            background: linear-gradient(135deg, #6366f1, #8b5cf6);
            color: #fff;
            padding: 3px 10px;
            border-radius: 20px;
            font-size: 0.7rem;
        }
        .menu-btn {
            background: #6366f1;
            color: #fff;
            border: none;
            width: 42px;
            height: 42px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 1.1rem;
            margin-right: -10px;
        }

        /* Overlay & Drawer */
        .overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.6);
            z-index: 2000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s;
        }
        .overlay.show {
            opacity: 1;
            visibility: visible;
        }
        .drawer {
            position: fixed;
            top: 0;
            right: -320px;
            width: 300px;
            height: 100dvh;
            background: #fff;
            z-index: 2001;
            transition: right 0.3s;
            display: flex;
            flex-direction: column;
        }
        .drawer.show { right: 0; }
        .drawer-head {
            padding: 1.5rem;
            background: linear-gradient(135deg, #6366f1, #8b5cf6);
            color: #fff;
            font-weight: 700;
            display: flex;
            justify-content: space-between;
        }
        .close {
            background: rgba(255,255,255,0.2);
            border: none;
            color: #fff;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 1.3rem;
        }
        .menu {
            list-style: none;
            padding: 1rem 0;
            flex: 1;
        }
        .menu a {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 1rem 1.5rem;
            text-decoration: none;
            color: #0f172a;
            font-weight: 500;
            transition: all 0.2s;
        }
        .menu a:hover {
            background: #f8fafc;
            color: #6366f1;
        }
        .menu i { width: 20px; font-size: 1.1rem; }

        /* ---------- MAIN LAYOUT ---------- */
        .main {
            max-width: 1400px;
            margin: 0 auto;
            padding: 1.5rem 1rem 6rem;
        }

        /* Tab switching */
        .tab { display: none; animation: fade 0.4s; }
        .tab.active { display: block; }
        @keyframes fade {
            from { opacity: 0; transform: translateY(10px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        /* Cards for input sections */
        .card {
            background: rgba(255,255,255,0.95);
            padding: 1.5rem;
            border-radius: 12px;
            margin-bottom: 1.2rem;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        }
        .card-title {
            font-family: 'Poppins', sans-serif;
            font-size: 1rem;
            font-weight: 700;
            color: #0f172a;
            margin-bottom: 1.2rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .card-title i { color: #6366f1; font-size: 1.1rem; }

        /* Photo upload */
        .photo-box {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1rem;
            padding: 1.2rem;
            background: #f8fafc;
            border-radius: 12px;
            margin-bottom: 1.2rem;
        }
        .photo {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            object-fit: cover;
            border: 3px solid #6366f1;
        }
        .photo-btn {
            background: #6366f1;
            color: #fff;
            padding: 0.7rem 1.3rem;
            border: none;
            border-radius: 25px;
            font-weight: 600;
            cursor: pointer;
            font-size: 0.9rem;
        }
        .remove {
            background: #ef4444;
            color: #fff;
            padding: 0.5rem 1rem;
            border: none;
            border-radius: 25px;
            font-weight: 600;
            cursor: pointer;
            font-size: 0.85rem;
        }
        .loader-logo {
            width: 130px;
            height: 130px;
            border-radius: 50%;
            object-fit: cover;
            border: 1px solid #6366f1;
        }

        /* Input groups with icons */
        .group {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            background: #fff;
            padding: 0.8rem 1rem;
            border-radius: 10px;
            border: 2px solid #e2e8f0;
            margin-bottom: 1rem;
            transition: border 0.2s;
        }
        .group:focus-within { border-color: #6366f1; }
        .group i {
            color: #6366f1;
            width: 18px;
            margin-top: 2px;
        }
        .input {
            flex: 1;
            border: none;
            outline: none;
            font-family: 'Inter', sans-serif;
            font-size: 0.95rem;
            color: #0f172a;
        }
        .input::placeholder { color: #64748b; }
        textarea.input {
            min-height: 80px;
            resize: vertical;
            line-height: 1.6;
        }

        /* Grid for two columns */
        .grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
        }

        /* ---------- BUTTONS (Save, Example, Clear) - now at top in one line ---------- */
        .action-btns {
            display: flex;
            gap: 0.5rem;
            flex-wrap: nowrap;          /* keep buttons in one line */
            margin-bottom: 1.2rem;
        }
        .btn {
            padding: 0.8rem 1rem;
            border: none;
            border-radius: 25px;
            font-weight: 600;
            cursor: pointer;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            flex: 1 1 0;                /* equal width, flexible */
            white-space: nowrap;
        }
        .btn-save    { background: #10b981; color: #fff; }
        .btn-example { background: blueviolet; color: #fff; }
        .btn-clear   { background: #ef4444; color: #fff; }

        /* Preview toolbar */
        .toolbar {
            background: rgba(255,255,255,0.95);
            padding: 1rem;
            border-radius: 12px;
            margin-bottom: 1rem;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
            display: flex;
            flex-wrap: wrap;
            gap: 1rem;
            justify-content: space-between;
        }
        .download {
            background: #10b981;
            color: #fff;
            padding: 0.9rem 1.8rem;
            border: none;
            border-radius: 25px;
            font-weight: 700;
            font-size: 1rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .zoom {
            display: flex;
            align-items: center;
            gap: 8px;
            background: #fff;
            padding: 0.5rem;
            border-radius: 25px;
            border: 2px solid #e2e8f0;
        }
        .zoom-btn {
            background: #6366f1;
            color: #fff;
            border: none;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
        }
        .zoom-text {
            font-weight: 600;
            min-width: 50px;
            text-align: center;
        }

        /* Resume preview */
        .wrap {
            display: flex;
            justify-content: center;
            padding: 1.5rem 0;
        }
        .resume {
            background: #fff;
            width: 100%;
            max-width: 794px;            /* matches A4 width at 96dpi */
            padding: 40px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            border-radius: 12px;
            font-family: 'Inter', sans-serif;
            color: #1e293b;
            /* height auto allows expansion for multi-page PDF */
            min-height: 1123px;           /* visual cue, but PDF will capture full height */
        }

        /* Resume interior styles */
        .r-head {
            display: grid;
            grid-template-columns: auto 1fr;
            gap: 20px;
            padding-bottom: 20px;
            border-bottom: 3px solid #2563eb;
            margin-bottom: 20px;
            align-items: center;
        }
        .r-photo {
            width: 100px;
            height: 100px;
            border-radius: 10px;
            object-fit: cover;
            border: 3px solid #2563eb;
        }
        .r-name {
            font-size: 28px;
            font-weight: 800;
            color: #2563eb;
            margin-bottom: 5px;
            font-family: 'Poppins', sans-serif;
            line-height: 1.2;
        }
        .r-role {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 12px;
            opacity: 0.85;
        }
        .r-contact {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 8px;
            font-size: 13px;
        }
        .r-contact span {
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .r-contact i { font-size: 12px; }
        .r-sec { margin-bottom: 20px; }
        .r-title {
            font-size: 18px;
            font-weight: 800;
            color: #2563eb;
            margin-bottom: 12px;
            padding-left: 12px;
            border-left: 4px solid #2563eb;
            font-family: 'Poppins', sans-serif;
        }
        .r-text {
            font-size: 14px;
            line-height: 1.7;
            white-space: pre-line;
        }
        .r-skills {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 10px;
        }
        .skill {
            background: linear-gradient(135deg, #2563eb, #3b82f6);
            color: #fff;
            padding: 8px 12px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            text-align: center;
        }

        /* Bottom navigation (Edit/Preview) */
        .nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(255,255,255,0.98);
            padding: 0.7rem;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.7rem;
            box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
            z-index: 999;
        }
        .nav-btn {
            background: #f8fafc;
            color: #0f172a;
            border: 2px solid #e2e8f0;
            padding: 0.8rem;
            border-radius: 10px;
            font-weight: 600;
            font-size: 0.9rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        .nav-btn.active {
            background: linear-gradient(135deg, #6366f1, #8b5cf6);
            color: #fff;
            border-color: #6366f1;
        }

        /* Toast notification */
        .toast {
            position: fixed;
            bottom: 90px;
            right: 15px;
            background: #0f172a;
            color: #fff;
            padding: 0.9rem 1.3rem;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.3);
            display: flex;
            align-items: center;
            gap: 10px;
            transform: translateX(400px);
            transition: transform 0.3s;
            z-index: 3000;
            font-weight: 600;
            font-size: 0.9rem;
        }
        .toast.show { transform: translateX(0); }
        .toast.ok  { background: #10b981; }
        .toast.err { background: #ef4444; }

        /* ---------- RESPONSIVE DESIGN ---------- */
        @media (max-width: 768px) {
            .main { padding: 1rem 0.5rem 6rem; }
            .card { padding: 1.2rem; }
            .grid { grid-template-columns: 1fr; }
            .resume { padding: 30px; max-width: 100%; }
            .r-head { grid-template-columns: 1fr; text-align: center; }
            .r-photo { margin: 0 auto; }
            .r-name { font-size: 22px; }
            .r-role { font-size: 14px; }
            .r-contact { grid-template-columns: 1fr; font-size: 12px; }
            .r-title { font-size: 16px; }
            .r-text { font-size: 13px; }
            .toolbar { flex-direction: column; }
            .download { width: 100%; justify-content: center; }

            /* Keep action buttons in one line on small screens */
            .action-btns { flex-wrap: nowrap; }
            .btn {
                padding: 0.6rem 0.3rem;
                font-size: 0.75rem;
            }
        }

        /* Extra small devices: still keep inline but shrink further */
        @media (max-width: 480px) {
            .logo { font-size: 1.1rem; }
            .logo img { width: 35px; height: 35px; }
            .r-skills { grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); }
            .btn { font-size: 0.7rem; padding: 0.5rem 0.2rem; }
        }

        /* Print styles: hide UI, show resume only */
        @media print {
            body { background: #fff; }
            .header, .nav, .toolbar, .drawer, .overlay, .action-btns {
                display: none !important;
            }
            .resume {
                box-shadow: none;
                border-radius: 0;
                max-width: 100%;
                margin: 0;
                padding: 40px;
            }
        }
    