/* ============================================================
   Escala OnLine — Design System
   Google Font: Inter
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  --primary:        #4f46e5;
  --primary-light:  #818cf8;
  --primary-dark:   #3730a3;
  --secondary:      #7c3aed;
  --success:        #059669;
  --success-light:  #d1fae5;
  --danger:         #dc2626;
  --danger-light:   #fee2e2;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --info:           #0891b2;
  --info-light:     #cffafe;

  --bg:             #0f0f1a;
  --bg-card:        #1a1a2e;
  --bg-card2:       #16213e;
  --bg-input:       #1e1e3a;
  --border:         rgba(255,255,255,0.08);
  --border-focus:   rgba(79,70,229,0.5);

  --text:           #f1f5f9;
  --text-muted:     #94a3b8;
  --text-dim:       #64748b;

  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      20px;
  --shadow:         0 8px 32px rgba(0,0,0,0.4);
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
  --transition:     all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-card); }
::-webkit-scrollbar-thumb { background: var(--primary-dark); border-radius: 3px; }

/* ─── Layout ─────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
}
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar-logo .logo-text { font-weight: 700; font-size: 14px; line-height: 1.3; }
.sidebar-logo .logo-text span { color: var(--text-muted); font-size: 11px; font-weight: 400; display: block; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-label {
  padding: 8px 20px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-item.active { color: var(--primary-light); background: rgba(79,70,229,0.15); border-right: 3px solid var(--primary); }
.nav-item .nav-icon { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.user-info {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.user-details { overflow: hidden; }
.user-details .user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details .user-role { font-size: 11px; color: var(--text-muted); }
.btn-logout {
  width: 100%;
  padding: 8px;
  background: rgba(220,38,38,0.1);
  color: var(--danger);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(220,38,38,0.2); }

.main-content {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 28px; flex: 1; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-header p { color: var(--text-muted); font-size: 14px; }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-sm { padding: 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ─── Stats Cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { border-color: rgba(79,70,229,0.3); transform: translateY(-2px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}
.stat-icon { font-size: 26px; margin-bottom: 12px; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; }
.btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 15px rgba(79,70,229,0.4); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #047857; transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; min-width: 36px; }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
.form-control::placeholder { color: var(--text-dim); }
.form-control[readonly] { opacity: 0.6; }
select.form-control option { background: var(--bg-card); }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ─── Badges / Status ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-draft     { background: rgba(100,116,139,0.2); color: #94a3b8; }
.badge-submitted { background: rgba(217,119,6,0.15); color: #fbbf24; }
.badge-approved  { background: rgba(5,150,105,0.15); color: #34d399; }
.badge-rejected  { background: rgba(220,38,38,0.15); color: #f87171; }
.badge-closed    { background: rgba(100,116,139,0.1); color: #64748b; }
.badge-open      { background: rgba(79,70,229,0.15); color: var(--primary-light); }
.badge-not_released { background: rgba(100,116,139,0.1); color: #64748b; }

/* ─── Table ──────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(255,255,255,0.025); }
.table-actions { display: flex; gap: 6px; }

/* ─── Schedule Day Cards ─────────────────────────────────────── */
.week-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.day-card {
  background: var(--bg-card2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  user-select: none;
}
.day-card:hover:not(.blocked):not(.disabled) { border-color: var(--primary); background: rgba(79,70,229,0.1); }
.day-card.home_office {
  border-color: var(--primary);
  background: rgba(79,70,229,0.15);
}
.day-card.blocked {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(100,116,139,0.05);
}
.day-card.disabled { cursor: not-allowed; opacity: 0.6; }
.day-card .day-name { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.day-card .day-date { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.day-card .day-emoji { font-size: 28px; margin-bottom: 6px; display: block; }
.day-card .day-type { font-size: 12px; font-weight: 600; }
.day-card.presencial .day-type { color: var(--text-muted); }
.day-card.home_office .day-type { color: var(--primary-light); }
.day-card .blocked-badge {
  position: absolute; top: 6px; right: 6px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 700;
}

/* ─── HO Counter ─────────────────────────────────────────────── */
.ho-counter {
  background: rgba(79,70,229,0.1);
  border: 1px solid rgba(79,70,229,0.2);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.ho-counter-label { font-size: 14px; color: var(--text-muted); }
.ho-counter-value { font-size: 18px; font-weight: 700; color: var(--primary-light); }
.ho-counter-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.ho-counter-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ─── Status Banner ──────────────────────────────────────────── */
.status-banner {
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}
.status-banner.submitted { background: rgba(217,119,6,0.1); border: 1px solid rgba(217,119,6,0.2); color: #fbbf24; }
.status-banner.approved  { background: rgba(5,150,105,0.1); border: 1px solid rgba(5,150,105,0.2); color: #34d399; }
.status-banner.rejected  { background: rgba(220,38,38,0.1); border: 1px solid rgba(220,38,38,0.2); color: #f87171; }
.status-banner.draft     { background: rgba(100,116,139,0.1); border: 1px solid var(--border); color: var(--text-muted); }
.status-banner .status-icon { font-size: 20px; }

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.25s ease;
}
.modal-header {
  padding: 24px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 24px; display: flex; gap: 10px; justify-content: flex-end; }
.btn-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 20px; padding: 4px; border-radius: 6px;
  transition: var(--transition); display: flex; align-items: center;
}
.btn-close:hover { color: var(--text); background: rgba(255,255,255,0.1); }

/* ─── Toast ──────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info    { border-left: 4px solid var(--primary); }
.toast-icon { font-size: 20px; flex-shrink: 0; }

/* ─── Login Page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 60% 30%, rgba(79,70,229,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(124,58,237,0.1) 0%, transparent 50%),
              var(--bg);
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-emoji { font-size: 48px; margin-bottom: 12px; display: block; }
.login-logo h1 { font-size: 24px; font-weight: 800; }
.login-logo p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ─── Filter Bar ─────────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 20px;
  align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 150px; flex: 1; }
.filter-bar .form-control { height: 40px; }

/* ─── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 12px 20px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
  display: flex; align-items: center; gap: 8px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary); }

/* ─── Loading / Empty States ─────────────────────────────────── */
.loading-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 12px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* ─── Alert Box ──────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-warning { background: rgba(217,119,6,0.1); border: 1px solid rgba(217,119,6,0.2); color: #fbbf24; }
.alert-danger  { background: rgba(220,38,38,0.1); border: 1px solid rgba(220,38,38,0.2); color: #f87171; }
.alert-success { background: rgba(5,150,105,0.1); border: 1px solid rgba(5,150,105,0.2); color: #34d399; }
.alert-info    { background: rgba(8,145,178,0.1); border: 1px solid rgba(8,145,178,0.2); color: #22d3ee; }

/* ─── Mobile Hamburger ───────────────────────────────────────── */
.hamburger { display: none; }

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ─── Utilities ──────────────────────────────────────────────── */
.d-flex { display: flex; }
.align-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-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }
.text-success { color: #34d399; }
.text-danger { color: #f87171; }
.text-warning { color: #fbbf24; }
.text-primary { color: var(--primary-light); }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
  .main-content { margin-left: 0; }
  .hamburger {
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none;
    color: var(--text); font-size: 22px; padding: 8px;
  }
  .week-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
  .page-content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .week-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}
