:root {
  --primary: #3b0707;
  --secondary: #711414;
  --accent: #ffc400;
  --accent-soft: #fff0b8;
  --bg: #f7f2ec;
  --card: #ffffff;
  --text: #24100c;
  --muted: #7c625a;
  --line: #e6d8cf;
  --green: #167a45;
  --amber: #a96500;
  --red: #b42318;
  --shadow: 0 10px 30px rgba(59, 7, 7, .10);
}
html[data-theme="dark"] {
  --primary: #ffc400;
  --secondary: #ffd65a;
  --accent: #ffc400;
  --accent-soft: #3a2b00;
  --bg: #130707;
  --card: #211111;
  --text: #f8eee9;
  --muted: #c8aaa0;
  --line: #4a241f;
  --green: #39d98a;
  --amber: #ffb340;
  --red: #ff6b5e;
  --shadow: 0 14px 36px rgba(0, 0, 0, .38);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Inter", Arial, sans-serif;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 196, 0, .08), transparent 32%),
    linear-gradient(180deg, #fbf8f3 0%, var(--bg) 100%);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 100% 0, rgba(255, 196, 0, .12), transparent 34%),
    radial-gradient(circle at 0 100%, rgba(113, 20, 20, .35), transparent 45%),
    linear-gradient(180deg, #1b0909 0%, var(--bg) 100%);
}
a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #081a33 0%, #0c2344 60%, #0a1d38 100%);
  color: #fff;
  padding: 26px 16px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,.06);
}
.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .3px;
  line-height: 1.1;
  padding: 0 10px;
}
.brand::before {
  content: "";
  display: block;
  width: 34px;
  height: 5px;
  border-radius: 99px;
  background: var(--accent);
  margin-bottom: 12px;
}
.brand span {
  color: #9fb3cc;
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.2px;
  margin-top: 7px;
}
.nav {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,196,0,.45) transparent;
}
.nav::-webkit-scrollbar { width: 7px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,196,0,.45); border-radius: 99px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav a { flex: 0 0 auto; }
.nav a {
  color: #c9d7e8;
  padding: 10px 12px;
  border-radius: 9px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active {
  background: rgba(242, 169, 0, .13);
  color: #ffd36b;
  border-left-color: var(--accent);
  font-weight: 700;
}
.sidebar .foot {
  position: static;
  flex: 0 0 auto;
  margin-top: 14px;
  padding-top: 12px;
  font-size: 11px;
  color: #8fa4bf;
  line-height: 1.6;
  border-top: 1px solid rgba(255,255,255,.08);
}
.main { flex: 1; padding: 30px 36px 64px; max-width: 1560px; min-width: 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.topbar-title { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.mobile-menu, .sidebar-backdrop { display: none; }
h1 { font-size: 27px; margin: 0; color: var(--primary); letter-spacing: -.4px; }
h2 { font-size: 18px; color: var(--primary); margin: 26px 0 12px; }
h3 { color: var(--primary); }
.sub { color: var(--muted); margin-top: 5px; font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 18px 0; }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.card { padding: 17px 18px; }
.card .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.card .value { font-size: 26px; font-weight: 800; margin-top: 7px; color: var(--primary); letter-spacing: -.5px; }
.card .small { font-size: 12px; color: var(--muted); margin-top: 4px; }
.panel { padding: 20px; margin: 16px 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .2px; }
.badge.green { background: #e5f6ec; color: var(--green); }
.badge.amber { background: #fff1d6; color: var(--amber); }
.badge.red { background: #fde7e5; color: var(--red); }
.badge.gray { background: #e9eef5; color: var(--muted); }
.badge.blue { background: #e2edfb; color: var(--secondary); }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); }
.table-scroll {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 270px);
    overflow: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: 12px;
    scroll-behavior: smooth;
}
.table-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 4px 0 10px;
}
.table-tools input {
    flex: 1 1 340px;
    max-width: 520px;
}
.table-scroll table { width: 100%; min-width: 1350px; table-layout: auto; }
.table-scroll th, .table-scroll td { white-space: normal; }
.table-scroll th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--card);
    box-shadow: 0 1px 0 var(--line);
}
.table-scroll td:first-child, .table-scroll th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card);
}
.table-scroll td.row-number { color: var(--muted); font-weight: 700; text-align: right; min-width: 44px; }
.table-scroll td:nth-child(2) { min-width: 250px; max-width: 340px; }
.table-scroll td:nth-child(3) { min-width: 150px; }
.table-scroll td:nth-child(4) { min-width: 260px; }
.table-scroll td:nth-child(n+7) { white-space: nowrap; }

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b2545 0%, #13315c 55%, #0b2545 100%);
    padding: 24px;
}
.login-card {
    width: min(420px, 100%);
    background: var(--card);
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}
.login-brand { margin-bottom: 18px; }
.login-card h1 { margin: 0 0 6px; font-size: 26px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); background: #f8fafd; font-weight: 800; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfcff; }
.mono { font-family: Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button, .btn {
  border: 0; border-radius: 9px; padding: 10px 15px; background: var(--primary); color: #fff;
  font-weight: 700; cursor: pointer; font-size: 13px; display: inline-block;
  transition: transform .12s ease, background .12s ease;
}
button:hover, .btn:hover { background: var(--secondary); text-decoration: none; color: #fff; transform: translateY(-1px); }
button.accent { background: var(--accent); color: var(--primary); }
button.accent:hover { background: #ffbf1f; }
button.danger { background: var(--red); }
button.ghost, .btn.ghost { background: #e9eef5; color: var(--primary); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 169, 0, .16);
}
input[type=checkbox] { width: auto; }
label { font-size: 11px; color: var(--muted); font-weight: 700; display: block; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.flash { padding: 12px 15px; border-radius: 10px; margin-bottom: 12px; border: 1px solid; font-weight: 600; }
.flash.success { background: #e5f6ec; border-color: #b7dfc7; color: #145c34; }
.flash.error { background: #fde7e5; border-color: #f3b7b0; color: #8a1c0b; }
.warning { background: #fff8e1; border: 1px solid #f3d27a; color: #6b4e00; padding: 13px; border-radius: 10px; margin: 12px 0; }
.notice { background: #eaf2fb; border: 1px solid #c3d7f0; color: #163a63; padding: 13px; border-radius: 10px; margin: 12px 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.gallery img { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.gallery .caption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 7px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
details { margin: 8px 0; }
summary { cursor: pointer; font-weight: 700; color: var(--secondary); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; min-width: 130px; }
.hero {
  background:
    radial-gradient(circle at 88% 18%, rgba(242, 169, 0, .28), transparent 34%),
    linear-gradient(120deg, #081a33, #12345f);
  color: #fff; padding: 26px 28px; border-radius: 16px;
  box-shadow: var(--shadow);
}
.hero h2 { color: #fff; margin: 0 0 7px; font-size: 24px; }
.hero p { color: #c9d7e8; margin: 0; max-width: 760px; }
.hero .kicker { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase; margin-bottom: 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 10px; }
.section-head h2 { margin: 0; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.stat-strip .item { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; }
.stat-strip .item strong { display: block; font-size: 20px; color: var(--primary); }
.stat-strip .item span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
@media (max-width: 860px) {
  body.menu-open { overflow: hidden; }
  body { overflow-x: hidden; }
  .layout { display: block; min-height: 100vh; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: min(84vw, 300px);
    height: 100dvh;
    padding: 22px 16px 18px;
    transform: translateX(-105%);
    transition: transform .22s ease;
    overflow: hidden;
    box-shadow: 14px 0 40px rgba(0,0,0,.45);
  }
  .sidebar.open { transform: translateX(0); }
  .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .sidebar .foot { position: static; margin-top: 12px; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0,0,0,.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .main { width: 100%; padding: 16px 14px 42px; }
  .topbar { flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .topbar-title { align-items: center; width: 100%; }
  .mobile-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #2a0505;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
  }
  h1 { font-size: 22px; line-height: 1.2; }
  .actions { width: 100%; align-items: stretch; }
  .actions > form, .actions > button, .actions > a { flex: 1 1 auto; }
  .actions button { width: 100%; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .panel { padding: 15px; margin: 12px 0; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .table-wrap, .table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .row { align-items: stretch; }
}

/* Identidad ZYTRON: rojo profundo, blanco y amarillo del logo. */
.sidebar {
  background: linear-gradient(180deg, #250404 0%, #3b0707 58%, #1c0303 100%);
  border-right-color: rgba(255, 196, 0, .16);
}
.brand-with-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-with-logo .brand-logo {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 196, 0, .45);
  box-shadow: 0 0 0 3px rgba(255, 196, 0, .08);
  flex: 0 0 auto;
}
.brand-with-logo > div { min-width: 0; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(255, 196, 0, .45);
}
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .item {
  background: var(--card);
  border-color: var(--line);
}
html[data-theme="dark"] .panel { box-shadow: var(--shadow); }
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: #180b0b;
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="dark"] .btn.ghost {
  color: var(--text);
  border-color: var(--line);
  background: #2a1514;
}
html[data-theme="dark"] .btn.ghost:hover { background: #3a1c19; }
html[data-theme="dark"] th {
  background: #2a1514;
  color: var(--text);
}
html[data-theme="dark"] tr:nth-child(even) td { background: rgba(255, 196, 0, .025); }
html[data-theme="dark"] .flash.success { background: #123522; color: #a7f3c8; }
html[data-theme="dark"] .flash.error { background: #3d1111; color: #ffc2bb; }
html[data-theme="dark"] .badge.blue { background: #2b1a12; color: #ffd65a; }
html[data-theme="dark"] .badge.gray { background: #2a2523; color: #d8c7bd; }
html[data-theme="dark"] .badge.green { background: #103a25; color: #6ff0ae; }
html[data-theme="dark"] .badge.amber { background: #3b2a08; color: #ffd166; }
html[data-theme="dark"] .badge.red { background: #3d1111; color: #ff9c92; }
html[data-theme="dark"] .table-scroll th,
html[data-theme="dark"] .table-scroll td:first-child { background: #211111; }
html[data-theme="dark"] a { color: #ffd65a; }
html[data-theme="dark"] .topbar .sub,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .small { color: var(--muted); }
html[data-theme="dark"] .stat-strip .item strong,
html[data-theme="dark"] .card .value { color: #fff8f2; }
html[data-theme="dark"] .notice { background: #2a1c08; border-color: #5c4614; color: #ffe4a3; }
.login-body {
  background:
    radial-gradient(circle at 75% 15%, rgba(255, 196, 0, .12), transparent 30%),
    radial-gradient(circle at 20% 80%, rgba(113, 20, 20, .55), transparent 45%),
    #130707;
}
.login-card { background: #211111; color: #f8eee9; border: 1px solid #4a241f; }
.login-card h1 { color: #fff8f2; }
.login-card .field label { color: #c8aaa0; }
/* Botones de accion: rojo profundo con texto blanco (mejor contraste). */
button.accent, .btn.accent {
  background: #8f1d1d;
  color: #ffffff;
  border: 1px solid #6b1010;
  box-shadow: 0 4px 14px rgba(143, 29, 29, .22);
}
button.accent:hover, .btn.accent:hover {
  background: #b32626;
  color: #ffffff;
  border-color: #8f1d1d;
}
html[data-theme="dark"] button.accent,
html[data-theme="dark"] .btn.accent {
  background: #b32626;
  color: #ffffff;
  border-color: #ff8a7a;
}
html[data-theme="dark"] button.accent:hover,
html[data-theme="dark"] .btn.accent:hover { background: #d13a3a; }
/* Correcciones de contraste del modo noche. */
html[data-theme="dark"] .stat-strip .item,
html[data-theme="dark"] .stat-strip .item:not(.hero),
html[data-theme="dark"] .grid3 > .item,
html[data-theme="dark"] .grid2 > .panel,
html[data-theme="dark"] .table-tools,
html[data-theme="dark"] .table-scroll {
  background: var(--card);
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="dark"] .stat-strip .item strong,
html[data-theme="dark"] .stat-strip .item .value,
html[data-theme="dark"] .grid3 > .item strong,
html[data-theme="dark"] .grid3 > .item h1,
html[data-theme="dark"] .grid3 > .item h2,
html[data-theme="dark"] .grid3 > .item h3 {
  color: #fff8f2;
}
html[data-theme="dark"] .grid3 > .item span,
html[data-theme="dark"] .stat-strip .item span {
  color: var(--muted);
}
html[data-theme="dark"] tr:hover td { background: #2a1514; }
html[data-theme="dark"] .gallery img,
html[data-theme="dark"] .photo img { background: #211111; }
html[data-theme="dark"] .warning {
  background: #3a2a08;
  border-color: #7a5a14;
  color: #ffe6a3;
}
html[data-theme="dark"] .flash.success { border-color: #1e5b39; }
html[data-theme="dark"] .flash.error { border-color: #6b2222; }
html[data-theme="dark"] button:not(.accent):not(.ghost),
html[data-theme="dark"] .btn:not(.accent):not(.ghost) {
  background: #8f1d1d;
  color: #ffffff;
  border-color: #b32626;
}
html[data-theme="dark"] button:not(.accent):not(.ghost):hover,
html[data-theme="dark"] .btn:not(.accent):not(.ghost):hover {
  background: #b32626;
  color: #ffffff;
}
html[data-theme="dark"] select,
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="file"],
html[data-theme="dark"] textarea {
  background: #180b0b;
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="dark"] .table-tools input::placeholder,
html[data-theme="dark"] input::placeholder { color: #9d7e74; }
html[data-theme="dark"] .table-scroll th { background: #2a1514; color: #fff8f2; }
html[data-theme="dark"] .table-scroll td { border-color: var(--line); }
html[data-theme="dark"] .table-scroll td:first-child { background: #211111; }
html[data-theme="dark"] .kv dt { color: var(--muted); }
html[data-theme="dark"] .kv dd { color: var(--text); }
html[data-theme="dark"] button.ghost {
  background: #2a1514;
  color: #fff8f2;
  border: 1px solid var(--line);
}
html[data-theme="dark"] button.ghost:hover {
  background: #3a1c19;
  color: #ffffff;
}
.card .value { overflow-wrap: anywhere; word-break: break-word; line-height: 1.18; }
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel { color: var(--text); }
html[data-theme="dark"] .topbar h1,
html[data-theme="dark"] .topbar .sub { color: var(--text); }
html[data-theme="dark"] .topbar .sub { color: var(--muted); }

/* ---------- tema vivo ZYTRON (animaciones y color) ---------- */
:root {
  --accent: #ffc61a;
  --accent-2: #ff5a3c;
  --glow: rgba(255, 198, 26, .28);
}

body {
  background:
    radial-gradient(1100px 500px at 8% -10%, rgba(200, 16, 46, .10), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(255, 198, 26, .12), transparent 55%),
    var(--bg);
}

.sidebar {
  background: linear-gradient(180deg, #2a0808 0%, #3b0707 45%, #4a0c0c 100%);
  overflow: hidden;
}

/* En móvil el sidebar debe seguir siendo fixed (menú deslizante).
   El degradado no necesita position: relative porque sticky/fixed ya
   establecen el bloque contenedor para ::after. */
@media (max-width: 860px) {
  .sidebar { position: fixed; }
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: -40% -60% auto auto;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255, 198, 26, .18), transparent 65%);
  animation: flotar 14s ease-in-out infinite;
}
@keyframes flotar {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-24px, 26px) scale(1.12); }
}

.nav a {
  transition: transform .18s ease, background .18s ease, padding-left .18s ease;
  border-radius: 10px;
}
.nav a:hover { transform: translateX(4px); background: rgba(255, 198, 26, .10); padding-left: 14px; }
.nav a.active {
  background: linear-gradient(90deg, rgba(255, 198, 26, .22), transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.panel, .card, .stat, .kpi {
  animation: aparecer .45s ease both;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.panel:hover, .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(30, 8, 8, .16);
  border-color: rgba(255, 198, 26, .45);
}
@keyframes aparecer {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

h1, h2, .section-head h2 { letter-spacing: .2px; }
.section-head h2::after {
  content: "";
  display: block;
  width: 46px; height: 3px;
  margin-top: 8px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: latir 3.2s ease-in-out infinite;
}
@keyframes latir {
  0%, 100% { width: 46px; opacity: .9; }
  50%      { width: 86px; opacity: 1; }
}

button.accent, .btn.accent {
  background: linear-gradient(120deg, #c8102e, #ff5a3c);
  border: 0;
  box-shadow: 0 8px 20px rgba(200, 16, 46, .28);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
button.accent:hover, .btn.accent:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 12px 26px rgba(200, 16, 46, .38);
}
button.accent:active { transform: translateY(1px) scale(.99); }

table tbody tr { transition: background .16s ease; }
table tbody tr:hover { background: rgba(255, 198, 26, .07); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}

.badge { animation: aparecer .5s ease both; }
.badge.green { box-shadow: 0 0 0 0 rgba(22, 122, 69, .5); animation: pulso 2.6s ease-out infinite; }
@keyframes pulso {
  0%   { box-shadow: 0 0 0 0 rgba(22, 122, 69, .45); }
  70%  { box-shadow: 0 0 0 10px rgba(22, 122, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 122, 69, 0); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   MODO NOCHE · "Onyx"  (negro, rojo y blanco)
   Fondo negro neutro, superficies grafito, texto blanco y un único acento rojo.
   Todo va prefijado con html[data-theme="dark"] para no tocar el modo claro.
   ========================================================================== */
html[data-theme="dark"] {
  --primary: #f7f7f8;
  --secondary: #ff6b74;
  --accent: #e11d2e;
  --accent-2: #f5f5f7;
  --accent-soft: #2a0b0f;
  --bg: #070708;
  --card: #101013;
  --text: #f4f4f6;
  --muted: #9a9aa3;
  --line: #26262b;
  --green: #3ddc97;
  --amber: #f0b45c;
  --red: #ff6b6b;
  --shadow: 0 16px 40px rgba(0, 0, 0, .62);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(820px 460px at 92% -10%, rgba(225, 29, 46, .14), transparent 62%),
    radial-gradient(700px 380px at 0% 104%, rgba(255, 255, 255, .05), transparent 60%),
    linear-gradient(180deg, #0a0a0c 0%, var(--bg) 100%);
}

/* ----- Barra lateral ----- */
html[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #050506 0%, #0b0b0d 55%, #08080a 100%);
  border-right-color: rgba(255, 255, 255, .07);
}
html[data-theme="dark"] .sidebar::after {
  background: radial-gradient(circle, rgba(225, 29, 46, .20), transparent 65%);
}
html[data-theme="dark"] .brand { color: #ffffff; }
html[data-theme="dark"] .brand::before { background: #e11d2e; }
html[data-theme="dark"] .brand span { color: #9a9aa3; }
html[data-theme="dark"] .nav a { color: #b6b6bf; }
html[data-theme="dark"] .nav a:hover { background: rgba(255, 255, 255, .06); color: #ffffff; }
html[data-theme="dark"] .nav a.active {
  background: rgba(225, 29, 46, .15);
  color: #ffffff;
  border-left-color: #e11d2e;
}
html[data-theme="dark"] .sidebar .foot { color: #85858f; border-top-color: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .mobile-menu { background: #e11d2e; color: #ffffff; }

/* ----- Tipografía y enlaces ----- */
html[data-theme="dark"] h1,
html[data-theme="dark"] .topbar h1 { color: #ffffff; }
html[data-theme="dark"] h2,
html[data-theme="dark"] h3 { color: #ececef; }
html[data-theme="dark"] .topbar .sub { color: var(--muted); }
html[data-theme="dark"] a { color: #ff8a92; }
html[data-theme="dark"] a:hover { color: #ffb3b8; }
html[data-theme="dark"] .card .value,
html[data-theme="dark"] .stat-strip .item strong { color: #ffffff; }

/* ----- Superficies ----- */
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel { background: var(--card); border-color: var(--line); }
html[data-theme="dark"] .stat-strip .item,
html[data-theme="dark"] .grid3 > .item,
html[data-theme="dark"] .grid2 > .panel,
html[data-theme="dark"] .table-tools,
html[data-theme="dark"] .table-scroll,
html[data-theme="dark"] .item { background: var(--card); border-color: var(--line); }
html[data-theme="dark"] .gallery img,
html[data-theme="dark"] .photo img { background: #0c0c0f; }
html[data-theme="dark"] .hero {
  background:
    radial-gradient(circle at 88% 18%, rgba(225, 29, 46, .26), transparent 36%),
    linear-gradient(120deg, #0d0d10, #1a0c10);
}
html[data-theme="dark"] .hero p { color: #c9c9d1; }
html[data-theme="dark"] .hero .kicker { color: #ff8a92; }

/* ----- Botones ----- */
html[data-theme="dark"] button:not(.accent):not(.ghost),
html[data-theme="dark"] .btn:not(.accent):not(.ghost) {
  background: #17171b;
  color: #f2f2f4;
  border: 1px solid #2c2c33;
  box-shadow: none;
}
html[data-theme="dark"] button:not(.accent):not(.ghost):hover,
html[data-theme="dark"] .btn:not(.accent):not(.ghost):hover {
  background: #202026;
  color: #ffffff;
  border-color: #3a3a43;
}
html[data-theme="dark"] button.accent,
html[data-theme="dark"] .btn.accent {
  background: linear-gradient(120deg, #c8102e, #ff3b4a);
  color: #ffffff;
  border: 0;
  box-shadow: 0 8px 20px rgba(200, 16, 46, .32);
}
html[data-theme="dark"] button.accent:hover,
html[data-theme="dark"] .btn.accent:hover {
  background: linear-gradient(120deg, #e11d2e, #ff5a66);
  box-shadow: 0 12px 26px rgba(200, 16, 46, .42);
}
html[data-theme="dark"] button.ghost,
html[data-theme="dark"] .btn.ghost {
  background: #131316;
  color: #dcdce2;
  border: 1px solid #2c2c33;
}
html[data-theme="dark"] button.ghost:hover,
html[data-theme="dark"] .btn.ghost:hover { background: #1c1c21; color: #ffffff; }
html[data-theme="dark"] button.danger { background: #b3172b; color: #ffffff; border-color: #d02338; }

/* ----- Formularios ----- */
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="time"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="file"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: #0d0d10;
  border: 1px solid #2a2a30;
  color: #f4f4f6;
}
html[data-theme="dark"] input[type="search"]:focus,
html[data-theme="dark"] input[type="text"]:focus,
html[data-theme="dark"] input[type="number"]:focus,
html[data-theme="dark"] input[type="date"]:focus,
html[data-theme="dark"] input[type="time"]:focus,
html[data-theme="dark"] input[type="email"]:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus {
  border-color: #e11d2e;
  box-shadow: 0 0 0 3px rgba(225, 29, 46, .20);
  outline: none;
}
html[data-theme="dark"] .table-tools input::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #6f6f79; }
html[data-theme="dark"] label { color: #9a9aa3; }

/* ----- Tablas ----- */
html[data-theme="dark"] th { background: #0b0b0e; color: #a9a9b2; }
html[data-theme="dark"] td { border-color: var(--line); }
html[data-theme="dark"] tr:nth-child(even) td { background: rgba(255, 255, 255, .022); }
html[data-theme="dark"] tr:hover td { background: rgba(225, 29, 46, .07); }
html[data-theme="dark"] .table-scroll th { background: #0b0b0e; color: #d7d7dd; }
html[data-theme="dark"] .table-scroll td:first-child { background: var(--card); }

/* ----- Etiquetas y avisos ----- */
html[data-theme="dark"] .badge.blue { background: #101a2b; color: #8fb8ff; }
html[data-theme="dark"] .badge.green { background: #0f2b20; color: #6ff0b6; }
html[data-theme="dark"] .badge.amber { background: #2f230c; color: #f0c374; }
html[data-theme="dark"] .badge.red { background: #2d0f13; color: #ff9b9b; }
html[data-theme="dark"] .badge.gray { background: #1a1a1f; color: #a9a9b2; }
html[data-theme="dark"] .flash.success { background: #0d2a1f; border-color: #1d5c41; color: #7ff0bb; }
html[data-theme="dark"] .flash.error { background: #2d0f13; border-color: #6b2222; color: #ffa9a2; }
html[data-theme="dark"] .notice { background: #141419; border-color: #33333b; color: #d8d8de; }
html[data-theme="dark"] .warning { background: #2f230c; border-color: #5c4614; color: #ffdd9a; }
html[data-theme="dark"] summary { color: #ff8a92; }
html[data-theme="dark"] .kv dt { color: var(--muted); }
html[data-theme="dark"] .kv dd { color: var(--text); }

/* Subrayado decorativo de secciones: rojo a blanco */
html[data-theme="dark"] .section-head h2::after {
  background: linear-gradient(90deg, #e11d2e, #f5f5f7);
}
