:root {
  --tblr-primary: #1f2937;
  --tblr-primary-rgb: 31, 41, 55;
  --cb-header-bg: #4c5666;
  --cb-calendar-sticky-width: 160px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  background: var(--tblr-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 20px;
}

.brand-logo-sm {
  width: 32px;
  height: 32px;
  background: var(--tblr-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.login-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 3rem 1.5rem 1.5rem;
  box-sizing: border-box;
}

.login-brand {
  text-align: center;
  margin-bottom: 3rem;
  width: 100%;
}

.login-content {
  flex: 1;
  text-align: center;
  width: 100%;
}

.login-actions {
  padding-top: 1.5rem;
  padding-bottom: env(safe-area-inset-bottom, 0);
  text-align: center;
  width: 100%;
}

.login-actions .btn {
  display: block;
  width: 100%;
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.progress-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tblr-border-color);
}

.progress-dots .dot.active {
  background: var(--tblr-primary);
}

.feature-icon {
  width: 80px;
  height: 80px;
  background: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tblr-primary);
  margin: 0 auto;
}

.status-icon {
  width: 80px;
  height: 80px;
  background: var(--status-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.status-icon svg {
  width: 40px;
  height: 40px;
  color: var(--status-color);
}

/* ClockBot logo shadow */
.clockbot-logo { filter: drop-shadow(2px 3px 0px rgba(0,0,0,0.5)) drop-shadow(0 0 6px rgba(255,255,255,0.15)); }

/* Sidebar brand spacing */
@media (min-width: 992px) {
  .navbar-vertical.navbar-expand-lg .navbar-brand { padding: 2rem 0; }
  .pt-lg-3 { padding-top: 0 !important; }
}

/* Schedule grid: clickable day cells */
.schedule-cell { cursor: pointer; min-width: 80px; transition: background-color 0.15s; }
.schedule-cell:hover { background-color: rgba(var(--tblr-primary-rgb), 0.12); }
.schedule-flex-badge {
  background: var(--cb-header-bg);
}

.schedule-cell .schedule-flex-badge,
td .schedule-flex-badge {
  font-size: .55rem;
  padding: .1em .25em .1em .35em;
  line-height: 1;
  align-self: flex-start;
  margin-top: -2px;
}

/* Override Tabler's absolute positioning of badges inside nav links */
.navbar .navbar-nav .nav-link > .badge {
  position: static;
  transform: none;
}

/* Dark header styling, shared between table headers and card headers.
   For tables, add .table-header-flush when the header sits at the top
   edge of a card so the corners follow the card's border-radius. */
.table.table-header-dark thead th {
  background: var(--cb-header-bg);
  color: #fff;
  text-transform: uppercase;
}
.table.table-header-dark.table-header-flush thead tr th:first-child {
  border-top-left-radius: var(--tblr-border-radius);
}
.table.table-header-dark.table-header-flush thead tr th:last-child {
  border-top-right-radius: var(--tblr-border-radius);
}

.card-header.card-header-dark {
  background: var(--cb-header-bg);
  color: #fff;
  border-top-left-radius: var(--tblr-border-radius);
  border-top-right-radius: var(--tblr-border-radius);
  padding-top: .5rem;
  padding-bottom: .5rem;
  min-height: 0;
}
.card-header-dark .card-title {
  color: #fff;
}
.card-header-dark .btn-action {
  color: #fff;
}

/* table-responsive-dropdown: use when a table has dropdowns in an action
   column. The default `overflow: auto` on .table-responsive clips
   dropdown menus; this variant keeps them visible. */
.table-responsive.table-responsive-dropdown {
  overflow: visible;
}

/* Calendar (staff coverage grid)
   z-index layers: 1 sticky head/sticky-col header corners,
   2 sticky-col body cells, 3 month/day-hdr top row, 5 floating cell-edit-btn. */
.coverage-wrap {
  overflow: auto;
  max-height: calc(100vh - 240px);
  background: transparent;
  visibility: hidden;
  cursor: grab;
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
}
.coverage-wrap.is-panning,
.coverage-wrap.is-panning td.c:hover,
.coverage-wrap.is-panning th {
  cursor: grabbing;
  user-select: none;
}
.cell-edit-btn {
  position: absolute;
  top: calc(100% - 2px);
  left: calc(100% - 10px);
  z-index: 5;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tblr-primary);
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  line-height: 1;
}
.cell-edit-btn:hover {
  filter: brightness(1.1);
}
.cell-edit-btn[hidden] {
  display: none;
}
.coverage-wrap.ready {
  visibility: visible;
}
table.coverage {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
  width: max-content;
}
table.coverage th,
table.coverage td {
  padding: 0;
  text-align: center;
}
table.coverage thead th {
  background: var(--cb-header-bg);
  font-weight: 600;
  color: #fff;
  vertical-align: middle;
}
table.coverage thead th.month-hdr {
  border-bottom: none;
}
.month-hdr {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.month-hdr + .month-hdr {
  border-left: 1px solid var(--tblr-border-color);
}
table.coverage th.day-hdr {
  position: sticky;
  top: 28px;
  z-index: 3;
  min-width: 30px;
  width: 30px;
  padding: 0.25rem 0 0.35rem;
  line-height: 1.1;
}
.day-hdr.month-start {
  border-left: 1px solid var(--tblr-border-color);
}
.day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
}
.day-wd {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
  margin-top: 0.1rem;
}
.day-hdr.is-today .day-num,
.day-hdr.is-today .day-wd {
  color: #ffc548;
}
.sticky-col-1 {
  position: sticky;
  left: 0;
  min-width: var(--cb-calendar-sticky-width);
  background: var(--tblr-body-bg);
  color: var(--tblr-primary);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem !important;
  text-align: right !important;
  border-bottom: 0 !important;
  border-right: 0;
}
tbody .sticky-col-1 {
  z-index: 2;
  background: #fff;
}
thead .head-top.sticky-col-1 {
  top: 0;
  z-index: 1;
  background: var(--cb-header-bg);
  border-bottom: none;
}
thead .head-bottom.sticky-col-1 {
  top: 28px;
  z-index: 1;
  background: var(--cb-header-bg);
  border-top: none;
}
td.c {
  width: 30px;
  height: 24px;
  position: relative;
  background: var(--tblr-bg-surface);
}
td.c::before {
  content: "";
  position: absolute;
  inset: 1px;
  pointer-events: none;
  background: var(--tblr-bg-surface);
}
td.c:hover {
  cursor: pointer;
}
td.c:hover::before,
td.c.c-selected::before {
  filter: brightness(0.82);
}
.coverage-wrap.is-panning td.c:hover:not(.c-selected)::before {
  filter: none;
}
td.c.c-working::before {
  background: #dbf2ff;
}
td.c.c-working[data-absence-type]::before {
  background: #fff7d6;
}
td.c.c-working[data-absence-type]::after {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--tblr-primary);
  pointer-events: none;
}
td.c.c-working[data-absence-type="holiday"]::after       { content: "H"; }
td.c.c-working[data-absence-type="sick"]::after          { content: "S"; color: var(--tblr-danger); }
td.c.c-working[data-absence-type="maternity"]::after     { content: "M"; }
td.c.c-working[data-absence-type="compassionate"]::after { content: "C"; }
td.c.c-working[data-absence-type="other"]::after         { content: "O"; }

