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

:root{
    --primary:#2563eb;
    --primary-dark:#1d4ed8;
    --primary-light:#3b82f6;
    --primary-soft:#eff6ff;

    --success:#10b981;
    --success-soft:#ecfdf5;

    --danger:#ef4444;
    --danger-soft:#fef2f2;

    --warning:#f59e0b;
    --warning-soft:#fffbeb;

    --bg:#f3f6fb;
    --card:#ffffff;
    --border:#dbe2ea;

    --text:#1f2937;
    --text-light:#6b7280;
    --text-lighter:#9ca3af;

    --radius-sm:8px;
    --radius-md:12px;
    --radius-lg:18px;

    --shadow-sm:0 2px 6px rgba(15,23,42,.06);
    --shadow:0 10px 25px rgba(15,23,42,.08);
    --shadow-lg:0 20px 40px rgba(15,23,42,.12);

    --transition:.2s ease;
}

html{
    scroll-behavior:smooth;
}

body{
    font-family:'Poppins',sans-serif;
    background:var(--bg);
    color:var(--text);
    line-height:1.5;
    -webkit-font-smoothing:antialiased;
}

button{
    cursor:pointer;
    border:none;
    font-family:inherit;
    transition:var(--transition);
}

button:disabled{
    cursor:not-allowed;
    opacity:.6;
}

input,
select,
textarea{
    font-family:'Poppins',sans-serif;
    font-size:15px;
    transition:var(--transition);
}

::selection{
    background:var(--primary-light);
    color:white;
}

/* Scrollbar */
::-webkit-scrollbar{
    width:8px;
    height:8px;
}
::-webkit-scrollbar-track{
    background:transparent;
}
::-webkit-scrollbar-thumb{
    background:#c7d0dc;
    border-radius:10px;
}
::-webkit-scrollbar-thumb:hover{
    background:#a8b3c2;
}

/* ===========================
   LOGIN
=========================== */

#login-screen{
    position:fixed;
    inset:0;
    display:flex;
    justify-content:center;
    align-items:center;
    background:linear-gradient(135deg,#f4f7fb 0%,#e9eef7 100%);
}

#app{
    display:flex;
    flex-direction:column;
    min-height:100vh;
}

.login-card{
    width:420px;
    background:var(--card);
    padding:40px;
    border-radius:var(--radius-lg);
    box-shadow:var(--shadow-lg);
    animation:fadeInUp .4s ease;
}

@keyframes fadeInUp{
    from{ opacity:0; transform:translateY(12px); }
    to{ opacity:1; transform:translateY(0); }
}

.login-logo{
    width:180px;
    display:block;
    margin:0 auto 25px;
}

.login-title{
    text-align:center;
    margin-bottom:8px;
    color:var(--primary);
    font-weight:700;
}

.login-subtitle{
    text-align:center;
    color:var(--text-light);
    margin-bottom:30px;
    font-size:14px;
}

.form-group{
    margin-bottom:20px;
}

.form-group label{
    display:block;
    margin-bottom:8px;
    font-weight:600;
    font-size:14px;
}

.form-group input{
    width:100%;
    padding:14px;
    border:1px solid var(--border);
    border-radius:10px;
    background:#fafbfc;
}

.form-group input:focus{
    outline:none;
    border-color:var(--primary);
    background:white;
    box-shadow:0 0 0 4px var(--primary-soft);
}

#btn-login{
    width:100%;
    padding:15px;
    background:var(--primary);
    color:white;
    font-size:16px;
    font-weight:600;
    border-radius:10px;
    box-shadow:0 4px 12px rgba(37,99,235,.25);
}

#btn-login:hover{
    background:var(--primary-dark);
    transform:translateY(-1px);
    box-shadow:0 6px 16px rgba(37,99,235,.35);
}

#btn-login:active{
    transform:translateY(0);
}

#error-login{
    color:var(--danger);
    margin-top:18px;
    text-align:center;
    font-size:14px;
    animation:fadeInUp .25s ease;
}

/* ===========================
   HEADER
=========================== */

header{
    height:70px;
    background:white;
    border-bottom:1px solid var(--border);
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 30px;
    position:sticky;
    top:0;
    z-index:10;
}

