:root {
    --primary:     #2563EB;
    --primary-dark:#1D4ED8;
    --accent:      #0EA5E9;
    --success:     #16A34A;
    --danger:      #DC2626;
    --warning:     #D97706;
    --bg:          #F1F5F9;
    --surface:     #FFFFFF;
    --border:      #E2E8F0;
    --text:        #1E293B;
    --text-muted:  #64748B;
    --sidebar-w:   240px;
    --radius:      8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #1E293B;
    color: #CBD5E1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 20px 16px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #334155;
}
.sidebar-logo img { width: 32px; height: 32px; border-radius: 6px; }
.sidebar-logo span { font-weight: 700; font-size: 16px; color: #fff; }

.sidebar nav { flex: 1; padding: 12px 0; }

.nav-section { padding: 8px 16px 4px; font-size: 11px; text-transform: uppercase;
               letter-spacing: .08em; color: #475569; font-weight: 600; }

.sidebar a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px;
    color: #94A3B8;
    text-decoration: none;
    border-radius: 0;
    transition: background .15s, color .15s;
}
.sidebar a:hover { background: #334155; color: #E2E8F0; }
.sidebar a.active { background: var(--primary); color: #fff; }
.sidebar a .icon { width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid #334155;
    font-size: 12px;
    color: #64748B;
}
.sidebar-footer a { color: #94A3B8; font-size: 12px; }

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-weight: 600; font-size: 16px; }
.topbar-user  { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }
.topbar-user strong { color: var(--text); }

.page { padding: 24px; flex: 1; }

/* ---- Cards / Surfaces ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ---- Stats grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}
.stat-card .label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--text); margin-top: 4px; }
.stat-card .value.success { color: var(--success); }
.stat-card .value.danger  { color: var(--danger); }
.stat-card .value.warning { color: var(--warning); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: #F8FAFC;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    white-space: nowrap;
}
tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #F8FAFC; }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
}
.badge-success { background: #DCFCE7; color: #166534; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info    { background: #DBEAFE; color: #1E40AF; }
.badge-neutral { background: #F1F5F9; color: #475569; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; }
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-warning  { background: var(--warning);  color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm       { padding: 5px 10px; font-size: 12px; }
.btn-icon     { padding: 6px; border-radius: 6px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
label .req { color: var(--danger); margin-left: 2px; }

input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=password], input[type=date], input[type=time], input[type=search],
select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ---- Alerts ---- */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    display: flex; align-items: flex-start; gap: 8px;
}
.alert-danger  { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 15px; font-weight: 600;
}
.modal-body    { padding: 20px; }
.modal-footer  { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ---- Login ---- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E293B 0%, #2563EB 100%);
}
.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 80px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--primary); }
.login-logo p  { font-size: 13px; color: var(--text-muted); }

/* ---- Photo preview ---- */
.foto-preview {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}
.foto-wrap { display: flex; align-items: center; gap: 12px; }

/* ---- Chips días semana ---- */
.dias-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.dia-chip {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    user-select: none;
    transition: all .15s;
}
.dia-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- Utils ---- */
.flex  { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mb-3  { margin-bottom: 12px; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
