/* =====================================================================
 * MAS — Multi Allrounder Services
 * Theme overrides for Gentelella v4 to match the MAS brand palette.
 * Colors are derived from the MAS logo (deep navy → cyan-blue gradient).
 * ===================================================================== */

:root {
  /* Brand palette — MAS blues */
  --primary: #1F5A8C;
  --primary-lt: rgba(31, 90, 140, 0.08);
  --primary-dk: #154470;

  /* Sidebar — deeper navy from the logo */
  --sidebar-bg: #0F2A47;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-active: rgba(63, 165, 219, 0.12);
  --sidebar-text: #8aa0bb;
  --sidebar-text-hover: #d6e2f0;
  --sidebar-text-active: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.07);

  /* Repaint the PWA theme color */
  --theme-color: #1F5A8C;
}

[data-theme="dark"] {
  --primary: #3FA5DB;
  --primary-lt: rgba(63, 165, 219, 0.10);
  --primary-dk: #2C7BB6;
  --sidebar-bg: #0a1c30;
}

/* Brand block in the sidebar — replace the default "G" tile with the logo */
.sidebar-brand {
  padding: 18px 16px 14px;
}

.sidebar-brand .brand-icon {
  background: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 0;
  flex-shrink: 0;
}

.sidebar-brand .brand-icon img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.sidebar-brand .brand-name {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.sidebar-brand .brand-name small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--sidebar-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Auth pages — full-bleed brand panel */
.auth-card .auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.auth-card .auth-brand img {
  width: 180px;
  max-width: 80%;
  height: auto;
}

.auth-card .auth-brand .brand-tag {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
}

/* Buttons — deeper hover for the new primary */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-dk);
  border-color: var(--primary-dk);
}

/* Server-side validation errors */
.invalid-feedback {
  display: block;
  font-size: 12.5px;
  color: var(--red);
  margin-top: 6px;
}

.form-control.is-invalid,
.is-invalid .form-control {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(214, 57, 57, 0.08);
}

/* Flash alert banner */
.flash-alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
}

.flash-alert--success {
  background: rgba(47, 179, 68, 0.08);
  border-color: rgba(47, 179, 68, 0.24);
  color: #1f7a2c;
}

.flash-alert--error {
  background: rgba(214, 57, 57, 0.08);
  border-color: rgba(214, 57, 57, 0.24);
  color: #b62a2a;
}

/* Topbar avatar fallback (initials chip) */
.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* Profile / settings page — page header */
.page-section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text);
}

.page-section-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  background: var(--primary-lt);
  color: var(--primary);
  border: 1px solid rgba(31, 90, 140, 0.18);
}

.role-pill--manager {
  background: rgba(245, 159, 0, 0.10);
  color: #c47900;
  border-color: rgba(245, 159, 0, 0.25);
}

.role-pill--staff {
  background: rgba(99, 109, 125, 0.10);
  color: #4a5360;
  border-color: rgba(99, 109, 125, 0.22);
}

/* =====================================================================
 * Settings page — sub-nav (Profile / Password) on a light card.
 * The default .nav-sublink class is tuned for the dark sidebar and looks
 * washed-out on a light surface, so we override the colors here.
 * ===================================================================== */
.settings-subnav {
  padding: 6px;
}

.settings-subnav__link {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.settings-subnav__link:hover {
  background: var(--bg-surface-secondary);
  color: var(--text);
}

.settings-subnav__link.is-active {
  background: var(--primary-lt);
  color: var(--primary);
  font-weight: 600;
}

/* =====================================================================
 * Sticky footer — pin the footer to the bottom of the viewport when the
 * page content is short, push it down naturally when content is long.
 * The Gentelella shell uses CSS grid (sidebar | main), and `<main>` gets
 * height: 100vh from the framework. We use flexbox inside to keep the
 * footer at the bottom and let .page-wrapper take the remaining space.
 * ===================================================================== */
main.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main.main > .page-wrapper {
  flex: 1 0 auto;
}

main.main > .footer {
  flex: 0 0 auto;
  margin-top: auto;
}

/* =====================================================================
 * Topbar language switcher
 * ===================================================================== */
.mas-lang {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .mas-lang {
  background: rgba(255, 255, 255, 0.04);
}

.mas-lang__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 2px;
  color: var(--text-muted);
}

.mas-lang__pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-right: 3px;
}

