/* ============================================================
   VARIABLES
   ============================================================ */
:root {
  --color-primary:       #552863;
  --color-primary-light: #7a3d8a;
  --color-primary-dark:  #3d1d47;
  --color-orange:        #FC6821;
  --color-orange-dark:   #d9531a;
  --color-teal:          #0ea5a0;
  --color-teal-dark:     #0a7875;
  --color-bg:            #f1f5f9;
  --color-surface:       #ffffff;
  --color-border:        #e5e7eb;
  --color-border-light:  #f3f4f6;
  --color-text:          #111827;
  --color-text-muted:    #6b7280;
  --color-text-light:    #9ca3af;
  --radius-sm:           8px;
  --radius-md:           12px;
  --radius-lg:           16px;
  --radius-xl:           20px;
  --radius-full:         9999px;
  --shadow-card:         0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card-md:      0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-lg:           0 8px 24px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-nav:          0 2px 8px rgba(85,40,99,0.15);
  --sidebar-w:           240px;
  --header-h:            62px;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #f9fafb;
  color: var(--color-text);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
#sidebar {
  background: linear-gradient(180deg, #552863 0%, #3d1d47 100%);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  box-shadow: 2px 0 16px rgba(85,40,99,0.25);
}
#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.sidebar-logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  display: block;
  font-weight: 400;
  letter-spacing: 0;
}

.sidebar-section-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 12px 16px 4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  flex: 1;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border-left: 3px solid transparent;
  color: rgba(255,255,255,0.62);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  border: none;
  background: transparent;
  font-family: inherit;
  text-align: left;
  width: 100%;
  position: relative;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}
.sidebar-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--color-orange);
}

.sidebar-badge {
  min-width: 18px;
  height: 18px;
  background: var(--color-orange);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.14s;
}
.sidebar-user:hover { background: rgba(255,255,255,0.08); }
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-teal), var(--color-teal-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: rgba(255,255,255,0.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   MAIN AREA (right side)
   ============================================================ */
#main-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   APP HEADER (right panel top bar)
   ============================================================ */
#app-header {
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

#header-module-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  cursor: pointer;
  position: relative;
  transition: background 0.12s, color 0.12s;
}
.header-action-btn:hover { background: var(--color-bg); color: var(--color-text); }

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-orange);
  border: 2px solid var(--color-surface);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid var(--color-border-light);
  transition: background 0.12s, box-shadow 0.12s;
}
.header-user:hover { background: var(--color-bg); box-shadow: var(--shadow-card); }

.header-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-teal), var(--color-teal-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.header-user-name { font-size: 12px; font-weight: 600; color: var(--color-text); }

/* ============================================================
   APP CONTENT
   ============================================================ */
#app-content {
  flex: 1;
  overflow-y: auto;
  background: #f9fafb;
}
.content-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 28px;
}

/* ============================================================
   MÓDULOS — COMPARTIDOS
   ============================================================ */
.module-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.module-title   { font-size: 20px; font-weight: 700; line-height: 1.2; letter-spacing: -0.3px; }
.module-subtitle{ font-size: 13px; color: var(--color-text-muted); margin-top: 3px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none;
  transition: all 0.2s;
  white-space: nowrap; flex-shrink: 0;
}
.btn:active { transform: scale(0.97); }
.btn-primary  {
  background: var(--color-orange); color: #fff;
  box-shadow: 0 4px 20px rgba(252,104,33,0.3);
}
.btn-primary:hover { background: var(--color-orange-dark); box-shadow: 0 4px 20px rgba(252,104,33,0.4); }
.btn-secondary{
  background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}
