/* ============================================================
   LEO DIANA — Panel de administración
   Estética coherente con la landing: dark #0b0c10 + gradiente Santa Fe.
   ============================================================ */
:root {
  --bg: #0b0c10;
  --bg-2: #111319;
  --panel: #14161d;
  --panel-2: #1a1d26;
  --line: #262a35;
  --line-2: #323744;
  --txt: #eef1f6;
  --txt-soft: #aab2c3;
  --txt-mute: #707889;
  --rojo: #e00034;
  --naranja: #f15a24;
  --amarillo: #ffb700;
  --grad: linear-gradient(90deg, #e00034 0%, #f15a24 50%, #ffb700 100%);
  --ok: #2ecc71;
  --warn: #ffb700;
  --danger: #e00034;
  --info: #4aa3ff;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 12px 40px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--txt);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.45rem; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; }
.subtitle { color: var(--txt-mute); }

/* ============ LOGIN ============ */
.login-body {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(225,0,52,.10), transparent 60%),
    radial-gradient(800px 500px at 90% 110%, rgba(255,183,0,.07), transparent 60%),
    var(--bg);
  padding: 24px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-flag, .brand-flag {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: var(--grad);
}
.login-title { font-weight: 700; font-size: 1.2rem; }
.login-sub, .brand-sub { color: var(--txt-mute); font-size: .8rem; }
.login-lead { color: var(--txt-soft); font-size: .9rem; margin: 0 0 18px; }

/* ============ APP LAYOUT ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex: none; background: var(--bg-2);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 18px 12px; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand-flag { width: 34px; height: 34px; border-radius: 9px; }
.brand-name { font-weight: 700; font-size: 1.02rem; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--txt-soft); font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s; font-size: .92rem;
}
.nav-link:hover { background: var(--panel-2); color: var(--txt); }
.nav-link.active { background: var(--panel-2); color: var(--txt); }
.nav-link.active::before {
  content: ''; position: absolute; left: 0; width: 3px; height: 20px;
  margin-left: -12px; border-radius: 3px; background: var(--grad);
}
.nav-link { position: relative; }
.nav-ico { font-size: 1rem; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--rojo); color: #fff; font-size: .72rem;
  font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px;
  display: grid; place-items: center; padding: 0 6px;
}
.nav-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 22px;
  border-bottom: 1px solid var(--line); background: var(--bg-2);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-weight: 600; font-size: 1.02rem; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-pill { display: flex; align-items: center; gap: 9px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--grad);
  color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .85rem;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { font-weight: 600; font-size: .85rem; }
.user-rol { color: var(--txt-mute); font-size: .72rem; text-transform: capitalize; }
.hamburger { display: none; background: none; border: 0; color: var(--txt); font-size: 1.3rem; cursor: pointer; }

.content { padding: 26px 28px 60px; flex: 1; }

/* ============ SECTIONS ============ */
.section { display: none; }
.section.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.section-desc { color: var(--txt-mute); font-size: .88rem; margin: 6px 0 0; max-width: 60ch; }
.section-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters .input { max-width: 230px; }
.search { min-width: 180px; }
.check-inline { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; color: var(--txt-soft); cursor: pointer; white-space: nowrap; }

/* ============ TABLES ============ */
.table-wrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto; background: var(--panel);
}
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl thead th {
  text-align: left; padding: 11px 14px; color: var(--txt-mute);
  font-weight: 600; font-size: .76rem; text-transform: uppercase;
  letter-spacing: .03em; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.row-inactive { opacity: .5; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.cell-clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; background: var(--panel-2); }
.thumb.ph { display: grid; place-items: center; color: var(--txt-mute); font-size: .65rem; }
.list-foot { color: var(--txt-mute); font-size: .82rem; margin-top: 10px; padding: 0 2px; }
.loader, .empty-state { text-align: center; color: var(--txt-mute); padding: 28px 14px; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
  border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: rgba(46,204,113,.14); color: #57d98a; }
.badge-warn { background: rgba(255,183,0,.14); color: var(--amarillo); }
.badge-danger { background: rgba(225,0,52,.16); color: #ff5577; }
.badge-info { background: rgba(74,163,255,.14); color: var(--info); }
.badge-muted { background: rgba(255,255,255,.06); color: var(--txt-mute); }
.badge-orange { background: rgba(241,90,36,.16); color: #ff8a5c; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--txt);
  padding: 9px 15px; border-radius: var(--radius-sm); font-weight: 600;
  font-size: .87rem; cursor: pointer; font-family: inherit;
  transition: filter .15s, background .15s, opacity .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: rgba(225,0,52,.5); color: #ff6685; }
.btn-danger:hover { background: rgba(225,0,52,.12); }
.btn-sm { padding: 6px 11px; font-size: .8rem; }
.btn-block { width: 100%; margin-top: 6px; }

/* ============ FORMS / INPUTS ============ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: .82rem; font-weight: 600; color: var(--txt-soft); }
.input {
  background: var(--bg); border: 1px solid var(--line-2); color: var(--txt);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: .9rem;
  font-family: inherit; width: 100%; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--naranja); box-shadow: 0 0 0 3px rgba(241,90,36,.15); }
textarea.input { resize: vertical; min-height: 70px; }
select.input { cursor: pointer; }
input[type="file"].input { padding: 8px; cursor: pointer; }
.hint { color: var(--txt-mute); font-size: .76rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.check-field { justify-content: center; gap: 9px; }
.form-error {
  display: none; background: rgba(225,0,52,.14); border: 1px solid rgba(225,0,52,.4);
  color: #ff7c97; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: .85rem; margin-bottom: 16px;
}
.form-error.show { display: block; }

/* config card form */
.card-form {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px 24px 20px; max-width: 760px;
}
.form-group-title { color: var(--amarillo); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 14px; }
.form-group-title:first-child { margin-top: 0; }
.form-foot { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.66);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto; backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  width: 100%; max-width: 560px; box-shadow: var(--shadow); animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-body { padding: 20px 22px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.icon-x {
  background: none; border: 0; color: var(--txt-mute); font-size: 1.5rem;
  cursor: pointer; line-height: 1; padding: 0 4px;
}
.icon-x:hover { color: var(--txt); }

/* key-value detail (reportes) */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 6px; }
.kv dt { color: var(--txt-mute); font-size: .82rem; }
.kv dd { margin: 0; }
.msg-box {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 12px 14px; white-space: pre-wrap; font-size: .9rem; line-height: 1.55;
  margin: 4px 0 16px; max-height: 240px; overflow-y: auto;
}
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.img-actual { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.img-actual img { width: 60px; height: 60px; object-fit: cover; border-radius: 7px; }

/* ============ TOASTS ============ */
.toast-stack {
  position: fixed; bottom: 22px; right: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; max-width: 340px;
}
.toast {
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt);
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: .87rem;
  box-shadow: var(--shadow); border-left: 3px solid var(--info);
  animation: slidein .2s ease;
}
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; } }
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--rojo); }
.toast.info { border-left-color: var(--info); }

/* ============ RESPONSIVE ============ */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: block; }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 18px 14px 50px; }
  .topbar { padding: 11px 14px; }
  .user-meta { display: none; }
  .section-head { align-items: stretch; }
  .section-actions, .filters { width: 100%; }
  .filters .input, .search { max-width: none; flex: 1; }
}
.scrim {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55;
}
.scrim.open { display: block; }

/* ============ ÍCONOS LUCIDE (SVG) — reemplazan emojis en la nav ============ */
.nav-ico { display: inline-flex; align-items: center; justify-content: center; }
.nav-ico svg { width: 18px; height: 18px; }
.hamburger { display: none; }
.hamburger svg { width: 22px; height: 22px; vertical-align: middle; }
@media (max-width: 860px) { .hamburger { display: inline-flex; align-items: center; } }
