/* SafariPulse HR - Modern UI */
:root {
  --primary: #0d9488;
  --primary-light: #2dd4bf;
  --primary-dark: #0f766e;
  --accent: #06b6d4;
  --accent-violet: #8b5cf6;
  --accent-amber: #f59e0b;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --text-on-dark: #f1f5f9;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --gradient-primary: linear-gradient(135deg, #0d9488 0%, #06b6d4 100%);
  --gradient-colorful: linear-gradient(135deg, #0d9488 0%, #06b6d4 45%, #8b5cf6 100%);
  --gradient-bg: linear-gradient(160deg, #0f172a 0%, #1e293b 30%, #0f766e 70%, #164e63 100%);
  --gradient-mesh: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(13, 148, 136, 0.2), transparent 45%),
                  radial-gradient(ellipse 60% 40% at 100% 20%, rgba(6, 182, 212, 0.15), transparent 45%),
                  radial-gradient(ellipse 50% 35% at 0% 60%, rgba(139, 92, 246, 0.12), transparent 45%);
  --header-bg: rgba(15, 23, 42, 0.9);
  --header-border: rgba(255, 255, 255, 0.06);
  --shadow-soft: 0 2px 16px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition: 0.2s ease;
}

* { box-sizing: border-box; }

body {
  background: var(--gradient-bg);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  margin: 0;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-mesh);
  pointer-events: none;
  z-index: 0;
}

/* Main content - fill viewport width and remaining height */
main {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  padding-bottom: 2rem;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.container-fluid {
  max-width: 100%;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: 0;
  margin-right: 0;
}
@media (min-width: 1200px) {
  .container-fluid {
    padding-left: 1.75rem;
    padding-right: 1.75rem;
  }
}

/* Top header - dark glass */
.app-header {
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--shadow-soft);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  width: 100%;
  flex-shrink: 0;
}

.app-header .navbar {
  padding: 0.5rem 0;
}

.app-header .navbar .container-fluid {
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Center main nav, push actions to far right */
@media (min-width: 992px) {
  .app-header .navbar-collapse-centered {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
  }
  .app-header .navbar-nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
  }
  .app-header .navbar-nav-center .navbar-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.1rem;
  }
  .app-header .navbar-actions {
    margin-left: auto;
    padding-left: 1rem;
    flex-shrink: 0;
  }
}

.app-header .navbar-brand {
  font-weight: 700;
  color: var(--text-on-dark);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.app-header .nav-link {
  color: rgba(241, 245, 249, 0.9);
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.app-header .nav-link:hover,
.app-header .nav-link:focus {
  background: rgba(20, 184, 166, 0.2);
  color: #fff;
}

.app-header .dropdown-menu {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
  padding: 0.35rem;
  margin-top: 0.35rem;
}

.app-header .dropdown-item {
  color: var(--text-on-dark);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  transition: background 0.15s;
}

.app-header .dropdown-item:hover {
  background: rgba(20, 184, 166, 0.2);
  color: #fff;
}

/* Global search */
[x-cloak] { display: none !important; }

.global-search-form {
  min-width: 180px;
  max-width: 260px;
}

.global-search-form .form-control {
  border-radius: 2rem;
  max-width: 220px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.global-search-form .form-control::placeholder {
  color: rgba(226, 232, 240, 0.6);
}
.global-search-form .form-control:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--primary-light);
  color: #fff;
}

.global-search-dropdown {
  background: rgba(30, 41, 59, 0.98);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1050;
  padding: 0.35rem 0;
}

.global-search-dropdown .dropdown-item {
  color: var(--text-on-dark);
}
.global-search-dropdown .dropdown-item:hover {
  background: rgba(20, 184, 166, 0.2);
  color: #fff;
}
.global-search-dropdown .text-muted {
  color: rgba(226, 232, 240, 0.6) !important;
}

@media (max-width: 991px) {
  .global-search-form .form-control { max-width: 100%; }
}

/* Mobile nav */
@media (max-width: 991.98px) {
  .app-header .navbar-collapse {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--header-border);
  }
  .app-header .nav-item.dropdown .dropdown-menu {
    background: rgba(30, 41, 59, 0.95);
    border-left: 3px solid var(--primary-light);
    margin: 0.25rem 0 0.5rem 0.75rem;
  }
  .app-header .navbar-actions {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--header-border);
  }
}

/* Buttons */
.btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(13, 148, 136, 0.35);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}
.btn-primary:hover {
  color: #fff;
  border: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(13, 148, 136, 0.4);
}
.btn-sm {
  font-weight: 500;
}

