/* =============================================
   AGP Dashboard – dashboard.css  (v2)
   ============================================= */

:root {
  --sidebar-bg:      #0f1f3d;
  --sidebar-w:       240px;
  --accent:          #2563eb;
  --accent-h:        #1d4ed8;
  --accent-soft:     rgba(37,99,235,.1);
  --orange:          #ea580c;
  --green:           #16a34a;
  --purple:          #7c3aed;
  --red:             #dc2626;
  --white:           #ffffff;
  --g50:             #f8fafc;
  --g100:            #f1f5f9;
  --g200:            #e2e8f0;
  --g300:            #cbd5e1;
  --g400:            #94a3b8;
  --g500:            #64748b;
  --g700:            #334155;
  --g800:            #1e293b;
  --g900:            #0f172a;
  --body-bg:         #f0f4f8;
  --font:            'Inter', system-ui, sans-serif;
  --r:               10px;
  --r-lg:            14px;
  --sh-xs: 0 1px 2px rgba(15,23,42,.06);
  --sh-sm: 0 1px 4px rgba(15,23,42,.08), 0 2px 8px rgba(15,23,42,.04);
  --sh-md: 0 4px 12px rgba(15,23,42,.10), 0 2px 4px rgba(15,23,42,.06);
  --sh-lg: 0 12px 32px rgba(15,23,42,.14), 0 4px 8px rgba(15,23,42,.08);
  --sh-xl: 0 24px 64px rgba(15,23,42,.18), 0 8px 16px rgba(15,23,42,.10);
  --topbar-h: 58px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { font-size: 15px; }
body { font-family: var(--font); color: var(--g900); background: var(--body-bg); }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ─── Login ─────────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(37,99,235,.18) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(124,58,237,.12) 0%, transparent 50%),
    linear-gradient(160deg, #071526 0%, #0f1f3d 50%, #162952 100%);
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.06) 1px, transparent 0);
  background-size: 36px 36px;
  pointer-events: none;
}

.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%; max-width: 400px;
  box-shadow: var(--sh-xl);
  text-align: center;
  position: relative; z-index: 1;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 60%; height: 3px;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  border-radius: 0 0 4px 4px;
}
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--sh-xl);
  text-align: center;
  position: relative; z-index: 1;
}

.login-brand { display: flex; align-items: center; justify-content: center; gap: 7px; margin-bottom: 32px; }
.lb-agp  { font-size: 2rem; font-weight: 800; color: #e85d00; letter-spacing: .04em; }
.lb-text { font-size: 1.2rem; font-weight: 600; color: var(--g700); }

.login-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 5px; color: var(--g900); }
.login-sub   { font-size: .87rem; color: var(--g500); margin-bottom: 30px; }
.login-err   { color: var(--red); font-size: .83rem; min-height: 20px; margin-bottom: 4px; text-align: left; }

.btn-login {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
  color: var(--white);
  border: none; border-radius: var(--r);
  font-size: .95rem; font-weight: 600;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  margin-top: 6px; transition: all .2s; letter-spacing: .01em;
}
.btn-login:hover  { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,.45); }
.btn-login:active { transform: translateY(0); }

.login-back { margin-top: 22px; font-size: .82rem; color: var(--g400); }
.login-back a { color: var(--accent); font-weight: 500; }
.login-back a:hover { text-decoration: underline; }

/* ─── App shell ─────────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
  z-index: 100;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

/* Radial glow overlay inside sidebar */
.sidebar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(37,99,235,.2) 0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(124,58,237,.10) 0%, transparent 50%);
  pointer-events: none;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 9px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 8px;
  position: relative;
}

.sidebar-nav { flex: 1; padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; position: relative; }

.snav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border: none; border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,.6);
  font-size: .875rem; font-weight: 500;
  text-align: left; transition: all .18s;
}
.snav-item:hover  { background: rgba(255,255,255,.08); color: var(--white); }
.snav-item.active {
  background: linear-gradient(135deg, rgba(37,99,235,.9), rgba(37,99,235,.7));
  color: var(--white);
  box-shadow: 0 2px 12px rgba(37,99,235,.4), inset 0 1px 0 rgba(255,255,255,.1);
}
.snav-item svg    { flex-shrink: 0; }
.snav-item:not(.active) svg { opacity: .7; }

.sidebar-footer {
  padding: 10px 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; flex-direction: column; gap: 2px;
  position: relative;
}

