:root{
  --brand-primary: #00AEEF;
  --brand-neutral: #54565A;

  --bg: #eef2f7;
  --surface: #ffffff;
  --border: #e7e7ea;
  --text: #111827;
  --muted: #6b7280;

  --radius: 14px;
  --shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

*{ box-sizing:border-box; }

body{
  font-family: Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{ color: var(--brand-primary); text-decoration:none; }
a:hover{ text-decoration:underline; }
a:focus-visible{
  outline: 3px solid rgba(0,174,239,.35);
  outline-offset: 3px;
  border-radius: 10px;
}

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

.page-head{
  display:flex;
  justify-content: space-between;
  align-items:flex-end;
  gap: 16px;
  margin: 12px 0 28px;
}
.page-head h1{
  margin:0;
  font-size: 24px;
  color: var(--brand-neutral);
  letter-spacing: .2px;
}
.page-head p{
  margin:6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.page-actions{
  display:flex;
  gap: 10px;
  align-items:center;
}

/* =========================
   BOTONES
========================= */

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 11px 16px;
  border: 0;
  border-radius: 12px;
  cursor:pointer;
  background: var(--brand-primary);
  color:#fff;
  font-weight: 800;
  letter-spacing:.2px;
  box-shadow: 0 10px 18px rgba(0,174,239,.22);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn:hover{ filter: brightness(.97); }
.btn:active{ transform: translateY(1px); }
.btn:focus{
  outline: none;
  box-shadow: 0 0 0 4px rgba(0,174,239,.18), 0 10px 18px rgba(0,174,239,.22);
}

.btn-secondary{
  background: rgba(0,174,239,.10);
  color: var(--brand-neutral);
  border: 1px solid rgba(0,174,239,.25);
  box-shadow: none;
}
.btn-secondary:hover{
  background: rgba(0,174,239,.14);
}

/* =========================
   KPI CARDS
========================= */

.kpi-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 0 0 22px;
}

.kpi-card{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.kpi-card::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  height:100%;
  width:6px;
  background: var(--brand-primary);
}

.kpi-card::after{
  content:"";
  position:absolute;
  right:-60px;
  top:-60px;
  width:140px;
  height:140px;
  border-radius:999px;
  background: rgba(0,174,239,.10);
}

.kpi-card:hover{
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .10);
  border-color: rgba(0,174,239,.25);
}

.kpi-title{
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .7px;
}

.kpi-value{
  font-size: 30px;
  font-weight: 900;
  margin: 10px 0 6px;
  letter-spacing: .4px;
  color: var(--brand-neutral);
}

.kpi-sub{
  font-size: 12px;
  color: var(--muted);
}

/* =========================
   SECTIONS
========================= */

.section{ margin-top: 14px; }

.section-head{
  display:flex;
  justify-content: space-between;
  align-items:center;
  margin: 0 0 10px;
}

.section-head h2{
  margin:0;
  font-size: 16px;
  color: var(--brand-neutral);
  letter-spacing:.2px;
}

/* =========================
   TABLE
========================= */

.table{
  width:100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
}

.table th, .table td{
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align:left;
  font-size: 14px;
  vertical-align: middle;
}

.table th{
  background: #f1f5f9;
  color: var(--brand-neutral);
  font-weight: 900;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody tr:nth-child(even) td{
  background: rgba(15, 23, 42, .015);
}

.table tr:hover td{
  background: rgba(0,174,239,.08);
}

/* Acci¨Žn tipo bot¨Žn */
.table a.action{
  display:inline-flex;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0,174,239,.10);
  border: 1px solid rgba(0,174,239,.22);
  font-weight: 800;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.table a.action:hover{
  text-decoration:none;
  background: rgba(0,174,239,.16);
}
.table a.action:active{
  transform: translateY(1px);
}

/* =========================
   BADGES
========================= */

.badge{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--border);
  letter-spacing: .3px;
}

.badge-new{
  background: rgba(0,174,239,.18);
  border-color: rgba(0,174,239,.35);
  color: var(--brand-neutral);
}

.badge-contacted{
  background: rgba(84,86,90,.10);
  border-color: rgba(84,86,90,.18);
  color: var(--brand-neutral);
}

.badge-closed{
  background: rgba(15, 23, 42, .06);
  border-color: rgba(15, 23, 42, .10);
  color: var(--brand-neutral);
}

/* =========================
   AUTH
========================= */

.auth-container{
  max-width: 390px;
  margin: 60px auto;
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

label{
  display:block;
  margin-top: 12px;
  font-size: 14px;
  color: var(--brand-neutral);
  font-weight: 700;
}

input, select{
  width:100%;
  padding: 11px 12px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline:none;
}

input:focus, select:focus{
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(0,174,239,.15);
}

/* =========================
   ALERT
========================= */

.alert{
  background: rgba(0,174,239,.10);
  border: 1px solid rgba(0,174,239,.25);
  padding: 10px 12px;
  border-radius: 12px;
  margin: 10px 0;
  color: var(--brand-neutral);
  font-weight: 800;
}

/* =========================
   ADMIN LAYOUT (TOPBAR + SIDEBAR)
========================= */

.admin-shell{
  min-height: 100vh;
  background: var(--bg);
}

.admin-topbar2{
  height: 64px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 18px;
  color:#fff;
  background: linear-gradient(90deg, var(--brand-neutral), #2f3134);
  border-bottom: 3px solid var(--brand-primary);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .10);
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
}
.brand-text{ line-height: 1.1; }
.brand-title{ font-weight: 900; letter-spacing: .2px; }
.brand-sub{ font-size: 12px; opacity: .85; margin-top: 3px; }

.top-actions{
  display:flex;
  align-items:center;
  gap: 12px;
}

.user-pill{
  display:flex;
  flex-direction: column;
  align-items:flex-end;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.user-name{ font-weight: 900; font-size: 13px; }
.user-role{ font-size: 12px; opacity: .9; }

.top-link{
  color:#fff;
  font-weight: 900;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.top-link:hover{ text-decoration:none; opacity:.95; }

.admin-body{
  display:grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  padding: 16px;
}

.admin-sidebar{
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(15, 23, 42, .05);
  padding: 16px;
  height: calc(100vh - 64px - 32px);
  position: sticky;
  top: 80px;
  overflow: auto;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.admin-content{
  min-width: 0;
}

/* Nav */
.nav{ display:flex; flex-direction: column; gap: 6px; }
.nav-group{
  margin-top: 10px;
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.nav-item{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  color: var(--brand-neutral);
  font-weight: 800;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.nav-item:hover{
  text-decoration:none;
  background: rgba(0,174,239,.08);
  border-color: rgba(0,174,239,.20);
  transform: translateX(1px);
}

.nav-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(84,86,90,.25);
}

.nav-item.is-active{
  background: rgba(0,174,239,.20);
  border-color: rgba(0,174,239,.35);
  font-weight: 900;
}
.nav-item.is-active .nav-dot{
  background: var(--brand-primary);
}

.nav-soon{
  margin-left:auto;
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
  background: rgba(84,86,90,.10);
  border: 1px solid rgba(84,86,90,.15);
  padding: 4px 8px;
  border-radius: 999px;
}

/* Logo en topbar admin */
.brand-logo{
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255,255,255,.10);
  padding: 6px;
  border: 1px solid rgba(255,255,255,.14);
}

/* Responsive */
@media (max-width: 980px){
  .admin-body{ grid-template-columns: 1fr; }
  .admin-sidebar{ height: auto; position: static; }
  .user-pill{ display:none; }
}

@media (max-width: 520px){
  .page-head{ align-items:flex-start; flex-direction: column; }
  .kpi-grid{ grid-template-columns: 1fr; }
}