.btn-outline-primary {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-outline-primary:hover {
  background: rgba(13, 148, 136, 0.1);
  border-color: var(--primary-dark);
  color: var(--primary-dark);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  border: none;
  color: #fff;
  font-weight: 600;
}
.btn-success:hover { color: #fff; opacity: 0.95; }

/* Cards - modern elevated panels */
.card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  background: rgba(248, 250, 252, 0.9);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  background: rgba(248, 250, 252, 0.7);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  padding: 0.9rem 1.25rem;
}

/* Page title */
.page-title {
  font-weight: 700;
  color: var(--text-on-dark);
  margin-bottom: 1.5rem;
  font-size: 1.625rem;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(241, 245, 249, 0.7);
  margin-bottom: 0.75rem;
}
.section-title:not(:first-child) {
  margin-top: 1.75rem;
}

.dashboard-summary {
  font-size: 0.9375rem;
  color: var(--text-on-dark);
  font-weight: 500;
}

/* KPI cards */
.kpi-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}
.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.kpi-card .kpi-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.kpi-card-primary::before { background: var(--primary); }
.kpi-card-success::before { background: #10b981; }
.kpi-card-warning::before { background: #f59e0b; }
.kpi-card-info::before { background: #06b6d4; }
.kpi-card-violet::before { background: #8b5cf6; }
.kpi-card-teal::before { background: #0d9488; }

.card-chart .card-body {
  min-height: 200px;
}

/* Stat cards - modern flat with soft shadow */
.stat-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gradient-primary);
  border-radius: 4px 0 0 4px;
  opacity: 0.9;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(255, 255, 255, 0.7);
}
.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.stat-card .stat-label {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 0.15rem;
}

/* Tables - modern data grid */
.table {
  width: 100%;
  color: var(--text-primary);
  font-size: 0.875rem;
}
.table thead th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding: 0.7rem 1rem;
  background: rgba(248, 250, 252, 0.8);
}
.table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table-striped tbody tr:nth-of-type(odd) {
  background: rgba(255, 255, 255, 0.4);
}
.table-hover tbody tr:hover {
  background: rgba(13, 148, 136, 0.05);
}
.table-light {
  background: rgba(255, 255, 255, 0.6);
}
.card .table thead th {
  background: rgba(248, 250, 252, 0.95);
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.8);
}

/* Forms */
.form-control,
.form-select {
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.9);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
  background: #fff;
}
.form-label {
  font-weight: 500;
  color: var(--text-primary);
}

/* Login page - rich gradient */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(145deg, #134e4a 0%, #0d9488 40%, #06b6d4 70%, #7c3aed 100%);
  background-attachment: fixed;
  position: relative;
}
.login-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.login-card {
  max-width: 420px;
  width: 100%;
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
  z-index: 1;
}
.login-header {
  background: var(--gradient-colorful);
  padding: 1.5rem;
  text-align: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.login-header .login-logo {
  max-height: 48px;
  width: auto;
  max-width: 100%;
  display: inline-block;
  vertical-align: middle;
}
.login-header .login-header-fallback {
  display: none;
}
.login-card .card-body {
  padding: 1.5rem 1.75rem;
}
.login-card .form-control {
  background: rgba(255, 255, 255, 0.95);
}
.login-card .text-muted {
  color: var(--text-muted) !important;
}

/* Nav toggler - light on dark header */
.app-header .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: var(--text-on-dark);
}
.app-header .navbar-toggler-icon {
  filter: invert(1);
  opacity: 0.9;
}
.app-header .navbar-toggler:focus {
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.4);
}

/* Badges */
.badge {
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.35em 0.65em;
  border-radius: 6px;
}
.bg-primary {
  background: var(--gradient-primary) !important;
  color: #fff !important;
  border: none;
}

/* Alerts */
.alert {
  border-radius: var(--radius);
  border: none;
  padding: 0.9rem 1.15rem;
}
.alert-success {
  background: rgba(16, 185, 129, 0.12);
  color: #065f46;
}
.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}
.alert-info {
  background: rgba(6, 182, 212, 0.12);
  color: #0e7490;
}
.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

