*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Dark theme (default) ── */
:root,
html[data-theme="dark"] {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --surface2:   rgba(32,36,51,0.5);
  --border:     #2a2d3e;
  --accent:     #4f8ef7;
  --tab-active: #c4f000;
  --text:       #e2e6f0;
  --text-muted: #7a82a0;
  --green:      #22c55e;
  --red:        #ef4444;
  color-scheme: dark;
}

/* ── Light theme ── */
html[data-theme="light"] {
  --bg:         #f0f3fa;
  --surface:    #ffffff;
  --surface2:   rgba(0,0,0,0.03);
  --border:     #dce1f0;
  --accent:     #2563eb;
  --tab-active: #7ab800;
  --text:       #1e2130;
  --text-muted: #64748b;
  --green:      #16a34a;
  --red:        #dc2626;
  color-scheme: light;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 0;
}

/* ── Logo ── */
.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 1.25rem;
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(79,142,247,0.35);
  box-shadow: 0 0 0 3px rgba(79,142,247,0.1);
  flex-shrink: 0;
  transition: box-shadow 0.2s;
}
.logo:hover .logo-img {
  box-shadow: 0 0 0 4px rgba(79,142,247,0.25);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.logo-brand {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Header divider ── */
.header-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin-right: 1.25rem;
  flex-shrink: 0;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0.1rem;
  height: 100%;
  align-items: stretch;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 1.05rem;
  font-size: 0.855rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
  position: relative;
  border-radius: 0;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
html[data-theme="light"] .tab:hover { background: rgba(0,0,0,0.04); }

.tab.active {
  color: var(--tab-active);
}
.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0.2rem;
  right: 0.2rem;
  height: 2.5px;
  background: var(--tab-active);
  border-radius: 2px 2px 0 0;
}

/* ── Tab dropdown (Deportivas) ── */
.tab-dropdown {
  position: relative;
  display: flex;
  align-items: stretch;
}
.tab-dropdown-trigger {
  cursor: default;
  user-select: none;
}
.tab-chevron {
  margin-left: 0.1rem;
  transition: transform 0.18s;
  flex-shrink: 0;
}
.tab-dropdown:hover .tab-chevron { transform: rotate(180deg); }
.tab-active-bar {
  position: absolute;
  bottom: 0;
  left: 0.2rem;
  right: 0.2rem;
  height: 2.5px;
  background: var(--tab-active);
  border-radius: 2px 2px 0 0;
}
.tab-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 0.3rem 0;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
}
.tab-dropdown:hover .tab-dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.tab-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}
.tab-dropdown-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}
html[data-theme="light"] .tab-dropdown-item:hover { background: rgba(0,0,0,0.04); }
.tab-dropdown-item.active {
  color: var(--tab-active);
}

/* ── Header right ── */
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Theme toggle button ── */
.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.theme-btn:hover { background: var(--border); color: var(--text); }

/* Mostrar sol en oscuro, luna en claro */
html[data-theme="dark"]  .icon-moon { display: none; }
html[data-theme="light"] .icon-sun  { display: none; }

/* ── Page layout ── */
main {
  padding: 1.75rem 2rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.month-selector-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.month-selector-wrap label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.month-selector-wrap select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
}
.month-selector-wrap select:focus { border-color: var(--accent); }

/* ── KPI grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-info-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
  line-height: 1;
}
.kpi-info-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.kpi-value.positive { color: var(--green); }
.kpi-value.negative { color: var(--red); }

.kpi-change { font-size: 0.8rem; min-height: 1.1em; }
.change-up   { color: var(--green); }
.change-down { color: var(--red); }

/* ── Charts ── */
.charts-grid { margin-bottom: 1.5rem; }

.charts-grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 900px) { .charts-grid.two-col { grid-template-columns: 1fr; } }

