/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 260px;
  --sidebar-collapsed: 72px;
  --bg-deep:    #0d0f12;
  --bg-surface: #13161b;
  --bg-raised:  #1a1e26;
  --bg-hover:   #1f2430;
  --accent:     #FF5C00;
  --accent-dim: rgba(255,92,0,0.15);
  --text-hi:    #f0f2f5;
  --text-mid:   #8a95a3;
  --text-lo:    #4a5568;
  --border-subtle: rgba(255,255,255,0.05);
  --border-strong: rgba(255,255,255,0.08);
  --border-soft: rgba(255,255,255,0.06);
  --border-faint: rgba(255,255,255,0.04);
  --row-hover: rgba(255,255,255,0.02);
  --overlay-backdrop: rgba(0,0,0,0.6);
  --modal-backdrop: rgba(0,0,0,0.65);
  --shadow-elevated: 0 20px 60px rgba(0,0,0,0.5);
  --green:      #22c55e;
  --blue:       #3b82f6;
  --red:        #ef4444;
  --transition: 0.28s cubic-bezier(0.4,0,0.2,1);
}

:root[data-theme="light"] {
  --bg-deep: #f4f6f8;
  --bg-surface: #ffffff;
  --bg-raised: #eef2f6;
  --bg-hover: #e4eaf1;
  --accent-dim: rgba(255,92,0,0.12);
  --text-hi: #18212b;
  --text-mid: #4f5d6d;
  --text-lo: #758396;
  --border-subtle: rgba(24,33,43,0.10);
  --border-strong: rgba(24,33,43,0.16);
  --border-soft: rgba(24,33,43,0.12);
  --border-faint: rgba(24,33,43,0.08);
  --row-hover: rgba(24,33,43,0.04);
  --overlay-backdrop: rgba(15,23,42,0.22);
  --modal-backdrop: rgba(15,23,42,0.28);
  --shadow-elevated: 0 20px 60px rgba(15,23,42,0.14);
}

body {
  font-family: 'Barlow', sans-serif;
  background: var(--bg-deep);
  color: var(--text-hi);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  overflow: auto;
  z-index: 1000;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

/* ── HEADER ── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent-dim);
  border: 1px solid rgba(255,92,0,0.3);
  border-radius: 8px;
}

.logo-text {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  color: var(--text-hi);
  white-space: nowrap;
}

/* ── USER CARD ── */
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff8c42 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  letter-spacing: 0.04em;
}

.user-info {
  min-width: 0;
  flex: 1;
}

.user-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ── NAV SECTIONS ── */
.nav-section {
  padding: 0.5rem 0 0;
  flex-shrink: 0;
  overflow: hidden;
}
.nav-section::-webkit-scrollbar { display: none; }

.nav-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-lo);
  padding: 0.25rem 1rem;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: color 0.2s;
}

.nav-label:hover {
  color: var(--text-mid);
}

.nav-label-large {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.65rem 0.75rem;
  color: var(--text-mid);
}

.nav-label-large:hover {
  color: var(--text-hi);
}

.nav-label .chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.nav-section.collapsed .nav-label .chevron {
  transform: rotate(-90deg);
}

.nav-section .nav-list {
  max-height: 800px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease;
  opacity: 1;
}

.nav-section.collapsed .nav-list {
  max-height: 0;
  opacity: 0;
}

.nav-list {
  list-style: none;
  padding: 0 0.5rem;
}

.nav-list li + li {
  margin-top: 2px;
}

/* ── NAV LINKS ── */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  color: var(--text-mid);
  text-decoration: none;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-hi);
}

.nav-link.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(255,92,0,0.2);
}

.nav-link.active .nav-icon svg {
  stroke: var(--accent);
}

.nav-link.logout:hover {
  background: rgba(239,68,68,0.1);
  color: var(--red);
}

.nav-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge {
  margin-left: auto;
  background: var(--bg-raised);
  color: var(--text-mid);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge.accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(255,92,0,0.2);
}

/* ── TOOLTIP (collapsed) ── */
.sidebar.collapsed .nav-link[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed) - 4px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-raised);
  color: var(--text-hi);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 9999;
  border: 1px solid var(--border-strong);
  pointer-events: none;
}

/* ── FOOTER ── */
.sidebar-footer {
  padding: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* ── BURGER BUTTON ── */
.burger-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 6px;
  border-radius: 6px;
  transition: background var(--transition);
  flex-shrink: 0;
}

.burger-btn:hover {
  background: var(--bg-hover);
}

.burger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-mid);
  border-radius: 2px;
  transition: all var(--transition);
  transform-origin: center;
}

.burger-btn.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
  background: var(--accent);
}
.burger-btn.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.burger-btn.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
  background: var(--accent);
}

/* Collapsed: hide text elements */
.sidebar.collapsed .sidebar-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar.collapsed .user-card {
  justify-content: center;
  padding: 0.75rem 0;
}

.sidebar.collapsed .badge {
  display: none;
}