.mas-lang__form {
  margin: 0;
}

.mas-lang__pill {
  min-width: 38px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.mas-lang__pill:hover {
  color: var(--text);
  background: rgba(31, 90, 140, 0.08);
}

.mas-lang__pill.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  box-shadow: 0 4px 12px rgba(31, 90, 140, 0.28);
}

.mas-lang__pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 90, 140, 0.22);
}

.auth-page .mas-lang {
  margin: 0 auto 18px;
  width: fit-content;
}

.auth-page .mas-lang__pill {
  min-width: 44px;
  height: 32px;
}

/* =====================================================================
 * Topbar user menu (Profile / Change password / Sign out).
 * Replaces Gentelella's default `.tb-avatar` menu so the items match
 * the actual routes in this app — no theme generator, no lock screen.
 * ===================================================================== */
.mas-user {
  position: relative;
  margin-left: 6px;
}

.mas-user__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #ffffff;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.mas-user__avatar:hover {
  transform: scale(1.06);
}

.mas-user__avatar:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 90, 140, 0.25);
}

.mas-user__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 224px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(15, 42, 71, 0.10), 0 0 0 1px var(--border-translucent);
  padding: 6px;
  z-index: 60;
}

.mas-user__head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border-color-light);
  margin-bottom: 6px;
}

.mas-user__name {
  font-weight: 600;
  color: var(--text);
  font-size: 13.5px;
}

.mas-user__email {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  word-break: break-all;
}

.mas-user__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease;
}

.mas-user__item svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.mas-user__item:hover {
  background: var(--primary-lt);
  color: var(--primary);
}

.mas-user__item:hover svg {
  color: var(--primary);
}

.mas-user__item--danger {
  color: var(--red);
}

.mas-user__item--danger svg {
  color: var(--red);
}

.mas-user__item--danger:hover {
  background: rgba(214, 57, 57, 0.08);
  color: var(--red);
}

.mas-user__item--danger:hover svg {
  color: var(--red);
}

.mas-user__divider {
  height: 1px;
  background: var(--border-color-light);
  margin: 6px 4px;
}

.mas-user__logout {
  margin: 0;
}

/* =====================================================================
 * Resource-list pages (Locations / Staff / Managers).
 * Toolbar with search + primary action, table actions, status pills,
 * empty state, pagination shell, and modal-confirm helpers.
 * ===================================================================== */
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.list-toolbar .search {
  position: relative;
  flex: 1 1 280px;
  max-width: 380px;
}

.list-toolbar .search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.list-toolbar .search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.list-toolbar .search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}

.list-toolbar .actions {
  display: flex;
  gap: 8px;
}

.table-actions {
  display: inline-flex;
  gap: 6px;
}

.table-actions .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.table-actions .icon-btn:hover {
  background: var(--primary-lt);
  color: var(--primary);
  border-color: rgba(31, 90, 140, 0.25);
}

.table-actions .icon-btn--danger:hover {
  background: rgba(214, 57, 57, 0.10);
  color: var(--red);
  border-color: rgba(214, 57, 57, 0.30);
}

.table-actions form {
  margin: 0;
  display: inline-flex;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill--on {
  background: rgba(47, 179, 68, 0.10);
  color: #1f7a2c;
}

.status-pill--off {
  background: rgba(99, 109, 125, 0.12);
  color: #4a5360;
}

.status-pill--archived {
  background: rgba(245, 159, 0, 0.10);
  color: #c47900;
}

.status-pill--archived::before {
  background: #c47900;
}

/* Soft-deleted row tint (Locations / Staff / Managers) */
.row-archived td {
  background: rgba(245, 159, 0, 0.04);
}

.row-archived td:first-child {
  border-left: 3px solid rgba(245, 159, 0, 0.55);
}

.icon-btn--success:hover {
  background: rgba(47, 179, 68, 0.10);
  color: #1f7a2c;
  border-color: rgba(47, 179, 68, 0.30);
}

.empty-state {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--primary-lt);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state__subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.list-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--border-color-light);
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.list-pagination .pages {
  display: flex;
  gap: 4px;
}