.charts-grid.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 1100px) { .charts-grid.three-col { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px)  { .charts-grid.three-col { grid-template-columns: 1fr; } }

.charts-grid.one-col { display: grid; grid-template-columns: 1fr; }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.chart-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.chart-wrap { height: 200px; }
.donut-wrap { height: 200px; margin: 0 auto; }

/* ── Maquinas cards ── */
.maq-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.maq-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  transform: translateY(-2px);
}
.maq-card-bar {
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--maq-color, var(--border));
  border-radius: 10px 0 0 10px;
}
.maq-card--error { opacity: .6; }
.maq-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding-left: .5rem;
}
.maq-card-name {
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.3;
}
.maq-card-id {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .1rem;
}
.maq-badge {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 600;
  padding: .18rem .55rem;
  border-radius: 99px;
  letter-spacing: .02em;
}
.maq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
  padding-left: .5rem;
}
.maq-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .74rem;
  padding: .22rem .55rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface2, rgba(255,255,255,.03));
  white-space: nowrap;
}
.maq-chip--on  { border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.maq-chip--off { color: var(--text-muted); opacity: .75; }
.maq-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: .45rem;
  padding-left: .5rem;
  flex-wrap: wrap;
  gap: .25rem;
}

/* ping animation */
@keyframes maq-ping {
  75%, 100% { transform: scale(2); opacity: 0; }
}
.maq-ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: maq-ping 1.4s cubic-bezier(0,0,.2,1) infinite;
}

/* ── Detail modal ── */
.detail-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.detail-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%; max-width: 860px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
}
.detail-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.detail-modal-title { font-weight: 600; font-size: .95rem; }
.detail-modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--text-muted);
  padding: .2rem .4rem; border-radius: 4px;
}
.detail-modal-close:hover { background: var(--border); }
.detail-modal-body {
  overflow-y: auto; padding: .75rem 1rem 1rem;
  flex: 1;
}
.detail-modal-body table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.detail-modal-body th {
  background: var(--surface-alt, var(--border));
  padding: .4rem .6rem; text-align: left;
  font-weight: 600; position: sticky; top: 0;
}
.detail-modal-body td { padding: .35rem .6rem; border-bottom: 1px solid var(--border); }
.detail-modal-body tr:last-child td { border-bottom: none; }
.btn-detail {
  font-size: .73rem; padding: .18rem .5rem;
  background: none; border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer; color: var(--text-muted);
  white-space: nowrap;
}
.btn-detail:hover { border-color: var(--accent, #1a56db); color: var(--accent, #1a56db); }

/* ── Sub-tabs ── */
.sub-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.sub-tab {
  padding: .45rem 1.1rem;
  font-size: .82rem;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.sub-tab:hover { color: var(--text); }
.sub-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Table card ── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.table-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.table-controls {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.table-controls input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  width: 220px;
  outline: none;
}
.table-controls input:focus { border-color: var(--accent); }
.table-controls input::placeholder { color: var(--text-muted); }

.table-controls button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}
.table-controls button:hover { background: #6ba3ff; }

.table-wrap { overflow-x: auto; }

#dataTable,
#sbTable,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

#dataTable thead th,
#sbTable thead th,
.data-table thead th {
  padding: 0.6rem 0.9rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  background: var(--surface);
}
#dataTable thead th.num,
#sbTable  thead th.num,
.data-table thead th.num { text-align: right; }

#dataTable tbody tr,
#sbTable  tbody tr,
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
#dataTable tbody tr:last-child,
#sbTable  tbody tr:last-child,
.data-table tbody tr:last-child { border-bottom: none; }

#dataTable tbody tr:hover,
#sbTable  tbody tr:hover,
.data-table tbody tr:hover { background: var(--surface2); }

#dataTable tbody td,
#sbTable  tbody td,
.data-table tbody td {
  padding: 0.55rem 0.9rem;
  color: var(--text);
  white-space: nowrap;
  font-size: 0.83rem;
  line-height: 1.4;
}
#dataTable tbody td.num,
#sbTable  tbody td.num,
.data-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }

#dataTable tbody td.neg,
#sbTable  tbody td.neg,
.data-table tbody td.neg { color: var(--red); }

.empty-row { text-align: center; color: var(--text-muted); padding: 2rem !important; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}

.pagination .pag-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: auto;
}

.pagination button {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.pagination button:hover { border-color: var(--accent); color: var(--accent); }

/* ── Section label ── */
.section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 1.5rem 0 0.6rem;
}

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.25rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-group label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.filter-group input,
.filter-group select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.38rem 0.7rem;
  font-size: 0.83rem;
  outline: none;
  height: 34px;
}
.filter-group input:focus,
.filter-group select:focus { border-color: var(--accent); }
.filter-group input::placeholder { color: var(--text-muted); }
.filter-group input[type="date"] { width: 150px; color-scheme: dark; }
.filter-group select             { min-width: 160px; cursor: pointer; }
.filter-group input[type="text"] { min-width: 150px; }

.filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  padding-bottom: 1px;
}

.btn-primary, .btn-secondary {
  border: none;
  border-radius: 6px;
  padding: 0.4rem 1rem;
  font-size: 0.83rem;
  cursor: pointer;
  height: 34px;
  transition: background 0.15s, color 0.15s;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: #6ba3ff; }
.btn-secondary { background: var(--border); color: var(--text-muted); }
.btn-secondary:hover { background: #3a3f55; color: var(--text); }

/* ── Machine KPI cards ── */
.machine-kpis-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  padding-bottom: 4px;
}

.machine-kpis {
  display: flex;
  gap: 0.75rem;
  min-width: max-content;
}

.loading-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

.mki-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.15s;
}
.mki-card:hover { border-color: var(--accent); }

.mki-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.mki-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.mki-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mki-val {
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.mki-val.egresos-val { color: var(--red); }
.mki-val.positive    { color: var(--green); }
.mki-val.negative    { color: var(--red); }

.mki-divider {
  height: 1px;
  background: var(--border);
  margin: 0.2rem 0;
}

.mki-neto-row .mki-lbl  { font-weight: 600; color: var(--text); }
.mki-neto-row .mki-val  { font-size: 0.88rem; }

.mki-txn {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Zone ranking ── */
.zone-ranking {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.zr-header, .zr-row {
  display: grid;
  grid-template-columns: 32px 1fr 170px 145px 145px 130px 68px 84px 24px;
  align-items: center;
  gap: 0;
  padding: 0 1.5rem;
}

.zr-header {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding-top: .65rem;
  padding-bottom: .65rem;
}

.zr-header span {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.zr-row {
  padding-top: .78rem;
  padding-bottom: .78rem;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  cursor: pointer;
  user-select: none;
}
.zr-row:hover,
.zr-row.expanded { background: var(--surface2); }

.zr-chevron {
  font-size: .6rem;
  color: var(--text-muted);
  text-align: right;
  transition: transform .2s;
}
.zr-row.expanded .zr-chevron { transform: rotate(90deg); }

/* ── Nivel 2: grupos ── */
.zr-l2-container {
  display: none;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 50%, var(--surface));
}
.zr-l2-container.open { display: block; }

.zr-l2-row {
  display: grid;
  grid-template-columns: 32px 1fr 170px 145px 145px 130px 68px 84px 24px;
  align-items: center;
  padding: .65rem 1.5rem .65rem 2.8rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  cursor: pointer;
  user-select: none;
  transition: background .12s;
  border-left: 3px solid var(--accent);
}
.zr-l2-row:last-of-type { border-bottom: none; }
.zr-l2-row:hover,
.zr-l2-row.expanded { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.zr-l2-row .zr-rank  { color: var(--accent); font-size: .72rem; }
.zr-l2-row .zr-name  { font-size: .82rem; }
.zr-l2-row .zr-chevron { transition: transform .2s; }
.zr-l2-row.expanded .zr-chevron { transform: rotate(90deg); }

/* ── Nivel 3: registros ── */
.zr-l3-container {
  display: none;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--bg) 75%, var(--surface));
  border-left: 3px solid var(--accent);
}
.zr-l3-container.open { display: block; }

.zr-l3-inner { padding: .4rem 1.1rem .6rem 4rem; }

.zr-l3-header, .zr-l3-row {
  display: grid;
  grid-template-columns: 95px 1fr 100px 115px 115px 115px 72px;
  align-items: center;
  padding: .3rem .4rem;
  gap: 0;
}
.zr-l3-header {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: .4rem;
  margin-bottom: .15rem;
}
.zr-l3-row {
  border-radius: 4px;
  transition: background .1s;
}
.zr-l3-row:hover { background: var(--surface2); }

.zr-rank {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.zr-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  padding-right: .75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zr-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-right: 1.25rem;
}
.zr-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width .6s ease;
}

.zr-num {
  font-size: .82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  padding-right: 1.25rem;
}
.zr-num.red   { color: var(--red); }
.zr-num.green { color: var(--green); }

.zr-pct {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
}

.zr-trend {
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
.zr-trend.up   { color: var(--green); }
.zr-trend.down { color: var(--red); }

@media (max-width: 960px) {
  .zr-header, .zr-row, .zr-l2-row {
    grid-template-columns: 24px 1fr 100px 110px 110px 100px 52px 68px 18px;
    padding: 0 1rem;
    font-size: .74rem;
  }
  .zr-l2-row { padding-left: 2rem; }
}

/* ── Donut card centering ── */
.donut-card { }

/* ── Import panel ── */
.import-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.import-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.import-folder {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 0.75rem;
}

.import-actions { display: flex; gap: 0.5rem; }

.import-table-wrap { overflow-x: auto; margin-top: 0.5rem; }

.import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.import-table th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.import-table th.num { text-align: right; }
.import-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.import-table tr:last-child td { border-bottom: none; }
.import-table td.num  { text-align: right; font-variant-numeric: tabular-nums; }
.import-table td.fname {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-sm {
  background: var(--border);
  color: var(--text);
  border: none;
  border-radius: 5px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-sm:hover { background: var(--accent); color: #fff; }

.import-result {
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
}
.import-result.info    { background: rgba(79,142,247,0.12); color: var(--accent); }
.import-result.success { background: rgba(34,197,94,0.12);  color: var(--green); }

/* ── SportBet global KPIs (5 cards) ── */
.sb-global-kpis { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .sb-global-kpis { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 600px)  { .sb-global-kpis { grid-template-columns: repeat(2,1fr); } }

/* ── Socio comparativa ── */
.sb-socio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ── No data message ── */
.no-data-msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ── Import toggle button ── */
.import-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.83rem;
}

/* ── SportBet KPI grid ── */
.sb-kpi-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.sb-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-color, var(--accent));
  border-radius: 10px;
  padding: 1rem 1.25rem;
  min-width: 200px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s;
}

.sb-kpi-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--card-color, var(--accent));
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.sb-kpi-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}
.sb-kpi-row span:first-child { color: var(--text-muted); }
.sb-kpi-row span:last-child  { font-weight: 600; font-variant-numeric: tabular-nums; }

.sb-kpi-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }

