/* =========================================
   RESET
========================================= */
*{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  background:linear-gradient(135deg,#eef2f7,#e3e9f2);
  color:#1e293b;
}

/* =========================================
   LINKS
========================================= */
a{
  text-decoration:none;
  color:#4f46e5;
  font-weight:500;
}
a:hover{ opacity:.85; }

/* =========================================
   LAYOUT
========================================= */
.container{
  width:90%;
  max-width:1100px;
  margin:40px auto;
}

/* =========================================
   TOPBAR (HEADER)
========================================= */
.topbar
 {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 14px 14px;
    margin-bottom: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    align-content: center;
    flex-wrap: wrap;
    flex-direction: row;
}

.brand{
  display:flex;
  align-items:center;
  gap:15px;
  min-width:0;
}

.logo{
  width:55px;
  height:55px;
  border-radius:18px;
  background:linear-gradient(135deg,#6366f1,#22c55e);
  flex:0 0 auto;
}

.brand h1{
  font-size:18px;
  font-weight:600;
}

.brand p{
  font-size:13px;
  color:#64748b;
}

/* =========================================
   NAV BUTTONS
========================================= */
.navlinks{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.btn{
  padding:10px 16px;
  border-radius:16px;
  border:1px solid #e2e8f0;
  background:#f8fafc;
  color:#1e293b;
  font-size:14px;
  transition:.2s;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
}

.btn:hover{ background:#eef2ff; }

.btn.primary{
  background:#4f46e5;
  color:#fff;
  border:none;
}

.btn.danger{
  background:#fff;
  border:1px solid #fecaca;
  color:#dc2626;
}

/* =========================================
   TITLES
========================================= */
.page-title{
  font-size:30px;
  font-weight:700;
  margin:30px 0 10px;
}

h2{
  font-size:22px;
  margin:25px 0 15px;
}

h3{
  font-size:18px;
  margin:20px 0 10px;
}

.muted{
  color:#64748b;
}

/* =========================================
   CARDS
========================================= */
.card{
  background:#ffffff;
  padding:20px;
  border-radius:20px;
  box-shadow:0 8px 25px rgba(0,0,0,.05);
  margin-bottom:20px;
}

/* =========================================
   STATS
========================================= */
.stats{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:15px;
  margin:20px 0;
}

.stat{
  background:#ffffff;
  padding:20px;
  border-radius:20px;
  box-shadow:0 6px 20px rgba(0,0,0,.05);
}

.stat .label{
  font-size:14px;
  color:#64748b;
  margin-bottom:8px;
}

.stat .v{
  font-size:22px;
  font-weight:700;
}

.income{ color:#16a34a; }
.expense{ color:#dc2626; }
.balance{ color:#1e293b; }

/* =========================================
   TABLE
========================================= */
.table-wrap{
  overflow:auto;
  border-radius:20px;
}

table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  border-radius:20px;
  overflow:hidden;
}

th, td{
  padding:14px;
  font-size:14px;
  border-bottom:1px solid #f1f5f9;
  text-align:left;
}

th{
  background:#f8fafc;
  font-weight:600;
  color:#475569;
}

tr:hover{
  background:#f9fafb;
}

/* =========================================
   FORMS
========================================= */
input, select, textarea{
  padding:12px;
  border-radius:14px;
  border:1px solid #e2e8f0;
  width:100%;
  font-size:14px;
  margin-bottom:10px;
}

button{
  padding:12px 18px;
  border-radius:14px;
  border:none;
  background:#4f46e5;
  color:#fff;
  font-weight:600;
  cursor:pointer;
  transition:.2s;
}

button:hover{ opacity:.9; }

/* =========================================
   LOGIN PAGE
========================================= */
.auth-wrapper{
  min-height:100vh;
  display:flex;
  justify-content:center;
  align-items:center;
  padding:20px;
}

.auth-card{
  width:100%;
  max-width:380px;
  background:#ffffff;
  padding:30px;
  border-radius:25px;
  box-shadow:0 10px 40px rgba(0,0,0,.08);
}

.auth-card h2{
  text-align:center;
  margin-bottom:20px;
}

.auth-card button{
  width:100%;
}

/* =========================================
   RESPONSIVE
========================================= */

/* Tablet */
@media (max-width:900px){
  .stats{
    grid-template-columns:1fr 1fr;
  }
}

/* Mobile */
@media (max-width:640px){

  .container{
    width:92%;
    margin:20px auto;
  }

  /* HEADER en columna */
  .topbar{
    flex-direction:column;
    align-items:stretch;
    gap:14px;
  }

  .brand{
    width:100%;
  }

  /* Opciones debajo del título */
  .navlinks{
    width:100%;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
  }

  .navlinks .btn{
    width:100%;
    text-align:center;
    padding:12px 10px;
  }

  /* Salir ocupa toda la fila */
  .navlinks .btn.danger{
    grid-column:span 2;
  }

  .stats{
    grid-template-columns:1fr;
  }

  .page-title{
    font-size:24px;
  }
}

/* Móvil pequeño */
@media (max-width:420px){
  .navlinks{
    grid-template-columns:1fr;
  }

  .navlinks .btn.danger{
    grid-column:auto;
  }
}