.list-pagination .pages a,
.list-pagination .pages span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.list-pagination .pages a:hover {
  background: var(--primary-lt);
  color: var(--primary);
}

.list-pagination .pages .is-current {
  background: var(--primary);
  color: #ffffff;
}

.list-pagination .pages .is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* User cell — avatar + name + email */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.user-cell__meta strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
}

.user-cell__meta small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* =====================================================================
 * Form pages — two column form-grid + helper text + switches.
 * ===================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.form-grid .form-group--full {
  grid-column: 1 / -1;
}

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

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}

.checkbox-pill input {
  accent-color: var(--primary);
}

.checkbox-pill:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--text-primary);
}

.form-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.form-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.form-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.form-switch__track {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-color);
  position: relative;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.form-switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease;
}

.form-switch input:checked + .form-switch__track {
  background: var(--primary);
}

.form-switch input:checked + .form-switch__track::after {
  transform: translateX(16px);
}

.form-switch__label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.form-switch__hint {
  font-size: 12px;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color-light);
}

/* =====================================================================
 * Location form — Nominatim autocomplete + Leaflet map picker.
 * ===================================================================== */
.location-search {
  position: relative;
}

.location-search__results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 42, 71, 0.12);
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  display: none;
}

.location-search__results.is-open {
  display: block;
}

.location-search__item {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  align-items: flex-start;
}

.location-search__item svg {
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 2px;
}

.location-search__item:hover,
.location-search__item.is-active {
  background: var(--primary-lt);
}

.location-search__empty {
  padding: 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

.map-picker {
  height: 360px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--bg-surface-secondary);
}

.map-picker-empty {
  height: 360px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

.coord-display {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color-light);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 8px;
}

/* =====================================================================
 * Dashboard — operations-focused widgets (stat tiles, role distribution,
 * compact lists, mini-map).
 * ===================================================================== */
.op-stat {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
}

.op-stat__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--primary-lt);
  color: var(--primary);
}

.op-stat__icon--blue   { background: rgba(59, 124, 207, 0.10); color: #2c5fb6; }
.op-stat__icon--green  { background: rgba(47, 179, 68, 0.10); color: #1f7a2c; }
.op-stat__icon--amber  { background: rgba(245, 159, 0, 0.12); color: #c47900; }
.op-stat__icon--purple { background: rgba(123, 75, 196, 0.10); color: #6a3eb1; }

.op-stat__body { flex: 1; min-width: 0; }
.op-stat__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.op-stat__value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.05;
}

.op-stat__sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.op-stat__cta {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.op-stat__cta:hover { text-decoration: underline; }

.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mini-list__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color-light);
}

.mini-list__row:last-child { border-bottom: 0; }

.mini-list__row .pin {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--primary-lt);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mini-list__row .body {
  flex: 1;
  min-width: 0;
}

.mini-list__row .body strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-list__row .body span {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-list__row .body span.coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
}

.role-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.role-split .tile {
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg-surface-secondary);
}

.role-split .tile .num {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.role-split .tile .lbl {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.role-split .tile .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dashboard-map {
  height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.dashboard-map-empty {
  height: 320px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

/* Leaflet on dark theme — soften the tiles a touch */
[data-theme="dark"] .leaflet-tile {
  filter: brightness(0.85) contrast(1.05);
}

/* =====================================================================
 * Topbar notification bell (sibling of .mas-user)
 * ===================================================================== */
.mas-bell {
  position: relative;
  margin-left: 4px;
}

.mas-bell__toggle {
  position: relative;
}

.mas-bell__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--bg-surface);
  box-sizing: content-box;
}

.mas-bell__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 360px;
  max-width: 90vw;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(15, 42, 71, 0.10), 0 0 0 1px var(--border-translucent);
  z-index: 60;
  overflow: hidden;
}

.mas-bell__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color-light);
}

