/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --violet: #6C4CF1;
    --violet-dark: #5538d8;
    --violet-light: #ede9fe;
    --text: #1a1a2e;
    --muted: #64748b;
    --border: #e2e8f0;
    --bg: #f8f7ff;
    --white: #ffffff;
    --radius: 10px;
    --shadow: 0 1px 4px rgba(108,76,241,.08);
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Auth page ─── */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0edff 0%, #e8f4ff 100%);
}

.auth-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(108,76,241,.15);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}

/* ─── Logo ─── */
.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--violet);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    display: block;
}
.logo small {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: .03em;
    text-transform: uppercase;
}

/* ─── Forms ─── */
label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 500;
    font-size: .875rem;
    color: var(--muted);
    margin-bottom: 1rem;
}
input[type=text], input[type=email], input[type=password],
input[type=url], input[type=number], select, textarea {
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 7px;
    padding: .55rem .8rem;
    outline: none;
    transition: border-color .15s;
    background: var(--white);
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(108,76,241,.12);
}
textarea { resize: vertical; min-height: 90px; }

/* ─── Buttons ─── */
.btn {
    display: inline-block;
    padding: .55rem 1.2rem;
    border-radius: 7px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: background .15s, transform .1s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover { background: var(--violet-dark); }
.btn-ghost { background: transparent; color: var(--violet); border: 1.5px solid var(--violet); }
.btn-ghost:hover { background: var(--violet-light); }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }
.btn-nav-out { background: #fee2e2; color: #b91c1c; padding: .3rem .8rem; border-radius: 6px; font-size: .85rem; font-weight: 600; }
.btn-nav-out:hover { background: #fca5a5; text-decoration: none; }

.form-actions { display: flex; gap: .75rem; margin-top: .5rem; }

/* ─── Alerts ─── */
.alert {
    border-radius: var(--radius);
    padding: .8rem 1rem;
    margin-bottom: 1.25rem;
    font-size: .9rem;
    font-weight: 500;
}
.alert-ok  { background: #d1fae5; color: #065f46; border-left: 4px solid #059669; }
.alert-err { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }

/* ─── Navbar ─── */
.navbar {
    background: var(--white);
    border-bottom: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}
.nav-logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--violet);
    line-height: 1.1;
    text-decoration: none;
}
.nav-logo small {
    display: block;
    font-size: .6rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.nav-links a { color: var(--muted); font-weight: 500; font-size: .9rem; }
.nav-links a:hover { color: var(--violet); text-decoration: none; }
.nav-user { font-size: .85rem; color: var(--muted); }

/* ─── Main wrap ─── */
.main-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

/* ─── Page header ─── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.page-header h1 { font-size: 1.6rem; font-weight: 800; }
.page-header p { color: var(--muted); font-size: .95rem; }

/* ─── Stat cards ─── */
.cards-resumen {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .75rem;
    margin-bottom: 2rem;
}
.card-stat {
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    border: 1.5px solid transparent;
}
.stat-num  { font-size: 2rem; font-weight: 800; }
.stat-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }

.badge-bg-generado    { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.badge-bg-enviada     { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.badge-bg-respuesta   { background: #fefce8; border-color: #fde047; color: #854d0e; }
.badge-bg-entrevista  { background: var(--violet-light); border-color: #c4b5fd; color: #5b21b6; }
.badge-bg-oferta      { background: #f0fdf4; border-color: #86efac; color: #166534; }
.badge-bg-rechazo     { background: #fff1f2; border-color: #fca5a5; color: #9f1239; }

/* ─── Badges ─── */
.badge {
    display: inline-block;
    border-radius: 20px;
    padding: .2rem .65rem;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.badge-generado   { background: #f1f5f9; color: #475569; }
.badge-enviada    { background: #dbeafe; color: #1d4ed8; }
.badge-respuesta  { background: #fef9c3; color: #854d0e; }
.badge-entrevista { background: var(--violet-light); color: #5b21b6; }
.badge-oferta     { background: #dcfce7; color: #166534; }
.badge-rechazo    { background: #fee2e2; color: #9f1239; }

/* ─── Table ─── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: .9rem;
}
.data-table th {
    background: var(--violet-light);
    color: #5b21b6;
    font-weight: 700;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .05em;
    padding: .7rem 1rem;
    text-align: left;
    white-space: nowrap;
}
.data-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #faf9ff; }

/* ─── Card ─── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; }

.form-card { max-width: 640px; }
.form-card h3 { font-size: 1rem; color: var(--violet); margin: 1.25rem 0 .5rem; }

/* ─── Two-col ─── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}
@media(max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* ─── Compat badge ─── */
.compat-badge {
    display: inline-block;
    background: var(--violet-light);
    color: var(--violet);
    border-radius: 20px;
    padding: .15rem .6rem;
    font-size: .82rem;
    font-weight: 700;
}

/* ─── Docs section ─── */
.docs-section { margin-top: .5rem; }
.docs-section h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }
.tabs { display: flex; flex-direction: column; gap: 1.25rem; }
.tab-panel {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.25rem;
    background: #faf9ff;
    border-bottom: 1.5px solid var(--border);
}
.tab-header h3 { font-size: .95rem; font-weight: 700; color: var(--violet); }
.doc-pre {
    padding: 1rem 1.25rem;
    font-family: "Cascadia Code", "Fira Code", ui-monospace, monospace;
    font-size: .82rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: #334155;
    max-height: 350px;
    overflow-y: auto;
    line-height: 1.65;
}

/* ─── Timeline ─── */
.timeline-card { overflow-y: auto; max-height: 340px; }
.timeline { list-style: none; }
.timeline li {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: .5rem;
    padding: .55rem 0;
    border-bottom: 1px dashed var(--border);
    font-size: .85rem;
}
.timeline li:last-child { border-bottom: none; }
.ev-date { color: var(--muted); white-space: nowrap; }
.ev-desc { font-weight: 500; }

/* ─── Filter bar ─── */
.filter-bar {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.25rem;
}
.filter-bar select { width: auto; min-width: 200px; }

/* ─── Misc ─── */
.empty-msg { color: var(--muted); font-style: italic; padding: 1rem 0; }

/* ─── Footer ─── */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: .8rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ─── Auth box inner form ─── */
.auth-box h2 { font-size: 1.2rem; margin-bottom: 1.25rem; font-weight: 700; }

/* ─── Responsive ─── */
@media(max-width: 640px) {
    .navbar { padding: .6rem 1rem; }
    .main-wrap { padding: 1.25rem .75rem; }
    .cards-resumen { grid-template-columns: repeat(3, 1fr); }
    .page-header { flex-direction: column; align-items: flex-start; }
}