.sb-kpi-ggr span:last-child { font-size: 0.92rem; }

/* ── Socio badge in table ── */
.socio-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 5px;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.evento-cell {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.82rem;
}

/* ── Home page ── */
main h1 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.75rem; }
main > p { color: var(--text-muted); line-height: 1.6; }

/* ── Chart title row (with info button) ── */
.chart-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.chart-title-row .chart-title { margin-bottom: 0; }

.chart-info-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
  line-height: 1;
}
.chart-info-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Chart info modal ── */
.chart-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 480px;
  width: calc(100% - 2rem);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.chart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.chart-modal-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.chart-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 0.15s;
  line-height: 1;
}
.chart-modal-close:hover { color: var(--text); }

.chart-modal-body {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.75;
}

/* ── Table column filters ── */
.table-col-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.col-filter-sel {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
  height: 28px;
  max-width: 160px;
}
.col-filter-sel:focus { border-color: var(--accent); }

/* ── Sync status ── */
.sync-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.sync-last-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── User pill ── */
.user-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.7rem 0.28rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.user-pill:hover { background: var(--bg); border-color: var(--accent); }
.user-pill.open  { border-color: var(--accent); }
.user-pill-name  { color: var(--text); font-weight: 600; }
.user-pill-role  {
  font-size: 0.68rem; font-weight: 700;
  padding: 0.1rem 0.45rem; border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent); letter-spacing: .03em; text-transform: uppercase;
}
.upill-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.upill-avatar img { width: 100%; height: 100%; object-fit: cover; }
.upill-chevron   { flex-shrink: 0; transition: transform 0.18s; }
.user-pill.open .upill-chevron { transform: rotate(180deg); }

