:root {
  --primary: #0d9488;
  --green: #27ae60;
  --yellow: #f2c94c;
  --red: #eb5757;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff;
  --bg: #f4f7ff;
  /** Sidebar, login hero, and logo “plate” (single-color #0D9488 logos read well on this). */
  --hrms-brand-gradient: linear-gradient(170deg, #0e1a3b, #122452 55%, #1a2f67);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, #e8f0ff, #f8fbff 40%, #f4f7ff 100%);
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 280px;
  background: var(--hrms-brand-gradient);
  color: #dbeafe;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1200;
  transition: transform 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(13, 148, 136, 0.35);
  color: #fff;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  color: #fff;
}

.brand p {
  margin: 0;
  font-size: 12px;
  color: #cbd5e1;
}

.brand--with-logo {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

/** Same navy gradient as login/sidebar — logo sits on this so one teal logo works everywhere. */
.brand-logo-plate {
  background: var(--hrms-brand-gradient);
  border-radius: 14px;
  padding: 12px 16px;
  box-sizing: border-box;
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-logo-plate--login {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 16px;
}

.brand-logo-img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 52px;
  object-fit: contain;
}

.brand-tagline-under-logo {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #cbd5e1;
}

.nav-menu {
  display: grid;
  gap: 6px;
}

.nav-link-item {
  border: 0;
  background: transparent;
  color: #dbeafe;
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  width: 100%;
  cursor: pointer;
}

a.nav-link-item {
  color: #dbeafe;
}

.nav-link-item:hover,
.nav-link-item.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.content {
  margin-left: 280px;
  width: calc(100% - 280px);
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
}

.search-wrap input {
  border: 0;
  outline: 0;
  width: 100%;
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  width: 44px;
  height: 44px;
}

.notif-bell-link {
  text-decoration: none;
  color: inherit;
}

.notif-count-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.notification-list .list-group-item {
  border-color: var(--line);
}

.notification-unread {
  background: rgba(47, 128, 237, 0.06);
}

.profile-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-chip img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.profile-chip h6,
.profile-chip p {
  margin: 0;
  line-height: 1.2;
}

.profile-chip h6 {
  font-size: 13px;
}

.profile-chip p {
  font-size: 11px;
  color: var(--muted);
}

.page-head {
  background: linear-gradient(120deg, #0d9488, #0f766e);
  color: #fff;
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.page-head h2 {
  margin: 0;
  font-size: 22px;
}

.page-head p {
  margin: 6px 0 0 0;
  color: #dbeafe;
}

.head-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-soft {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.badge-soft.success {
  background: rgba(39, 174, 96, 0.22);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
}

.stat-icon {
  width: 45px;
  height: 45px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 19px;
}

.stat-icon.blue {
  background: rgba(47, 128, 237, 0.14);
  color: var(--primary);
}

.stat-icon.green {
  background: rgba(39, 174, 96, 0.14);
  color: var(--green);
}

.stat-icon.yellow {
  background: rgba(242, 201, 76, 0.22);
  color: #a17400;
}

.stat-icon.red {
  background: rgba(235, 87, 87, 0.16);
  color: var(--red);
}

.stat-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.stat-card h3 {
  margin: 2px 0;
  font-size: 23px;
}

.stat-card span {
  font-size: 12px;
  color: var(--muted);
}

.stat-card .up {
  color: var(--green);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}

.glass-card {
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(6px);
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-head h4 {
  margin: 0;
  font-size: 16px;
}

.table-modern th {
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
}

.table-modern td {
  font-size: 14px;
}

.pill {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pill.success {
  background: rgba(39, 174, 96, 0.14);
  color: var(--green);
}

.pill.warning {
  background: rgba(242, 201, 76, 0.25);
  color: #8d6500;
}

.pill.danger {
  background: rgba(235, 87, 87, 0.16);
  color: #c53030;
}

.pill.secondary {
  background: rgba(100, 116, 139, 0.18);
  color: #475569;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.mini-item h6,
.mini-item p {
  margin: 0;
}

.mini-item h6 {
  font-size: 14px;
}

.mini-item p {
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
}

.activity-feed {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.activity-feed li {
  color: #1f2937;
  font-size: 14px;
}

.activity-feed .activity-feed-ts {
  color: #64748b;
  margin-right: 6px;
  font-weight: 600;
}

.audit-json-pre {
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
  margin: 0;
  background: transparent;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.attendance-map-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e8eef5;
}

.attendance-map {
  height: min(52vh, 320px);
  width: 100%;
}

.attendance-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.attendance-legend-office {
  background: #0d9488;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* Leaflet: office marker = map pin (teardrop) + building or logo in head */
.hrms-office-marker-leaflet {
  background: transparent !important;
  border: none !important;
}

.hrms-map-pin {
  width: 48px;
  height: 56px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  pointer-events: none;
}

/* Rotated square with one sharp corner = classic map-pin silhouette */
.hrms-map-pin-head {
  width: 38px;
  height: 38px;
  margin-top: 4px;
  background: linear-gradient(155deg, #14b8a6, #0d9488 45%, #0f766e);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.55), 0 2px 4px rgba(15, 23, 42, 0.12);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hrms-map-pin-head i {
  transform: rotate(45deg);
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
}

/* Logo inside pin head (counter-rotated) */
.hrms-map-pin--brand .hrms-map-pin-head {
  background: #fff;
}

.hrms-map-pin--brand .hrms-map-pin-head img {
  transform: rotate(45deg);
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.attendance-legend-you {
  background: #2563eb;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
    width: 100%;
    padding: 16px;
  }

  .profile-chip div {
    display: none;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .search-wrap {
    width: 100%;
    order: 3;
  }
}

/* Login page */
.login-body {
  min-height: 100vh;
  margin: 0;
  position: relative;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-brand-panel {
  background: var(--hrms-brand-gradient);
  color: #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}

.login-brand-inner {
  max-width: 420px;
}

.login-brand-panel h1 {
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  margin: 16px 0 12px;
}

.login-brand-panel p {
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.6;
}

.login-brand-logo {
  display: block;
  max-width: min(320px, 100%);
  height: auto;
  margin-bottom: 0;
}

.login-brand-lead {
  margin: 0 0 8px;
}

.brand-badge-lg {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(13, 148, 136, 0.35);
  color: #fff;
  font-size: 26px;
}

.login-features {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 12px;
}

.login-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #e2e8f0;
}

.login-features i {
  color: var(--green);
}

.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.login-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.login-hint code {
  font-size: 11px;
}

.login-submit {
  border-radius: 12px;
  font-weight: 600;
}

.login-skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 10;
  padding: 8px 12px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.login-password-wrap .form-control {
  border-radius: 12px 0 0 12px;
}

.login-password-wrap .login-toggle-password {
  border-radius: 0 12px 12px 0;
  border-color: var(--line, #e2e8f0);
}

.login-password-wrap .login-toggle-password:focus {
  box-shadow: none;
}

.top-actions .profile-chip.dropdown-toggle {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: none;
}

.top-actions .profile-chip.dropdown-toggle::after {
  margin-left: 4px;
}

@media (max-width: 991px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    padding: 32px 24px;
    min-height: auto;
  }

  .login-form-panel {
    padding-bottom: 48px;
  }
}

/* Settings — office map (Leaflet) */
.settings-office-map {
  height: min(420px, 55vh);
  min-height: 280px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e8eef7;
}

.settings-office-map .leaflet-container {
  font-family: inherit;
}

.settings-map-legend {
  font-size: 12px;
  color: var(--muted);
}

/* PWA — small optional hint (corner chip, easy to dismiss) */
.pwa-install-hint {
  position: fixed;
  z-index: 1080;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  left: auto;
  width: min(300px, calc(100vw - 24px));
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.22s ease;
}

.pwa-install-hint--visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.pwa-install-hint__card {
  background: var(--card, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.1);
  padding: 10px 12px 10px 10px;
}

.pwa-install-hint__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.pwa-install-hint__label {
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--text, #0f172a);
  padding-top: 2px;
}

.pwa-install-hint__close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin: -4px -4px -4px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #64748b);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-install-hint__close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text, #0f172a);
}

.pwa-install-hint__text {
  font-size: 0.75rem;
  color: var(--muted, #64748b);
  line-height: 1.45;
  margin: 0 0 8px 0;
}

.pwa-install-hint__text p {
  margin: 0 0 6px 0;
}

.pwa-install-hint__text p:last-child {
  margin-bottom: 0;
}

.pwa-install-hint__text code {
  font-size: 0.7rem;
}

.pwa-install-hint__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.pwa-install-hint__actions .btn {
  font-size: 0.75rem;
  padding: 0.28rem 0.65rem;
}

.pwa-install-hint__ios-icon {
  font-weight: 700;
  color: var(--accent, #0d9488);
}