.attachment-dropzone {
  position: relative;
  border: 1.5px dashed var(--tblr-border-color);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--tblr-bg-surface-tertiary, #fafbfc);
  transition: border-color .15s ease, background-color .15s ease;
}
.attachment-dropzone:hover { border-color: var(--tblr-primary); }
.attachment-dropzone:focus-visible {
  outline: 2px solid var(--tblr-primary);
  outline-offset: 2px;
}
.attachment-dropzone.is-drag {
  border-color: var(--tblr-primary);
  background: var(--tblr-primary-lt, #e7f2fe);
}
.attachment-dropzone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  color: var(--tblr-muted);
}
.attachment-dropzone-empty svg { color: var(--tblr-muted); }
.attachment-dropzone-text { font-size: .875rem; }
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: .375rem;
}
.attachment-chip {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .375rem .5rem;
  border: 1px solid var(--tblr-border-color);
  border-radius: 6px;
  background: var(--tblr-bg-surface, #fff);
}
.attachment-chip img {
  height: 36px;
  width: 36px;
  object-fit: cover;
  border-radius: 4px;
  flex: 0 0 auto;
}
.attachment-chip .file-icon {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: var(--tblr-blue-lt, #e7f2fe);
  color: var(--tblr-blue, #206bc4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-weight: 600;
  font-size: .7rem;
}

/* --- Staff dashboard --- */
.clock-btn {
  display: block;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: none;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  margin: 0 auto;
  padding: 0;
}
.clock-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 2px 4px rgba(0,0,0,0.2);
}
.clock-btn .clock-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 0;
}
.clock-btn .clock-icon svg {
  width: 48px;
  height: 48px;
  display: block;
  opacity: 0.95;
  filter: drop-shadow(2px 3px 0px rgba(0,0,0,0.15)) drop-shadow(0 0 6px rgba(255,255,255,0.05));
}
.clock-hint {
  text-align: center;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--tblr-secondary);
}
.clock-btn-in {
  background: linear-gradient(to bottom, #06b07a, #048a5a);
  color: white;
  box-shadow: 0 4px 24px rgba(5, 150, 105, 0.17), 0 2px 4px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.1);
}
.clock-btn-out {
  background: linear-gradient(to bottom, #ef4444, #b91c1c);
  color: white;
  box-shadow: 0 4px 24px rgba(220, 38, 38, 0.17), 0 2px 4px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.1);
}
.clock-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.active-shift-timer {
  font-size: 2.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--tblr-primary);
  text-align: center;
}
.active-shift-site {
  text-align: center;
  color: var(--tblr-secondary);
  margin-bottom: 0.75rem;
}
.stat-card {
  text-align: center;
  padding: 1rem;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tblr-primary);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--tblr-secondary);
  margin-top: 0.25rem;
}
.clock-header {
  min-height: 6rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: calc(100dvh - 3.5rem - 80px - 0.75rem);
}
.dashboard-top { flex-shrink: 0; }
.dashboard-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: none;
  min-height: 0;
  scrollbar-width: thin;
}
.gps-status {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  min-height: 1.5rem;
  margin-top: 0.75rem;
}
.gps-status .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  flex-shrink: 0;
}
.dot-acquiring { background: #f59e0b; animation: pulse-dot 1.5s infinite; }
.dot-ready { background: #059669; }
.dot-error { background: #dc2626; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.shift-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--tblr-border-color);
}
.shift-row:last-child { border-bottom: none; }
.shift-date {
  width: 3rem;
  text-align: center;
}
.shift-date-day {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}
.shift-date-month {
  font-size: 0.7rem;
  color: var(--tblr-secondary);
  text-transform: uppercase;
}
.shift-details {
  flex: 1;
  padding-left: 0.75rem;
}
.shift-site {
  font-weight: 500;
}
.shift-time {
  font-size: 0.85rem;
  color: var(--tblr-secondary);
}
.shift-duration {
  font-weight: 600;
  font-size: 0.9rem;
  padding-left: 0.5rem;
  white-space: nowrap;
}

/* --- Site form (Leaflet map) --- */
#map { height: 500px; border-radius: var(--tblr-border-radius); }
.leaflet-container { cursor: pointer !important; }
.leaflet-grab { cursor: pointer !important; }
.leaflet-dragging .leaflet-grab { cursor: grabbing !important; }

/* --- Review queue --- */
.clock-event-card {
  background: var(--tblr-bg-surface-secondary);
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
  padding: 1rem;
}

/* Unified modal header: dark CB bar with white title + close. Applies to every
   .modal-header in the app — notify, confirm, schedule, calendar, etc.
   Tabler's .btn-close uses currentColor for its mask, so the cross inherits
   the white text color automatically — no filter needed. */
.modal-header {
  background: var(--cb-header-bg);
  color: #fff;
}

/* Bump stroke on the alert/error icons in notify/confirm modal headers
   so they read at the same visual weight as denser icons like edit. */
.icon-bold {
  stroke-width: 2.5;
}

/* Hide any modal stacked beneath notify/confirm so the dialog reads alone.
   Backdrops remain; visibility: hidden keeps Bootstrap's stacking sane. */
body:has(#notify-modal.show) .modal.show:not(#notify-modal),
body:has(#confirm-modal.show) .modal.show:not(#confirm-modal) {
  visibility: hidden;
}
