@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/DMSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/DMSans-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/DMSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --electric-blue: #0E4BF5;
  --electric-blue-dark: #0A38B8;
  --bright-white: #FFFFFF;
  --lime-pop: #BEF86F;
  --ink-black: #000000;
  --cloud-grey: #D8D8D8;
  --cloud-grey-light: #F2F2F2;
  --muted: #5A5A5A;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: var(--ink-black);
  background: var(--cloud-grey-light);
}

.topbar {
  background: var(--electric-blue);
  color: var(--bright-white);
  display: flex; align-items: center; flex-wrap: wrap;
  padding: 10px 20px; gap: 10px 18px;
}
.topbar img.logo { height: 30px; }
.topbar .nombre { font-weight: 500; }
.topbar .topbar-link { color: var(--bright-white); text-decoration: none; font-size: 0.92em; opacity: 0.9; }
.topbar .topbar-link:hover { opacity: 1; text-decoration: underline; }
.topbar .nombre { margin-left: auto; }
.topbar a.logout { color: var(--bright-white); text-decoration: underline; font-size: 0.9em; }

main { padding: 30px 20px; max-width: 1000px; margin: 0 auto; }

.flash {
  background: var(--lime-pop); color: var(--ink-black);
  padding: 10px 14px; border-radius: 4px; margin-bottom: 14px; font-weight: 500;
}
.flash.error { background: #ffd7d0; }

label { font-weight: 500; font-size: 0.9em; display: block; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search] {
  font-family: inherit; font-size: 0.95em; padding: 8px;
  border: 1px solid var(--cloud-grey); border-radius: 4px;
  background: var(--bright-white); color: var(--ink-black); width: 100%;
}
input:focus { outline: 2px solid var(--electric-blue); }
.field { margin-bottom: 12px; }
.checkbox-field { display: flex; align-items: center; gap: 6px; font-weight: normal; }
.checkbox-field input { width: auto; }

.btn {
  display: inline-block; background: var(--electric-blue); color: var(--bright-white);
  border: none; padding: 9px 16px; border-radius: 4px; font-family: inherit;
  font-weight: 500; font-size: 0.95em; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--electric-blue-dark); }
.btn.secondary {
  background: var(--bright-white); color: var(--electric-blue); border: 1px solid var(--electric-blue);
}
.btn.secondary:hover { background: var(--cloud-grey-light); }

.card { background: var(--bright-white); border: 1px solid var(--cloud-grey); border-radius: 6px; padding: 16px; }
.muted { color: var(--muted); font-size: 0.88em; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.spacer { flex: 1; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 0.82em; font-weight: 500; margin: 2px; }

.table-scroll { overflow-x: auto; border-radius: 6px; }

.admin-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--cloud-grey); margin-bottom: 18px; overflow-x: auto; }
.admin-tabs a {
  padding: 9px 16px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 0.95em;
  border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.admin-tabs a:hover { color: var(--electric-blue); }
.admin-tabs a.active { color: var(--electric-blue); border-bottom-color: var(--electric-blue); }

.admin-table { width: 100%; border-collapse: collapse; background: var(--bright-white); border: 1px solid var(--cloud-grey); border-radius: 6px; overflow: hidden; }
.admin-table th {
  background: var(--electric-blue); color: var(--bright-white); text-align: left;
  padding: 10px 12px; font-weight: 500; font-size: 0.85em;
}
.admin-table td { padding: 9px 12px; border-bottom: 1px solid var(--cloud-grey-light); font-size: 0.92em; }
.admin-table tr:last-child td { border-bottom: none; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; text-align: center; }
.login-card img.logo { height: 60px; margin-bottom: 18px; }

.sites-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
  margin-top: 20px;
}
.site-tile {
  display: block; text-decoration: none; color: inherit;
  background: var(--bright-white); border: 1px solid var(--cloud-grey); border-radius: 8px;
  padding: 20px; transition: box-shadow 0.15s;
}
.site-tile:hover { box-shadow: 0 4px 14px rgba(14,75,245,0.18); border-color: var(--electric-blue); }
.site-tile .tile-bar { height: 4px; border-radius: 2px; margin-bottom: 14px; }
.site-tile h3 { margin: 0 0 6px; color: var(--electric-blue); }
.site-tile p { margin: 0; color: var(--muted); font-size: 0.9em; }

/* Interruptor deslizante ON/OFF (permisos por pestaña, admin_form.html) */
.switch { position: relative; display: inline-block; width: 42px; height: 23px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer; background: #D62839;
  border-radius: 23px; transition: background 0.15s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 17px; width: 17px; left: 3px; bottom: 3px;
  background: var(--bright-white); border-radius: 50%; transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.switch input:checked + .slider { background: #1E9E4A; }
.switch input:checked + .slider::before { transform: translateX(19px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--electric-blue); outline-offset: 2px; }

.app-toggle-app { border: 1px solid var(--cloud-grey); border-radius: 6px; margin-bottom: 10px; overflow: hidden; }
.app-toggle-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px; cursor: pointer; background: var(--cloud-grey-light); font-weight: 500; font-size: 0.92em;
  user-select: none;
}
.app-toggle-header .arrow { color: var(--muted); transition: transform 0.15s; }
.app-toggle-app.open .app-toggle-header .arrow { transform: rotate(90deg); }
.app-toggle-body { display: none; padding: 2px 14px 6px; }
.app-toggle-app.open .app-toggle-body { display: block; }
.tab-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--cloud-grey-light); flex-wrap: wrap;
}
.tab-row:last-child { border-bottom: none; }
.tab-row-label { font-weight: normal; font-size: 0.9em; margin-bottom: 0; }
.tab-row-controls { display: flex; align-items: center; gap: 16px; }
.edit-toggle-wrap { display: flex; align-items: center; gap: 8px; font-size: 0.82em; color: var(--muted); }
