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

:root {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --text: #0f172a;
    --text-muted: #64748b;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #2563eb;
    --radius: 10px;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h2 {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.sidebar-brand p {
    color: var(--sidebar-text);
    font-size: 0.75rem;
    margin-top: 0.2rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-nav a.active {
    color: #fff;
    background: rgba(37,99,235,0.2);
    border-left-color: var(--accent);
}

.sidebar-nav .nav-icon { font-size: 1.1rem; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-footer a:hover { color: #fff; }

/* ── MAIN CONTENT ── */
.main {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
}

.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h1 { font-size: 1.2rem; font-weight: 700; }

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

.content { padding: 2rem; }

/* ── CARDS ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.card-header h2 { font-size: 1rem; font-weight: 700; }

/* ── BOTONES ── */
.btn {
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #f1f5f9; color: #334155; border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }

/* ── TABLA ── */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.6rem 0.8rem;
    border-bottom: 2px solid var(--border);
}
td {
    padding: 0.75rem 0.8rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
    vertical-align: middle;
}
tr:hover td { background: #f8fafc; }
.actions { display: flex; gap: 0.4rem; }

/* ── MODAL ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 90vw;
    width: 90vw;
    height: 90vh;
}

.modal h3 { font-size: 1.1rem; margin-bottom: 1.5rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

/* ── FORMULARIOS ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea { min-height: 100px; resize: vertical; }

.checkbox-group { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-group input { width: auto; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-1c1 { background: #dbeafe; color: #1d4ed8; }
.badge-1c2 { background: #dcfce7; color: #166534; }
.badge-2c1 { background: #fef3c7; color: #92400e; }
.badge-2c2 { background: #fce7f3; color: #9d174d; }

.pro-tag {
    background: #fef3c7;
    color: #92400e;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
}

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* ── QUILL ── */
#editorContainer { min-height: 300px; background: #fff; }
.ql-toolbar { border-radius: 6px 6px 0 0; }
.ql-container { border-radius: 0 0 6px 6px; font-size: 0.9rem; min-height: 250px; }

/* ── LOGIN ── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: var(--sidebar-bg);
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.login-card p { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.9rem; }

.alert {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: none;
}
.alert.error { background: #fef2f2; color: var(--danger); border: 1px solid #fca5a5; }
.alert.show { display: block; }