/* ============================================================
   CONTROL HORARIO - Design System
   Estilo: iOS / Apple HIG / Premium Minimal
   ============================================================ */

/* --- VARIABLES DE TEMA ------------------------------------ */
:root {
  --bg-primary:       #EEEEF0;
  --bg-secondary:     #F5F5F7;
  --bg-tertiary:      #E0E0E2;
  --bg-card:          #FFFFFF;
  --bg-sidebar:       #FFFFFF;
  --bg-input:         #F5F5F7;
  --bg-overlay:       rgba(0,0,0,0.4);

  --text-primary:     #1D1D1F;
  --text-secondary:   #6E6E73;
  --text-tertiary:    #98989D;
  --text-inverse:     #FFFFFF;

  --accent:           #8A1FF7;
  --accent-2:         #B450EE;
  --accent-3:         #D27BE9;
  --accent-gradient:  linear-gradient(333deg, #871ff7, #b450ee, #d27be9);
  --accent-hover:     #7012D4;
  --accent-light:     rgba(138,31,247,0.10);
  --accent-medium:    rgba(138,31,247,0.20);

  --success:          #34C759;
  --success-bg:       rgba(52,199,89,0.12);
  --warning:          #FF9500;
  --warning-bg:       rgba(255,149,0,0.12);
  --danger:           #FF3B30;
  --danger-bg:        rgba(255,59,48,0.12);
  --info:             #007AFF;
  --info-bg:          rgba(0,122,255,0.12);
  --vacation:         #5AC8FA;
  --holiday:          #FFD60A;

  --border:           rgba(0,0,0,0.08);
  --border-strong:    rgba(0,0,0,0.16);
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:        0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:        0 12px 32px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-xl:        0 24px 48px rgba(0,0,0,0.14);

  --radius-sm:        8px;
  --radius-md:        12px;
  --radius-lg:        16px;
  --radius-xl:        20px;
  --radius-full:      9999px;

  --sidebar-width:    260px;
  --header-height:    60px;
  --transition:       0.2s cubic-bezier(0.4,0,0.2,1);
  --transition-slow:  0.35s cubic-bezier(0.4,0,0.2,1);

  --font-main:        -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --font-display:     -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  --font-mono:        'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

/* --- MODO OSCURO ------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --theme: dark; }
}
[data-theme="dark"], :root[data-theme="dark"] {
  --bg-primary:       #0A0A0C;
  --bg-secondary:     #161618;
  --bg-tertiary:      #222224;
  --bg-card:          #1C1C1E;
  --bg-sidebar:       #141416;
  --bg-input:         #2C2C2E;

  --text-primary:     #F5F5F7;
  --text-secondary:   #98989D;
  --text-tertiary:    #636366;

  --accent:           #A855F7;
  --accent-2:         #C084FC;
  --accent-3:         #DDA6F9;
  --accent-gradient:  linear-gradient(333deg, #871ff7, #b450ee, #d27be9);
  --accent-hover:     #9333EA;
  --accent-light:     rgba(168,85,247,0.13);
  --accent-medium:    rgba(168,85,247,0.24);

  --border:           rgba(255,255,255,0.08);
  --border-strong:    rgba(255,255,255,0.14);
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:        0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:        0 12px 32px rgba(0,0,0,0.5);
}

/* --- RESET ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-slow), color var(--transition-slow);
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* --- LAYOUT ----------------------------------------------- */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  min-height: 100vh;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
}

/* --- SIDEBAR ---------------------------------------------- */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform var(--transition-slow);
  /* Hide scrollbar but keep scroll */
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge */
}
.sidebar::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; fill: white; }
.sidebar-logo-text { font-size: 15px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.sidebar-logo-sub { font-size: 11px; color: var(--text-secondary); font-weight: 400; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; scrollbar-width: none; }
.nav-section { margin-bottom: 20px; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 0 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;  /* push to bottom of flex column */
  flex-shrink: 0;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
  cursor: pointer;
}
.user-card:hover { background: var(--bg-secondary); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-secondary); }

