:root {
  --bg: #0B1016;
  --card: #111821;
  --card-raised: #18212C;
  --border: #253140;
  --border-strong: #344256;
  --text: #F1F5F9;
  --text-secondary: #A3AFBF;
  --text-tertiary: #697789;
  --accent: #8FA6C1;
  --accent-hover: #A9BDD3;
  --accent-glow: rgba(143, 166, 193, 0.09);
  --accent-light: #C5D3E1;
  --green: #45C486;
  --yellow: #E6B95C;
  --red: #EC6A70;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

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

.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Top bar ---------- */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.25rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border);
  background: var(--card); flex-shrink: 0; position: sticky; top: 0; z-index: 20;
}
.top-left { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.back-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-secondary);
  padding: 0.45rem 0.8rem; border-radius: 8px; text-decoration: none; font-size: 0.8rem;
  font-weight: 500; transition: all 0.2s; flex-shrink: 0;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }
.top-divider { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }

.page-title { display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.95rem; min-width: 0; }
.page-title-context { color: var(--text-secondary); font-weight: 500; }
.page-title-sep { color: var(--text-tertiary); font-weight: 400; }
.page-title-current { color: var(--text); font-weight: 600; }

.admin-tabs { display: flex; align-items: center; gap: 1.5rem; }
.admin-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-secondary); font-family: inherit; font-size: 0.83rem; font-weight: 500;
  padding: 0.4rem 0.05rem; cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.top-right { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.env-note { font-size: 0.72rem; color: var(--text-tertiary); white-space: nowrap; }

/* ---------- Content ---------- */
.content { flex: 1; padding: 1.5rem 2rem 3rem; max-width: 1400px; margin: 0 auto; width: 100%; }
.view { display: none; }
.view.active { display: block; }

/* ---------- Stats grid ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.1rem;
}
.stat-card .stat-label { font-size: 0.68rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.35rem; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-card .stat-value.good { color: var(--green); }
.stat-card .stat-value.danger { color: var(--red); }
.stat-card .stat-sub { font-size: 0.72rem; color: var(--text-tertiary); margin-top: 0.2rem; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-box-wrap { position: relative; flex: 1; min-width: 260px; max-width: 380px; }
.search-box-icon { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; }
.search-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.55rem 0.75rem 0.55rem 2.05rem; color: var(--text); font-size: 0.82rem; outline: none; width: 100%;
  font-family: inherit;
}
.search-box:focus { border-color: var(--accent); }

.filter-tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.filter-tab {
  background: var(--card); border: 1px solid transparent; color: var(--text-secondary);
  font-family: inherit; font-size: 0.76rem; font-weight: 500; padding: 0.42rem 0.75rem;
  border-radius: 999px; cursor: pointer; transition: all 0.15s;
}
.filter-tab:hover { color: var(--text); border-color: var(--border); }
.filter-tab.active { background: rgba(99,102,241,.15); border-color: rgba(99,102,241,.3); color: var(--accent-light); }

/* ---------- Table ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.admin-table th {
  text-align: left; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-secondary); font-weight: 600; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border);
  background: var(--card-raised);
}
.admin-table td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(255,255,255,0.015); }

.actions-cell { width: 1%; text-align: right; }
.kebab-btn {
  background: transparent; border: 1px solid transparent; color: var(--text-secondary);
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.kebab-btn:hover { background: var(--bg); border-color: var(--border); color: var(--text); }

.cell-name { font-weight: 600; font-size: 0.86rem; }
.cell-sub { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.1rem; }

.usage-cell { min-width: 130px; }
.usage-cell .usage-num { font-size: 0.78rem; font-weight: 600; margin-bottom: 0.3rem; }
.usage-bar-track { height: 5px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.usage-bar-track > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.usage-bar-track > span.warn { background: var(--yellow); }
.usage-bar-track > span.danger { background: var(--red); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.68rem; font-weight: 600; padding: 0.22rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.plan-basico { background: rgba(138,138,143,.12); color: var(--text-secondary); border: 1px solid rgba(138,138,143,.25); }
.badge.plan-pro { background: rgba(99,102,241,.12); color: var(--accent-light); border: 1px solid rgba(99,102,241,.25); }
.badge.plan-enterprise { background: rgba(168,85,247,.12); color: #C4B5FD; border: 1px solid rgba(168,85,247,.28); }
.badge.estado-activo { background: rgba(34,197,94,.12); color: var(--green); border: 1px solid rgba(34,197,94,.25); }
.badge.estado-bloqueado { background: rgba(239,68,68,.12); color: var(--red); border: 1px solid rgba(239,68,68,.25); }
.badge.estado-impago { background: rgba(234,179,8,.12); color: var(--yellow); border: 1px solid rgba(234,179,8,.25); }
.badge.estado-pausado { background: rgba(138,138,143,.12); color: var(--text-secondary); border: 1px solid rgba(138,138,143,.25); }
.badge.estado-trial { background: rgba(99,102,241,.12); color: var(--accent-light); border: 1px solid rgba(99,102,241,.25); }
.badge.estado-cancela-pronto { background: rgba(234,179,8,.12); color: var(--yellow); border: 1px solid rgba(234,179,8,.25); }
.badge.estado-pendiente { background: rgba(138,138,143,.12); color: var(--text-secondary); border: 1px solid rgba(138,138,143,.25); }
.badge.estado-sin-suscripcion { background: rgba(138,138,143,.12); color: var(--text-secondary); border: 1px solid rgba(138,138,143,.25); }
.badge.estado-cancelada { background: rgba(138,138,143,.12); color: var(--text-secondary); border: 1px solid rgba(138,138,143,.25); }
.badge.tipo-info { background: rgba(99,102,241,.12); color: var(--accent-light); border: 1px solid rgba(99,102,241,.25); }
.badge.tipo-warning { background: rgba(234,179,8,.12); color: var(--yellow); border: 1px solid rgba(234,179,8,.25); }
.badge.tipo-critico { background: rgba(239,68,68,.12); color: var(--red); border: 1px solid rgba(239,68,68,.25); }
.badge.rol-administrador { background: rgba(168,85,247,.12); color: #C4B5FD; border: 1px solid rgba(168,85,247,.28); }
.badge.rol-gerente { background: rgba(99,102,241,.12); color: var(--accent-light); border: 1px solid rgba(99,102,241,.25); }
.badge.rol-admin { background: rgba(99,102,241,.1); color: var(--text-secondary); border: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.btn {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; font-size: 0.78rem; padding: 0.5rem 0.85rem;
  border-radius: 8px; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); color: var(--red); background: rgba(239,68,68,.08); }
.btn.sm { padding: 0.35rem 0.6rem; font-size: 0.72rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.link-back {
  display: inline-flex; align-items: center; gap: 0.35rem; background: transparent; border: none;
  color: var(--text-secondary); font-family: inherit; font-size: 0.8rem; cursor: pointer; margin-bottom: 1rem; padding: 0;
}
.link-back:hover { color: var(--accent); }

/* ---------- Popover (action menus) ---------- */
.popover-wrap { position: relative; display: inline-block; }
.popover {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 400;
  background: var(--card-raised); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  min-width: 210px; padding: 0.35rem; overflow: hidden;
}
.popover.right { left: auto; right: 0; }
.popover-title {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-secondary); padding: 0.5rem 0.65rem 0.35rem;
}
.popover-item {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: left;
  background: transparent; border: none; color: var(--text); font-family: inherit;
  font-size: 0.82rem; padding: 0.5rem 0.65rem; border-radius: 7px; cursor: pointer; transition: background 0.15s;
}
.popover-item:hover { background: var(--bg); }
.popover-item.danger { color: var(--red); }
.popover-item.danger.critical { font-weight: 600; }
.popover-item.danger.critical:hover { background: rgba(239,68,68,.12); }
.popover-sep { height: 1px; background: var(--border); margin: 0.3rem 0.2rem; }

