:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #64748b;
    --accent: #2563eb;
    --border: #e2e8f0;
    --danger: #dc2626;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 2rem 1rem;
}

.container {
    max-width: 820px;
    margin: 0 auto;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    padding: 2.5rem;
}

/* ---------- Builder form ---------- */

.page-head {
    border-bottom: 2px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.page-head h1 {
    font-size: 1.75rem;
    letter-spacing: -0.02em;
}

.page-head p {
    color: var(--muted);
    margin-top: 0.25rem;
}

.alert {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

legend {
    font-weight: 600;
    color: var(--accent);
    padding: 0 0.5rem;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 1rem;
}

.grid label {
    margin-bottom: 0;
}

input,
textarea {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.55rem 0.7rem;
    font: inherit;
    font-weight: 400;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
    resize: vertical;
}

.repeat-row {
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fafbfc;
}

.repeat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.remove-btn:hover {
    text-decoration: underline;
}

.add-btn {
    background: none;
    border: 1px dashed var(--accent);
    color: var(--accent);
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.add-btn:hover {
    background: #eff6ff;
}

.actions {
    display: flex;
    gap: 0.75rem;
}

button.primary,
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.4rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

button.primary:hover,
.btn:hover {
    background: #1d4ed8;
}

.btn.secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background: #f1f5f9;
}

/* ---------- Resume preview ---------- */

.header {
    border-bottom: 2px solid var(--border);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.header h1 {
    font-size: 2rem;
    letter-spacing: -0.02em;
}

.header .title {
    color: var(--accent);
    font-weight: 600;
    margin-top: 0.25rem;
}

.contact {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 0.75rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.contact a {
    color: var(--muted);
    text-decoration: none;
}

.contact a:hover {
    color: var(--accent);
}

.summary {
    margin-top: 1rem;
}

.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 1rem;
}

.entry {
    margin-bottom: 1.25rem;
}

.entry:last-child {
    margin-bottom: 0;
}

.entry-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.entry-head h3 {
    font-size: 1rem;
}

.period {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.entry ul {
    margin: 0.5rem 0 0 1.15rem;
}

.entry li {
    margin-bottom: 0.35rem;
}

.entry p {
    color: var(--muted);
    margin-top: 0.25rem;
}

.entry a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--accent);
}

.entry a:hover {
    color: var(--accent);
}

.skills {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.skills li {
    background: #eff6ff;
    color: var(--accent);
    border-radius: 999px;
    padding: 0.2rem 0.8rem;
    font-size: 0.85rem;
}

.toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.empty {
    color: var(--muted);
    font-style: italic;
}

@media (max-width: 600px) {
    .container {
        padding: 1.5rem;
    }

    .entry-head {
        flex-direction: column;
    }
}

@media print {
    body {
        background: #fff;
        padding: 0;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        max-width: 100%;
    }

    .toolbar {
        display: none;
    }
}
