/* ==========================================================================
   Appscreati — Panel de administración
   ========================================================================== */
:root {
  --bg: #070b1a;
  --panel: #0d142c;
  --panel-2: #121a36;
  --border: rgba(255,255,255,.09);
  --text: #f7f8ff;
  --muted: #98a4c3;
  --violet: #1d4ed8;
  --cyan: #06b6d4;
  --pink: #06b6d4;
  --green: #0891b2;
  --orange: #cbd5e1;
  --grad: linear-gradient(120deg, #60a5fa 0%, #1d4ed8 28%, #06b6d4 64%, #7dd3fc 100%);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'DM Sans', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .side-brand b { font-family: 'Sora', sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 22px 16px;
  background: linear-gradient(180deg, #0b1128, #080d1e);
  border-right: 1px solid var(--border);
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 26px; }
.side-brand { perspective: 500px; }
.side-brand i { width: 34px; height: 34px; display: grid; place-items: center; font-style: normal; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.side-brand i .site-logo { width: 34px; height: 34px; display: block; }
.side-brand:hover i { transform: rotateX(var(--lx, 0deg)) rotateY(var(--ly, 0deg)) scale(1.12); }
.login-art .big-mark { animation: bigMarkFloat 4s ease-in-out infinite; }
@keyframes bigMarkFloat { 50% { transform: translateY(-6px); } }
.login-art .big-mark .site-logo { width: 54px; height: 54px; display: block; filter: drop-shadow(0 12px 26px rgba(29,78,216,.35)); }
.side-brand b { font-size: 1.05rem; letter-spacing: -.04em; }
.side-brand b span { color: var(--violet); }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px; color: #aab6d6; font-size: .9rem; font-weight: 500; transition: .2s; }
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-nav a.active { background: linear-gradient(90deg, rgba(29,78,216,.22), rgba(29,78,216,.05)); color: #fff; box-shadow: inset 2px 0 var(--violet); }
.side-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.side-nav .nav-icon { font-size: 1rem; width: 18px; text-align: center; }
.side-bottom { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.side-bottom a { padding: 9px 13px; border-radius: 10px; color: #aab6d6; font-size: .85rem; }
.side-bottom a:hover { background: rgba(255,255,255,.05); color: #fff; }
.logout-btn { width: 100%; text-align: left; background: none; border: 0; color: #fb7185; padding: 9px 13px; border-radius: 10px; cursor: pointer; font-size: .85rem; }
.logout-btn:hover { background: rgba(244,63,94,.1); }

.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 34px; border-bottom: 1px solid var(--border);
  background: rgba(7,11,26,.75); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10;
}
.admin-topbar h1 { font-size: 1.25rem; letter-spacing: -.03em; }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.admin-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; background: var(--grad); }
.admin-user small { display: block; color: var(--muted); font-size: .7rem; }
.admin-content { padding: 30px 34px 60px; max-width: 1400px; }

/* Tarjetas y estadísticas */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 20px; border-radius: 18px; background: var(--panel); border: 1px solid var(--border); position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; width: 110px; height: 110px; border-radius: 50%; filter: blur(35px); opacity: .22; right: -40px; top: -40px; background: var(--violet); }
.stat-card:nth-child(2)::after { background: var(--cyan); }
.stat-card:nth-child(3)::after { background: var(--green); }
.stat-card:nth-child(4)::after { background: var(--pink); }
.stat-card span { font-size: .78rem; color: var(--muted); }
.stat-card strong { display: block; font-family: 'Sora'; font-size: 1.9rem; letter-spacing: -.05em; margin-top: 4px; }
.stat-card small { font-size: .72rem; color: #6f7c9e; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 22px; margin-bottom: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.card-head h2 { font-size: 1.05rem; letter-spacing: -.02em; }
.card-head p { color: var(--muted); font-size: .8rem; }
.two-col { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: start; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { text-align: left; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 12px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.025); }
td a { color: #fff; font-weight: 600; }
td a:hover { color: var(--cyan); }
.cell-sub { display: block; color: var(--muted); font-size: .74rem; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty b { display: block; color: #fff; font-family: 'Sora'; margin-bottom: 6px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 100px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-nueva { background: rgba(6,182,212,.13); color: var(--cyan); }
.badge-en_revision { background: rgba(203,213,225,.13); color: var(--orange); }
.badge-aprobada { background: rgba(6,182,212,.13); color: var(--green); }
.badge-en_proceso { background: rgba(29,78,216,.15); color: #93c5fd; }
.badge-rechazada { background: rgba(244,63,94,.13); color: #fb7185; }
.badge-admin { background: rgba(29,78,216,.15); color: #93c5fd; }
.badge-editor { background: rgba(6,182,212,.13); color: var(--cyan); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font-weight: 700; font-size: .86rem; transition: .2s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 22px rgba(29,78,216,.28); }
.btn-ghost { background: rgba(255,255,255,.05); border-color: var(--border); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-danger { background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.3); color: #fb7185; }
.btn-danger:hover { background: rgba(244,63,94,.2); }
.btn-sm { padding: 7px 13px; font-size: .78rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* Filtros */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.filter-bar input, .filter-bar select, .field input, .field select, .field textarea {
  padding: 10px 13px; border-radius: 10px; background: rgba(255,255,255,.04);
  border: 1px solid var(--border); color: #fff; outline: none; font-size: .86rem; transition: .2s;
}
.filter-bar input { min-width: 240px; flex: 1; }
.filter-bar input::placeholder, .field input::placeholder, .field textarea::placeholder { color: #646f90; }
.filter-bar input:focus, .filter-bar select:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.filter-bar select option, .field select option { background: var(--panel); }
.status-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.status-tabs a { padding: 7px 14px; border-radius: 100px; font-size: .8rem; font-weight: 600; color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--border); }
.status-tabs a:hover { color: #fff; }
.status-tabs a.active { background: var(--grad); color: #fff; border-color: transparent; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 22px; }
.pagination a, .pagination span { min-width: 34px; height: 34px; display: grid; place-items: center; padding: 0 10px; border-radius: 9px; font-size: .82rem; background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--muted); }
.pagination a:hover { color: #fff; border-color: var(--violet); }
.pagination .current { background: var(--grad); color: #fff; border-color: transparent; }

/* Barras del dashboard */
.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 34px; align-items: center; gap: 12px; font-size: .8rem; }
.bar-row span:last-child { text-align: right; color: var(--muted); }
.bar-track { height: 8px; border-radius: 10px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 10px; background: var(--grad); min-width: 3px; }

/* Detalle */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-item span { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; }
.info-item strong { font-size: .92rem; font-weight: 600; word-break: break-word; }
.breakdown { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.breakdown li { display: flex; justify-content: space-between; gap: 12px; font-size: .85rem; color: #cbd4ee; }
.breakdown li b { color: #fff; }
.breakdown li.grand { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 4px; font-size: 1rem; font-weight: 700; }
.breakdown li.grand b { color: var(--cyan); }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: .78rem; font-weight: 600; color: #c9d2ec; }
.field textarea { min-height: 110px; resize: vertical; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.danger-zone { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }

/* Avisos */
.toast-stack { position: fixed; top: 84px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 350px; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); box-shadow: 0 18px 40px rgba(0,0,0,.4); font-size: .85rem; animation: toastIn .3s ease both; }
.toast.success { border-color: rgba(6,182,212,.4); }
.toast.error { border-color: rgba(244,63,94,.4); }
.toast .toast-icon { color: var(--green); font-weight: 700; }
.toast.error .toast-icon { color: #fb7185; }
.toast button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; }
@keyframes toastIn { from { opacity: 0; transform: translateX(25px); } }

/* Login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 60px; background: linear-gradient(140deg, #1e3a8a, #1d4ed8 40%, #06b6d4 72%, #0891b2); }
.login-art::before, .login-art::after { content: ''; position: absolute; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; }
.login-art::before { width: 480px; height: 480px; right: -180px; top: -160px; }
.login-art::after { width: 340px; height: 340px; left: -140px; bottom: -160px; }
.login-art > * { position: relative; z-index: 1; }
.login-art .big-mark { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 34px; }
.login-art h1 { font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.12; letter-spacing: -.05em; color: #fff; max-width: 460px; }
.login-art h1 span { color: #e2e8f0; }
.login-art p { color: rgba(255,255,255,.82); max-width: 420px; margin-top: 18px; }
.login-art .login-foot { position: absolute; bottom: 34px; left: 60px; right: 60px; font-size: .8rem; color: rgba(255,255,255,.65); }
.login-form-side { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login-box { width: min(400px, 100%); }
.login-box h2 { font-size: 1.7rem; letter-spacing: -.04em; }
.login-box > p { color: var(--muted); font-size: .9rem; margin: 8px 0 30px; }
.login-box .field label { margin-bottom: 3px; }
.login-box .field input { padding: 13px 15px; }
.login-box .btn { margin-top: 10px; padding: 13px; }
.login-back { display: inline-block; margin-top: 24px; color: var(--muted); font-size: .85rem; }
.login-back:hover { color: var(--cyan); }
.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 30px; }
.error-page .code { font-family: 'Sora'; font-size: 6rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.error-page h1 { font-size: 1.5rem; margin: 12px 0; }
.error-page p { color: var(--muted); margin-bottom: 24px; }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 14px; }
  .side-brand { padding-bottom: 12px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav a { padding: 8px 10px; font-size: .8rem; }
  .side-bottom { flex-direction: row; align-items: center; gap: 4px; margin-top: 10px; }
  .logout-btn { width: auto; }
  .admin-topbar { padding: 14px 18px; }
  .admin-content { padding: 20px 16px 50px; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 40px 26px; min-height: 280px; }
  .login-art h1 { font-size: 2rem; }
  .login-art .login-foot { display: none; }
  .login-form-side { padding: 36px 22px; }
  .info-list { grid-template-columns: 1fr; }
  .toast-stack { left: 14px; right: 14px; max-width: none; }
}