/* ---------- Detail header ---------- */
.detail-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.detail-header-info h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 0.4rem; }
.detail-header-info .detail-email { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.6rem; }
.detail-header-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.detail-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Detail tabs ---------- */
.detail-tabs { display: flex; gap: 0.3rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; flex-wrap: wrap; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Panel cards (global view, subscription) ---------- */
.panel-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.4rem; margin-bottom: 1.25rem; }
.panel-card-head { margin-bottom: 1.1rem; }
.panel-card-head h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.25rem; }
.panel-card-head p { font-size: 0.8rem; color: var(--text-secondary); }

.section-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.9rem; }

/* ---------- Forms ---------- */
.form-row { display: flex; gap: 1rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.global-form label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.76rem; color: var(--text-secondary); flex: 1; min-width: 180px; }
.global-form label.form-grow { flex: 2; }
.global-form label.form-full { width: 100%; margin-bottom: 0.9rem; }
.global-form input, .global-form select, .global-form textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.55rem 0.7rem; color: var(--text); font-family: inherit; font-size: 0.82rem; outline: none; resize: vertical;
}
.global-form input:focus, .global-form select:focus, .global-form textarea:focus { border-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.modal-body .global-form select { width: 100%; margin-top: 0; }
.modal-body .global-form { padding: 0; }

.file-drop-field {
  display: flex; align-items: center; gap: 10px; background: var(--bg);
  border: 1px dashed var(--border-strong); border-radius: 8px; padding: 0.55rem 0.7rem;
}
.file-drop-field input[type="file"] { flex: 1; font-size: 0.78rem; color: var(--text-secondary); }
.file-drop-current { font-size: 0.74rem; color: var(--text-tertiary); }
.file-drop-current a { color: var(--accent-light); }

.limits-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.9rem; }
.limits-form label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.72rem; color: var(--text-secondary); }
.limits-form input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.5rem 0.65rem; color: var(--text); font-family: inherit; font-size: 0.85rem; outline: none;
}
.limits-form input:focus { border-color: var(--accent); }