.btn-secondary:hover { background: var(--color-bg); }
.btn-ghost    { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg); }
.btn-danger   { background: rgba(239,68,68,0.08); color: #ef4444; }
.btn-danger:hover { background: rgba(239,68,68,0.14); }
.btn-sm       { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
}
.badge-activo     { background: rgba(34,197,94,0.1);  color: #16a34a; }
.badge-inactivo   { background: rgba(239,68,68,0.1);  color: #dc2626; }
.badge-vacaciones { background: rgba(252,104,33,0.1); color: #c2410c; }
.badge-pendiente  { background: rgba(234,179,8,0.1);  color: #a16207; }

/* Card */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.card:hover { box-shadow: var(--shadow-card-md); }
.card-title {
  font-size: 13px; font-weight: 600; color: var(--color-text);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
  width: 100%;
}

/* ============================================================
   DASHBOARD — WELCOME BANNER
   ============================================================ */
.welcome-banner {
  background: linear-gradient(135deg, #552863 0%, #35123F 100%);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card-md);
}
.welcome-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.welcome-title { font-size: 22px; font-weight: 700; line-height: 1.2; }
.welcome-sub   { font-size: 13px; color: rgba(255,255,255,0.7); margin-top: 4px; }
.welcome-active-badge {
  display: flex; align-items: center; gap: 7px; flex-shrink: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  padding: 6px 14px;
}
.welcome-active-badge span { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.9); }
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-teal);
  animation: pulseDot 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}
.welcome-progress-wrap { margin-top: 18px; }
.welcome-progress-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: rgba(255,255,255,0.7); margin-bottom: 7px;
}
.welcome-progress-head strong { color: #fff; font-weight: 700; }
.welcome-progress-track {
  height: 8px; background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full); overflow: hidden;
}
.welcome-progress-fill {
  height: 100%; border-radius: var(--radius-full);
  background: linear-gradient(to right, var(--color-teal), #34d399);
  transition: width 0.7s ease;
}

/* ============================================================
   DASHBOARD — KPI GRID
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px; margin-bottom: 14px;
}
@media (max-width:1200px){ .kpi-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width:700px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } }

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.kpi-card:hover { box-shadow: var(--shadow-card-md); transform: translateY(-2px); }
.kpi-top  { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.kpi-icon {
  width:34px; height:34px; border-radius:var(--radius-sm);
  display:flex; align-items:center; justify-content:center;
}
.kpi-icon-primary{ background:rgba(85,40,99,0.09);  color:var(--color-primary); }
.kpi-icon-slate  { background:rgba(100,116,139,0.1); color:#475569;             }
.kpi-icon-teal   { background:rgba(14,165,160,0.1); color:var(--color-teal);   }
.kpi-icon-red    { background:rgba(239,68,68,0.1);  color:#dc2626;             }
.kpi-icon-green  { background:rgba(34,197,94,0.1);  color:#16a34a;             }
.kpi-icon-orange { background:rgba(252,104,33,0.1); color:var(--color-orange); }
.kpi-trend { font-size:10px; font-weight:700; padding:2px 7px; border-radius:var(--radius-full); display:flex; align-items:center; gap:2px; }
.trend-up  { background:rgba(34,197,94,0.1); color:#16a34a; }
.trend-down{ background:rgba(239,68,68,0.1); color:#dc2626; }
.kpi-value { font-size:26px; font-weight:700; line-height:1; letter-spacing:-0.5px; margin-top:2px; }
.kpi-label { font-size:11px; color:var(--color-text-muted); margin-top:4px; font-weight:500; }
.kpi-sub   { font-size:10px; color:var(--color-text-light); margin-top:2px; }

.dash-grid {
  display: grid; grid-template-columns: 1fr 300px; gap: 12px;
}
@media (max-width:860px){ .dash-grid { grid-template-columns:1fr; } }

.att-item {
  display:flex; align-items:center; gap:10px;
  padding:8px 0; border-bottom:1px solid var(--color-border-light);
}
.att-item:last-child{ border-bottom:none; }
.att-av {
  width:32px; height:32px; border-radius:50%;
  background:linear-gradient(135deg,var(--color-primary),var(--color-primary-light));
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700; color:#fff; flex-shrink:0;
}
.att-info  { flex:1; min-width:0; }
.att-name  { font-size:13px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.att-type  { font-size:11px; color:var(--color-text-muted); }
.att-right { text-align:right; flex-shrink:0; }
.att-time  { font-size:12px; font-weight:600; }
.att-status {
  font-size:10px; font-weight:600;
  padding:1px 7px; border-radius:var(--radius-full); display:inline-block;
}
.status-puntual{ background:rgba(34,197,94,0.1);  color:#16a34a; }
.status-retardo { background:rgba(252,104,33,0.1); color:#c2410c; }

.dept-row  { margin-bottom:13px; }
.dept-head { display:flex; align-items:center; justify-content:space-between; font-size:12px; margin-bottom:5px; }
.dept-name { font-weight:500; color:var(--color-text); }
.dept-emp  { font-size:11px; color:var(--color-text-light); margin-left:6px; }
.dept-pct  { color:var(--color-text-muted); font-weight:700; font-size:13px; }
.dept-track{ height:6px; background:var(--color-border); border-radius:var(--radius-full); overflow:hidden; }
.dept-fill { height:100%; border-radius:var(--radius-full); transition:width 0.7s ease; }

/* ============================================================
   EMPLEADOS
   ============================================================ */
.emp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.emp-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.2s;
}
.emp-card:hover { box-shadow: var(--shadow-card-md); transform: translateY(-2px); }
.emp-card-top   { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:12px; }
.emp-card-av    { width:42px; height:42px; border-radius:var(--radius-md); display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:700; color:#fff; flex-shrink:0; }
.emp-card-name  { font-size:13px; font-weight:600; color:var(--color-text); margin-bottom:2px; line-height:1.3; }
.emp-card-puesto{ font-size:11px; color:var(--color-text-muted); margin-bottom:10px; }
.emp-card-foot  { display:flex; flex-wrap:wrap; gap:4px; }

/* Modal tabs */
.modal-tabs {
  display: flex; border-bottom: 2px solid var(--color-border-light);
  padding: 0 18px; gap: 0; overflow-x: auto;
}
.modal-tab {
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: var(--color-text-muted); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.modal-tab:hover { color: var(--color-text); }
.modal-tab.active { color: var(--color-orange); border-bottom-color: var(--color-orange); font-weight: 600; }

/* Step indicators inside new employee modal tabs */
.step-ind {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.step-ind-done    { background: var(--color-teal);   color: #fff; }
.step-ind-current { background: var(--color-orange); color: #fff; }
.step-ind-future  { background: var(--color-border); color: var(--color-text-muted); }

/* Close button on gradient modal headers */
.modal-close-grad:hover { background: rgba(255,255,255,0.2) !important; }

.toolbar { display:flex; align-items:center; gap:8px; margin-bottom:14px; flex-wrap:wrap; }
.search-box {
  display:flex; align-items:center; gap:7px;
  background:var(--color-surface); border:1px solid var(--color-border);
  border-radius:var(--radius-md); padding:7px 13px; flex:1; min-width:200px;
  box-shadow:var(--shadow-card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within {
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px rgba(252,104,33,0.1);
}
.search-box input {
  border:none; background:none; outline:none;
  font-family:inherit; font-size:13px; color:var(--color-text); width:100%;
}
.search-box input::placeholder{ color:var(--color-text-light); }

.filter-chip {
  display:inline-flex; align-items:center; gap:4px;
  padding:5px 12px; border-radius:var(--radius-md);
  font-size:12px; font-weight:500;
  background:var(--color-surface); border:1px solid var(--color-border);
  cursor:pointer; color:var(--color-text-muted); flex-shrink:0;
  box-shadow:var(--shadow-card);
  transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--color-text-muted); }
.filter-chip.active {
  background:rgba(252,104,33,0.08); border-color:var(--color-orange);
  color:var(--color-orange);
  box-shadow: 0 0 0 3px rgba(252,104,33,0.08);
}

/* Layout btn — usado en empleados para toggle grid/lista */
.layout-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.layout-btn.active {
  background: var(--color-orange);
  color: #fff;
  box-shadow: 0 2px 4px rgba(252,104,33,0.3);
}
.layout-btn:not(.active):hover { background: var(--color-bg); color: var(--color-text); }

.data-table { width:100%; border-collapse:collapse; }
.data-table th {
  text-align:left; font-size:10px; font-weight:700;
  color:var(--color-text-muted); text-transform:uppercase;
  letter-spacing:0.06em; padding:8px 12px;
  border-bottom:2px solid var(--color-border);
  background:#f8f9fa; white-space:nowrap;
}
.data-table td {
  padding:9px 12px; font-size:13px;
  border-bottom:1px solid var(--color-border-light); vertical-align:middle;
}
.data-table tr:last-child td{ border-bottom:none; }
.data-table tbody tr:hover td{ background:rgba(252,104,33,0.025); }

.emp-av {
  width:28px; height:28px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:10px; font-weight:700; color:#fff; flex-shrink:0;
}
.emp-cell  { display:flex; align-items:center; gap:8px; }
.emp-name  { font-weight:500; font-size:13px; }
.emp-email { font-size:11px; color:var(--color-text-muted); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position:fixed; inset:0;
  background:rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index:500;
  display:flex; align-items:center; justify-content:center;
  padding:16px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal {
  background:var(--color-surface);
  border-radius:var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.1);
  width:100%; max-width:520px;
  max-height:90vh; overflow-y:auto;
  animation: slideUp 0.2s ease;
}
.modal-wide { max-width: 640px; }
@keyframes slideUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 18px; border-bottom:1px solid var(--color-border-light);
}
.modal-title  { font-size:15px; font-weight:700; }
.modal-close  {
  width:28px; height:28px; border-radius:var(--radius-sm);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; color:var(--color-text-muted); transition:background 0.12s;
}
.modal-close:hover{ background:var(--color-bg); }
.modal-body   { padding:18px; }
.modal-footer {
  padding:12px 18px; border-top:1px solid var(--color-border-light);
  display:flex; justify-content:flex-end; gap:8px;
}
.form-grid   { display:grid; grid-template-columns:1fr 1fr; gap:13px; }
.form-group  { display:flex; flex-direction:column; gap:5px; }
.full-col    { grid-column:1/-1; }
.form-label  { font-size:11px; font-weight:600; color:var(--color-text-muted); text-transform:uppercase; letter-spacing:0.04em; }
.form-value  { font-size:13px; padding:8px 0; }
.form-input, .form-select {
  padding:8px 11px;
  border:1px solid var(--color-border); border-radius:var(--radius-sm);
  font-family:inherit; font-size:13px; color:var(--color-text);
  outline:none; background:var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus {
  border-color:var(--color-orange);
  box-shadow:0 0 0 3px rgba(252,104,33,0.1);
}

/* ============================================================
   TIPOS EVENTOS
   ============================================================ */
.ev-row { transition: background 0.1s; }
.ev-row:hover { background: rgba(249,250,251,0.8); }
.ev-row-deleting { background: rgba(239,68,68,0.04) !important; }

.ev-action-btn {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; background: transparent;
  color: #d1d5db; font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.ev-action-btn:hover { background: rgba(20,184,166,0.08); color: #0d9488; }
.ev-action-btn-danger:hover { background: rgba(239,68,68,0.08) !important; color: #ef4444 !important; }

/* ============================================================
   TRANSFERENCIAS
   ============================================================ */
.tr-tabs {
  display:flex; gap:2px; background:var(--color-bg);
  border-radius:var(--radius-md); padding:3px;
  width:fit-content; margin-bottom:16px;
}
.tr-tab {
  padding:6px 14px; border-radius:var(--radius-sm);
  font-size:13px; font-weight:500;
  cursor:pointer; color:var(--color-text-muted);
  transition: all 0.15s;
}
.tr-tab.active {
  background:var(--color-surface); color:var(--color-text);
  box-shadow:var(--shadow-card);
}
.tr-item {
  display:flex; align-items:center; gap:12px;
  padding:13px 14px; border:1px solid var(--color-border-light);
  border-radius:var(--radius-lg); margin-bottom:8px;
  box-shadow:var(--shadow-card);
  transition: box-shadow 0.15s, transform 0.15s;
}
.tr-item:hover { box-shadow: var(--shadow-card-md); transform: translateY(-2px); }
.tr-icon {
  width:40px; height:40px; border-radius:var(--radius-sm);
  background:rgba(252,104,33,0.08);
  display:flex; align-items:center; justify-content:center;
  color:var(--color-orange); flex-shrink:0;
}
.tr-info      { flex:1; }
.tr-empresa   { font-size:14px; font-weight:600; }
.tr-meta      { font-size:12px; color:var(--color-text-muted); }

.stepper { display:flex; align-items:center; margin-bottom:22px; }
.step    { display:flex; align-items:center; gap:7px; }
.step-circle {
  width:26px; height:26px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700;
  background:var(--color-bg); color:var(--color-text-muted);
  border:2px solid var(--color-border);
}
.step.active .step-circle { background:var(--color-orange); color:#fff; border-color:var(--color-orange); }
.step.done   .step-circle { background:var(--color-teal);   color:#fff; border-color:var(--color-teal);   }
.step-lbl              { font-size:12px; font-weight:500; color:var(--color-text-muted); }
.step.active .step-lbl { color:var(--color-text); font-weight:600; }
.step-line { flex:1; height:2px; background:var(--color-border); margin:0 6px; }
.step.done + .step-line { background: var(--color-orange); }

/* ============================================================
   SINCRONIZAR — button-group tabs + device cards
   ============================================================ */
.sync-btn-group {
  display: flex; gap: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 5px; margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.sync-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; flex: 1; justify-content: center;
  color: var(--color-text-muted); cursor: pointer; border: none;
  font-family: inherit; background: transparent;
  transition: background 0.15s, color 0.15s;
}
.sync-btn:not(.active):hover { background: var(--color-bg); color: var(--color-text); }
.sync-btn.active {
  background: linear-gradient(135deg, #552863, #35123F);
  color: #fff; box-shadow: 0 2px 8px rgba(85,40,99,0.3);
}
.sync-btn span { display: none; }
@media (min-width: 500px) { .sync-btn span { display: inline; } }

.dev-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.dev-card {
  background: var(--color-bg); border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg); padding: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.dev-card:hover { box-shadow: var(--shadow-card-md); transform: translateY(-2px); }
.dev-card-top { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:10px; }
.dev-card-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: rgba(85,40,99,0.07); display: flex; align-items: center; justify-content: center;
  color: var(--color-primary);
}

.status-dot{ width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.dot-on    { background:#16a34a; box-shadow:0 0 6px rgba(22,163,74,0.4); }
.dot-off   { background:#dc2626; }

/* ============================================================
   GEOCERCAS — split panel
   ============================================================ */
.geo-split {
  display: flex; gap: 14px;
  height: calc(100vh - var(--header-h) - 96px); min-height: 380px;
}
.geo-panel-list {
  width: 268px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.geo-panel-map {
  flex: 1; position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-card-md);
  overflow: hidden;
}

/* Geocercas responsive — mobile */
@media (max-width: 680px) {
  .geo-split {
    flex-direction: column;
    height: auto;
    min-height: unset;
  }
  .geo-panel-map {
    order: -1;
    height: 240px;
    flex: none;
  }
  .geo-panel-list {
    width: 100%;
    order: 0;
  }
  .geo-selected-card {
    width: calc(100% - 28px);
  }
}

.geo-zone-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  border-bottom: 1px solid var(--color-border-light);
}
.geo-zone-item:last-child { border-bottom: none; }
.geo-zone-item:hover { background: var(--color-bg); }
.geo-zone-selected { background: rgba(252,104,33,0.04) !important; border-left-color: var(--color-orange) !important; }

.geo-zone-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.geo-zone-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.geo-zone-meta { font-size: 11px; color: var(--color-text-muted); }

/* Controles flotantes del mapa */
.geo-controls {
  position: absolute; top: 12px; left: 12px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(229,231,235,0.8);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card-md);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.geo-ctrl-btn {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(229,231,235,0.6);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--color-text-muted);
  font-family: inherit; font-size: 14px;
  transition: background 0.12s;
}
.geo-ctrl-btn:hover { background: var(--color-bg); color: var(--color-text); }

/* Card flotante zona seleccionada */
.geo-selected-card {
  position: absolute; bottom: 14px; left: 14px;
  width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-md);
  padding: 14px;
}
@keyframes slideUpSm { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.animate-slide-up { animation: slideUpSm 0.2s ease; }
.animate-fade-in  { animation: fadeIn 0.2s ease; }

/* ============================================================
   CONFIGURACIÓN
   ============================================================ */
.cfg-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:12px; }
.cfg-card {
  border:1px solid var(--color-border-light); border-radius:var(--radius-lg);
  padding:18px; cursor:pointer; box-shadow:var(--shadow-card);
  transition: all 0.15s;
}
.cfg-card:hover {
  box-shadow: var(--shadow-card-md);
  transform: translateY(-2px);
}
.cfg-card:hover .cfg-arrow { opacity: 1 !important; }
.cfg-icon { width:40px; height:40px; border-radius:var(--radius-sm); display:flex; align-items:center; justify-content:center; margin-bottom:11px; }
.cfg-name { font-size:14px; font-weight:600; margin-bottom:4px; }
.cfg-desc { font-size:12px; color:var(--color-text-muted); line-height:1.5; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty { text-align:center; padding:52px 20px; color:var(--color-text-muted); }
.empty-title { font-size:15px; font-weight:500; margin-bottom:4px; }
.empty-sub   { font-size:13px; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar       { width:5px; height:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:#e5e7eb; border-radius:10px; }
::-webkit-scrollbar-thumb:hover { background:#d1d5db; }

/* ============================================================
   HAMBURGER BUTTON (oculto en desktop)
   ============================================================ */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--color-bg); color: var(--color-text); }

/* Overlay oscuro detrás del sidebar en móvil */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 200;
  animation: fadeIn 0.2s ease;
}
#sidebar-overlay.visible { display: block; }

/* ============================================================
   RESPONSIVE — general
   ============================================================ */
@media (max-width: 768px) {
  body { grid-template-columns: 1fr; }

  /* Sidebar: drawer lateral fijo, fuera de pantalla por defecto */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.25);
  }

  /* Botón hamburguesa visible en móvil */
  .sidebar-toggle { display: flex; }

  /* Botón X de cierre dentro del sidebar */
  .sidebar-close-btn { display: flex !important; }

  .module-header { flex-direction: column; }
  .content-inner { padding: 14px 16px 20px; }
}
@media (max-width: 640px) {
  .emp-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .modal { width: calc(100% - 32px); }
}