/* ── User dropdown ── */
.udd-wrap { position: relative; }
.udd-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 230px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.22);
  padding: .4rem 0; z-index: 400;
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity .18s, transform .18s;
}
.udd-wrap.open .udd-menu { opacity: 1; pointer-events: all; transform: translateY(0); }
.udd-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem;
}
.udd-avatar-lg {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.udd-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.udd-hname  { font-weight: 700; font-size: .88rem; color: var(--text); }
.udd-hrole  { font-size: .72rem; color: var(--text-muted); margin-top: .05rem; }
.udd-divider { height: 1px; background: var(--border); margin: .3rem 0; }
.udd-group-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
  padding: .5rem 1rem .2rem;
}
.udd-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .52rem 1rem; font-size: .83rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  transition: color .12s, background .12s; cursor: pointer;
}
.udd-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
html[data-theme="light"] .udd-item:hover { background: rgba(0,0,0,0.04); }
.udd-logout { color: var(--red) !important; }
.udd-logout:hover { background: color-mix(in srgb,var(--red) 8%,transparent) !important; }

/* ── Profile avatar (configuracion) ── */
.cfg-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700;
  overflow: hidden; flex-shrink: 0; position: relative; cursor: pointer;
}
.cfg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cfg-avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.cfg-avatar:hover .cfg-avatar-overlay { opacity: 1; }

/* ── cfg-label / cfg-input ── */
.cfg-label {
  display: block; font-size: .78rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .03em; margin-bottom: .35rem;
}
.cfg-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: .55rem .8rem; font-size: .88rem; outline: none;
  transition: border-color .15s;
}
.cfg-input:focus { border-color: var(--accent); }

/* ── User Drawer ── */
.udrawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.42);
  z-index: 300; opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
}
.udrawer-overlay.open { opacity: 1; pointer-events: all; }

.udrawer {
  position: fixed; top: 0; right: 0;
  height: 100vh; width: 460px; max-width: 100vw;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 301; display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -10px 0 40px rgba(0,0,0,0.2);
}
.udrawer.open { transform: translateX(0); }

.udrawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.udrawer-hname  { font-weight: 700; font-size: .95rem; color: var(--text); }
.udrawer-hrole  { font-size: .73rem; color: var(--text-muted); margin-top: .1rem; }
.udrawer-close  {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1rem; padding: .4rem .5rem;
  border-radius: 6px; line-height: 1; transition: color .15s, background .15s;
}
.udrawer-close:hover { color: var(--text); background: var(--bg); }

/* Avatars */
.udrawer-avatar {
  border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.udrawer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.udrawer-avatar-sm  { width: 38px; height: 38px; font-size: .95rem; }
.udrawer-avatar-lg  {
  width: 76px; height: 76px; font-size: 1.85rem;
  position: relative; cursor: pointer;
}
.udrawer-avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.udrawer-avatar-lg:hover .udrawer-avatar-overlay { opacity: 1; }

/* Tabs */
.udrawer-tabs {
  display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.udrawer-tab {
  flex: 1; padding: .65rem .5rem;
  background: none; border: none; border-bottom: 2.5px solid transparent;
  color: var(--text-muted); font-size: .82rem; font-weight: 500;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.udrawer-tab.active       { color: var(--tab-active); border-bottom-color: var(--tab-active); }
.udrawer-tab:hover:not(.active) { color: var(--text); }

/* Body */
.udrawer-body { flex: 1; overflow-y: auto; overflow-x: hidden; }
.dtab-panel   { min-height: 100%; }
.udrawer-section { padding: 1.25rem; }

/* Form */
.udrawer-label {
  display: block; font-size: .78rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .03em; margin-bottom: .35rem;
}
.udrawer-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: .55rem .8rem; font-size: .88rem; outline: none;
  transition: border-color .15s;
}
.udrawer-input:focus { border-color: var(--accent); }

/* Sub-tabs */
.udrawer-subtabs {
  display: flex; gap: .3rem;
  padding: .75rem 1rem .6rem; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.udrawer-subtab {
  padding: .28rem .75rem;
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-muted); font-size: .78rem; font-weight: 500;
  cursor: pointer; transition: all .12s;
}
.udrawer-subtab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.stab-panel { }

/* Footer */
.udrawer-footer {
  border-top: 1px solid var(--border);
  padding: .85rem 1.25rem; flex-shrink: 0;
}
.udrawer-logout-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--red); text-decoration: none;
  font-size: .83rem; font-weight: 500; transition: opacity .15s;
}
.udrawer-logout-btn:hover { opacity: .7; }