/* ---------- Subscription tab ---------- */
.subscription-grid { display: grid; grid-template-columns: 1.45fr .85fr; gap: 1.1rem; margin-bottom: 1.1rem; }
@media (max-width: 1100px) { .subscription-grid { grid-template-columns: 1fr; } }

.section-copy { color: var(--text-tertiary); font-size: 0.73rem; line-height: 1.45; margin: -4px 0 14px; }

.plan-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.plan-option {
  position: relative;
  display: block;
  padding: 12px 12px 10px;
  background: #0A1016;
  border: 1px solid #253241;
  border-radius: 7px;
  cursor: pointer;
}
.plan-option input { position: absolute; opacity: 0; pointer-events: none; }
.plan-option:hover { border-color: #3E5368; background: #101821; }
.plan-option:has(input:checked) {
  border-color: #7E96B0;
  background: #15202B;
  box-shadow: inset 0 0 0 1px rgba(126,150,176,.25);
}
.plan-option-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-option-top strong { font-size: 0.82rem; font-weight: 620; color: #F0F4F8; }
.plan-current-tag {
  font-size: 0.61rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #C5D3E2;
  background: #243140;
  border: 1px solid #3A4E63;
  border-radius: 3px;
  padding: 2px 5px;
}
.plan-option-price { margin-top: 8px; color: #F4F7FA; font-size: 1.15rem; font-weight: 650; }
.plan-option-price span { margin-left: 3px; color: #7A8A9C; font-size: 0.68rem; font-weight: 500; }
.plan-option p { margin: 6px 0 10px; color: #7D8C9D; font-size: 0.64rem; line-height: 1.35; min-height: 3.4em; }
.plan-option ul { margin: 0; padding: 0; list-style: none; color: #9AABBC; font-size: 0.68rem; }
.plan-option li { padding: 2px 0; }
.subscription-facts { margin-bottom: 14px; }
#applyPlanBtn:disabled { opacity: .45; cursor: default; }

.limits-group { margin-bottom: 18px; }
.limits-group-title {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #202B37;
  color: #748295;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.feature-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #0A1016;
  border: 1px solid #253241;
  border-radius: 6px;
  cursor: pointer;
}
.feature-toggle:hover { border-color: #3E5368; }
.feature-toggle:has(input:checked) { border-color: #4A6278; background: #121C26; }
.feature-toggle input { margin-top: 3px; accent-color: #8FA6C1; }
.feature-toggle strong { display: block; color: #DEE6EE; font-size: 0.76rem; font-weight: 590; }
.feature-toggle small { display: block; margin-top: 2px; color: #718095; font-size: 0.66rem; line-height: 1.35; }
.limits-actions { gap: 8px; }
#planPickerCard, #limitsEditorCard, #featuresEditorCard { margin-top: 0; }
#planPickerCard { margin-bottom: 1.1rem; }

.feature-group { margin-bottom: 18px; }
.feature-group:last-child { margin-bottom: 0; }
.feature-group-title {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #202B37;
  color: #748295;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.features-form { display: flex; flex-direction: column; gap: 8px; }
.feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  background: #0A1016;
  border: 1px solid #253241;
  border-radius: 6px;
  flex-wrap: wrap;
}
.feature-row-label { color: #DEE6EE; font-size: 0.76rem; font-weight: 590; }
.feature-row-label small { display: block; margin-top: 2px; color: #718095; font-size: 0.64rem; font-weight: 500; }
.feature-row-options { display: flex; gap: 12px; flex-wrap: wrap; }
.feature-row-options label { display: flex; align-items: center; gap: 5px; color: #9AABBC; font-size: 0.7rem; cursor: pointer; }
.feature-row-options input { accent-color: #8FA6C1; }

.limits-form label small { color: #667687; font-size: 0.62rem; line-height: 1.35; }
.limit-plan-hint { color: #8FA6C1; font-size: 0.61rem; font-weight: 600; letter-spacing: .03em; }
.plan-banner {
  margin-bottom: 12px;
  padding: 9px 12px;
  color: #D5DEE8;
  background: #18222C;
  border: 1px solid #334556;
  border-radius: 6px;
  font-size: 0.73rem;
  line-height: 1.4;
}
.plan-banner.trial { border-color: #4A5F3A; color: #D7E4C7; background: #162016; }
.plan-extra-fields { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-bottom: 14px; align-items: center; }
.plan-extra-fields label { display: flex; flex-direction: column; gap: 6px; color: var(--text-secondary); font-size: 0.72rem; min-width: 200px; }
.plan-extra-fields input[type="number"] {
  background: #080D12; border: 1px solid #293645; border-radius: 5px; color: var(--text);
  padding: 0.5rem 0.65rem; font: inherit; font-size: 0.85rem;
}
.trial-check { flex-direction: row !important; align-items: center; gap: 8px !important; min-width: 280px; }
.trial-check.is-disabled { opacity: .5; }
.is-hidden { display: none !important; }
.sla-row { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 0.72rem; color: #C5D0DB; }
.feature-grid-select { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.feature-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: #0A1016;
  border: 1px solid #253241;
  border-radius: 6px;
}
.feature-select strong { display: block; color: #DEE6EE; font-size: 0.76rem; font-weight: 590; }
.feature-select small { display: block; margin-top: 2px; color: #718095; font-size: 0.66rem; }
.feature-select select {
  background: #080D12;
  border: 1px solid #293645;
  border-radius: 5px;
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  padding: 7px 8px;
}

@media (max-width: 1200px) {
  .plan-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .plan-picker { grid-template-columns: 1fr; }
}

.kv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.kv { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.75rem; }
.kv-label { font-size: 0.64rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.kv-val { font-size: 0.9rem; font-weight: 600; margin-top: 0.15rem; }

.timeline { display: flex; flex-direction: column; gap: 0.65rem; max-height: 380px; overflow-y: auto; }
.timeline-item { display: flex; gap: 0.6rem; font-size: 0.78rem; }
.timeline-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 0.35rem; flex-shrink: 0; }
.timeline-body strong { color: var(--text); }
.timeline-date { font-size: 0.68rem; color: var(--text-tertiary); margin-top: 0.1rem; }

/* ---------- Team hierarchy ---------- */
.team-owner,
.team-member {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  min-height: 88px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.15rem 1.3rem;
}
.team-owner { margin-bottom: 1.15rem; }
#tab-equipo > .team-member { margin-bottom: 1.15rem; }
.team-owner.blocked,
.team-member.blocked { border-color: rgba(239,68,68,.35); }
.team-tree-line {
  position: relative;
  margin: 0 0 1rem 2.1rem;
  padding-left: 1.5rem;
  border-left: 2px dashed var(--border);
}
.team-list { display: flex; flex-direction: column; gap: 0.9rem; }
.team-member { position: relative; }
.team-member::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 50%;
  width: 1.4rem;
  height: 2px;
  background: var(--border);
}
.avatar-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #8B5CF6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
}
.avatar-circle.owner { background: linear-gradient(135deg, #A855F7, #6366F1); }
.team-info { flex: 1; min-width: 0; }
.team-info .team-name {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  line-height: 1.35;
}
.team-info .team-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  line-height: 1.4;
}
.team-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; padding-left: 0.4rem; }
.team-actions .btn { padding: 0.5rem 0.85rem; }

/* ---------- Communication tab ---------- */
.comm-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 980px) { .comm-layout { grid-template-columns: 1fr; } }
.comm-log { display: flex; flex-direction: column; gap: 0.6rem; max-height: 420px; overflow-y: auto; }
.comm-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.85rem; }
.comm-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.25rem; }
.comm-item-subject { font-weight: 600; font-size: 0.82rem; }
.comm-item-date { font-size: 0.66rem; color: var(--text-tertiary); flex-shrink: 0; white-space: nowrap; }
.comm-item-body { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; }
.comm-item-target { font-size: 0.68rem; color: var(--accent-light); margin-top: 0.35rem; }

/* ---------- Empty state ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2.5rem 1rem; color: var(--text-secondary); text-align: center; font-size: 0.85rem;
}
.empty svg { width: 42px; height: 42px; opacity: 0.35; margin-bottom: 0.75rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; background: var(--card-raised);
  border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem 1.1rem;
  font-size: 0.85rem; z-index: 500; opacity: 0; transition: opacity 0.3s; pointer-events: none;
  box-shadow: 0 12px 32px rgba(0,0,0,.45); display: flex; align-items: center; gap: 0.5rem;
}
.toast.show { opacity: 1; }
.toast .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.toast.error .dot { background: var(--red); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none;
  align-items: center; justify-content: center; z-index: 600; padding: 1.5rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  width: 100%; max-width: 460px; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-box.wide { max-width: 720px; }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-close { background: var(--bg); border: 1px solid var(--border); color: var(--text); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; }
.modal-close:hover { border-color: var(--accent); color: var(--accent); }
.modal-body { flex: 1; overflow-y: auto; padding: 1.1rem 1.25rem; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.modal-body strong { color: var(--text); }
.modal-body .radio-option {
  display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.65rem 0.7rem; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 0.5rem; cursor: pointer; transition: all 0.15s;
}
.modal-body .radio-option:hover { border-color: var(--accent); }
.modal-body .radio-option input { margin-top: 0.2rem; accent-color: var(--accent); }
.modal-body .radio-option .radio-label { font-size: 0.85rem; color: var(--text); font-weight: 600; }
.modal-body .radio-option .radio-desc { font-size: 0.74rem; color: var(--text-secondary); margin-top: 0.1rem; }
.modal-body select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.6rem 0.7rem; color: var(--text); font-family: inherit; font-size: 0.85rem; outline: none; margin-top: 0.5rem;
}
.modal-footer { padding: 0.9rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 1.25rem 1rem 2.5rem; }
}

/* ---------- Operational console redesign ---------- */
body { background: var(--bg); letter-spacing: -0.005em; }
.app { display: block; min-height: 100vh; }

.top-bar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  height: 100vh;
  padding: 20px 14px;
  background: #0E151D;
  border-right: 1px solid var(--border);
  border-bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
}
.top-left { gap: 9px; padding: 0 4px; }
.back-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
  background: transparent;
  border-color: transparent;
  border-radius: 6px;
}
.back-btn:hover { background: #16202B; border-color: var(--border); color: var(--text); }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #DCE6F0;
  background: #18222E;
  border: 1px solid #2A394A;
  border-radius: 7px;
}
.brand-copy { min-width: 0; line-height: 1.1; }
.brand-copy > span {
  display: block;
  color: var(--text-tertiary);
  font-size: 0.63rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.brand-copy h1 { font-size: 0.92rem; font-weight: 650; letter-spacing: -0.01em; }
.top-divider, .page-title { display: none; }

.admin-tabs {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  margin-top: 30px;
}
.admin-tab {
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: left;
}
.admin-tab svg { flex: 0 0 auto; color: #7F8EA0; }
.admin-tab span { display: flex; flex-direction: column; gap: 2px; }
.admin-tab strong { color: inherit; font-size: 0.8rem; font-weight: 600; }
.admin-tab small { color: var(--text-tertiary); font-size: 0.66rem; font-weight: 400; }
.admin-tab:hover {
  color: var(--text);
  background: #131C26;
  border-color: #202C39;
}
.admin-tab.active {
  color: var(--text);
  background: #1A2430;
  border-color: #2C3A4A;
  box-shadow: inset 3px 0 0 #91A8C0;
}
.admin-tab.active svg { color: #B9C9D9; }

.top-right {
  margin-top: auto;
  padding: 14px 5px 2px;
  border-top: 1px solid #202B38;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
}
.env-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 550;
}
.env-indicator i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 3px rgba(230, 185, 92, 0.1);
}
.env-indicator.live i {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}
.env-note { color: var(--text-tertiary); font-size: 0.66rem; }

.content {
  width: auto;
  max-width: none;
  margin: 0 0 0 232px;
  padding: 32px 38px 56px;
}

.stats-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 22px;
  background: #101720;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.stat-card {
  min-height: 100px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 17px 20px;
}
.stat-card:last-child { border-right: 0; }
.stat-card .stat-label {
  color: #7D8999;
  font-size: 0.64rem;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.stat-card .stat-value { font-size: 1.48rem; font-weight: 620; }
.stat-card .stat-sub { color: #657285; font-size: 0.69rem; margin-top: 5px; }

.toolbar {
  min-height: 48px;
  padding: 6px;
  gap: 8px;
  margin-bottom: 10px;
  background: #0E151D;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.search-box-wrap { max-width: none; flex: 1 1 320px; }
.search-box {
  min-height: 34px;
  padding: 0.48rem 0.72rem 0.48rem 2.05rem;
  background: #080D12;
  border-color: #202B38;
  border-radius: 5px;
}
.search-box:focus { border-color: #50647B; box-shadow: 0 0 0 2px rgba(143,166,193,.08); }
.filter-tabs { gap: 2px; padding-right: 2px; }
.filter-tab {
  background: transparent;
  border: 1px solid transparent;
  color: #8491A1;
  border-radius: 5px;
  padding: 0.4rem 0.65rem;
}
.filter-tab:hover { background: #17212B; border-color: transparent; color: var(--text); }
.filter-tab.active {
  background: #243141;
  border-color: #344559;
  color: #E2EAF2;
  box-shadow: none;
}

.table-wrap {
  background: #0F161E;
  border-color: var(--border);
  border-radius: 7px;
  overflow: visible;
}
.admin-table { font-size: 0.8rem; }
.admin-table th {
  padding: 0.68rem 0.9rem;
  background: #141C26;
  color: #748194;
  border-bottom-color: #2A3644;
  letter-spacing: 0.06em;
}
.admin-table td { padding: 0.72rem 0.9rem; border-bottom-color: #202B37; }
.admin-table tbody tr { background: #0F161E; transition: background 0.12s; }
.admin-table tbody tr:nth-child(even) { background: #101820; }
.admin-table tbody tr:hover { background: #17212B; }
.cell-name { color: #ECF2F8; font-size: 0.82rem; font-weight: 590; }
.cell-sub { color: #718095; font-size: 0.69rem; }
.office-cell { cursor: pointer; }
.office-cell:hover .office-link { color: #DCE6F0; text-decoration: underline; text-underline-offset: 2px; }
.office-cell:hover .cell-sub { color: #8A97A8; }
.usage-cell .usage-num { font-size: 0.74rem; font-weight: 560; }
.usage-bar-track { height: 3px; background: #25303C; }
.usage-bar-track > span { background: #7894B2; }

.badge {
  gap: 0;
  padding: 0.2rem 0.46rem;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 580;
  background: transparent;
}
.badge::before { display: none; }
.badge.plan-free,
.badge.plan-esencial,
.badge.plan-avanzado,
.badge.plan-basico,
.badge.plan-pro,
.badge.plan-enterprise,
.badge.rol-administrador,
.badge.rol-gerente,
.badge.rol-admin {
  background: #18212B;
  color: #AAB6C5;
  border-color: #2B3744;
}
.badge.plan-free { color: #8C97A4; }
.badge.plan-esencial { color: #B7C4D2; }
.badge.plan-avanzado { color: #C9D7C0; }
.badge.plan-enterprise { color: #D4DEE8; border-color: #455467; }
.badge.estado-activo,
.badge.estado-bloqueado,
.badge.estado-impago,
.badge.estado-pausado,
.badge.estado-trial,
.badge.estado-cancela-pronto,
.badge.estado-pendiente,
.badge.estado-sin-suscripcion,
.badge.estado-cancelada,
.badge.tipo-info,
.badge.tipo-warning,
.badge.tipo-critico {
  border: 0;
  padding-left: 0;
  background: transparent;
}
.badge.estado-activo::before,
.badge.estado-bloqueado::before,
.badge.estado-impago::before,
.badge.estado-pausado::before,
.badge.estado-trial::before,
.badge.estado-cancela-pronto::before,
.badge.estado-pendiente::before,
.badge.estado-sin-suscripcion::before,
.badge.estado-cancelada::before,
.badge.tipo-info::before,
.badge.tipo-warning::before,
.badge.tipo-critico::before {
  display: block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
}

.kebab-btn { border-radius: 5px; }
.kebab-btn:hover, .kebab-btn:focus { background: #202B37; border-color: #334154; color: var(--text); outline: none; }
.popover {
  min-width: 224px;
  padding: 5px;
  background: #18212C;
  border-color: #334153;
  border-radius: 7px;
  box-shadow: 0 18px 40px rgba(0,0,0,.55);
}
.popover-item { min-height: 32px; padding: 0.42rem 0.55rem; border-radius: 4px; font-size: 0.77rem; }
.popover-item:hover { background: #222E3B; }

.btn {
  background: #141C25;
  border-color: #2B3745;
  color: #D6DEE7;
  border-radius: 5px;
  font-weight: 540;
}
.btn:hover { background: #1B2632; border-color: #4A5B70; color: #F4F7FA; }
.btn.primary { background: #DCE6F0; border-color: #DCE6F0; color: #10161D; font-weight: 620; }
.btn.primary:hover { background: #F0F5F9; border-color: #F0F5F9; color: #0A0F14; }
.btn.danger { color: #F08A8F; }

.detail-header {
  position: relative;
  align-items: center;
  background: #101821;
  border-color: #2B3745;
  border-radius: 7px;
  padding: 20px 22px;
  margin-bottom: 14px;
}
.detail-header::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  background: #8198B2;
  border-radius: 0 2px 2px 0;
}
.detail-header-info h2 { font-size: 1.2rem; font-weight: 630; }
.detail-tabs {
  gap: 4px;
  margin-bottom: 16px;
  padding: 5px;
  background: #0E151D;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.panel-card {
  background: #101821;
  border-color: var(--border);
  border-radius: 7px;
  padding: 20px;
}
.panel-card-head h2, .section-title { font-weight: 620; }
.global-form input,
.global-form select,
.global-form textarea,
.limits-form input,
.modal-body select {
  background: #080D12;
  border-color: #293645;
  border-radius: 5px;
}
.global-form input:focus,
.global-form select:focus,
.global-form textarea:focus,
.limits-form input:focus { border-color: #5B7189; box-shadow: 0 0 0 2px rgba(143,166,193,.08); }
.kv { background: #0A1016; border-color: #253241; border-radius: 5px; }
.kv-label { color: #748295; }
.timeline-dot { background: #8198B2; }

.team-owner, .team-member, .comm-item {
  background: #0D141B;
  border-color: #263342;
  border-radius: 8px;
}
.avatar-circle, .avatar-circle.owner {
  background: #26384B;
  border: 1px solid #40556C;
  color: #E5EDF5;
}
.modal-overlay { background: rgba(4,8,12,.76); backdrop-filter: blur(2px); }
.modal-box { background: #141D27; border-color: #344255; border-radius: 8px; }
.modal-close { background: transparent; border-color: #344255; border-radius: 5px; }
.toast { background: #18232F; border-color: #3A495C; border-radius: 6px; }

/* ---------- Account overview ---------- */
.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr);
  gap: 14px;
}
.overview-main, .overview-side { display: flex; flex-direction: column; gap: 14px; }
.overview-section {
  background: #101821;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.overview-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 45px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.overview-section-head h3 { font-size: 0.82rem; font-weight: 620; }
.overview-section-head span { color: var(--text-tertiary); font-size: 0.68rem; }
.data-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.data-item {
  min-height: 64px;
  padding: 12px 16px;
  border-bottom: 1px solid #202B37;
}
.data-item:nth-child(odd) { border-right: 1px solid #202B37; }
.data-item:nth-last-child(-n+2) { border-bottom: 0; }
.data-label { color: #6F7D90; font-size: 0.63rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.data-value { color: #DEE6EE; font-size: 0.79rem; margin-top: 5px; overflow-wrap: anywhere; }
.usage-overview { display: grid; grid-template-columns: repeat(3, 1fr); }
.usage-overview-item { padding: 16px; border-right: 1px solid #202B37; }
.usage-overview-item:last-child { border-right: 0; }
.usage-overview-top { display: flex; justify-content: space-between; gap: 10px; color: #B9C4D0; font-size: .72rem; }
.usage-overview-top strong { color: #F0F4F8; font-weight: 620; }
.activity-list { padding: 6px 14px; }
.activity-row {
  display: flex;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid #202B37;
}
.activity-row:last-child { border-bottom: 0; }
.activity-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #91A5BA;
  background: #17222D;
  border: 1px solid #283747;
  border-radius: 5px;
}
.activity-copy { min-width: 0; }
.activity-copy strong { display: block; font-size: .75rem; font-weight: 580; }
.activity-copy span { display: block; color: #728094; font-size: .67rem; margin-top: 3px; }

.overview-side { position: sticky; top: 18px; align-self: start; }
.side-panel {
  background: #101821;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.side-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: #202B37;
  border-bottom: 1px solid var(--border);
}
.side-actions button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 64px;
  padding: 10px 6px;
  color: #A9B6C4;
  background: #0E151C;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
}
.side-actions button:hover { background: #17222C; color: #F0F4F8; }
.side-actions svg { color: #8095AB; }

.quick-notes { padding: 14px 14px 8px; }
.quick-notes-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.quick-notes-head h3 { font-size: 0.82rem; font-weight: 620; }
.quick-notes-head p { color: #6F7D90; font-size: 0.66rem; margin-top: 3px; }
.quick-notes-head span {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #C5D0DC;
  background: #18222C;
  border: 1px solid #2A3848;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 650;
}
.quick-notes-form { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.quick-notes-form textarea {
  width: 100%;
  min-height: 78px;
  padding: 10px 11px;
  color: var(--text);
  background: #080D12;
  border: 1px solid #293645;
  border-radius: 6px;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.45;
  outline: none;
  resize: vertical;
}
.quick-notes-form textarea:focus { border-color: #5B7189; }
.quick-notes-form .btn { align-self: flex-end; }
.quick-notes-list {
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
}
.quick-note {
  display: flex;
  gap: 10px;
  padding: 11px 2px 12px;
  border-top: 1px solid #202B37;
}
.quick-note-check {
  width: 15px;
  height: 15px;
  margin-top: 3px;
  flex: 0 0 auto;
  accent-color: #8FA6C1;
  cursor: pointer;
}
.quick-note-body { min-width: 0; flex: 1; }
.quick-note p { color: #D0D8E0; font-size: 0.76rem; line-height: 1.5; }
.quick-note.is-done p { color: #6F7D90; text-decoration: line-through; }
.quick-note-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: #6F7D90;
  font-size: 0.64rem;
}
.quick-note-meta .note-delete { margin-left: auto; }
.quick-notes-empty {
  padding: 18px 4px 12px;
  color: #6F7D90;
  font-size: 0.73rem;
  line-height: 1.4;
}
.note-delete {
  color: #718095;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: .68rem;
}
.note-delete:hover { color: var(--red); }

.side-account {
  border-top: 1px solid var(--border);
  padding: 6px 0;
}
.side-account-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  color: #6F7D90;
  font-size: 0.68rem;
}
.side-account-row strong { color: #DEE6EE; font-size: 0.75rem; font-weight: 580; text-align: right; }

.office-alerts { padding-bottom: 8px; }
.office-alerts-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 14px 6px;
}
.alert-option-group { display: flex; flex-direction: column; gap: 7px; }
.alert-option-label {
  color: #748295;
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.alert-option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.alert-type-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.alert-option {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 9px 11px;
  background: #0A1016;
  border: 1px solid #253241;
  border-radius: 6px;
  cursor: pointer;
}
.alert-option input { position: absolute; opacity: 0; pointer-events: none; }
.alert-option:hover { border-color: #3E5368; background: #101821; }
.alert-option:has(input:checked) {
  border-color: #7E96B0;
  background: #15202B;
  box-shadow: inset 0 0 0 1px rgba(126,150,176,.22);
}
.alert-option strong { color: #F0F4F8; font-size: 0.75rem; font-weight: 620; }
.alert-option small { color: #7D8C9D; font-size: 0.61rem; line-height: 1.3; }
.alert-option.alert-type {
  min-height: 40px;
  align-items: center;
  text-align: center;
  padding: 8px 6px;
}
.alert-message-field { display: flex; flex-direction: column; gap: 7px; }
.office-alerts-form textarea {
  width: 100%;
  min-height: 78px;
  padding: 10px 11px;
  color: var(--text);
  background: #080D12;
  border: 1px solid #293645;
  border-radius: 6px;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.45;
  outline: none;
  resize: vertical;
}
.office-alerts-form textarea:focus { border-color: #5B7189; box-shadow: 0 0 0 2px rgba(143,166,193,.08); }
.office-alerts-form .form-actions { margin-top: 2px; }
.office-alerts-list { padding: 4px 14px 10px; max-height: 280px; overflow-y: auto; }
.office-alerts-list.is-wide { max-height: none; padding: 0; }
.office-alert {
  padding: 11px 0 12px;
  border-top: 1px solid #202B37;
  border-left: 2px solid #3D5368;
  padding-left: 10px;
  margin-top: 4px;
}
.office-alert.tipo-warning { border-left-color: #C4A15A; }
.office-alert.tipo-critico { border-left-color: #D46A70; }
.office-alert.is-inactive { opacity: .55; }
.office-alert-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.office-alert-tags .badge { font-size: 0.6rem; padding: 2px 6px; }
.office-alert-body p { color: #D0D8E0; font-size: 0.76rem; line-height: 1.45; }
.office-alert-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: #6F7D90;
  font-size: 0.64rem;
}
.office-alert-meta .note-delete { margin-left: auto; }

@media (max-width: 1050px) {
  .top-bar { width: 196px; }
  .content { margin-left: 196px; padding: 26px 24px 45px; }
  .overview-layout { grid-template-columns: 1fr; }
  .overview-side { position: static; }
}
@media (max-width: 760px) {
  .top-bar {
    position: sticky;
    width: 100%;
    height: auto;
    padding: 10px;
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .brand-copy > span, .admin-tab small, .top-right { display: none; }
  .admin-tabs { margin: 0 0 0 auto; flex-direction: row; }
  .admin-tab { width: auto; min-height: 38px; padding: 7px 9px; }
  .admin-tab span { display: block; }
  .content { margin-left: 0; padding: 18px 12px 36px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card:nth-child(2) { border-right: 0; }
  .stat-card:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .data-list, .usage-overview { grid-template-columns: 1fr; }
  .data-item, .data-item:nth-child(odd) { border-right: 0; border-bottom: 1px solid #202B37; }
  .usage-overview-item { border-right: 0; border-bottom: 1px solid #202B37; }
}

/* ---------- Global email alerts (Avisos view) ---------- */
.panel-card > .office-alerts-form.is-wide { padding: 0; }
.alert-form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.alert-form-cols .alert-option-group { min-width: 0; }
.alert-input {
  width: 100%;
  padding: 10px 11px;
  color: var(--text);
  background: #080D12;
  border: 1px solid #293645;
  border-radius: 6px;
  font: inherit;
  font-size: 0.78rem;
  outline: none;
}
.alert-input:focus { border-color: #5B7189; box-shadow: 0 0 0 2px rgba(143,166,193,.08); }
.alert-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.recipient-hint { margin-right: auto; color: #6F7D90; font-size: 0.72rem; }
.recipient-hint strong { color: #C5D0DC; font-weight: 620; }

.correo-result {
  margin-top: 14px;
  padding: 12px 14px;
  background: #0A1016;
  border: 1px solid #253241;
  border-left: 2px solid #3D5368;
  border-radius: 6px;
  font-size: 0.76rem;
  color: #D0D8E0;
  line-height: 1.5;
}
.correo-result.is-ok { border-left-color: #45C486; }
.correo-result.is-warn { border-left-color: #C4A15A; }
.correo-result.is-error { border-left-color: #D46A70; }
.correo-result .correo-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 620;
  color: #F0F4F8;
  margin-bottom: 4px;
}
.correo-result .correo-result-meta { color: #6F7D90; font-size: 0.68rem; margin-top: 6px; }
.correo-result .correo-result-failures {
  margin-top: 6px;
  color: #D46A70;
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .alert-form-cols { grid-template-columns: 1fr; }
}
