:root {
    --bg: #0f172a;
    --panel: #111827;
    --card: #ffffff;
    --muted: #64748b;
    --text: #0f172a;
    --line: #e2e8f0;
    --brand: #2563eb;
    --brand-2: #7c3aed;
    --success: #16a34a;
    --danger: #dc2626;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.15), transparent 28%),
        radial-gradient(circle at top right, rgba(124, 58, 237, 0.12), transparent 22%),
        #f8fafc;
}
a { color: var(--brand); text-decoration: none; }
input, textarea, select, button { font: inherit; }

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}
.auth-shell {
    width: min(440px, calc(100vw - 2rem));
}
.auth-card, .hero-card, .resume-card, .empty-state, .editor-panel, .preview-panel, .pdf-shell, .alert {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}
.auth-card {
    padding: 1.6rem 1.6rem 1.8rem;
}
.brand-row {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: .9rem;
}
.brand-logo {
    width: 72px;
    height: 72px;
    display: block;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(21, 128, 61, 0.22);
    flex: 0 0 auto;
}
.brand-kicker {
    font-weight: 800;
    letter-spacing: .02em;
    color: #14532d;
    font-size: 1rem;
}
.brand-subtitle {
    color: var(--muted);
    font-size: .88rem;
}
.brand-mark {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    border-radius: 16px;
    color: white;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    font-weight: 800;
    margin-bottom: 1rem;
}
.auth-form, .resume-form { display: grid; gap: 1rem; }
label { display: grid; gap: .45rem; font-weight: 600; color: #334155; }
small { color: var(--muted); font-weight: 500; }
input, textarea, select {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .9rem 1rem;
    background: white;
}
textarea { resize: vertical; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: .85rem 1.1rem;
    cursor: pointer;
    transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: white; }
.btn.ghost { background: white; border-color: var(--line); color: var(--text); }
.btn.danger { background: #fff1f2; color: var(--danger); border-color: #fecdd3; }
.btn.small { padding: .55rem .8rem; border-radius: 12px; font-size: .92rem; }
.alert { padding: .9rem 1rem; margin: .75rem 0; }
.alert.success { border-color: rgba(22,163,74,.2); color: var(--success); }
.alert.error { border-color: rgba(220,38,38,.2); color: var(--danger); }
.auth-footer, .eyebrow, .resume-template, .preview-toolbar, .pdf-actions { color: var(--muted); }

.topbar, .page-shell {
    width: min(1240px, calc(100vw - 2rem));
    margin: 1rem auto;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.topnav { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.user-pill {
    padding: .6rem .9rem;
    border-radius: 999px;
    background: rgba(37,99,235,.08);
    color: var(--brand);
    font-weight: 700;
}
.hero-card {
    padding: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.section-head { margin: 1rem 0; }
.resume-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.resume-card, .empty-state { padding: 1.2rem; }
.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.editor-layout {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 1rem;
}
.editor-panel, .preview-panel, .pdf-shell { padding: 1.2rem; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.preview-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: .75rem;
}
.template-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.template-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.2rem;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #f8fafc);
    box-shadow: var(--shadow);
    color: var(--text);
    transition: transform .2s ease, box-shadow .2s ease;
    min-height: 180px;
}
.template-card:hover { transform: translateY(-2px); }
.template-card > * { text-align: left; }
.template-card h4 { margin: .35rem 0 .5rem; font-size: 1.1rem; }
.template-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.template-card-badge {
    display: inline-flex;
    padding: .35rem .7rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
    background: rgba(37,99,235,.08);
    color: var(--brand);
}
.template-card-cta {
    display: inline-flex;
    margin-top: 1rem;
    font-weight: 700;
    color: var(--brand);
    align-self: flex-start;
}
.card-fresher { border-top: 6px solid #2563eb; }
.card-it { border-top: 6px solid #7c3aed; }
.card-accountant { border-top: 6px solid #0f172a; }
.editor-tools {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-bottom: 1rem;
    padding: .7rem .8rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8fafc;
    flex-wrap: wrap;
}
.toolbar-label {
    font-size: .86rem;
    font-weight: 800;
    color: #334155;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
}
.tool-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 .8rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 700;
    color: #0f172a;
}
.tool-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}
.bold-btn.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}
.font-size-pill {
    min-width: 42px;
    text-align: center;
    font-weight: 700;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .45rem .5rem;
}
.field-active {
    outline: 2px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}
.template-guide {
    display: grid;
    gap: .25rem;
    padding: .9rem 1rem;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid var(--line);
    color: #334155;
}
.resume-preview {
    background: white;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    min-height: 760px;
}
.resume-preview section + section { margin-top: 1rem; }
.resume-preview h3 {
    margin: 0 0 .5rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--line);
}
.preview-header h2 { margin: 0; font-size: 2rem; }
.preview-header p { margin: .3rem 0; color: var(--muted); }
.preview-meta { display: flex; gap: .7rem; flex-wrap: wrap; color: var(--muted); }
.pdf-shell .resume-preview {
    min-height: auto;
}
.pdf-shell .resume-preview .preview-header {
    margin-bottom: 1rem;
}
.pdf-shell .resume-preview .pdf-body {
    display: grid;
    gap: 1rem;
}
pre {
    white-space: pre-wrap;
    word-break: break-word;
    font: inherit;
    margin: 0;
}
.form-actions, .pdf-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }

.template-fresher { border-top: 6px solid #2563eb; }
.template-experienced_it { border-top: 6px solid #7c3aed; }
.template-accountant { border-top: 6px solid #0f172a; background: linear-gradient(180deg, #fff, #f8fafc); }
.template-fresher .preview-header h2,
.template-experienced_it .preview-header h2,
.template-accountant .preview-header h2 { letter-spacing: .2px; }

.pdf-page { background: #e2e8f0; }
.pdf-shell {
    width: min(900px, calc(100vw - 2rem));
    margin: 1.5rem auto;
}

@media print {
    body {
        background: #fff !important;
    }
    .pdf-shell {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }
    .pdf-actions,
    .topbar,
    .hero-card,
    .template-grid,
    .resume-grid,
    .alert {
        display: none !important;
    }
    .pdf-page .resume-preview {
        margin: 0;
        border: none;
        border-radius: 0;
        min-height: auto;
        padding: 0.6in;
        box-shadow: none;
    }
    .pdf-page .resume-preview h2 {
        font-size: 22pt;
    }
    .pdf-page .resume-preview h3 {
        font-size: 11pt;
        text-transform: uppercase;
        letter-spacing: .08em;
    }
    .pdf-page .resume-preview,
    .pdf-page .resume-preview * {
        color: #000 !important;
        background: #fff !important;
    }
    .pdf-page .resume-preview section {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}

@media (max-width: 980px) {
    .editor-layout { grid-template-columns: 1fr; }
    .template-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .topbar, .hero-card, .form-grid { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
    .form-grid { display: grid; }
    .topnav { width: 100%; }
    .editor-tools { justify-content: stretch; }
    .toolbar-group { width: 100%; justify-content: space-between; }
    .tool-btn { flex: 1; }
    .brand-row {
        align-items: flex-start;
    }
    .brand-logo {
        width: 62px;
        height: 62px;
    }
    .brand-subtitle {
        line-height: 1.3;
    }
    .template-card {
        min-height: 0;
    }
}