/* ── OVERLAY ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-backdrop);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition);
}

.overlay.show {
  display: block;
  opacity: 1;
}

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--sidebar-w);
  height: 100vh;
  min-height: 100vh;
  transition: margin-left var(--transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main.collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* ── TOPBAR ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-hi);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.topbar-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-mid);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.15s ease;
}

.topbar-shortcut:hover {
  background: var(--bg-hover);
  color: var(--text-hi);
  border-color: rgba(255,92,0,0.25);
}

.topbar-shortcut:active {
  transform: scale(0.98);
}

.topbar-shortcut.active {
  background: rgba(255,92,0,0.14);
  color: var(--text-hi);
  border-color: rgba(255,92,0,0.35);
}

.topbar-shortcut-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-date {
  font-size: 0.82rem;
  color: var(--text-lo);
  letter-spacing: 0.02em;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-mid);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.15s ease;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-hi);
  border-color: rgba(255,92,0,0.25);
}

.theme-toggle:active {
  transform: scale(0.98);
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle-icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle-icon-moon {
  display: inline-flex;
}

.mobile-only { display: none; }

/* ── CONTENT AREA ── */
.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2rem;
}

/* ── STATS GRID ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 1.25rem;
  transition: border-color var(--transition), transform 0.2s;
}

.stat-card:hover {
  border-color: rgba(255,92,0,0.2);
  transform: translateY(-2px);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-lo);
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.orange { background: rgba(255,92,0,0.15); color: var(--accent); }
.stat-icon.green  { background: rgba(34,197,94,0.12); color: var(--green); }
.stat-icon.blue   { background: rgba(59,130,246,0.12); color: var(--blue); }
.stat-icon.red    { background: rgba(239,68,68,0.12); color: var(--red); }

.stat-number {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-hi);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-change {
  font-size: 0.78rem;
  color: var(--text-lo);
}

.stat-change.positive { color: var(--green); }
.stat-change.negative { color: var(--red); }

.hint {
  font-size: 0.82rem;
  color: var(--text-lo);
  text-align: center;
  padding: 2rem;
}

/* ── SECTION PAGES (placeholders) ── */
.section-header {
  margin-bottom: 2rem;
}

.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-hi);
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-mid);
  max-width: 500px;
}

.placeholder-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  max-width: 400px;
}

.placeholder-icon {
  color: var(--text-lo);
  opacity: 0.5;
}

.placeholder-text {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-lo);
  letter-spacing: 0.02em;
}

/* ── ALERTS ── */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  transition: opacity 0.3s ease;
}
.alert-success {
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.25);
  color: var(--green);
}
.alert-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--red);
}
.alert-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.25rem;
  opacity: 0.7;
}
.alert-close:hover { opacity: 1; }

/* ── SECTION HEADER ROW ── */
.section-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background var(--transition), transform 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #e05200; }
.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-mid);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-hi);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: var(--text-mid);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-hi); }
.btn-edit:hover { color: var(--blue); border-color: rgba(59,130,246,0.3); }
.btn-delete:hover { color: var(--red); border-color: rgba(239,68,68,0.3); }

/* ── DATA TABLE ── */
.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table thead {
  background: var(--bg-raised);
}
.data-table th {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-lo);
  padding: 0.85rem 1rem;
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: 0.8rem 1rem;
  color: var(--text-mid);
  border-top: 1px solid var(--border-faint);
  vertical-align: middle;
}
.data-table tbody tr:hover {
  background: var(--row-hover);
}
.td-main {
  color: var(--text-hi);
  font-weight: 500;
}
.td-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.th-actions { width: 100px; }
.td-empty {
  text-align: center;
  color: var(--text-lo);
  padding: 2.5rem 1rem !important;
  font-style: italic;
}

/* ── CODE TAG ── */
.code-tag {
  background: var(--bg-raised);
  color: var(--accent);
  font-family: 'Barlow Condensed', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

/* ── STATUS BADGE ── */
.status-badge {
  display: inline-block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}
.status-badge.active {
  background: rgba(34,197,94,0.12);
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.25);
}
.status-badge.inactive {
  background: rgba(239,68,68,0.1);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-soft);
}
.modal-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-hi);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-lo);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text-hi); }
.modal-body {
  padding: 1.5rem;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── FORM ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-group.full-width {
  grid-column: 1 / -1;
}
.form-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-lo);
  text-transform: uppercase;
}
.form-input {
  background: var(--bg-raised);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: var(--text-hi);
  font-family: 'Barlow', sans-serif;
  font-size: 0.88rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input::placeholder { color: var(--text-lo); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,92,0,0.15);
}
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a95a3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

/* ── TOGGLE / CHECKBOX ── */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.toggle-text {
  font-size: 0.88rem;
  color: var(--text-mid);
}
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-mid);
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .section-header-row {
    flex-direction: column;
  }
}