.btn-logout, .btn-sidebar-link {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 10px;
  border: none; border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,.5);
  font-size: .875rem; font-weight: 500;
  transition: all .18s; text-align: left;
}
.btn-sidebar-link:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.btn-logout:hover        { background: rgba(239,68,68,.15); color: #fca5a5; }

/* ─── Content ───────────────────────────────────────────────────────────────── */
.content-wrap { flex: 1; padding: 28px 32px; overflow-y: auto; min-width: 0; }

/* ─── View header ───────────────────────────────────────────────────────────── */
.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.view-title { font-size: 1.45rem; font-weight: 700; color: var(--g900); }
.view-sub   { font-size: .9rem; color: var(--g500); margin-left: 10px; }

/* ─── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--r);
  border: 1px solid var(--g200);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--g200);
}
.card-title { font-size: .9rem; font-weight: 600; color: var(--g700); }
.mt-5 { margin-top: 20px; }

/* ─── Stat grid ─────────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--sh-sm);
  display: flex; align-items: flex-start; gap: 14px;
  transition: box-shadow .2s, transform .2s;
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0; height: 3px;
  opacity: 0; transition: opacity .2s;
}
.stat-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.stat-card:hover::after { opacity: 1; }

.stat-card--blue::after   { background: var(--accent); }
.stat-card--orange::after { background: var(--orange); }
.stat-card--green::after  { background: var(--green); }
.stat-card--purple::after { background: var(--purple); }

.stat-card__icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; flex-shrink: 0;
}
.stat-card--blue   .stat-card__icon { background: #dbeafe; }
.stat-card--orange .stat-card__icon { background: #ffedd5; }
.stat-card--green  .stat-card__icon { background: #dcfce7; }
.stat-card--purple .stat-card__icon { background: #f3e8ff; }

.stat-card__body { flex: 1; min-width: 0; }
.stat-card__num  { font-size: 1.9rem; font-weight: 800; line-height: 1; margin-bottom: 4px; letter-spacing: -.02em; }
.stat-card--blue   .stat-card__num { color: var(--accent); }
.stat-card--orange .stat-card__num { color: var(--orange); }
.stat-card--green  .stat-card__num { color: var(--green); }
.stat-card--purple .stat-card__num { color: var(--purple); }
.stat-card__label { font-size: .8rem; color: var(--g500); font-weight: 500; }

/* ─── Content wrap ───────────────────────────────────────────────────────────── */
.content-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* ─── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--g200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
  flex-shrink: 0; position: sticky; top: 0; z-index: 50;
}
.topbar__left { display: flex; align-items: center; gap: 10px; }
.topbar__breadcrumb {
  font-size: .82rem; color: var(--g400);
  display: flex; align-items: center; gap: 6px;
}
.topbar__breadcrumb span { color: var(--g700); font-weight: 600; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__user {
  display: flex; align-items: center; gap: 9px;
  background: var(--g100); border: 1px solid var(--g200);
  border-radius: 100px; padding: 5px 14px 5px 5px;
  font-size: .83rem; font-weight: 600; color: var(--g700);
}
.topbar__avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--white); font-size: .72rem; font-weight: 700;
  letter-spacing: .02em; flex-shrink: 0;
}

/* ─── Content inner ──────────────────────────────────────────────────────────── */
.content-inner { flex: 1; padding: 26px 28px; overflow-y: auto; }

/* ─── View header ────────────────────────────────────────────────────────────── */
.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.view-header__left { display: flex; flex-direction: column; gap: 2px; }
.view-title { font-size: 1.4rem; font-weight: 700; color: var(--g900); line-height: 1.2; }
.view-sub   { font-size: .82rem; color: var(--g400); font-weight: 400; }

/* ─── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--r-lg);
  border: 1px solid var(--g200); box-shadow: var(--sh-sm); overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--g100);
  background: var(--g50);
}
.card-title {
  font-size: .875rem; font-weight: 700; color: var(--g800);
  display: flex; align-items: center; gap: 7px;
}
.card-title::before {
  content: ''; display: block; width: 3px; height: 14px;
  background: var(--accent); border-radius: 2px;
}
.mt-5 { margin-top: 20px; }

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table thead th {
  padding: 11px 16px; text-align: left;
  font-size: .7rem; font-weight: 700; color: var(--g500);
  text-transform: uppercase; letter-spacing: .07em;
  background: var(--g50); border-bottom: 1px solid var(--g200); white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--g100); transition: background .12s; }
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: #f8faff; }
.table tbody td { padding: 11px 16px; color: var(--g700); vertical-align: middle; }
.td-title   { font-weight: 600; color: var(--g900) !important; min-width: 140px; }
.td-date    { color: var(--g400) !important; font-size: .8rem; white-space: nowrap; }
.td-check   { text-align: center !important; padding: 11px 5px !important; }
.td-actions { white-space: nowrap; text-align: right; padding-right: 12px !important; }
.th-check   { text-align: center !important; padding: 11px 6px !important; font-size: .65rem !important; line-height: 1.3 !important; width: 62px; min-width: 62px; max-width: 62px; white-space: normal !important; word-break: break-word; }
.prosp-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r);
  font-size: .875rem; font-weight: 600;
  border: 1px solid transparent;
  transition: all .18s; white-space: nowrap; cursor: pointer;
  font-family: var(--font); letter-spacing: .01em;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #1a4fd6 100%);
  color: var(--white); box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,.4); }
.btn-ghost {
  background: var(--white); color: var(--g700);
  border-color: var(--g300); box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
.btn-ghost:hover { background: var(--g100); border-color: var(--g400); }
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: var(--white); box-shadow: 0 2px 8px rgba(220,38,38,.3);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(220,38,38,.4); }
.btn-sm { padding: 6px 13px; font-size: .8rem; }
.btn-icon {
  background: none; border: none;
  padding: 5px 7px; border-radius: 7px;
  font-size: .9rem; transition: all .12s; line-height: 1;
  cursor: pointer; color: var(--g500);
}
.btn-icon:hover          { background: var(--g100); color: var(--g800); }
.btn-icon--danger:hover  { background: #fee2e2; color: var(--red); }

/* ─── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 100px;
  font-size: .72rem; font-weight: 600;
  background: var(--g100); color: var(--g700); letter-spacing: .01em;
}
.badge--blue   { background: #dbeafe; color: #1d4ed8; }
.badge--green  { background: #dcfce7; color: #15803d; }
.badge--orange { background: #ffedd5; color: #c2410c; }
.badge--red    { background: #fee2e2; color: #b91c1c; }
.badge--purple { background: #f3e8ff; color: #7e22ce; }
.badge--gray   { background: var(--g100); color: var(--g500); }

/* ─── Progress bar ───────────────────────────────────────────────────────────── */
.progress-wrap { min-width: 96px; }
.progress-bar {
  height: 6px; background: var(--g100); border-radius: 100px;
  overflow: hidden; margin-bottom: 3px; border: 1px solid var(--g200);
}
.progress-bar__fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 100px; transition: width .4s ease;
}
.progress-pct { font-size: .73rem; color: var(--g500); font-weight: 500; }

