html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #4f46e5;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ---------- Brand accent ---------- */
a {
  color: #4f46e5;
}
a:hover {
  color: #4338ca;
}

/* ==========================================================================
   Admin shell: fixed sidebar + topbar + content, built on the existing
   vendored Bootstrap 5.3 install. No new asset dependencies.
   ========================================================================== */

:root {
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --sidebar-bg: #111827;
  --sidebar-bg-hover: #1c2536;
  --sidebar-bg-active: #232d43;
  --sidebar-color: #9aa5b8;
  --sidebar-color-active: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-accent: #6366f1;
}

[data-bs-theme="dark"] {
  --sidebar-bg: #0b0f19;
  --sidebar-bg-hover: #151b2b;
  --sidebar-bg-active: #1a2236;
}

* {
  box-sizing: border-box;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-color);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform 0.25s ease;
  scrollbar-width: thin;
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--sidebar-border);
  position: sticky;
  top: 0;
  background: var(--sidebar-bg);
  z-index: 1;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #fff;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--sidebar-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.brand-text {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: #fff;
}

.sidebar-nav {
  padding: 0.75rem 0.75rem 1.5rem;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--sidebar-color);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.3;
}

.sidebar .nav-link:hover {
  background: var(--sidebar-bg-hover);
  color: #fff;
}

.sidebar .nav-link.active {
  background: var(--sidebar-bg-active);
  color: var(--sidebar-color-active);
}

.sidebar .nav-link.active .nav-icon {
  color: var(--sidebar-accent);
}

.sidebar .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar .nav-link-group {
  cursor: pointer;
}

.sidebar .nav-link-group .nav-icon:last-child {
  width: 14px;
  height: 14px;
  margin-left: auto;
  transition: transform 0.2s ease;
}

.sidebar .nav-link-group[aria-expanded="true"] .nav-icon:last-child {
  transform: rotate(180deg);
}

.nav-sub {
  padding: 0.15rem 0 0.35rem 0;
}

.nav-sub .nav-link {
  padding-left: 2.5rem;
  font-size: 0.85rem;
}

.sidebar-divider {
  margin: 0.35rem 1rem;
  border-color: var(--sidebar-border);
  opacity: 1;
}

.sidebar-backdrop {
  display: none;
}

/* ---------- Topbar ---------- */
.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-spacer {
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topbar-action-btn {
  color: var(--bs-body-color);
  text-decoration: none;
  border: none;
}

.topbar-action-btn:hover {
  color: var(--bs-body-color);
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #4f46e5;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
}

.sidebar-toggle-btn span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--bs-body-color);
}

/* ---------- Content ---------- */
.app-content {
  flex: 1;
  padding: 1.5rem;
}

.app-content .container-fluid {
  padding: 0;
}

.app-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--bs-border-color);
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

/* ---------- Responsive: off-canvas sidebar below 992px ---------- */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .sidebar-toggle-btn {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1025;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .app-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ---------- RTL (Arabic) ---------- */
[dir="rtl"] body {
  text-align: right;
}

[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
}

[dir="rtl"] .app-main {
  margin-left: 0;
  margin-right: var(--sidebar-width);
}

[dir="rtl"] .nav-sub .nav-link {
  padding-left: 0.75rem;
  padding-right: 2.5rem;
}

[dir="rtl"] .sidebar .nav-link-group .nav-icon:last-child {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .dropdown-menu-end {
  --bs-position: start;
}

@media (max-width: 991.98px) {
  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  [dir="rtl"] .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  [dir="rtl"] .app-main {
    margin-right: 0;
  }
}

/* ==========================================================================
   Global feedback UI: toasts, an error modal, and a page-transition loader.
   Driven by wwwroot/js/ui-feedback.js (window.HrmsAlert / the loader).
   ========================================================================== */

.hrms-toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
  width: calc(100% - 2rem);
}

[dir="rtl"] .hrms-toast-container {
  right: auto;
  left: 1rem;
}

.hrms-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  border-left: 4px solid #6b7280;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[dir="rtl"] .hrms-toast {
  border-left: none;
  border-right: 4px solid #6b7280;
}

