/* LeonTech · Panel de administración */
:root {
  --navy-950: #020b1f; --navy-900: #041633; --navy-800: #0a2550;
  --blue-600: #1265b4; --blue-500: #1e88e5; --cyan-400: #29b6f6; --cyan-100: #e0f4fe;
  --ink: #0b1b33; --body: #34465f; --muted: #64748b; --line: #e3eaf3; --bg: #f3f6fb;
  --grad: linear-gradient(135deg, #1265b4, #1e88e5 45%, #29b6f6);
  --r: 14px; --sb: 256px;
  --shadow: 0 1px 2px rgba(4, 22, 51, .05), 0 6px 20px -8px rgba(4, 22, 51, .12);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 "Inter", system-ui, sans-serif; color: var(--body); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue-600); text-decoration: none; }
h1, h2, h3 { font-family: "Sora", sans-serif; color: var(--ink); margin: 0 0 .5em; letter-spacing: -.01em; }
img { max-width: 100%; }
.lucide, [data-lucide] { width: 18px; height: 18px; flex-shrink: 0; }
.muted { color: var(--muted); } .block { display: block; } .right { text-align: right; } .nowrap { white-space: nowrap; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font: 600 14px/1 "Inter", sans-serif; cursor: pointer; transition: .2s; background: var(--ink); color: #fff; text-decoration: none; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--grad); box-shadow: 0 6px 16px -6px rgba(30, 136, 229, .6); }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-light:hover { border-color: var(--blue-500); color: var(--blue-600); }
.btn-danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.btn-whatsapp { background: #25d366; color: #04381b; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--body); cursor: pointer; transition: .2s; padding: 0; }
.icon-btn:hover { border-color: var(--blue-500); color: var(--blue-600); }
.icon-btn.danger:hover { border-color: #ef4444; color: #ef4444; background: #fef2f2; }
form.inline { display: inline; }

/* Sidebar */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sb); background: var(--navy-950); color: rgba(226, 238, 252, .7); display: flex; flex-direction: column; padding: 22px 14px; z-index: 50; transition: transform .3s; background-image: radial-gradient(400px 300px at 0 0, rgba(30, 136, 229, .25), transparent); }
.sb-brand { display: flex; align-items: center; gap: 12px; color: #fff; font: 700 18px "Sora", sans-serif; padding: 0 8px 22px; border-bottom: 1px solid rgba(255, 255, 255, .07); margin-bottom: 18px; }
.sb-brand b { color: var(--cyan-400); }
.sb-brand small { display: block; font: 500 10px "Inter"; letter-spacing: .3em; text-transform: uppercase; opacity: .6; }
.sb-logo { width: 42px; height: 42px; border-radius: 12px; background: #fff; display: grid; place-items: center; box-shadow: 0 0 20px rgba(41, 182, 246, .4); }
.sb-logo img { width: 36px; }
.sb-nav { display: grid; gap: 3px; }
.sb-nav a, .sb-foot a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: rgba(226, 238, 252, .72); font-weight: 500; transition: .2s; }
.sb-nav a:hover, .sb-foot a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sb-nav a.is-active { background: linear-gradient(90deg, rgba(41, 182, 246, .2), rgba(41, 182, 246, .04)); color: #fff; box-shadow: inset 3px 0 0 var(--cyan-400); }
.sb-nav a.is-active svg { color: var(--cyan-400); }
.count { margin-left: auto; font-style: normal; background: var(--cyan-400); color: var(--navy-950); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.sb-foot { margin-top: auto; display: grid; gap: 3px; border-top: 1px solid rgba(255, 255, 255, .07); padding-top: 14px; }

/* Shell */
.shell { margin-left: var(--sb); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; height: 70px; padding: 0 32px; background: rgba(243, 246, 251, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 20px; margin: 0; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user b { display: block; color: var(--ink); font-size: 14px; line-height: 1.2; }
.topbar-user small { color: var(--muted); font-size: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; }
.sb-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 40px; height: 40px; place-items: center; cursor: pointer; }
.content { padding: 30px 32px 60px; max-width: 1400px; }

/* Tarjetas */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head.padded { padding: 18px 22px; margin: 0; border-bottom: 1px solid var(--line); }
.card-head h3, .card-title { font-size: 16px; margin: 0; }
.card-title { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-2.align-start { align-items: start; }
.welcome { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 28px 30px; border-radius: var(--r); margin-bottom: 24px; color: rgba(226, 238, 252, .8); background: radial-gradient(500px 200px at 100% 0, rgba(41, 182, 246, .35), transparent), linear-gradient(120deg, var(--navy-900), var(--navy-800)); }
.welcome h2 { color: #fff; font-size: 22px; margin-bottom: 4px; }
.welcome p { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 24px; }
.kpi { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.kpi b { display: block; font: 700 26px/1.1 "Sora", sans-serif; color: var(--ink); }
.kpi small { color: var(--muted); }
.kpi-ico { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; background: #e8f1fd; color: var(--blue-600); }
.kpi-ico.amber { background: #fef6e7; color: #b45309; } .kpi-ico.cyan { background: var(--cyan-100); color: #0284c7; } .kpi-ico.green { background: #e7f8f0; color: #047857; }
.kpi-ico svg { width: 22px; height: 22px; }

.bars-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.bl-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.bl-row a { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-track { height: 8px; border-radius: 8px; background: #eef3f9; overflow: hidden; }
.bl-track span { display: block; height: 100%; border-radius: 8px; background: var(--grad); }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 18px; background: #f8fafd; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.card:not(.flush) .table td { padding-inline: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcff; }
.table .strong { color: var(--ink); font-weight: 600; }
.table .strong:hover { color: var(--blue-600); }
.table .actions { white-space: nowrap; }
.table .actions > * { margin-left: 4px; }
.table tr.unread .strong { color: var(--blue-600); }
.table tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--cyan-400); }
.table tr.selected { background: var(--cyan-100); }
.table tr.disabled { opacity: .55; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f7; color: var(--body); }
.badge.green { background: #e7f8f0; color: #047857; } .badge.amber { background: #fef6e7; color: #b45309; } .badge.blue { background: #e8f1fd; color: var(--blue-600); } .badge.red { background: #fef2f2; color: #b91c1c; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--blue-500); margin: 0 auto 10px; display: block; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 20px; }
.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); padding: 4px; border-radius: 12px; }
.tabs a { padding: 7px 14px; border-radius: 9px; color: var(--body); font-weight: 500; font-size: 14px; }
.tabs a.is-active { background: var(--ink); color: #fff; }
.search { position: relative; margin-left: auto; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding: 10px 14px 10px 38px; border-radius: 10px; border: 1px solid var(--line); font: inherit; min-width: 240px; }
.pager { display: flex; gap: 6px; justify-content: center; }
.pager a { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--body); font-weight: 600; }
.pager a.is-active { background: var(--grad); color: #fff; border-color: transparent; }

/* Formularios */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 13px; color: var(--ink); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; color: var(--ink); background: #fbfcfe; transition: .2s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue-500); background: #fff; box-shadow: 0 0 0 4px rgba(30, 136, 229, .12); }
.field input:disabled { color: var(--muted); }
.field small { display: block; margin-top: 5px; font-size: 12px; }
.input-xl { font: 700 22px "Sora", sans-serif !important; padding: 14px 16px !important; }
.input-prefix { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fbfcfe; }
.input-prefix span { padding: 11px 0 11px 14px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.input-prefix input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding-left: 2px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-bottom: 18px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue-500); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #f1f5fa; border-radius: 10px; padding: 4px; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); transition: .2s; }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.seg input[value="published"]:checked + span { color: #047857; }

/* Editor */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.editor-side .sticky { position: sticky; top: 94px; }
.side-actions { display: grid; gap: 10px; margin-top: 8px; }
.ql-toolbar.ql-snow { border: 1px solid var(--line) !important; border-radius: 10px 10px 0 0; background: #f8fafd; position: sticky; top: 70px; z-index: 5; }
.ql-container.ql-snow { border: 1px solid var(--line) !important; border-top: 0 !important; border-radius: 0 0 10px 10px; font: 16px/1.75 "Inter", sans-serif; }
.ql-editor { min-height: 420px; color: var(--ink); }
.ql-editor h2, .ql-editor h3 { font-family: "Sora", sans-serif; }
.ql-editor img { border-radius: 10px; }
.ql-editor blockquote { border-left: 4px solid var(--cyan-400) !important; background: #f4f8fc; padding: 10px 16px !important; }
.cover-drop { display: block; position: relative; border: 2px dashed var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; aspect-ratio: 16/9; background: #fbfcfe; transition: .2s; }
.cover-drop:hover, .cover-drop.over { border-color: var(--blue-500); background: var(--cyan-100); }
.cover-drop input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.cover-drop img { width: 100%; height: 100%; object-fit: cover; }
.cover-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; color: var(--body); font-weight: 600; font-size: 13px; padding: 12px; pointer-events: none; }
.cover-hint svg { width: 28px; height: 28px; color: var(--blue-500); }
.cover-hint small { font-weight: 400; color: var(--muted); font-size: 11px; }
[hidden] { display: none !important; }
.serp { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: #fff; font-family: Arial, sans-serif; }
.serp span { display: block; }
.serp-url { font-size: 13px; color: #202124; }
.serp-title { font-size: 19px; color: #1a0dab; margin: 4px 0; }
.serp-desc { font-size: 14px; color: #4d5156; }

/* Mensajes */
.message-view h2 { font-size: 22px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.message-view .actions { display: flex; gap: 8px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 0 0 20px; }
.meta-grid dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.meta-grid dd { margin: 2px 0 0; font-weight: 600; color: var(--ink); word-break: break-word; }
.message-body { background: #f8fafd; border: 1px solid var(--line); border-radius: 12px; padding: 20px; color: var(--ink); line-height: 1.7; }
.reply-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Alertas */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; margin-bottom: 20px; font-weight: 500; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(800px 500px at 80% 0, rgba(30, 136, 229, .4), transparent), radial-gradient(600px 400px at 0 100%, rgba(41, 182, 246, .2), transparent), var(--navy-950); }
.login-page::before { content: ""; position: fixed; inset: 0; background-image: linear-gradient(rgba(125, 211, 252, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(125, 211, 252, .06) 1px, transparent 1px); background-size: 48px 48px; pointer-events: none; }
.login-card { position: relative; width: 100%; max-width: 410px; background: #fff; border-radius: 22px; padding: 38px 34px 28px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); text-align: center; }
.login-card form { text-align: left; margin-top: 22px; }
.login-logo { width: 96px; height: 96px; margin: -86px auto 16px; border-radius: 28px; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 6px rgba(41, 182, 246, .25), 0 20px 40px -10px rgba(41, 182, 246, .6); }
.login-logo img { width: 82px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .btn { padding: 13px; font-size: 15px; margin-top: 6px; }
.login-card .back { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* Responsive */
@media (max-width: 1100px) { .editor-layout { grid-template-columns: 1fr; } .editor-side .sticky { position: static; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sb-open .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .4); }
  .shell { margin-left: 0; }
  .sb-toggle { display: grid; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .topbar-user div { display: none; }
  .search { margin-left: 0; width: 100%; } .search input { width: 100%; min-width: 0; }
  .ql-toolbar.ql-snow { top: 70px; }
}

/* Visitas */
.visits-card .card-head h3 { display: flex; align-items: center; gap: 8px; }
.visits-card .card-head h3 svg { color: var(--blue-500); }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #047857; background: #e7f8f0; padding: 5px 12px; border-radius: 999px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); animation: livep 1.8s infinite; }
@keyframes livep { 70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }
.visit-stats { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.vs { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.vs small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.vs b { font: 700 28px/1.15 "Sora", sans-serif; color: var(--ink); }
.vs.main { background: linear-gradient(135deg, #f0f7ff, #e6f6fe); border-color: #cfe5fb; }
.vs.main b { font-size: 38px; color: var(--blue-600); }
.vs .muted { font-size: 13px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; margin-top: 4px; }
.delta svg { width: 15px; height: 15px; }
.delta.up { color: #047857; } .delta.down { color: #b91c1c; }

.vchart { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: 180px auto; gap: 6px 10px; }
.vchart-grid { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: 11px; color: var(--muted); }
.vchart-grid span { transform: translateY(-50%); } .vchart-grid span:last-child { transform: translateY(50%); }
.vchart-bars { display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--line); background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 50%; }
.vbar { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; cursor: default; outline: none; }
.vbar span { width: 100%; background: var(--blue-500); border-radius: 4px 4px 0 0; transition: background .15s; min-height: 0; }
.vbar.is-today span { background: var(--cyan-400); }
.vbar:hover span, .vbar:focus span { background: var(--blue-600); }
.vtip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-style: normal; font-size: 12px; white-space: nowrap; padding: 7px 10px; border-radius: 8px; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 5; }
.vtip b { display: block; font-size: 11px; color: #9fd8fb; text-transform: capitalize; }
.vbar:hover .vtip, .vbar:focus .vtip { opacity: 1; }
.vbar:first-child .vtip { left: 0; transform: none; } .vbar:last-child .vtip { left: auto; right: 0; transform: none; }
.vchart-x { grid-column: 2; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.vtable { margin: 10px 0 4px; font-size: 13px; }
.vtable summary { cursor: pointer; color: var(--blue-600); font-weight: 600; }
.vtable .table { margin-top: 8px; max-width: 420px; }
.vtable .table td, .vtable .table th { padding: 6px 10px !important; }
.visit-breakdown { display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.visit-breakdown h4 { font: 600 14px "Sora", sans-serif; color: var(--ink); margin: 0 0 12px; }
.dev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dev-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #f8fafd; border-radius: 10px; font-size: 14px; }
.dev-list li svg { color: var(--blue-500); }
.dev-list li b { margin-left: auto; color: var(--ink); }
@media (max-width: 900px) {
  .visit-stats { grid-template-columns: 1fr 1fr; }
  .vs.main { grid-column: 1 / -1; }
  .visit-breakdown { grid-template-columns: 1fr; }
  .vchart-bars { gap: 2px; }
}
