:root{
  --blue:#2f86ff;
  --bg1:#0f2a4a;
  --bg2:#05070c;
  --card:rgba(10,14,20,.72);
  --border:rgba(80,120,170,.35);
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  min-height:100vh;
  background: radial-gradient(1200px 800px at 30% 20%, var(--bg1) 0%, var(--bg2) 60%, #020308 100%);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:#e9eef7;
}

.container{
  width:min(1600px,97vw);
  margin:22px auto;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  backdrop-filter: blur(10px);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.brand img{
  width:42px;
  height:42px;
  object-fit:contain;
}

.appname{
  font-weight:800;
  letter-spacing:.3px;
}

.sub{
  font-size:12px;
  color:#b8c7dd;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
}

.pill{
  padding:6px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  color:#cfe3ff;
  font-size:13px;
}

.linkbtn{
  color:#7bb5ff;
  text-decoration:none;
  font-weight:700;
}

.card{
  width:100%;
  background: var(--card);
  border:1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  border-radius:18px;
  padding:22px;
  backdrop-filter: blur(10px);
}

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}

.users-grid{
  display:grid;
  grid-template-columns: 340px 1fr;
  gap:14px;
}

.graphics-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}

h1{
  margin:0 0 6px;
  font-size:26px;
}

hr.sep{
  border:0;
  height:1px;
  background:rgba(255,255,255,.08);
  margin:12px 0 14px;
}

label{
  display:block;
  margin:12px 0 8px;
  color:#cfe3ff;
  font-size:14px;
}

input,
select,
textarea{
  width:100%;
  padding:12px 12px;
  border-radius:12px;
  border:1px solid rgba(47,134,255,.5);
  background: rgba(6,10,18,.75);
  color:#fff;
  outline:none;
}

textarea{
  min-height:90px;
}

input:focus,
select:focus,
textarea:focus{
  box-shadow: 0 0 0 3px rgba(47,134,255,.25);
}

.btn{
  margin-top:14px;
  padding:12px 14px;
  border:0;
  border-radius:12px;
  background: linear-gradient(90deg, rgba(47,134,255,.95), rgba(47,134,255,.55));
  color:#fff;
  font-weight:800;
  letter-spacing:.3px;
  cursor:pointer;
}

.btn.secondary{
  background: transparent;
  border:1px solid rgba(47,134,255,.5);
}

.note{
  color:#b8c7dd;
  font-size:13px;
}

.alert{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  margin:10px 0;
}

.alert.err{
  border-color: rgba(255,80,80,.25);
  color:#ffb1b1;
}

.alert.ok{
  border-color: rgba(0,255,140,.25);
  color:#93ffcf;
}

.login-wrap{
  width:min(420px,92vw);
  margin:40px auto;
}

.center{
  text-align:center;
}

.logoBig{
  width:64px;
  height:64px;
  object-fit:contain;
}

.line{
  width:140px;
  height:3px;
  background: rgba(47,134,255,.55);
  border-radius:999px;
  margin:10px auto 14px;
}

.links{
  margin-top:12px;
  font-size:14px;
  color:#b8c7dd;
}

.links a{
  color:#7bb5ff;
  text-decoration:none;
  font-weight:700;
}

.links a:hover{
  text-decoration:underline;
}

/* ===== Formularios centrados ===== */

.form-container{
  max-width:1100px;
  margin:0 auto;
}

/* ===== Layout vertical admin ===== */

.admin-stack{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.form-grid-top{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:14px;
  align-items:end;
}

.form-grid-top .field-full{
  grid-column:1 / -1;
}

.form-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:4px;
}

.inline-form{
  display:inline;
}

