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

:root {
  --green-50: #E1F5EE;
  --green-100: #9FE1CB;
  --green-500: #1D9E75;
  --green-700: #0F6E56;
  --green-900: #085041;

  --gray-50: #F7F7F5;
  --gray-100: #EFEFEB;
  --gray-200: #E0DED6;
  --gray-300: #C8C6BC;
  --gray-500: #888780;
  --gray-700: #5F5E5A;
  --gray-900: #2C2C2A;

  --sidebar-width: 228px;
  --topbar-height: 56px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.5;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 99px; }

/* ===== LOGIN ===== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0faf6 0%, #e8f4f0 50%, #f5f5f2 100%);
}

.login-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  width: 380px;
  box-shadow: var(--shadow-md);
}

.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-icon {
  width: 56px; height: 56px;
  background: var(--green-50);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px; color: var(--green-700);
}
.l-title { font-size: 22px; font-weight: 600; color: var(--gray-900); }
.l-sub { font-size: 13px; color: var(--gray-500); margin-top: 4px; line-height: 1.4; }

.login-tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 1.25rem;
}
.login-tab {
  flex: 1; padding: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: center;
  background: transparent; border: none;
  border-radius: 6px;
  color: var(--gray-500);
  transition: all 0.15s;
  font-family: inherit;
}
.login-tab.active {
  background: #fff;
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}

.login-error {
  background: #FCEBEB;
  color: #A32D2D;
  border: 1px solid #F09595;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 1rem;
}

.login-hint {
  text-align: center;
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
}

/* ===== APP LAYOUT ===== */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  z-index: 50;
}

#sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}
.logo {
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  color: var(--gray-900);
}
.sidebar-sub { font-size: 11px; color: var(--gray-500); margin-top: 3px; line-height: 1.3; }

nav { flex: 1; padding: 0.5rem 0.75rem; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: var(--radius-md);
  text-decoration: none;
  margin-bottom: 2px;
  transition: all 0.12s;
  font-weight: 400;
  border: none; background: transparent; width: 100%; font-family: inherit;
}
.nav-link i { font-size: 18px; flex-shrink: 0; }
.nav-link:hover { background: var(--gray-50); color: var(--gray-900); }
.nav-link.active { background: var(--green-50); color: var(--green-700); font-weight: 500; }

.role-badge {
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--gray-500);
}
.btn-logout {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: var(--gray-500); font-size: 16px;
  padding: 4px; border-radius: var(--radius-md);
  display: flex; align-items: center;
  transition: color 0.12s;
}
.btn-logout:hover { color: #A32D2D; }

/* ===== MAIN ===== */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

#topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 12px;
  flex-shrink: 0;
}
.page-title { font-size: 15px; font-weight: 500; flex: 1; }
.topbar-date { font-size: 12px; color: var(--gray-500); }

#menu-toggle {
  display: none; border: none; background: none;
  font-size: 20px; cursor: pointer; color: var(--gray-700);
  padding: 4px; border-radius: var(--radius-md);
}

#content { flex: 1; overflow-y: auto; padding: 1.5rem; }

.view { display: none; }
.view.active { display: block; }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.125rem;
  display: flex; gap: 14px; align-items: center;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-info .label { font-size: 12px; color: var(--gray-500); }
.stat-info .value { font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat-info .change { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

/* ===== CARD ===== */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.card-title { font-size: 14px; font-weight: 500; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; font-size: 13px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--gray-900);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--green-500); color: #fff;
  border-color: var(--green-500);
}
.btn-primary:hover { background: var(--green-700); border-color: var(--green-700); }
.btn-danger {
  background: #FCEBEB; color: #A32D2D;
  border-color: #F09595;
}
.btn-danger:hover { background: #F7C1C1; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 500px; }
thead th {
  text-align: left; font-weight: 500;
  font-size: 11.5px; color: var(--gray-500);
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
  text-transform: uppercase; letter-spacing: 0.03em;
}
thead th:first-child { border-radius: var(--radius-md) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-md) 0 0; }
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafaf8; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
}
.badge-teal   { background: #E1F5EE; color: #085041; }
.badge-blue   { background: #E6F1FB; color: #0C447C; }
.badge-amber  { background: #FAEEDA; color: #633806; }
.badge-gray   { background: #F1EFE8; color: #444441; }
.badge-coral  { background: #FAECE7; color: #712B13; }
.badge-green  { background: #EAF3DE; color: #27500A; }
.badge-red    { background: #FCEBEB; color: #791F1F; }

/* ===== FORM ===== */
.form-row { margin-bottom: 1rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1rem; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--gray-700); margin-bottom: 5px; }
.form-input {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px; font-family: inherit;
  background: #fff; color: var(--gray-900);
  transition: border-color 0.12s;
}
.form-input:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(29,158,117,0.1); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* ===== FILTER ROW ===== */
.filter-row { display: flex; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.filter-select { width: auto; min-width: 160px; }
.filter-month { width: auto; }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 1rem;
}
.search-bar i { color: var(--gray-500); font-size: 16px; flex-shrink: 0; }
.search-bar input {
  background: transparent; border: none; outline: none;
  font-size: 13px; color: var(--gray-900); font-family: inherit; width: 100%;
}

/* ===== PROFILE CHIP ===== */
.profile-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--green-50);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--green-700);
  flex-shrink: 0;
}
.hours-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--green-50); color: var(--green-700);
  border-radius: 99px; padding: 4px 12px;
  font-size: 13px; font-weight: 500;
}

/* ===== HISTORIAL ===== */
.hist-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 1rem;
}
.hist-row:last-child { border-bottom: none; }
.hist-name { font-size: 14px; font-weight: 500; }
.hist-meta { font-size: 12px; color: var(--gray-500); margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ===== REPORT ===== */
.report-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.report-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.report-bar-label { width: 110px; color: var(--gray-500); flex-shrink: 0; font-size: 12px; }
.report-bar-track { flex: 1; background: var(--gray-100); border-radius: 99px; height: 8px; overflow: hidden; }
.report-bar-fill { height: 100%; border-radius: 99px; background: var(--green-500); transition: width 0.6s ease; }
.report-bar-val { width: 36px; text-align: right; font-size: 12px; font-weight: 500; color: var(--gray-700); }

.gen-row {
  display: flex; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.gen-row:last-child { border-bottom: none; }
.gen-row .gen-label { color: var(--gray-500); }
.gen-row b { font-weight: 600; }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  width: 520px; max-width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in { from { opacity:0; transform: translateY(12px) scale(0.98); } to { opacity:1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 1.25rem; padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
}

/* ===== TOAST ===== */
#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--green-700); color: #fff;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 13px; font-weight: 500;
  display: none; align-items: center; gap: 8px;
  z-index: 200;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease;
}
#toast.show { display: flex; }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ===== ACTIONS COL ===== */
.act-actions { display: flex; gap: 5px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #menu-toggle { display: flex; }
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  #sidebar.open { transform: translateX(0); }
  #content { padding: 1rem; }
  .form-row-2 { grid-template-columns: 1fr; }
  .report-summary { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