/* ══ Campana de alertas ══════════════════════════════════════════════════════ */

.bell-wrap { position: relative; }

.bell-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  position: relative;
}
.bell-btn:hover { background: var(--border); color: var(--text); }
.bell-btn.has-alerts {
  color: #f59e0b;
  border-color: rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.07);
}

.bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  border: 2px solid var(--surface);
}
.bell-badge.visible { display: flex; }

/* ── Dropdown ── */
.alert-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 500;
  overflow: hidden;
  display: none;
  animation: ddFadeIn .15s ease;
}
.alert-dropdown.open { display: block; }

@keyframes ddFadeIn {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}

.alert-dd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.alert-dd-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.alert-dd-mark-all {
  font-size: 0.75rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.alert-dd-mark-all:hover { text-decoration: underline; }

.alert-dd-list { max-height: 340px; overflow-y: auto; }

.alert-dd-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.alert-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--surface2); }

.alert-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}
.alert-item-icon.maquina_caida {
  background: color-mix(in srgb, var(--red) 12%, transparent);
}
.alert-item-icon.ventas_umbral {
  background: color-mix(in srgb, #f59e0b 12%, transparent);
}

.alert-item-body { flex: 1; min-width: 0; }
.alert-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert-item-msg {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert-item-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.alert-dd-footer {
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.alert-dd-footer a {
  font-size: 0.76rem;
  color: var(--accent);
  text-decoration: none;
}
.alert-dd-footer a:hover { text-decoration: underline; }

/* ══ Toast notifications ══════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 76px;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  min-width: 270px;
  max-width: 320px;
  cursor: pointer;
  animation: toastIn .3s ease;
}
.toast.hiding { animation: toastOut .3s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform:translateX(40px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { from { opacity:1; transform:translateX(0); }    to { opacity:0; transform:translateX(40px); } }

.toast-icon  { font-size: 1.1rem; flex-shrink: 0; line-height: 1.5; }
.toast-body  { flex: 1; min-width: 0; }
.toast-title { font-size: 0.82rem; font-weight: 700; }
.toast-msg   { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.15rem; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  flex-shrink: 0;
  line-height: 1.5;
}
.toast-close:hover { color: var(--text); }

/* ══ Página Configuración ══════════════════════════════════════════════════════ */

.config-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.config-section-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.config-section-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.config-section-title {
  font-size: 0.9rem;
  font-weight: 600;
}
.config-section-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.config-item:last-child { border-bottom: none; }
.config-item.disabled   { opacity: 0.55; }

.config-item-info { flex: 1; }
.config-item-name {
  font-size: 0.86rem;
  font-weight: 500;
}
.config-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.45;
}
.config-item-badge {
  font-size: 0.67rem;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.45rem;
  background: var(--border);
  color: var(--text-muted);
  vertical-align: middle;
}

/* Toggle switch */
.toggle-wrap    { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle-input   { display: none; }
.toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--border);
  transition: background 0.2s;
  position: relative;
  flex-shrink: 0;
}
.toggle-input:checked + .toggle-track { background: var(--accent); }
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.toggle-input:checked + .toggle-track::after { transform: translateX(18px); }
