/* LegalRAG-ES — minimal CSS, dark theme */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-2: #222536;
    --border: #2e3148;
    --primary: #6c8aff;
    --primary-dark: #4f6fdf;
    --text: #e4e6f0;
    --text-muted: #9498b0;
    --error: #f87171;
    --success: #34d399;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Nav ─────────────────────────────────────── */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    color: var(--text);
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
}
.nav-right { display: flex; gap: 1rem; align-items: center; }
.nav-email { color: var(--text-muted); font-size: 0.9rem; }
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: background 0.15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-form { display: inline; margin: 0; }
.nav-button { background: none; border: none; cursor: pointer; font: inherit; }

/* ── Main ────────────────────────────────────── */
.main {
    flex: 1;
    padding: 2rem 1.5rem;
    max-width: 920px;
    width: 100%;
    margin: 0 auto;
}

/* ── Card (login pages) ──────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    max-width: 440px;
    margin: 4rem auto 0;
}
.card h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }

/* ── Form ────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1.5rem; }
.form label { font-size: 0.85rem; color: var(--text-muted); }
.form input[type="email"], textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.7rem 1rem;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
}
.form input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}
button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.7rem 1.2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
button:hover:not(:disabled) { background: var(--primary-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.muted { color: var(--text-muted); font-size: 0.9rem; }
.error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--error);
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.9rem;
}
.link-back {
    display: inline-block;
    margin-top: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}
.link-back:hover { color: var(--text); }

/* ── Ask page ────────────────────────────────── */
.ask-page { display: flex; flex-direction: column; gap: 1.5rem; }
.quota {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.ask-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.ask-form textarea {
    resize: vertical;
    min-height: 80px;
}
.ask-form button { align-self: flex-end; }

.answer-section, .sources-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}
.answer-section h2, .sources-section h2 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}
.answer { white-space: pre-wrap; line-height: 1.6; font-size: 1.05rem; }
.stats { margin-top: 1rem; font-size: 0.85rem; }

.sources { list-style: none; display: flex; flex-direction: column; gap: 0.8rem; }
.source-item {
    background: var(--surface-2);
    border-left: 3px solid var(--primary);
    padding: 0.8rem 1rem;
    border-radius: 4px;
}
.source-title { font-weight: 500; color: var(--text); }
.source-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.source-excerpt { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; }
.source-link { font-size: 0.8rem; color: var(--primary); text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.source-score {
    display: inline-block;
    background: var(--bg);
    color: var(--success);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-right: 0.5rem;
    font-family: monospace;
}

/* ── Ajustes ─────────────────────────────────── */
.settings { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.2rem; }
.settings h1 { font-size: 1.5rem; }
.settings .card { max-width: none; margin: 0; }
.settings h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.check { display: flex; gap: 0.5rem; align-items: flex-start; color: var(--text) !important; font-size: 0.95rem !important; }
.form input[type="number"], .invite-link {
    padding: 0.6rem 0.8rem; background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); font-size: 0.95rem; width: 100%;
}
.success { border: 1px solid var(--success); border-radius: 6px; padding: 0.8rem; margin: 0.8rem 0; }
.success p { margin-bottom: 0.4rem; }
.settings-link { margin-top: 0.8rem; }
.settings-link a { color: var(--primary); }
.invites { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.85rem; }
.invites th, .invites td { text-align: left; padding: 0.4rem; border-bottom: 1px solid var(--border); }
.link-button { background: none; border: none; color: var(--error); padding: 0; cursor: pointer; font: inherit; }
.danger { border-color: var(--error); }
.danger-button { background: var(--error); }