/* ── EMPRESA CARD (sidebar) ── */
.empresa-card {
  padding: 0.5rem 1.25rem 0.75rem;
}
.empresa-current {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}
.empresa-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empresa-select {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  color: var(--text-hi);
  font-family: 'Barlow', sans-serif;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238a95a3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.75rem;
}
.empresa-select:focus {
  border-color: var(--accent);
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    transition: transform var(--transition);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .sidebar.collapsed .sidebar-text {
    opacity: 1;
    width: auto;
    pointer-events: auto;
  }

  .main {
    margin-left: 0 !important;
  }

  .mobile-only { display: flex; }

  .topbar { padding: 0.85rem 1rem; }

  .topbar-right { gap: 0.5rem; }

  .topbar-shortcut,
  .theme-toggle {
    padding: 0.5rem 0.7rem;
  }

  .topbar-shortcut-label,
  .theme-toggle-label {
    display: none;
  }

  .content { padding: 1rem; }
}

/* ── REPORTES ── */
.report-filters {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}
.report-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.report-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 1.25rem;
}
.report-card-wide {
  grid-column: 1 / -1;
}
.report-card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-lo);
  margin-bottom: 1rem;
}
.settings-shell {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.settings-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.settings-tab-btn {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 0.65rem 1rem;
  color: var(--text-mid);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.settings-tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-hi);
}
.settings-tab-btn.is-active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(255,92,0,0.28);
}
.settings-tab-panels {
  display: block;
}
.settings-tab-panel {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
}
.settings-tab-panel.is-active {
  display: flex;
}
.settings-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}
.settings-help {
  color: var(--text-lo);
  font-size: 0.82rem;
  margin-bottom: 0.85rem;
}
.settings-image-preview {
  margin-top: 0.85rem;
}
.settings-image-preview img {
  display: block;
  max-width: 240px;
  max-height: 150px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  object-fit: cover;
}
.settings-actions {
  display: flex;
  justify-content: flex-end;
}
.settings-tab-panel .crud-table-wrap {
  margin-top: 0.25rem;
}
.chart-container {
  position: relative;
  height: 300px;
}
.chart-container-sm {
  height: 260px;
}
.report-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 768px) {
  .report-charts-grid {
    grid-template-columns: 1fr;
  }
  .report-tables-grid {
    grid-template-columns: 1fr;
  }
  .filter-row {
    grid-template-columns: 1fr 1fr;
  }
  .settings-actions {
    justify-content: stretch;
  }
  .settings-actions .btn {
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 480px) {
  .filter-row {
    grid-template-columns: 1fr;
  }
  .settings-tab-nav {
    flex-direction: column;
  }
  .settings-tab-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── CRUD TABLE CONTROLS ── */
.crud-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.crud-toolbar-left {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}
.crud-search-wrap {
  position: relative;
}
.crud-search-wrap .crud-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-lo);
  pointer-events: none;
}
.crud-search-wrap .crud-search {
  padding-left: 2.25rem;
  width: 100%;
}
.crud-search-wrap .crud-search-btn {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.42rem 0.8rem;
  font-size: 0.82rem;
  line-height: 1;
}
.crud-search-wrap:has(.crud-search-btn) .crud-search {
  padding-right: 5.8rem;
}
.crud-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.crud-perpage-label {
  font-size: 0.82rem;
  color: var(--text-lo);
  white-space: nowrap;
}
.crud-toolbar-right .crud-perpage {
  width: auto;
  min-width: 70px;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  font-size: 0.82rem;
}
.crud-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.crud-pagination-info {
  font-size: 0.82rem;
  color: var(--text-lo);
}
.crud-pagination-buttons {
  display: flex;
  gap: 0.25rem;
}
.crud-page-btn {
  background: var(--bg-raised);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-mid);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Barlow', sans-serif;
}
.crud-page-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-hi);
  border-color: rgba(255,255,255,0.15);
}
.crud-page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.crud-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.crud-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.75rem;
  align-items: flex-end;
  padding: 0.75rem;
  background: var(--bg-raised);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.crud-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 130px;
  flex: 1 1 150px;
  max-width: 220px;
}
.crud-filter-actions {
  flex: 0 0 auto;
  min-width: auto;
  max-width: none;
}
.crud-filter-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.crud-filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-lo);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.crud-filter {
  padding: 0.4rem 0.55rem !important;
  font-size: 0.82rem !important;
}

.exercise-filters .crud-filters {
  display: grid;
  grid-template-columns: minmax(200px, 1.35fr) minmax(200px, 1.35fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  align-items: end;
}

.exercise-filters .crud-filter-group {
  min-width: 0;
  max-width: none;
}

.exercise-filters .crud-filter-actions {
  justify-self: end;
}

@media (max-width: 600px) {
  .crud-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .crud-toolbar-left {
    max-width: none;
  }
  .crud-pagination {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 1180px) {
  .exercise-filters .crud-filters {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .exercise-filters .crud-filter-actions {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 760px) {
  .exercise-filters .crud-filters {
    grid-template-columns: 1fr;
  }

  .exercise-filters .crud-filter-actions {
    grid-column: auto;
    justify-self: stretch;
  }

  .exercise-filters .crud-filter-action-buttons {
    width: 100%;
  }

  .exercise-filters .crud-filter-action-buttons .btn {
    flex: 1 1 0;
  }
}