/* --- HEADER ----------------------------------------------- */
.app-header {
  grid-area: header;
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 90;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
[data-theme="dark"] .app-header {
  background: rgba(28,28,30,0.85);
}
.header-title { font-size: 17px; font-weight: 600; flex: 1; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header-greeting { font-size:14px; font-weight:500; color:var(--text-secondary); flex:1; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text-secondary);
  position: relative;
}
.icon-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.icon-btn svg { width: 18px; height: 18px; }
.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 16px; height: 16px;
  background: var(--danger);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-primary);
}

/* --- MAIN CONTENT ----------------------------------------- */
.main-content {
  grid-area: main;
  margin-left: 1px;
  padding: 28px 28px;
  min-height: calc(100vh - var(--header-height));
  background: var(--bg-secondary);
}
.page-header {
  margin-bottom: 24px;
}
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-primary); }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

/* --- CARDS ------------------------------------------------ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

/* --- STAT CARDS ------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(138,31,247,.15); transform: translateY(-1px); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-primary); font-family: var(--font-display); }
.stat-change { font-size: 12px; color: var(--text-tertiary); }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* --- BOTÓN FICHAR (HERO) ---------------------------------- */
.fichar-hero {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  padding: 36px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.fichar-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
}
.status-dot.active { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); animation: pulse 2s infinite; }
.status-dot.paused { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.cronometro {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -2px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  margin: 12px 0;
}
.cronometro.paused { color: var(--warning); }

.fichar-date {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.btn-fichar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 48px;
  border-radius: var(--radius-full);
  font-size: 17px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: -0.2px;
}
.btn-fichar-start {
  background: var(--accent-gradient) !important;
  color: white;
  box-shadow: 0 4px 20px rgba(138,31,247,0.35);
}
.btn-fichar-start:hover { background: var(--accent-hover); transform: scale(1.02); box-shadow: 0 6px 24px rgba(138,31,247,0.45); }
.btn-fichar-start:active { transform: scale(0.98); }

.btn-fichar-pause {
  background: var(--warning);
  color: white;
  box-shadow: 0 4px 20px rgba(255,149,0,0.30);
}
.btn-fichar-pause:hover { background: #E68800; transform: scale(1.02); }

.btn-fichar-resume {
  background: var(--info);
  color: white;
  box-shadow: 0 4px 20px rgba(0,122,255,0.30);
}
.btn-fichar-resume:hover { background: #0066DD; transform: scale(1.02); }

.btn-fichar-end {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 20px rgba(255,59,48,0.30);
}
.btn-fichar-end:hover { background: #E0352C; transform: scale(1.02); }

.fichar-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* --- BOTONES GENERALES ------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-tertiary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #E0352C; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- FORMULARIOS ----------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-control::placeholder { color: var(--text-tertiary); }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236E6E73' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer; }
.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .btn { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* --- TABLAS ----------------------------------------------- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--bg-secondary);
  padding: 11px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-secondary); }
tbody td { padding: 12px 16px; color: var(--text-primary); vertical-align: middle; }

/* --- BADGES ----------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-info    { background: var(--info-bg);    color: var(--info);    }
.badge-neutral { background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-accent  { background: var(--accent-light); color: var(--accent); }

/* --- MODALES ---------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.96) translateY(8px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close { background: var(--bg-secondary); border: none; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); }
.modal-close:hover { background: var(--bg-tertiary); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* --- NOTIFICACIONES PANEL --------------------------------- */
.notif-panel {
  position: fixed;
  top: var(--header-height);
  right: 16px;
  width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 500;
  overflow: hidden;
  transform: translateY(-8px) scale(0.97);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}
.notif-panel.open { transform: translateY(0) scale(1); opacity: 1; visibility: visible; }
.notif-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-title { font-size: 14px; font-weight: 600; }
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-start;
  transition: background var(--transition);
  cursor: pointer;
}
.notif-item:hover { background: var(--bg-secondary); }
.notif-item.unread { background: var(--accent-light); }
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 5px; }
.notif-content .notif-msg-title { font-size: 13px; font-weight: 600; }
.notif-content .notif-msg-body { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.notif-content .notif-time { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }

/* --- CALENDARIO ------------------------------------------- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day-header {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  padding: 8px 0;
}
.cal-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
  padding: 4px;
  min-height: 52px;
}
.cal-day:hover { background: var(--bg-secondary); }
.cal-day.today { background: var(--accent-light); }
.cal-day.today .cal-day-num { color: var(--accent); font-weight: 700; }
.cal-day.worked { background: var(--success-bg); }
.cal-day.deficit { background: var(--danger-bg); }
.cal-day.vacation { background: rgba(90,200,250,0.15); }
.cal-day.holiday { background: rgba(255,214,10,0.15); }
.cal-day.other-month { opacity: 0.35; }
.cal-day-num { font-size: 14px; font-weight: 500; }
.cal-day-hours { font-size: 10px; color: var(--text-secondary); }

/* --- GAUGE / PROGRESS ------------------------------------- */
.progress-ring { display: flex; align-items: center; justify-content: center; }
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* --- LOGIN ------------------------------------------------ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  padding: 20px;
}
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  margin-bottom: 32px;
}
.login-logo-icon { width: 48px; height: 48px; background: var(--accent); border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.login-logo-icon svg { width: 26px; height: 26px; fill: white; }
.login-logo-text { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-subtitle { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }

/* --- ALERTS ----------------------------------------------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: #1A6B2B; border: 1px solid rgba(52,199,89,0.25); }
.alert-warning { background: var(--warning-bg); color: #7A4800; border: 1px solid rgba(255,149,0,0.25); }
.alert-danger  { background: var(--danger-bg);  color: #B02A20; border: 1px solid rgba(255,59,48,0.25); }
.alert-info    { background: var(--info-bg);    color: #0040A0; border: 1px solid rgba(0,122,255,0.25); }
[data-theme="dark"] .alert-success { color: #7AE49A; }
[data-theme="dark"] .alert-warning { color: #FFB84D; }
[data-theme="dark"] .alert-danger  { color: #FF8A84; }
[data-theme="dark"] .alert-info    { color: #66AEFF; }

/* --- TABS ------------------------------------------------- */
.tabs { display: flex; gap: 2px; background: var(--bg-secondary); border-radius: var(--radius-lg); padding: 4px; margin-bottom: 20px; }
.tab-btn {
  flex: 1; padding: 8px 12px;
  border: none; background: none;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- TOGGLE SWITCH ---------------------------------------- */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 44px; height: 26px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* --- SKELETON LOADING ------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- TOAST ------------------------------------------------ */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
  animation: toast-in 0.3s ease;
  max-width: 320px;
}
.toast.success { background: var(--accent); color: white; }
.toast.error   { background: var(--danger);  color: white; }
.toast.warning { background: var(--warning); color: white; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* --- SEARCH ----------------------------------------------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; }
.search-box input { border: none; background: none; outline: none; flex: 1; font-size: 14px; color: var(--text-primary); }
.search-box input::placeholder { color: var(--text-tertiary); }

/* --- SIDEBAR MÓVIL ---------------------------------------- */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: var(--bg-overlay); z-index: 99; }
.menu-toggle { display: none; }

/* --- RESPONSIVE ------------------------------------------- */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 260px; }
  
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; opacity: 0; visibility: hidden; transition: all var(--transition); }
  .sidebar-overlay.open { opacity: 1; visibility: visible; }
  .app-header { margin-left: 0; padding: 0 16px; }
  .main-content { margin-left: 0; padding: 16px; }
  .menu-toggle { display: flex; }
  
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .cronometro { font-size: 42px; }
  .fichar-hero { padding: 24px 16px; }
  .btn-fichar { padding: 14px 32px; font-size: 16px; }
  .fichar-actions { flex-direction: column; align-items: center; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
  .modal { border-radius: var(--radius-lg); }
  .table-wrapper { font-size: 13px; }
}

