/* Admin shell guardrails: ensure legacy styles do not interfere */
:root {
  --sidebar-w: 10rem;
  --topbar-h: 56px;
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-900: #111827;
}
html, body {
  height: auto !important;
  width: auto !important;
  overflow: auto !important;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--gray-900);
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
[role="banner"] {
  position: fixed !important;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: #fff;
  z-index: 40;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 0;
}
[role="banner"] img {
  height: 24px !important;
  width: 24px !important;
  object-fit: contain;
}
/* Topbar section separators */
.tb-sep {
  width: 1px;
  height: 24px;
  background: var(--gray-200);
  margin: 0 14px;
  flex-shrink: 0;
}
/* Logo group */
.tb-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* Filters group (branch + search) */
.tb-filters {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}
.tb-field {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tb-label {
  font-size: 12px;
  color: var(--gray-500);
  white-space: nowrap;
}
.tb-select, .tb-input {
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--gray-900);
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
.tb-select:focus, .tb-input:focus { border-color: #93c5fd; box-shadow: 0 0 0 2px #dbeafe; }
.tb-input { width: 180px; }
/* Actualizar group */
.tb-update {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tb-update-btn {
  padding: 5px 12px;
  border-radius: 5px;
  border: none;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.tb-update-btn:hover  { background: #1d4ed8; }
.tb-update-btn:disabled { opacity: .55; cursor: default; }
.tb-update-legend {
  font-size: 11px;
  color: var(--gray-400);
  white-space: nowrap;
}
/* User group */
.tb-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tb-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--gray-600);
  font-weight: 600;
}
.tb-username { font-size: 13px; color: var(--gray-600); }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
aside[data-admin-sidebar] {
  position: fixed !important;
  top: var(--topbar-h);
  left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  z-index: 30;
  overflow-y: auto;
}
aside[data-admin-sidebar] ul {
  list-style: none;
  margin: 0;
  padding: 12px;
}

/* ── Content wrapper ─────────────────────────────────────────────────────── */
#app-main {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  background: #fff;
}

/* ── Content bar (sticky sub-header inside #app-main) ───────────────────── */
#app-main .content-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 12px;
}
#app-main .content-bar .content-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.2;
}
#app-main .content-bar .content-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.help-icon-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #9ca3af;
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
}
.help-icon-btn:hover {
  background: #f3f4f6;
  border-color: #4b5563;
  color: #1f2937;
}

/* ── Shared data grid ────────────────────────────────────────────────────── */
.vk-scroll {
  overflow: auto;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
}
.vk-grid {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.vk-grid thead th {
  position: sticky; top: 0; z-index: 10;
  padding: 10px 12px;
  background: #d1d5db;
  border-bottom: 2px solid #9ca3af;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.vk-grid thead th.left  { text-align: left; }
.vk-grid thead th.sortable          { cursor: pointer; user-select: none; }
.vk-grid thead th.sortable:hover    { background: #b0bec5; }
/* Show muted ↕ on every sortable column */
.vk-grid thead th.sortable::after   { content: ' ↕'; color: #9ca3af; font-weight: 400; }
/* Active sort: replace with directional arrow in strong black */
.vk-grid thead th.sort-asc::after   { content: ' ↑'; color: #111827; font-weight: 900; }
.vk-grid thead th.sort-desc::after  { content: ' ↓'; color: #111827; font-weight: 900; }
/* Active column header text: full black, slightly heavier */
.vk-grid thead th.sort-asc,
.vk-grid thead th.sort-desc         { color: #111827; }
.vk-grid tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  text-align: center;
  color: var(--gray-900);
}
.vk-grid tbody td.left  { text-align: left; }
.vk-grid tbody tr:last-child td { border-bottom: none; }
.vk-grid tbody tr:nth-child(even) td { background: #d6eaff; }
.vk-grid tbody tr:hover td { background: #bfdbfe !important; }
.vk-grid td.muted  { color: var(--gray-500); }
.vk-grid td.strong { font-weight: 600; }

/* ── Inline edit (socios) ────────────────────────────────────────────────── */
.vk-grid td[data-field] { cursor: text; }
.vk-grid td[data-field]:hover { background: #eff6ff; }
.vk-grid td[data-field] input {
  width: 100%; box-sizing: border-box;
  border: 1px solid #3b82f6;
  border-radius: 3px;
  padding: 2px 5px;
  font-size: inherit;
  font-family: inherit;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.vk-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.vk-red    { background: #fee2e2; color: #991b1b; }
.vk-yellow { background: #fef9c3; color: #854d0e; }
.vk-green  { background: #dcfce7; color: #166534; }
.vk-muted  { background: var(--gray-100); color: var(--gray-400); }

/* ── WA link ─────────────────────────────────────────────────────────────── */
.vk-wa { color: #15803d; font-weight: 500; text-decoration: none; }
.vk-wa:hover { text-decoration: underline; }

/* ── Highlight animation ─────────────────────────────────────────────────── */
.fade-new { animation: fadeHighlight 2s ease-out; }
@keyframes fadeHighlight { 0% { background: #fff9c2; } 100% { background: transparent; } }

/* ── Hide injected logos inside app-main ────────────────────────────────── */
#app-main img[src*="vukova-logo"],
#app-main img[alt*="Vukova" i],
#app-main .logo { display: none !important; }

/* ── Icon action buttons inside grid cells ───────────────────────────────── */
.vk-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity .15s, background .15s;
}
.vk-icon-btn:hover { opacity: 1; background: var(--gray-100); }

/* ── Misc input helpers ──────────────────────────────────────────────────── */
.admin-input-compact  { width: 4.5rem; }
.admin-select-compact { width: 14rem; }
.msg-input {
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
  width: 200px;
}