/* ─── Empty state ────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; color: var(--g500); padding: 40px 20px; font-size: .9rem; }
.empty-cell  { text-align: center !important; color: var(--g400) !important; padding: 48px !important; font-size: .88rem !important; }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: backdropIn .15s ease;
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white); border-radius: 16px;
  width: 100%; max-width: 580px; max-height: 92vh; overflow-y: auto;
  box-shadow: var(--sh-xl); border: 1px solid var(--g200);
  animation: modalIn .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal--sm { max-width: 420px; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--g100);
  position: sticky; top: 0; background: var(--white); z-index: 1;
  border-radius: 16px 16px 0 0;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--g900); }
.modal-close {
  background: var(--g100); border: none;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--g500); line-height: 1; transition: all .15s;
}
.modal-close:hover { background: var(--g200); color: var(--g900); }
.modal-body { padding: 22px 24px; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--g100);
}

/* ─── Form elements ──────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: .78rem; font-weight: 600; color: var(--g700); letter-spacing: .01em; }
.field input,
.field select,
.field textarea {
  padding: 9px 12px; border: 1.5px solid var(--g300); border-radius: var(--r);
  font-size: .875rem; color: var(--g900); background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none; -webkit-appearance: none; appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus  { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.field input.invalid,
.field select.invalid,
.field textarea.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.field textarea { resize: vertical; }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.check-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 14px; background: var(--g50);
  border-radius: var(--r); border: 1px solid var(--g200); margin-bottom: 14px;
}
.check-label {
  display: flex; align-items: center; gap: 7px;
  font-size: .8rem; font-weight: 500; color: var(--g700);
  cursor: pointer; padding: 4px; border-radius: 6px; transition: background .12s;
}
.check-label:hover { background: var(--g100); }
.check-label input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Hamburger (oculto en escritorio) ── */
.topbar__hamburger {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  background: none; border: none;
  padding: 6px; border-radius: 8px;
  cursor: pointer; flex-shrink: 0;
}
.topbar__hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--g700); border-radius: 2px;
  transition: all .2s;
}

/* ── Sidebar overlay (oculto en escritorio) ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
  /* Sidebar: oculto por defecto, desliza desde la izquierda */
  .sidebar {
    display: flex !important;
    position: fixed; inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.35);
  }
  .sidebar-overlay.open {
    display: block;
  }

  /* Hamburger visible */
  .topbar__hamburger { display: flex; }

  /* Topbar */
  .topbar { padding: 0 14px; }
  .topbar__breadcrumb { font-size: .78rem; }
  .topbar__user span  { display: none; }

  /* Contenido */
  .content-inner  { padding: 14px; }
  .form-row-2     { grid-template-columns: 1fr; }
  .check-grid     { grid-template-columns: repeat(2, 1fr); }
  .view-header    { flex-wrap: wrap; gap: 10px; }
  .view-title     { font-size: 1.2rem; }
  .stat-grid      { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card__num { font-size: 1.5rem; }

  /* Tablas: scroll horizontal limpio */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table      { min-width: 600px; }
  .table thead th,
  .table tbody td { white-space: nowrap; }
  /* Prospecciones es más ancha, mínimo generoso */
  .table--prosp { min-width: 820px; }

  /* Modales: full-screen en móvil */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    width: 100%;
    max-width: 100%;
  }
  .modal--sm { max-width: 100%; }
  .modal-head { border-radius: 16px 16px 0 0; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 14px 16px; }
  .btn { padding: 8px 14px; font-size: .82rem; }
}