.mas-bell__title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.mas-bell__mark-all {
  background: transparent;
  border: 0;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 6px;
  border-radius: 6px;
}

.mas-bell__mark-all:hover {
  background: var(--primary-lt);
}

.mas-bell__list {
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 380px;
  overflow-y: auto;
}

.mas-bell__item {
  border-radius: 8px;
}

.mas-bell__item.is-unread {
  background: rgba(31, 90, 140, 0.04);
}

.mas-bell__link {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--text);
  align-items: flex-start;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.mas-bell__link:hover {
  background: var(--primary-lt);
}

.mas-bell__icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-lt);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.mas-bell__icon.is-flag {
  background: rgba(214, 57, 57, 0.10);
  color: var(--red);
}

.mas-bell__body {
  flex: 1;
  min-width: 0;
}

.mas-bell__text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.mas-bell__time {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.mas-bell__empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.mas-bell__foot {
  display: block;
  text-align: center;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border-top: 1px solid var(--border-color-light);
}

.mas-bell__foot:hover {
  background: var(--primary-lt);
}

/* =====================================================================
 * Application settings — radius input with suffix + preset row
 * ===================================================================== */
.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-suffix .form-control {
  padding-right: 70px;
}

.input-with-suffix .suffix {
  position: absolute;
  right: 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  pointer-events: none;
}

.radius-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
}

.radius-presets__label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}

/* Live preview block under the date-format dropdown */
.format-preview {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-surface-secondary, rgba(0, 0, 0, 0.025));
  border: 1px solid var(--border-color-light, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius, 6px);
  font-size: 12.5px;
}

.format-preview__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
}

.format-preview__row + .format-preview__row {
  border-top: 1px dashed var(--border-color-light, rgba(0, 0, 0, 0.08));
}

.format-preview__label {
  color: var(--text-muted);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.format-preview__value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 600;
}

/* =====================================================================
 * Attendance page — filter tabs, flagged row highlight, flag badge
 * ===================================================================== */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.filter-tab:hover {
  background: var(--bg-surface);
  color: var(--text);
}

.filter-tab.is-active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(15, 42, 71, 0.06);
}

.filter-tab--danger.is-active {
  color: var(--red);
}

.filter-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--border-color-light);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.filter-tab.is-active .filter-tab__count {
  background: var(--primary-lt);
  color: var(--primary);
}