.action-group{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.toolbar-users{
  display:grid;
  grid-template-columns:minmax(260px, 1fr) 180px 180px auto auto;
  gap:10px;
  align-items:center;
  margin-bottom:14px;
}

.toolbar-plans{
  display:grid;
  grid-template-columns:minmax(260px, 1fr) 180px auto auto;
  gap:10px;
  align-items:center;
  margin-bottom:14px;
}

/* ===== Stats ===== */

.stats-grid{
  display:grid;
  grid-template-columns: repeat(5, minmax(120px,1fr));
  gap:12px;
  margin-bottom:12px;
}

.stats-grid-4{
  grid-template-columns: repeat(4, minmax(120px,1fr));
}

.stats-grid-5{
  grid-template-columns: repeat(5, minmax(120px,1fr));
}

.stats-grid-6{
  grid-template-columns: repeat(6, minmax(120px,1fr));
}

.stat-card{
  background: rgba(6,10,18,.55);
  border:1px solid rgba(47,134,255,.22);
  border-radius:16px;
  padding:14px;
}

.stat-label{
  font-size:13px;
  color:#b8c7dd;
  margin-bottom:6px;
}

.stat-value{
  font-size:28px;
  font-weight:800;
}

/* ===== Quick filters ===== */

.quick-filters{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.quick-filter{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid rgba(47,134,255,.35);
  background: rgba(47,134,255,.08);
  color:#cfe3ff;
  text-decoration:none;
  font-size:13px;
  font-weight:700;
}

.quick-filter.active,
.quick-filter:hover{
  background: rgba(47,134,255,.2);
  color:#fff;
  text-decoration:none;
}

/* ===== Toolbar ===== */

.toolbar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.toolbar input{
  flex:1 1 320px;
}

.toolbar select{
  flex:0 0 180px;
}

.btn-inline{
  margin-top:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}

/* ===== Shortcuts / accesos rápidos ===== */

.admin-shortcuts{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin:14px 0;
}

.shortcut-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:12px;
  text-decoration:none;
  font-weight:800;
  font-size:14px;
  line-height:1;
  border:1px solid transparent;
  transition:all .18s ease;
  white-space:nowrap;
}

.shortcut-btn:hover{
  text-decoration:none;
  transform:translateY(-1px);
  filter:brightness(1.05);
}

.shortcut-users{
  background: linear-gradient(90deg, rgba(47,134,255,.95), rgba(47,134,255,.55));
  color:#fff;
  border-color: rgba(47,134,255,.45);
}

.shortcut-assign{
  background: rgba(0,255,140,.10);
  color:#93ffcf;
  border-color: rgba(0,255,140,.28);
}

.shortcut-plans{
  background: rgba(255,210,80,.10);
  color:#ffe3a0;
  border-color: rgba(255,210,80,.25);
}

.shortcut-stats{
  background: rgba(180,120,255,.12);
  color:#d9b8ff;
  border-color: rgba(180,120,255,.28);
}

.shortcut-accounts{
  background: rgba(80,200,255,.10);
  color:#a8e6ff;
  border-color: rgba(80,200,255,.28);
}

.shortcut-investments{
  background: rgba(255,120,120,.10);
  color:#ffb8b8;
  border-color: rgba(255,120,120,.28);
}

.shortcut-portfolio{
  background: rgba(120,255,170,.10);
  color:#b8ffd2;
  border-color: rgba(120,255,170,.28);
}
/* ===== Tables ===== */

.table-wrap{
  width:100%;
  overflow-x:auto;
  overflow-y:visible;
  -webkit-overflow-scrolling: touch;
}

.table{
  width:100%;
  min-width:1450px;
  border-collapse:collapse;
}

.table th,
.table td{
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
  text-align:left;
  font-size:14px;
  vertical-align:middle;
}

.table th{
  white-space:nowrap;
}

.table td{
  white-space:nowrap;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  font-size:12px;
  white-space:nowrap;
}

.badge.ok{
  border-color:rgba(0,255,140,.25);
  color:#93ffcf;
}

.badge.warn{
  border-color:rgba(255,210,80,.25);
  color:#ffe3a0;
}

.badge.bad{
  border-color:rgba(255,80,80,.25);
  color:#ffb1b1;
}

.generic-mail{
  margin-top:4px;
  font-size:12px;
  color:#8fb8ff;
  word-break:break-all;
  white-space:normal;
}

.wa-btn{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(0,255,140,.25);
  color:#93ffcf;
  text-decoration:none;
  font-size:13px;
  white-space:nowrap;
}

.wa-btn:hover{
  text-decoration:none;
  filter:brightness(1.08);
}

.renew-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.mini-btn{
  padding:6px 10px;
  border-radius:10px;
  border:1px solid rgba(47,134,255,.35);
  background: rgba(47,134,255,.12);
  color:#fff;
  cursor:pointer;
  font-weight:700;
  white-space:nowrap;
}

.mini-btn:hover{
  background: rgba(47,134,255,.22);
}

.pagination{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.page-link{
  color:#7bb5ff;
  text-decoration:none;
  font-weight:700;
}

.page-info{
  color:#b8c7dd;
  font-size:13px;
}

/* ===== Dashboard specific widths ===== */

.table th:nth-child(1),
.table td:nth-child(1){
  min-width:100px;
  white-space:normal;
}

.table th:nth-child(2),
.table td:nth-child(2){
  min-width:100px;
}

.table th:nth-child(3),
.table td:nth-child(3){
  min-width:90px;
}

.table th:nth-child(4),
.table td:nth-child(4){
  min-width:120px;
  white-space:normal;
}

.table th:nth-child(5),
.table td:nth-child(5){
  min-width:70px;
}

.table th:nth-child(6),
.table td:nth-child(6){
  min-width:80px;
}

.table th:nth-child(7),
.table td:nth-child(7),
.table th:nth-child(8),
.table td:nth-child(8){
  min-width:95px;
  white-space:nowrap;
}

.table th:nth-child(9),
.table td:nth-child(9){
  min-width:55px;
}

.table th:nth-child(10),
.table td:nth-child(10){
  min-width:90px;
}

.table th:nth-child(11),
.table td:nth-child(11){
  min-width:95px;
}

.table th:nth-child(12),
.table td:nth-child(12){
  min-width:150px;
}

/* ===== Responsive ===== */

@media (max-width: 1200px){
  .stats-grid-6{
    grid-template-columns: repeat(3, minmax(120px,1fr));
  }

  .stats-grid-5{
    grid-template-columns: repeat(3, minmax(120px,1fr));
  }

  .stats-grid-4{
    grid-template-columns: repeat(2, minmax(120px,1fr));
  }

  .form-grid-top{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .toolbar-users{
    grid-template-columns:1fr 1fr;
  }

  .toolbar-plans{
    grid-template-columns:1fr 1fr;
  }
}

@media (max-width: 980px){
  .grid,
  .users-grid,
  .graphics-grid{
    grid-template-columns:1fr;
  }

  .stats-grid,
  .stats-grid-4,
  .stats-grid-5,
  .stats-grid-6{
    grid-template-columns: repeat(2, minmax(120px,1fr));
  }

  .container{
    width:min(1600px, 99vw);
  }
}

@media (max-width: 800px){
  .table{
    min-width:1200px;
  }

  .stats-grid,
  .stats-grid-4,
  .stats-grid-5,
  .stats-grid-6{
    grid-template-columns: 1fr;
  }

  .form-grid-top,
  .toolbar-users,
  .toolbar-plans{
    grid-template-columns:1fr;
  }
}

.shortcut-btn.shortcut-personal-expenses{
  background: rgba(255,180,120,.10);
  color:#ffd3b0;
  border-color: rgba(255,180,120,.28);
}

.shortcut-btn.shortcut-personal-expenses:hover{
  background: rgba(255,180,120,.20);
  color:#fff;
}