.hrms-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.hrms-toast-success { border-left-color: #16a34a; }
.hrms-toast-error { border-left-color: #dc2626; }
.hrms-toast-warning { border-left-color: #d97706; }
.hrms-toast-info { border-left-color: #4f46e5; }
[dir="rtl"] .hrms-toast-success { border-right-color: #16a34a; }
[dir="rtl"] .hrms-toast-error { border-right-color: #dc2626; }
[dir="rtl"] .hrms-toast-warning { border-right-color: #d97706; }
[dir="rtl"] .hrms-toast-info { border-right-color: #4f46e5; }

.hrms-toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.hrms-toast-success .hrms-toast-icon { background: #16a34a; }
.hrms-toast-error .hrms-toast-icon { background: #dc2626; }
.hrms-toast-warning .hrms-toast-icon { background: #d97706; }
.hrms-toast-info .hrms-toast-icon { background: #4f46e5; }

.hrms-toast-message {
  flex: 1;
  font-size: 0.9rem;
  padding-top: 2px;
}

.hrms-toast-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--bs-secondary-color);
  cursor: pointer;
  padding: 0;
}

/* ---------- Error modal (sweetalert-style) ---------- */
.hrms-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1095;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 1rem;
}

.hrms-modal-overlay.show {
  opacity: 1;
}

.hrms-modal {
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-radius: 12px;
  padding: 2rem 1.75rem 1.75rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.92);
  transition: transform 0.2s ease;
}

.hrms-modal-overlay.show .hrms-modal {
  transform: scale(1);
}

.hrms-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
}

.hrms-modal-icon-error { background: #dc2626; }
.hrms-modal-icon-success { background: #16a34a; }
.hrms-modal-icon-warning { background: #d97706; }
.hrms-modal-icon-info { background: #4f46e5; }

.hrms-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hrms-modal-message {
  color: var(--bs-secondary-color);
  margin-bottom: 1.25rem;
}

/* ---------- Page-transition loader ---------- */
.hrms-page-loader {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

[data-bs-theme="dark"] .hrms-page-loader {
  background: rgba(11, 15, 25, 0.6);
}

.hrms-page-loader.active {
  opacity: 1;
  pointer-events: auto;
}

.hrms-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(79, 70, 229, 0.25);
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: hrms-spin 0.7s linear infinite;
}

@keyframes hrms-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   ESS Dashboard widgets
   ========================================================================== */

:root {
  --dash-grad-1: #4f46e5;
  --dash-grad-2: #7c3aed;
  --dash-grad-3: #c026d3;
  --dash-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -14px rgba(15, 23, 42, 0.16);
  --dash-shadow-hover: 0 4px 10px rgba(15, 23, 42, 0.06), 0 20px 40px -16px rgba(15, 23, 42, 0.22);
}

[data-bs-theme="dark"] {
  --dash-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 28px -14px rgba(0, 0, 0, 0.5);
  --dash-shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.25), 0 20px 40px -16px rgba(0, 0, 0, 0.6);
}

/* ---------- Greeting banner ---------- */
.dashboard-hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(120deg, var(--dash-grad-1), var(--dash-grad-2) 55%, var(--dash-grad-3));
  color: #fff;
  box-shadow: var(--dash-shadow);
}

.dashboard-hero::before,
.dashboard-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.dashboard-hero::before {
  width: 260px;
  height: 260px;
  top: -140px;
  right: -60px;
}

.dashboard-hero::after {
  width: 160px;
  height: 160px;
  bottom: -90px;
  right: 140px;
  background: rgba(255, 255, 255, 0.08);
}

[dir="rtl"] .dashboard-hero::before { right: auto; left: -60px; }
[dir="rtl"] .dashboard-hero::after { right: auto; left: 140px; }

.dashboard-hero-content {
  position: relative;
  z-index: 1;
}

.dashboard-hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 0.25rem;
}

.dashboard-hero-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.dashboard-hero-sub {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.92rem;
  margin-bottom: 0;
}

.dashboard-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

/* ---------- Card polish ---------- */
.dashboard-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  box-shadow: var(--dash-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--dash-shadow-hover);
}

.dashboard-card .card-body {
  padding: 1.25rem 1.35rem;
}

.dashboard-card-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 0;
}

.dashboard-icon-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
  background: linear-gradient(135deg, var(--dash-grad-1), var(--dash-grad-2));
}

.dashboard-icon-badge svg {
  width: 19px;
  height: 19px;
}

.dashboard-icon-badge.tint-violet { background: linear-gradient(135deg, #7c3aed, #c026d3); }
.dashboard-icon-badge.tint-emerald { background: linear-gradient(135deg, #059669, #10b981); }
.dashboard-icon-badge.tint-amber { background: linear-gradient(135deg, #d97706, #f59e0b); }
.dashboard-icon-badge.tint-rose { background: linear-gradient(135deg, #e11d48, #f43f5e); }
.dashboard-icon-badge.tint-sky { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.dashboard-icon-badge.tint-slate { background: linear-gradient(135deg, #475569, #64748b); }

/* ---------- Stat tiles (Company Overview) ---------- */
.dashboard-stat-tile .card-body {
  padding: 1.25rem 1.35rem;
}

.dashboard-stat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.dashboard-stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.dashboard-stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.dashboard-stat-link {
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Pill tabs ---------- */
.dashboard-tabs {
  border-bottom: none !important;
  background: var(--bs-tertiary-bg);
  border-radius: 999px;
  padding: 0.25rem;
  display: inline-flex;
  gap: 0.15rem;
}

.dashboard-tabs .nav-link {
  border: none !important;
  border-radius: 999px !important;
  padding: 0.32rem 0.85rem !important;
  font-weight: 600;
  color: var(--bs-secondary-color);
  background: transparent !important;
}

.dashboard-tabs .nav-link.active {
  background: var(--bs-body-bg) !important;
  color: var(--dash-grad-1) !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

/* ---------- CTA card (check in/out) ---------- */
.dashboard-cta {
  border-radius: 14px;
  padding: 1rem;
  background: linear-gradient(160deg, color-mix(in srgb, var(--dash-grad-1) 10%, transparent), color-mix(in srgb, var(--dash-grad-2) 6%, transparent));
  border: 1px solid color-mix(in srgb, var(--dash-grad-1) 18%, var(--bs-border-color));
}

/* ---------- Entrance animation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .dashboard-animate {
    animation: dashboard-fade-up 0.45s ease both;
  }
}

@keyframes dashboard-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .row > div:nth-child(1) .dashboard-animate { animation-delay: 0s; }
  .row > div:nth-child(2) .dashboard-animate { animation-delay: 0.06s; }
  .row > div:nth-child(3) .dashboard-animate { animation-delay: 0.12s; }
  .row > div:nth-child(4) .dashboard-animate { animation-delay: 0.18s; }
  .row > div:nth-child(5) .dashboard-animate { animation-delay: 0.24s; }
  .row > div:nth-child(6) .dashboard-animate { animation-delay: 0.3s; }
  .row > div:nth-child(7) .dashboard-animate { animation-delay: 0.36s; }
}

.dashboard-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 0 0 4px color-mix(in srgb, #6366f1 18%, transparent);
}

.dashboard-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dashboard-avatar-initials {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}

.dashboard-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 2px;
}

.dashboard-scroll-table {
  max-height: 220px;
  overflow-y: auto;
}

.dashboard-timer {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