.filter-tab--danger.is-active .filter-tab__count {
  background: rgba(214, 57, 57, 0.12);
  color: var(--red);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.filter-select {
  min-width: 140px;
  max-width: 200px;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.filter-date {
  width: 170px;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

/* Flatpickr — tweak the popup to match the admin theme */
.flatpickr-calendar {
  font-family: inherit !important;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-color-light, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius, 6px);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  background: var(--accent, #4084f0);
  border-color: var(--accent, #4084f0);
  color: #fff;
}

.flatpickr-day.today {
  border-color: var(--accent, #4084f0);
}

.date-range__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 -2px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-meta {
  margin-top: 8px;
  padding: 6px 12px;
  background: rgba(var(--accent-rgb, 64, 132, 240), 0.06);
  border-left: 3px solid var(--accent, #4084f0);
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.filter-meta strong {
  color: var(--text);
  font-weight: 600;
}

/* Highlight a flagged row in the attendance table */
.row-flagged td {
  background: rgba(214, 57, 57, 0.04);
}

.row-flagged td:first-child {
  border-left: 3px solid var(--red);
}

/* Red flag badge — used in tables, the bell, the dashboard list */
.flag-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(214, 57, 57, 0.10);
  color: var(--red);
  text-transform: uppercase;
}

/* Alert banner at the top of the dashboard */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: rgba(214, 57, 57, 0.07);
  border: 1px solid rgba(214, 57, 57, 0.20);
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s ease;
}

.alert-banner:hover {
  background: rgba(214, 57, 57, 0.10);
}

.alert-banner__icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(214, 57, 57, 0.12);
  color: var(--red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-banner__body {
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
}

.alert-banner__cta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--red);
  white-space: nowrap;
}

/* Op-stat icon variants */
.op-stat__icon--red   { background: rgba(214, 57, 57, 0.10); color: var(--red); }
.op-stat-card--alert  { border-color: rgba(214, 57, 57, 0.18); }

/* Flagged row inside the dashboard mini-list */
.mini-list__row--flagged .pin.pin--flag {
  background: rgba(214, 57, 57, 0.10);
  color: var(--red);
}

/* =====================================================================
 * Cleaning category icons — Material Icons picker + inline display
 * ===================================================================== */
.category-icon,
.icon-picker .material-icons {
  font-family: "Material Icons";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

.category-icon-inline .category-icon {
  font-size: 18px;
  color: var(--primary);
}

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.icon-picker__btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg, #fff);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.icon-picker__btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.icon-picker__btn.is-selected {
  border-color: var(--primary);
  background: var(--primary-lt);
  color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.icon-picker__none {
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-muted);
}

/* =====================================================================
 * Attendance shift detail + photo gallery
 * ===================================================================== */
.att-detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .att-detail-grid {
    grid-template-columns: 1fr;
  }
}

.detail-dl {
  margin: 0;
  display: grid;
  gap: 14px;
}

.detail-dl dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-dl dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.detail-dl .text-muted {
  color: var(--text-muted);
}

.photo-category-block {
  margin-bottom: 22px;
}

.photo-category-block:last-child {
  margin-bottom: 0;
}

.photo-category-block__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.photo-category-block__icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--blue100, rgba(31, 90, 140, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-category-block__icon .category-icon {
  font-size: 22px;
  color: var(--primary);
}

.work-ratings-list {
  display: grid;
  gap: 12px;
}

.work-rating-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, rgba(0, 0, 0, 0.02));
}

.work-rating-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.work-rating-card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.work-rating-card__score {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.work-rating-card__comment {
  margin: 12px 0 0;
  white-space: pre-wrap;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.work-rating-card__footer {
  margin-top: 10px;
  font-size: 12px;
}

.work-rating-stars {
  display: inline-flex;
  gap: 2px;
  line-height: 1;
}

.work-rating-stars--compact .work-rating-stars__star {
  font-size: 14px;
}

.work-rating-stars__star {
  font-size: 18px;
  color: var(--text-muted);
}

.work-rating-stars__star.is-filled {
  color: #e6a817;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.photo-gallery__item {
  display: block;
  width: 100%;
  padding: 0;
  cursor: pointer;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--surface-muted, #f4f6f8);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.photo-gallery__item:hover:not(:disabled) {
  box-shadow: 0 4px 14px rgba(15, 42, 71, 0.12);
  transform: translateY(-1px);
}

.photo-gallery__item:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.photo-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-gallery__missing {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px;
  text-align: center;
}

/* Photo lightbox (shift detail) */
body.photo-lightbox-open {
  overflow: hidden;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox[hidden] {
  display: none !important;
}

.photo-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 27, 45, 0.88);
}

.photo-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 1100px);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 56px 20px;
  box-sizing: border-box;
}

.photo-lightbox__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.photo-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox__nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.28);
}

.photo-lightbox__nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.photo-lightbox__nav--prev {
  left: 4px;
}

.photo-lightbox__nav--next {
  right: 4px;
}

.photo-lightbox__stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox__stage img {
  max-width: 100%;
  max-height: calc(96vh - 120px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.photo-lightbox__meta {
  margin-top: 14px;
  text-align: center;
  color: #fff;
  max-width: 100%;
}

.photo-lightbox__category {
  font-size: 15px;
  font-weight: 600;
}

.photo-lightbox__counter {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.85;
}

.photo-lightbox__caption {
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.75;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 640px) {
  .photo-lightbox__panel {
    padding: 44px 12px 16px;
  }

  .photo-lightbox__nav {
    width: 40px;
    height: 40px;
  }
}