.header-left{
    display:flex;
    align-items:center;
    gap:15px;
}

.header-logo{
    width:48px;
    height:48px;
    object-fit:contain;
}

.header-right{
    display:flex;
    align-items:center;
    gap:20px;
}

#current-user{
    font-weight:600;
    font-size:14px;
    color:var(--text);
}

#btn-logout{
    background:var(--danger-soft);
    color:var(--danger);
    padding:10px 18px;
    border-radius:var(--radius-sm);
    font-weight:600;
    font-size:14px;
}

#btn-logout:hover{
    background:var(--danger);
    color:white;
}

/* ===========================
   MENÚ
=========================== */

nav{
    height:60px;
    display:flex;
    align-items:center;
    gap:10px;
    padding:0 25px;
    background:white;
    border-bottom:1px solid var(--border);
    overflow-x:auto;
}

#menu{
    display:flex;
    gap:10px;
}

.menu-item{
    background:transparent;
    border:1px solid var(--border);
    padding:10px 20px;
    border-radius:var(--radius-sm);
    font-weight:600;
    font-size:14px;
    color:var(--text-light);
    white-space:nowrap;
}

.menu-item:hover{
    background:var(--primary-soft);
    border-color:var(--primary-light);
    color:var(--primary);
}

.menu-item.active{
    background:var(--primary);
    border-color:var(--primary);
    color:white;
    box-shadow:0 4px 10px rgba(37,99,235,.25);
}

/* ===========================
   MAIN / DASHBOARD
=========================== */

main{
    flex:1;
    padding:30px;
    max-width:1400px;
    width:100%;
    margin:0 auto;
}

#dashboard h1{
    margin-bottom:25px;
    font-size:24px;
    font-weight:700;
}

.cards{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:20px;
    margin-bottom:30px;
}

.card{
    background:var(--card);
    border-radius:var(--radius-md);
    padding:25px;
    box-shadow:var(--shadow-sm);
    border:1px solid var(--border);
    transition:var(--transition);
}

.card:hover{
    box-shadow:var(--shadow);
    transform:translateY(-2px);
}

.card h3{
    color:var(--text-light);
    font-size:14px;
    font-weight:600;
    margin-bottom:12px;
    text-transform:uppercase;
    letter-spacing:.03em;
}

.card span{
    font-size:34px;
    font-weight:700;
    color:var(--text);
}

#graficoPacientes{
    background:var(--card);
    border-radius:var(--radius-md);
    padding:20px;
    box-shadow:var(--shadow-sm);
    border:1px solid var(--border);
    height:400px;
}

/* ===========================
   RESPONSIVE
=========================== */

@media (max-width:1100px){
    .cards{
        grid-template-columns:repeat(2,1fr);
    }
}

@media (max-width:640px){
    header{
        padding:0 16px;
    }
    main{
        padding:16px;
    }
    .cards{
        grid-template-columns:1fr;
    }
    .login-card{
        width:90vw;
        padding:28px;
    }
}

.toolbar{

display:flex;

justify-content:space-between;

margin:25px 0;

}

.toolbar input{

width:350px;

padding:12px;

border:1px solid var(--border);

border-radius:8px;

}

#nuevoPaciente{

background:var(--primary);

color:white;

padding:12px 18px;

border-radius:8px;

}

table{

width:100%;

background:white;

border-collapse:collapse;

box-shadow:var(--shadow);

border-radius:12px;

overflow:hidden;

}

th{

background:#f5f7fb;

padding:15px;

text-align:left;

}

td{

padding:15px;

border-top:1px solid var(--border);

}

/*==========================
  MODAL
==========================*/

.modal{

    display:none;

    position:fixed;

    top:0;
    left:0;

    width:100%;
    height:100%;

    background:rgba(0,0,0,.45);

    justify-content:center;

    align-items:center;

    z-index:9999;

}

.modal-content{

    width:700px;

    max-width:95%;

    background:white;

    border-radius:12px;

    padding:30px;

    box-shadow:var(--shadow);

}

.modal-buttons{

    display:flex;

    justify-content:flex-end;

    gap:15px;

    margin-top:20px;

}

.modal textarea{

    min-height:90px;

    resize:vertical;

}