/* --- UTILIDADES ------------------------------------------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 17px; }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- PRINT ----------------------------------------------- */
@media print {
  .sidebar, .app-header, .no-print { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

.dev-credit {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  color: #000000;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  z-index: 9999;
  transition: all 0.2s ease;
}

.dev-credit:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
/* ============================================================
   v4.0 — Mejoras visuales y responsive
   ============================================================ */

/* Gradiente morado en botones primarios */
.btn-primary {
  background: var(--accent-gradient) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 2px 12px rgba(138,31,247,.30);
}
.btn-primary:hover { opacity:.88; box-shadow:0 4px 18px rgba(138,31,247,.45); }

/* Gradiente en badges accent */
.badge-accent { background: var(--accent-gradient) !important; color:#fff !important; border:none; }

/* Status dot activo en morado */
.status-dot.active { background: var(--accent); box-shadow:0 0 0 3px var(--accent-light); }

/* Navegación activa con gradiente */
.nav-item.active {
  background: var(--accent-light) !important;
  color: var(--accent) !important;
}
.nav-item.active svg { stroke: var(--accent); }

/* Card hover sombra con acento morado */
.card { transition: box-shadow 0.2s; }
.card:hover { box-shadow: 0 4px 20px rgba(138,31,247,.12); }

/* Gráficas: colores de barras con gradiente */
.progress-fill { background: var(--accent-gradient) !important; }

/* Input focus */
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* Header title → saludo (se inyecta via JS, ocultamos el h1 repetido) */

/* ── Responsive: tablas con scroll propio ──────────────────── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
/* ── RESPONSIVE GLOBAL v4.2 ─────────────────────────────── */
/* Regla universal: toda tabla queda dentro de su contenedor */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Scroll solo dentro, nunca en la página */
  overscroll-behavior-x: contain;
}
.table-wrapper table { min-width: 520px; }

/* Asegurar que pages sin .table-wrapper tampoco desbordan */
.card .table-wrapper { border: none; border-radius: 0; }

@media (max-width: 768px) {
  /* Modal mobile fix */
  .modal {
    max-width: 95vw !important;
    max-height: 85vh;
    overflow-y: auto;
    margin: 0;
  }
  .modal-body { max-height: 60vh; overflow-y: auto; }
  .modal-overlay { padding: 10px; align-items: flex-start; padding-top: 40px; }

  /* Layout */
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .app-header { padding: 0 12px; }
  .main-content { padding: 16px 12px; }
  .card-header { flex-wrap: wrap; gap: 6px; }

  /* Tablas */
  th, td { font-size: 12px; padding: 6px 8px; white-space: nowrap; }
  .table-wrapper { -webkit-overflow-scrolling: touch; }

  /* Tareas lista: 2 filas en móvil */
  .tarea-row-mobile { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .tarea-row-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .tarea-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
  .tarea-table-desktop { display: none; }
  .tarea-list-mobile { display: block; }

  /* Kanban móvil: columnas verticales, scroll horizontal solo en tarjetas */
  .kanban-board { flex-direction: column; overflow-x: visible; gap: 12px; }
  .kanban-col { min-width: unset; max-width: unset; width: 100%; }
  .kanban-col-body { overflow-x: auto; display: flex; flex-direction: row; gap: 8px; padding: 8px; min-height: 80px; overscroll-behavior-x: contain; }
  .kanban-card { min-width: 240px; max-width: 280px; flex-shrink: 0; }
}

@media (min-width: 769px) {
  .tarea-table-desktop { display: table; width: 100%; border-collapse: collapse; }
  .tarea-list-mobile { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn { font-size: 13px; padding: 8px 12px; }
  .tabs { gap: 4px; }
  .tab-btn { font-size: 12px; padding: 6px 8px; }
  .page-title { font-size: 20px; }
  th, td { font-size: 11px; padding: 5px 6px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn { font-size:13px; padding:8px 12px; }
  .tabs { gap:4px; }
  .tab-btn { font-size:12px; padding:6px 8px; }
}

/* ── Popup de pausa (modal especial con backdrop blur) ──────── */
.pausa-popup-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.pausa-popup {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 380px; width: 90%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
  animation: slideUp .25s ease;
}
.pausa-popup .pausa-gif { font-size:72px; margin-bottom:12px; display:block; }
.pausa-popup .pausa-msg { font-size:15px; color:var(--text-secondary); margin-bottom:8px; }
.pausa-popup .pausa-nombre { font-weight:700; font-size:16px; color:var(--text-primary); }
.pausa-popup .pausa-tipo { font-size:13px; color:var(--accent); font-weight:600; margin-bottom:16px; }
.pausa-popup .pausa-timer { font-family:var(--font-mono); font-size:36px; font-weight:700; color:var(--accent); margin:16px 0; }

@keyframes slideUp { from{transform:translateY(24px);opacity:0} to{transform:translateY(0);opacity:1} }
@keyframes fadeIn  { from{opacity:0} to{opacity:1} }

/* ── Crédito discreto ───────────────────────────────────────── */
.dev-credit-inline {
  font-size: 10px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 6px 10px 0;
  display: block;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.dev-credit-inline a { color: var(--text-tertiary); text-decoration: none; }
.dev-credit-inline a:hover { color: var(--accent); }

/* Botón demo solo en plan prueba */
.dev-credit-demo {
  position:fixed; bottom:16px; left:50%; transform:translateX(-50%);
  background: var(--accent-gradient);
  color:#fff; font-size:12px; font-weight:600;
  padding:8px 16px; border-radius:20px;
  box-shadow:0 4px 16px rgba(138,31,247,.4);
  z-index:999; white-space:nowrap; text-decoration:none;
}

/* ── Mensajería: icono en header ───────────────────────────── */
.msg-badge {
  position:absolute; top:-4px; right:-4px;
  background: var(--accent-gradient);
  color:#fff; font-size:9px; font-weight:700;
  min-width:16px; height:16px;
  border-radius:8px; display:flex; align-items:center; justify-content:center;
  padding:0 4px;
}

/* ── Kanban ────────────────────────────────────────────────── */
.kanban-board { display:flex; gap:16px; overflow-x:auto; padding-bottom:16px; align-items:flex-start; }
.kanban-col { min-width:260px; max-width:300px; flex-shrink:0; }
.kanban-col-header { padding:10px 14px; border-radius:10px 10px 0 0; font-weight:600; font-size:13px; display:flex; justify-content:space-between; }
.kanban-col-body { background:var(--bg-secondary); border-radius:0 0 10px 10px; min-height:120px; padding:8px; display:flex; flex-direction:column; gap:8px; }
.kanban-card { background:var(--bg-card); border-radius:10px; padding:12px; cursor:grab; box-shadow:0 1px 4px rgba(0,0,0,.06); border-left:3px solid transparent; transition:box-shadow .15s; }
.kanban-card:active { cursor:grabbing; }
.kanban-card.dragging { opacity:.5; box-shadow:0 8px 24px rgba(138,31,247,.3); }
.kanban-card.drag-over { border-left-color:var(--accent); background:var(--accent-light); }

/* ── Anuncio tablón ─────────────────────────────────────────── */
.anuncio-card { border-left: 3px solid var(--accent); }
.anuncio-fijado { border-left-color: #FFB800; }

/* ── Tablas sin wrapper: scroll automático en móvil ─────── */
@media (max-width: 768px) {
  .card table, .card-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    max-width: 100%;
    white-space: nowrap;
  }
  /* Excepción: tablas de notas post-it o calendarios que no necesitan scroll */
  .no-scroll table { display: table; overflow-x: visible; white-space: normal; }
}

/* ── Tareas: layout 2 filas en móvil ───────────────────────── */
.tarea-card-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: nowrap; /* desktop: single row */
}
.tarea-card-info { flex: 1; min-width: 0; }
.tarea-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 768px) {
  .tarea-card-inner { flex-direction: column; gap: 10px; }
  .tarea-card-actions {
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 2px;
  }
  .tarea-card-actions .btn { flex: 1; min-width: 0; text-align: center; font-size: 12px; padding: 7px 6px; }
  .tarea-card-actions form { flex: 1; }
  .tarea-card-actions form .btn { width: 100%; }
}

/* ── Kanban móvil: columnas verticales con scroll horizontal en tarjetas ── */
@media (max-width: 768px) {
  .kanban-board {
    display: flex;
    flex-direction: column;
    overflow-x: visible;
    gap: 0;
  }
  .kanban-col {
    min-width: unset;
    max-width: unset;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: stretch;
  }
  .kanban-col-header {
    /* Vertical text - column label rotated */
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    border-radius: 0 0 10px 10px;
    padding: 12px 8px;
    min-width: 36px;
    max-width: 36px;
    flex-shrink: 0;
    justify-content: space-between;
    align-items: center;
  }
  .kanban-col-header span:last-child {
    /* count badge */
    writing-mode: horizontal-tb;
    transform: rotate(180deg);
    border-radius: 10px;
  }
  .kanban-col-body {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    gap: 8px;
    padding: 8px;
    flex: 1;
    min-height: 140px;
    border-radius: 0 10px 10px 0;
    align-items: flex-start;
  }
  .kanban-card {
    min-width: 220px;
    max-width: 260px;
    flex-shrink: 0;
  }
  /* Separator between columns */
  .kanban-col + .kanban-col { border-top: 1px solid var(--border); }
}

/* ═══════════════════════════════════════════════════════════
   v4.2.4 — TABLE SCROLL UNIVERSAL
   Todas las tablas dentro de .card tienen scroll propio en móvil
   ═══════════════════════════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
}
.table-wrapper.no-border { border: none; border-radius: 0; }
.table-wrapper table { min-width: 600px; }

/* Filtros compactos en móvil */
@media (max-width: 768px) {
  .filters-bar { flex-wrap: wrap; gap: 6px !important; }
  .filters-bar .btn, .filters-bar button { font-size: 11px !important; padding: 5px 8px !important; }
  .filters-bar .form-control, .filters-bar select { font-size: 12px !important; }
  .filters-bar .form-group { margin: 0 !important; }

  /* Notas más pastel */
  .nota-card { min-height: 130px; }
}

/* ═══════════════════════════════════════════════════════════
   TABLE SCROLL - CANONICAL OVERRIDE (v4.2.4)
   ═══════════════════════════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-x: contain;
  display: block;
  width: 100%;
}
.table-wrapper table,
.table-wrapper > table {
  min-width: 600px;
  white-space: nowrap;
}
/* Allow normal text wrapping for description columns */
.table-wrapper td.wrap,
.table-wrapper th.wrap { white-space: normal; min-width: 120px; }

/* Card tables without border */
.card .table-wrapper { border-left: none; border-right: none; border-radius: 0; }
.card > .table-wrapper:last-child { border-bottom: none; }

/* Calendar: mobile shows only #ID, desktop shows full title */
.cal-ref-full { display: inline; }
.cal-ref-only { display: none; }
@media (max-width: 768px) {
  .cal-ref-full { display: none; }
  .cal-ref-only { display: inline; }
}

/* Notas: full pastel background, no top strip */
.nota-card::before { display: none !important; }