/* Tabs */
.nav-tabs {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.nav-tabs .nav-link {
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  padding: 0.6rem 1rem;
  border-radius: 8px 8px 0 0;
  transition: color 0.2s, border-color 0.2s;
}
.nav-tabs .nav-link:hover {
  color: var(--primary-dark);
}
.nav-tabs .nav-link.active {
  color: var(--primary-dark);
  background: rgba(13, 148, 136, 0.06);
  border-bottom-color: var(--primary);
}

.nav-pills .nav-link {
  border-radius: 8px;
  font-weight: 500;
}
.nav-pills .nav-link.active {
  background: var(--gradient-colorful);
  color: #fff;
}

/* Attendance tabs */
.nav-tabs-attendance .nav-link {
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.5rem 1rem;
  font-weight: 500;
}
.nav-tabs-attendance .nav-link:hover {
  border-bottom-color: rgba(15, 23, 42, 0.15);
  color: var(--text-primary);
}
.nav-tabs-attendance .nav-link.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
  background: transparent;
}

/* Attendance status badges */
.att-status { font-size: 0.7rem; padding: 0.25rem 0.45rem; border-radius: 6px; }
.att-status-p { background: rgba(255,255,255,0.8); color: #334155; border: 1px solid rgba(15,23,42,0.1); }
.att-status-wod { background: #d1fae5; color: #065f46; }
.att-status-ph { background: #e9d5ff; color: #5b21b6; }
.att-status-al { background: #bbf7d0; color: #166534; }
.att-status-ml { background: #fecaca; color: #b91c1c; }
.att-status-el { background: #fef3c7; color: #b45309; }
.att-status-abs { background: #b91c1c; color: #fff; }
.att-status-off { background: #fed7aa; color: #c2410c; }
.att-status-oph { background: #fef08a; color: #854d0e; }
.att-status-w { background: #f1f5f9; color: #475569; }
.att-cell { font-size: 0.75rem; font-weight: 600; min-width: 2rem; border-radius: 4px; }
.att-cell.att-status-p { background: rgba(255,255,255,0.9); }
.att-cell.att-status-wod { background: #d1fae5; }
.att-cell.att-status-ph { background: #e9d5ff; }
.att-cell.att-status-al { background: #bbf7d0; }
.att-cell.att-status-ml { background: #fecaca; }
.att-cell.att-status-abs { background: #b91c1c; color: #fff; }
.att-cell.att-status-off { background: #fed7aa; }
.att-cell.att-status-oph { background: #fef08a; }
.att-cell.att-status-w { background: #f1f5f9; }
.att-cell.att-status-pl,
.att-cell.att-status-cl,
.att-cell.att-status-opd,
.att-cell.att-status-do { background: #e0f2fe; color: #0369a1; }

/* List group (notices, etc.) */
.list-group-item {
  background: rgba(255, 255, 255, 0.5);
  border: none;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  padding: 0.95rem 1.25rem;
  transition: background var(--transition);
}
.list-group-item:hover {
  background: rgba(255, 255, 255, 0.7);
}
.list-group-item:last-child {
  border-bottom: none;
}

/* User profile picture / avatar in header */
.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}
.header-avatar-initial {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-colorful);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.4);
}
.app-header .user-profile-trigger {
  text-decoration: none;
  color: rgba(226, 232, 240, 0.95);
}
.app-header .user-profile-trigger:hover {
  color: #fff;
}

/* User dropdown in header */
.app-header .dropdown-menu-end .dropdown-item {
  color: var(--text-on-dark);
}
.app-header .dropdown-menu-end .dropdown-item:hover {
  background: rgba(20, 184, 166, 0.2);
  color: #fff;
}

/* DataTables pagination & info */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 8px !important;
  margin: 0 2px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--gradient-colorful) !important;
  border: none !important;
  color: #fff !important;
}

/* Login page body */
body.login-page {
  background: linear-gradient(145deg, #134e4a 0%, #0d9488 40%, #06b6d4 70%, #7c3aed 100%);
  background-attachment: fixed;
}

/* Form check (checkboxes/radios) */
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
.form-check-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

/* Dropdowns in page content (not header) */
.dropdown-menu {
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

/* Breadcrumb / subtle text */
.text-muted {
  color: var(--text-muted) !important;
}

/* ========== Responsive: mobile & desktop ========== */
html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Container & main - comfortable on all screens */
@media (max-width: 575.98px) {
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  main.container-fluid {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
}

/* Page title - scale on small screens */
@media (max-width: 767.98px) {
  .page-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }
}

/* Stat cards - compact on mobile */
@media (max-width: 575.98px) {
  .stat-card {
    padding: 1rem;
  }
  .stat-card .stat-value {
    font-size: 1.5rem;
  }
  .stat-card .stat-label {
    font-size: 0.8rem;
  }
}

/* Cards - body padding on mobile */
@media (max-width: 767.98px) {
  .card-body {
    padding: 1rem;
  }
  .card-header,
  .card-footer {
    padding: 0.75rem 1rem;
  }
}

/* No text wrap in table cells (e.g. Staff List) */
.table-nowrap th,
.table-nowrap td {
  white-space: nowrap;
}

/* Tables - horizontal scroll on mobile/tablet */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}
@media (max-width: 991.98px) {
  .card-body .table,
  .card-body.p-0 .table {
    font-size: 0.875rem;
  }
  .card-body .table thead th,
  .card-body .table tbody td,
  .card-body.p-0 .table thead th,
  .card-body.p-0 .table tbody td {
    padding: 0.5rem 0.6rem;
    white-space: nowrap;
  }
}
@media (max-width: 767.98px) {
  .card-body.p-0 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* DataTables - responsive wrapper */
.dataTables_wrapper {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 767.98px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    text-align: left;
    margin-bottom: 0.5rem;
  }
  .dataTables_wrapper .dataTables_length select,
  .dataTables_wrapper .dataTables_filter input {
    width: 100%;
    max-width: 120px;
  }
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    margin-top: 0.5rem;
    font-size: 0.875rem;
  }
}

/* Nav tabs - horizontal scroll when many tabs */
@media (max-width: 767.98px) {
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 2px;
  }
  .nav-tabs .nav-link {
    white-space: nowrap;
  }
  .nav-pills {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
}

/* Forms - full width inputs on mobile */
@media (max-width: 575.98px) {
  .row.g-2 .col-auto,
  .row.g-3 .col-auto,
  .row.g-2 .col-md-4,
  .row.g-3 .col-md-4,
  .row.g-2 .col-md-6,
  .row.g-3 .col-md-6 {
    width: 100%;
    max-width: 100%;
  }
}

/* Button groups & toolbars - wrap on small screens */
.d-flex.flex-wrap,
.d-flex.gap-2,
.d-flex.gap-3 {
  flex-wrap: wrap;
}
@media (max-width: 575.98px) {
  .btn-group {
    flex-wrap: wrap;
  }
  .btn-group .btn {
    margin-bottom: 0.25rem;
  }
}

/* Header - touch targets and mobile layout */
@media (max-width: 991.98px) {
  .app-header .navbar {
    padding: 0.4rem 0;
  }
  .app-header .navbar-brand {
    font-size: 1.1rem;
  }
  .app-header .nav-link {
    padding: 0.6rem 0.75rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .app-header .navbar-actions .nav-link,
  .app-header .navbar-actions .dropdown .dropdown-toggle {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    display: inline-flex;
    align-items: center;
  }
  .app-header .navbar-toggler {
    padding: 0.5rem 0.65rem;
    min-width: 44px;
    min-height: 44px;
  }
  .app-header .global-search-form {
    width: 100%;
  }
  .app-header .global-search-form .form-control {
    min-height: 40px;
  }
  /* Collapsed menu: scroll if many items */
  .app-header .navbar-collapse {
    max-height: min(85vh, 600px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .app-header .navbar-nav-center {
    width: 100%;
  }
  .app-header .navbar-actions {
    flex-wrap: wrap;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }
}

/* Login - smaller padding on very small screens */
@media (max-width: 375px) {
  .login-wrap {
    padding: 0.75rem;
  }
  .login-card .card-body {
    padding: 1rem 1.25rem;
  }
}

/* Charts - responsive container */
.card-body canvas {
  max-width: 100%;
  height: auto !important;
}
/* Chart.js needs a fixed-height container so the chart doesn't overflow/drag layout */
.chart-container {
  position: relative;
  height: 220px;
  width: 100%;
}
.chart-container.chart-container-sm {
  height: 200px;
}
.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
}
@media (max-width: 767.98px) {
  .card-body canvas {
    max-height: 220px;
  }
  .chart-container {
    height: 200px;
  }
  .chart-container.chart-container-sm {
    height: 180px;
  }
}

/* User Rights - gradient card and readable text */
.rights-card-gradient {
  background: linear-gradient(160deg, #0f766e 0%, #0d9488 35%, #0c7c73 60%, #164e63 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.rights-card-gradient .card-body {
  background: transparent;
}
/* Override .card .table thead th so header matches gradient (no white) */
.rights-card-gradient .rights-table thead,
.rights-card-gradient .rights-thead,
.rights-card-gradient .rights-thead th {
  background: rgba(0, 0, 0, 0.28) !important;
  color: var(--text-on-dark) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  font-weight: 600;
}
.rights-card-gradient .rights-table tbody td {
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}
.rights-card-gradient .rights-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.08);
}
.rights-card-gradient .rights-table {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-on-dark);
}
.rights-card-footer {
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-on-dark);
}
.rights-card-gradient .form-check-input {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}
.rights-card-gradient .form-check-input:checked {
  background-color: var(--primary-light);
  border-color: var(--primary-light);
}
.rights-card-gradient .form-check-input:disabled {
  opacity: 0.8;
}

/* User Rights / wide tables - scroll on small screens */
@media (max-width: 991.98px) {
  .table-responsive {
    border-radius: var(--radius);
  }
}

/* HR Notice Board - no card background, content centered on page, white text */
.notice-board-content {
  background: transparent;
  padding: 0;
  max-width: 100%;
  color: #fff !important;
}
.notice-board-content .notice-item {
  margin-bottom: 2rem;
  padding: 0;
  background: transparent;
  color: #fff !important;
}
.notice-board-content .notice-item strong,
.notice-board-content .notice-item p,
.notice-board-content .notice-item small,
.notice-board-content .notice-item .text-muted,
.notice-board-content .text-muted {
  color: #fff !important;
}
.notice-board-content .notice-item:last-child {
  margin-bottom: 0;
}
.notice-image-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}
.notice-image-wrap img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  .app-header .container-fluid {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Dhivehi (Thaana): Faruma font + RTL. Add /assets/fonts/Faruma.ttf */
@font-face {
  font-family: 'Faruma';
  src: url('/assets/fonts/Faruma.ttf') format('truetype'),
       url('../fonts/Faruma.ttf') format('truetype');
  font-display: swap;
}
.dhivehi-text {
  font-family: 'Faruma', sans-serif;
  direction: rtl;
  text-align: right;
}

/* Daily Information page – auto-generated + your content */
.daily-info-page .letter-spacing {
  letter-spacing: 0.06em;
}
.daily-info-page .fw-600 {
  font-weight: 600;
}
.daily-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.daily-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
.daily-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.daily-card-quote .daily-card-icon {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.2), rgba(6, 182, 212, 0.2));
  color: var(--primary-dark);
}
.daily-card-quote {
  border-left: 4px solid var(--primary);
}
.daily-card-history .daily-card-icon {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(99, 102, 241, 0.2));
  color: #5b21b6;
}
.daily-card-history {
  border-left: 4px solid #8b5cf6;
}
.daily-card-tip .daily-card-icon {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(234, 179, 8, 0.2));
  color: #b45309;
}
.daily-card-tip {
  border-left: 4px solid #f59e0b;
}
.daily-card-custom {
  border-left: 4px solid var(--text-muted);
}
.daily-card-custom .card-body {
  background: var(--surface);
}
.daily-card blockquote p {
  font-style: italic;
  color: var(--text-primary);
}
.daily-card ul li {
  line-height: 1.5;
}

/* Modal: always on top and clickable */
.modal {
  z-index: 2050 !important;
}
.modal-backdrop {
  z-index: 2040 !important;
}
/* Custom backdrop inside modal (when data-bs-backdrop="false") - behind dialog, click to close */
.modal-backdrop-custom {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.modal .modal-dialog {
  position: relative;
  z-index: 1;
}

/* Today Status — department filter tabs */
.today-status-dept-tabs .nav-link {
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
  border-radius: 2rem;
  color: var(--text-primary, #212529);
  background: var(--surface, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
}
.today-status-dept-tabs .nav-link:hover {
  background: var(--bs-secondary-bg, #f8f9fa);
  border-color: var(--bs-border-color, #dee2e6);
}
.today-status-dept-tabs .nav-link.active {
  color: #fff;
  background: var(--bs-dark, #212529);
  border-color: var(--bs-dark, #212529);
}

/* Fusion export — daily time card */
.fusion-time-card {
  min-height: 420px;
}
.fusion-day-list {
  width: 9.5rem;
  max-height: min(70vh, 520px);
}
.fusion-day-list-inner {
  max-height: calc(min(70vh, 520px) - 2.5rem);
  overflow-y: auto;
}
.fusion-day-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  font-size: 0.8125rem;
}
.fusion-day-row:hover {
  background: var(--bs-secondary-bg, #f8f9fa);
}
.fusion-day-row.active {
  background: var(--bs-dark, #212529);
  color: #fff;
}
.fusion-day-row.active:hover {
  color: #fff;
}
.fusion-day-idx {
  width: 1.25rem;
  text-align: right;
  opacity: 0.75;
}
.fusion-grid-scroll {
  max-height: min(70vh, 560px);
  overflow: auto;
}
.fusion-session-table thead th {
  font-size: 0.75rem;
  white-space: nowrap;
}
.fusion-session-table td {
  vertical-align: middle;
}
.fusion-accum-col {
  width: 2.5rem;
}
