:root {
  --navy: #0B2545;
  --navy-2: #123A63;
  --teal: #0E6E62;
  --orange: #E8720C;
  --green: #0E9E6D;
  --amber: #C77A0A;
  --purple: #7C5CFC;
  --red: #D6336C;
  --grey-bg: #F3F4F7;
  --grey-txt: #6B7280;
  --border: #E5E8EE;
  --cream: #FFFDE7;
  --indigo: #E6E9FF;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  background: var(--grey-bg);
  color: #1C2430;
}
h1, h2, h3 { font-family: 'Manrope', system-ui, sans-serif; margin: 0; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--orange); }
table { border-collapse: collapse; width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

.topbar {
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-2) 55%, var(--teal) 100%);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.brand { color: #fff; margin-right: auto; }
.brand-akba { font-family: 'Manrope', sans-serif; font-weight: 800; color: var(--orange); font-size: 18px; }
.brand-rest { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 15px; }
.brand-sub { font-size: 11px; color: #CFE0DA; margin-top: 1px; }

.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a {
  color: #E6EAF0;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
}
.topnav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.topnav a.active { background: rgba(255,255,255,0.18); color: #fff; }

.logout-link {
  color: #fff !important;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
}

.page { padding: 28px 32px; max-width: 1400px; margin: 0 auto; }

.pagefooter {
  text-align: center;
  padding: 20px;
  color: var(--grey-txt);
  font-size: 12px;
}

/* ---- Cards / KPIs ---- */
.kpi-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  border-radius: 14px;
  padding: 19px 21px;
  flex: 1 1 160px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(11,37,69,0.14);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(11,37,69,0.2); }
.kpi-card .num { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 30px; }
.kpi-card .label { font-size: 12px; letter-spacing: 0.4px; margin-top: 4px; opacity: 0.95; }
.kpi-navy { background: linear-gradient(135deg, #0B2545, #123A63); }
.kpi-green { background: linear-gradient(135deg, #0B8C60, var(--green)); }
.kpi-amber { background: linear-gradient(135deg, #A8650A, var(--amber)); }
.kpi-purple { background: linear-gradient(135deg, #6544D6, var(--purple)); }
.kpi-teal { background: linear-gradient(135deg, #0A5A50, var(--teal)); }
.kpi-red { background: linear-gradient(135deg, #B02356, var(--red)); }

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(11,37,69,0.07);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card h2 { font-size: 16px; color: var(--navy); margin-bottom: 14px; }

.grid-2 { display: flex; gap: 20px; flex-wrap: wrap; }
.grid-2 > * { flex: 1 1 380px; }
.grid-3 { display: flex; gap: 20px; flex-wrap: wrap; }
.grid-3 > * { flex: 1 1 260px; }

/* ---- Tables ---- */
.data-table th {
  background: var(--grey-bg);
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: var(--grey-txt);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
.data-table tr:nth-child(even) td { background: #FAFBFC; }
.data-table tbody tr:hover td { background: #EEF3FB; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 20px;
}
.badge-active { background: #E6F7F0; color: var(--green); }
.badge-leave { background: #FDF1E4; color: var(--amber); }
.badge-inactive { background: #F1F2F4; color: var(--grey-txt); }
.badge-terminated { background: #FDEEF2; color: var(--red); }
.badge-late { background: #FDEEF2; color: #991B1B; }
.badge-ontime { background: #E6F7F0; color: #065F46; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid.wide { grid-template-columns: 1fr; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1.5px solid #D9DEE7;
  border-radius: 8px;
  padding: 9px 12px;
  color: #1C2430;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
  font-size: 13.5px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(11,37,69,0.1);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #B8C2D4; }
.field textarea { resize: vertical; min-height: 70px; }
.fieldset-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--orange);
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-outline { background: #fff; color: var(--navy); border: 1px solid #D9DEE7; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #F3C6D3; }
.btn-sm { padding: 6px 14px; font-size: 12px; }

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search-bar input, .search-bar select { flex: 1; min-width: 140px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.alert-success { background: #E6F7F0; color: #065F46; }
.alert-error { background: #FDEEF2; color: #991B1B; }

/* ---- Login ---- */
.login-wrap {
  max-width: 380px;
  margin: 80px auto;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 10px 30px rgba(11,37,69,0.12);
  text-align: center;
}
.login-wrap .field { text-align: left; margin-bottom: 16px; }

/* ---- Attendance scan ---- */
.scan-box {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}
#reader { width: 100%; }
.scan-result {
  text-align: center;
  padding: 20px;
}
.scan-result .avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 20px;
  margin: 0 auto 10px;
}

/* ---- ID Card ---- */
.id-card {
  width: 320px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(11,37,69,0.15);
  overflow: hidden;
  display: inline-block;
  margin: 10px;
  vertical-align: top;
}
.id-card .band {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 60%, var(--teal) 100%);
  padding: 18px 20px 40px;
  color: #fff;
}
.id-card .band .name { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 15px; }
.id-card .photo {
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--navy); border: 5px solid #fff;
  margin: -38px auto 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 28px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}
.id-card .body { text-align: center; padding: 10px 20px 6px; }
.id-card .role { color: var(--orange); font-weight: 700; font-size: 12.5px; }
.id-card .meta { font-size: 11.5px; color: var(--grey-txt); }
.id-card .details { padding: 10px 22px 0; font-size: 11.5px; }
.id-card .details div { display: flex; justify-content: space-between; padding: 3px 0; }
.id-card .qr { text-align: center; padding: 12px 0 6px; }
.id-card .foot { background: var(--navy); color: #fff; text-align: center; font-size: 9px; padding: 8px; letter-spacing: 0.5px; }

@media print {
  .topbar, .pagefooter, .no-print { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
}

/* ============================================================
   Sidebar layout (AKBA ERP style) - replaces the old .topbar
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0B2545 0%, #0E2E5C 100%);
  color: #E6EAF0;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 20px; }
.sidebar-brand .logo-box {
  width: 40px; height: 40px; border-radius: 10px; background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Manrope', sans-serif; font-weight: 800; color: #fff; font-size: 17px; flex-shrink: 0;
}
.sidebar-brand .brand-name { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 14.5px; color: #fff; line-height: 1.2; }
.sidebar-brand .brand-tag { font-size: 10.5px; color: #9FB0C9; }

.sidebar-section-label {
  font-size: 10px; letter-spacing: 0.6px; color: #7C8FAE; font-weight: 700;
  padding: 14px 10px 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px; margin-bottom: 2px;
  color: #C7D2E3; text-decoration: none; font-size: 13.5px; font-weight: 600;
}
.sidebar-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-link.active { background: var(--orange); color: #fff; box-shadow: 0 3px 10px rgba(232,114,12,0.35); font-weight: 700; }
.sidebar-link .icon { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-spacer { flex: 1; }
.sidebar-signout {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px; color: #C7D2E3;
  text-decoration: none; font-size: 13.5px; font-weight: 600; margin-top: 8px;
  border: none; background: none; cursor: pointer; width: 100%; text-align: left;
}
.sidebar-signout:hover { background: rgba(255,255,255,0.08); color: #fff; }

.app-topbar {
  display: flex; justify-content: flex-end; align-items: center; gap: 16px;
  padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--border);
}
#encourageMount { flex: 1; min-width: 0; overflow: hidden; display: flex; align-items: center; }
.encourage-ticker {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: 0.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 0.3s ease;
  position: relative;
  padding: 7px 18px 7px 34px;
  border-radius: 20px;
  background: linear-gradient(90deg, #FDF1E4 0%, #FBF8EF 60%, transparent 100%);
  background-image: linear-gradient(90deg, #0B2545 0%, #1E5FBF 45%, var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  max-width: 100%;
}
.encourage-ticker::before {
  content: '\275D'; /* ornamental quotation mark */
  position: absolute; left: 8px; top: 2px;
  font-family: Georgia, serif;
  font-size: 22px;
  font-style: normal;
  color: var(--orange);
  -webkit-text-fill-color: var(--orange);
  opacity: 0.85;
}
.app-topbar .user-chip { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; color: var(--navy); }
.app-topbar .user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
}
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--grey-bg); }
.app-content { padding: 26px 28px; flex: 1; animation: contentFadeIn 0.35s ease; }
@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; }
  .sidebar-spacer { display: none; }
}

/* ---- Gradient page header card (matches the AKBA ERP reference) ---- */
.page-hero {
  background: linear-gradient(120deg, #0B2545 0%, #123A7A 55%, #4C3FB5 100%);
  border-radius: 16px;
  padding: 22px 26px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(11,37,69,0.2);
}
.page-hero::after {
  content: '';
  position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232,114,12,0.22) 0%, rgba(232,114,12,0) 70%);
  pointer-events: none;
}
.page-hero .hero-icon, .page-hero .hero-text, .page-hero .hero-action { position: relative; z-index: 1; }
.page-hero .hero-icon {
  width: 52px; height: 52px; border-radius: 12px;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.page-hero .hero-text { flex: 1; min-width: 200px; }
.page-hero h1 { font-size: 22px; font-weight: 800; }
.page-hero p { font-size: 13px; color: #CBD5EE; margin-top: 2px; }
.page-hero .hero-action {
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff; font-weight: 700; font-size: 13.5px;
  padding: 11px 20px; border-radius: 10px; text-decoration: none; white-space: nowrap;
}
.page-hero .hero-action:hover { background: rgba(255,255,255,0.26); color: #fff; }

/* ---- White stat cards that sit inside/below the gradient hero ---- */
.stat-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: 14px; padding: 18px 20px; text-align: center;
  box-shadow: 0 4px 14px rgba(11,37,69,0.08);
  border-top: 3px solid var(--orange);
  flex: 1 1 160px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(11,37,69,0.13); }
.stat-card .stat-num { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 26px; }
.stat-card .stat-label { font-size: 11px; letter-spacing: 0.4px; color: var(--grey-txt); font-weight: 700; margin-top: 4px; }
.stat-num.c-navy { color: var(--navy); }
.stat-num.c-amber { color: #C77A0A; }
.stat-num.c-green { color: #0E9E6D; }
.stat-num.c-red { color: #D6336C; }
.stat-num.c-purple { color: #7C5CFC; }

/* ---- Filter pills ---- */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pill {
  background: #fff; border: 1px solid var(--border); color: var(--navy);
  font-weight: 700; font-size: 12.5px; padding: 8px 16px; border-radius: 20px;
  cursor: pointer;
}
.pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--grey-txt); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 14px; }
.empty-state p { font-size: 14px; margin-bottom: 18px; }

@media print {
  .sidebar, .app-topbar, .pagefooter, .no-print { display: none !important; }
  .app-shell { display: block; }
  .app-content { padding: 0; }
}

/* ---- Welcome banner (time-based greeting + verse of the day) ---- */
.welcome-banner {
  background: linear-gradient(120deg, #123A63 0%, #1E5FBF 60%, #4C8DFF 100%);
  border-radius: 16px;
  padding: 20px 26px;
  color: #fff;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(11,37,69,0.18);
}
.welcome-banner::after {
  content: '';
  position: absolute; right: -30px; top: -50px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232,114,12,0.25) 0%, rgba(232,114,12,0) 70%);
}
.welcome-greeting {
  font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 19px;
  display: flex; align-items: center; gap: 6px; position: relative; z-index: 1;
}
.welcome-wave { display: inline-block; animation: welcomeWave 1.8s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes welcomeWave {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(16deg); }
  30% { transform: rotate(-8deg); }
  45% { transform: rotate(14deg); }
  60% { transform: rotate(0deg); }
}
.welcome-date { font-size: 12.5px; color: #CBD9F5; margin-top: 2px; position: relative; z-index: 1; }
.welcome-verse {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.18);
  font-size: 13.5px; font-style: italic; color: #EAF0FC; position: relative; z-index: 1; line-height: 1.5;
}
.welcome-verse-ref { font-style: normal; font-weight: 700; color: var(--orange); }

/* ---- Refined scrollbar (WebKit browsers) - a small detail that reads as polish ---- */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--grey-bg); }
::-webkit-scrollbar-thumb { background: #C7D0DE; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #AEB9CC; }

/* ---- Smooth link/nav transitions ---- */
.sidebar-link, .sidebar-signout { transition: background 0.15s ease, color 0.15s ease; }
a { transition: color 0.12s ease; }
