:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #1f2340;
  --muted: #8a90a6;
  --line: #eceef4;
  --brand: #2f6bff;
  --brand-soft: #eaf0ff;
  --accent: #7c5cff;
  --green: #2fbf71;
  --amber: #f0a621;
  --red: #e5484d;
  --sidebar: #ffffff;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(31, 35, 64, .06);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #f7c9b8 0%, #fbe6c8 55%, #f9d9c4 100%);
}
.login-card {
  width: 380px; background: var(--panel); border-radius: 20px;
  padding: 36px 32px; box-shadow: 0 24px 60px rgba(120, 70, 50, .18);
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-logo .dot { width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #ff7a59, #ffb15c); }
.login-card h1 { font-size: 20px; margin: 14px 0 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 22px; }

/* ---------- SHELL ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--line);
  padding: 18px 14px; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand .dot { width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, #ff7a59, #ffb15c); }
.brand span { font-weight: 700; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 10px; color: #5b6178; font-weight: 500; font-size: 13.5px;
}
.nav a .ic { width: 18px; text-align: center; opacity: .8; }
.nav a:hover { background: #f4f5f9; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav .badge { margin-left: auto; font-size: 10px; background: #ffe3ea;
  color: #e5484d; padding: 2px 6px; border-radius: 6px; }

.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-top: 1px solid var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #ff7a59, #ffb15c); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 12px; }

/* ---------- TOPBAR ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; border-bottom: 1px solid var(--line); background: #fff; }
.topbar .crumbs { color: var(--muted); font-size: 13px; }
.topbar .tools { display: flex; align-items: center; gap: 8px; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 7px 12px; font-size: 12.5px; color: #5b6178; }
.pill.brand { color: var(--accent); border-color: #ece7ff; background: #f6f3ff; }

.content { padding: 24px 26px; }

/* ---------- BUTTONS / INPUTS ---------- */
.btn { border: none; border-radius: 10px; padding: 11px 18px; font-weight: 600;
  font-size: 13.5px; }
.btn.primary { background: var(--brand); color: #fff; width: 100%; }
.btn.dark { background: #10121a; color: #fff; }
.btn.ghost { background: #f1f2f6; color: #4b5165; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label.fld { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font-size: 13.5px; color: var(--ink); background: #fff;
  font-family: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 240px; }

.card { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* ---------- TEMPLATE EDITOR (imagen 1) ---------- */
.editor-grid { display: grid; grid-template-columns: 1fr 240px; gap: 18px; }
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  border: 1px solid var(--line); border-bottom: none; border-radius: 12px 12px 0 0;
  padding: 8px 10px; background: #fafbfd; }
.toolbar select { width: auto; padding: 6px 8px; }
.toolbar .tb { border: none; background: transparent; padding: 6px 8px;
  border-radius: 7px; color: #5b6178; font-weight: 600; }
.toolbar .tb:hover { background: #eef0f5; }
.toolbar .chip { border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 5px 9px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.body-area { border: 1px solid var(--line); border-radius: 0 0 12px 12px;
  border-top: none; }
.body-area textarea { border: none; border-radius: 0 0 12px 12px; min-height: 320px; }

.spam-panel { background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; height: fit-content; }
.metric { margin-bottom: 15px; }
.metric .top { display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: #4b5165; margin-bottom: 6px; }
.metric .val { font-weight: 700; color: var(--ink); }
.bar { height: 5px; border-radius: 4px; background: #eef0f5; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; }
.g { background: var(--green); } .a { background: var(--amber); } .r { background: var(--red); }

/* ---------- TABLES ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px;
  letter-spacing: .04em; text-transform: uppercase; padding: 12px 14px;
  border-bottom: 2px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); color: #3a3f57; }
tr:hover td { background: #fafbfd; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px;
  overflow: hidden; }
.seg button { border: none; background: #fff; padding: 7px 14px; font-weight: 600;
  color: #6b7189; font-size: 12.5px; }
.seg button.active { background: var(--brand); color: #fff; }

.page-title { font-size: 22px; font-weight: 800; margin: 0 0 2px; }
.muted { color: var(--muted); }
.tag { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.tag.ok { background: #e7f8ef; color: #1f9d57; }
.tag.warn { background: #fdf1dd; color: #c9821a; }
.tag.off { background: #fdeaea; color: #d13b40; }

.kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.kpi .n { font-size: 24px; font-weight: 800; margin-top: 4px; }
.kpi .l { color: var(--muted); font-size: 12.5px; }

.hidden { display: none !important; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #10121a; color: #fff;
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 99; }
.dropzone { border: 2px dashed #d7dbe7; border-radius: 12px; padding: 30px;
  text-align: center; color: var(--muted); background: #fafbfd; cursor: pointer; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
