/* Portal staff: mobile-first, textos claros, áreas táctiles amplias. */
body[data-page="dashboard"] {
  --dash-surface: #ffffff;
  --dash-nav-dark: #27272a;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.06);
}

.staff-app {
  width: min(1480px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.staff-sidebar,
.section-card,
.summary-card,
.mini-panel,
.day-card,
.mission-card,
.training-item {
  background: var(--dash-surface);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.staff-sidebar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 36px);
  position: sticky;
  top: 18px;
}

.staff-brand-kicker,
.staff-kicker,
.section-kicker {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.staff-brand h1,
.staff-header h2 {
  margin: 0;
  line-height: 1.25;
  font-weight: 600;
}

.staff-brand h1 {
  font-size: clamp(20px, 3vw, 26px);
}

.staff-header h2 {
  font-size: clamp(16px, 2.1vw, 20px);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staff-brand-lead {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 15px;
  max-width: 42ch;
}

.staff-nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.staff-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  text-align: left;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.staff-nav-text {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.staff-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger-dark);
  font-size: 11px;
  font-weight: 600;
}

.staff-nav-badge.is-hidden {
  display: none;
}

.staff-nav-link.is-active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.22);
}

.staff-sidebar-footer {
  margin-top: auto;
}

.ghost-button {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ghost-button:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.06);
}

.staff-main {
  display: grid;
  gap: 18px;
}

.staff-data-warning {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(180, 83, 9, 0.12);
  border: 1px solid rgba(180, 83, 9, 0.28);
  color: #92400e;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
}

.staff-data-warning.is-hidden {
  display: none;
}

.staff-header {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  padding: 10px 4px 0;
  position: relative;
}

.staff-header-titles {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.staff-header .staff-kicker {
  margin: 0;
  flex-shrink: 0;
}

.staff-header-aside {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.staff-nav-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.staff-nav-more:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.06);
}

.staff-nav-more-bars {
  display: block;
  position: relative;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.staff-nav-more[aria-expanded="true"] .staff-nav-more-bars {
  background: transparent;
  box-shadow: none;
}

.staff-nav-more[aria-expanded="true"] .staff-nav-more-bars::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transform: translateY(-50%) rotate(45deg);
  box-shadow: 0 0 0 currentColor;
}

.staff-nav-more[aria-expanded="true"] .staff-nav-more-bars::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transform: translateY(-50%) rotate(-45deg);
}

.staff-more-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
  pointer-events: none;
}

.staff-more-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.staff-more-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 92vw);
  z-index: 46;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) 18px;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.staff-more-drawer.is-open {
  transform: translateX(0);
}

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

.staff-more-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.staff-more-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.staff-more-close:hover {
  background: rgba(37, 99, 235, 0.12);
}

.staff-more-lead {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.staff-more-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.staff-more-link {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.staff-more-link:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.06);
}

.staff-more-link.is-active {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.staff-logout-btn {
  min-height: var(--tap-min, 44px);
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
}

.staff-logout-btn:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.06);
}

@media (min-width: 761px) {
  .staff-logout-btn {
    display: none;
  }
}

.section-back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-height: var(--tap-min, 44px);
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
}

.section-back-button::before {
  content: "←";
  font-size: 16px;
  line-height: 1;
}

.section-back-button.is-hidden {
  display: none;
}

.user-badge {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  max-width: min(42vw, 160px);
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  min-width: 0;
}

.user-badge strong {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-badge span {
  flex-shrink: 0;
  color: var(--muted);
}

.summary-card small,
.mini-panel p,
.mission-card p,
.training-item p,
.training-item small,
.section-note,
.notes-label {
  color: var(--muted);
}

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

.summary-grid-inline {
  margin-bottom: 14px;
}

.summary-card {
  padding: 14px 16px;
  border-radius: 8px;
}

.summary-card strong {
  display: block;
  font-size: 26px;
  font-weight: 600;
}

.summary-card span {
  display: block;
  margin-top: 6px;
  font-weight: 600;
}

.staff-sections {
  display: grid;
}

.section-card {
  border-radius: 8px;
  padding: 16px 18px;
}

/* Vista inicio: quita la “caja vacía” y deja respirar el grid de acciones. */
.section-card.section-card--home {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.section-head--home {
  margin-bottom: 12px;
}

.section-head--home h3 {
  font-size: 20px;
}

.staff-home-hint {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.12);
  color: #3f3f46;
  font-size: 14px;
  line-height: 1.45;
}

.staff-home-hint strong {
  color: var(--ink);
}

.section-card.is-hidden {
  display: none;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: end;
}

.filter-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
}

.filter-chip.is-active {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.22);
  color: var(--ink);
}

.date-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.date-input {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
}

.section-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.webapp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.webapp-tile {
  /* Fallback si falta modificador en HTML */
  --tile-icon-bg: rgba(24, 24, 27, 0.08);
  --tile-icon-fg: #3f3f46;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 88px;
  padding: 12px 12px 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.webapp-tile:hover {
  border-color: #d4d4d8;
  background: #fafafa;
}

.webapp-tile:hover .webapp-tile-icon {
  transform: translateY(-1px);
}

.webapp-tile:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.webapp-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--tile-icon-bg, #fafafa);
  color: var(--tile-icon-fg, var(--ink));
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.webapp-tile-svg {
  width: 22px;
  height: 22px;
}

.webapp-tile-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.webapp-tile-body strong {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.webapp-tile-body > span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

/*
 * Iconos con color por significado (misma “fuerza” de tinte ~12% para que no compitan entre sí).
 * Azul fichaje | violeta turno | ámbar checklist | teal operativa | rojo avisos | cielo chat | verde formación | gris resumen.
 */
.webapp-tile--clock {
  --tile-icon-bg: rgba(37, 99, 235, 0.12);
  --tile-icon-fg: #1d4ed8;
}

.webapp-tile--shift {
  --tile-icon-bg: rgba(79, 70, 229, 0.12);
  --tile-icon-fg: #4338ca;
}

.webapp-tile--checklist {
  --tile-icon-bg: rgba(202, 138, 4, 0.14);
  --tile-icon-fg: #b45309;
}

.webapp-tile--missions {
  --tile-icon-bg: rgba(13, 148, 136, 0.12);
  --tile-icon-fg: #0f766e;
}

.webapp-tile--notices {
  --tile-icon-bg: rgba(220, 38, 38, 0.12);
  --tile-icon-fg: #b91c1c;
}

.webapp-tile--chat {
  --tile-icon-bg: rgba(14, 165, 233, 0.12);
  --tile-icon-fg: #0369a1;
}

.webapp-tile--training {
  --tile-icon-bg: rgba(22, 163, 74, 0.12);
  --tile-icon-fg: #15803d;
}

.webapp-tile--summary {
  --tile-icon-bg: rgba(82, 82, 91, 0.11);
  --tile-icon-fg: #52525b;
}

.overview-stack {
  margin-top: 14px;
}

.agenda-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-left: 3px solid var(--brand);
}

.reminders-panel {
  margin-bottom: 14px;
}

.reminders-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.reminders-panel-head h4,
.reminders-panel-head p {
  margin: 0;
}

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

.reminder-item {
  display: flex;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.reminder-item-main {
  display: grid;
  gap: 4px;
  flex: 1;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.reminder-item strong {
  color: var(--ink);
}

.reminder-item span {
  color: var(--muted);
}

.reminder-dismiss {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

.reminder-item.severity-high {
  background: rgba(220, 38, 38, 0.05);
  border-color: rgba(220, 38, 38, 0.18);
}

.reminder-item.severity-medium {
  background: rgba(168, 100, 0, 0.05);
  border-color: rgba(168, 100, 0, 0.16);
}

.reminder-item.severity-low {
  background: rgba(31, 92, 168, 0.05);
  border-color: rgba(31, 92, 168, 0.14);
}

.mini-panel,
.mission-card,
.training-item {
  border-radius: 8px;
  padding: 14px 16px;
}

.notice-card {
  cursor: pointer;
}

.notice-card.is-unread {
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.05);
}

.notice-card-urgent,
.notice-highlight.urgent {
  border-color: rgba(220, 38, 38, 0.24);
  background: rgba(220, 38, 38, 0.04);
}

.notice-highlight {
  margin-bottom: 14px;
}

.chat-shell {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.chat-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
}

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

.chat-message {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 8px 8px 8px 4px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
}

.chat-message.is-mine {
  margin-left: auto;
  background: #ecfdf5;
  border-color: rgba(22, 163, 74, 0.25);
  border-radius: 8px 8px 4px 8px;
}

.chat-message-pinned {
  border-color: rgba(168, 100, 0, 0.24);
  background: rgba(168, 100, 0, 0.05);
}

.chat-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.chat-message-meta span {
  color: var(--muted);
  font-size: 12px;
}

.chat-message p {
  margin: 0;
}

.chat-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.chat-input {
  min-height: 100px;
}

.chat-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.mini-panel h4 {
  margin: 0 0 10px;
}

.mini-panel ul {
  margin: 0;
  padding-left: 18px;
}

.inline-link {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 4px;
  background: rgba(24, 24, 27, 0.06);
  font-size: 12px;
  font-weight: 500;
}

.status-chip.ok,
.status-chip.completed {
  background: rgba(22, 117, 71, 0.14);
  color: var(--ok);
}

.status-chip.warn,
.status-chip.in_progress {
  background: rgba(168, 100, 0, 0.14);
  color: var(--progress);
}

.status-chip.assigned,
.status-chip.muted {
  background: rgba(31, 92, 168, 0.14);
  color: var(--pending);
}

.checklist-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.checklist-group h4 {
  margin: 0 0 10px;
}

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

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

.check-item.info {
  align-items: flex-start;
}

.check-item.interactive {
  cursor: pointer;
  align-items: center;
}

.check-item.interactive input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.check-item.interactive.is-done {
  background: rgba(22, 117, 71, 0.08);
  border-color: rgba(22, 117, 71, 0.16);
}

.check-item-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 600;
}

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

.notes-label {
  display: block;
  margin-top: 18px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 13px;
}

.notes-area {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
}

.mission-list,
.training-list {
  display: grid;
  gap: 12px;
}

.training-block {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.training-block h4 {
  margin: 0 0 8px;
}

.training-block ol,
.training-block ul {
  margin: 0;
  padding-left: 18px;
}

.training-inline-note {
  margin-top: 12px;
}

.operations-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.attendance-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: #fff;
  border-left: 3px solid var(--brand);
}

.attendance-hero.is-clocked-out {
  border-left-color: var(--ok);
  background: #fff;
}

.attendance-hero.is-clocked-in {
  border-left-color: var(--danger);
  background: #fff;
}

.attendance-hero-copy {
  display: grid;
  gap: 6px;
}

.attendance-hero-copy h4,
.attendance-hero-copy p,
.attendance-hero-copy small {
  margin: 0;
}

.attendance-hero-copy h4 {
  font-size: 18px;
  font-weight: 600;
}

.attendance-hero-action {
  display: flex;
  align-items: center;
  width: 100%;
}

.attendance-main-button {
  width: 100%;
  min-height: 52px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: none;
  border: 0;
  color: #fff;
  cursor: pointer;
}

.attendance-main-button-enter {
  background: var(--ok);
}

.attendance-main-button-enter:hover {
  filter: brightness(0.95);
}

.attendance-main-button-leave {
  background: var(--danger);
}

.attendance-main-button-leave:hover {
  filter: brightness(0.95);
}

.attendance-secondary-panel {
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.attendance-secondary-panel h4,
.attendance-secondary-panel small {
  margin: 0;
}

.attendance-details-disclosure {
  margin-top: 16px;
}

.attendance-details-disclosure summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  font-weight: 600;
}

.attendance-details-disclosure summary::-webkit-details-marker {
  display: none;
}

.attendance-details-disclosure summary::after {
  content: "+";
  float: right;
  font-size: 20px;
  line-height: 1;
}

.attendance-details-disclosure[open] summary::after {
  content: "−";
}

.attendance-details-disclosure[open] > .operations-grid {
  margin-top: 16px;
}

.attendance-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.attendance-panel p {
  margin-bottom: 8px;
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
}

.attendance-panel-primary p {
  font-size: 16px;
  font-weight: 500;
}

.attendance-detail-grid {
  align-items: start;
}

.attendance-breakdown {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.attendance-breakdown-month {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 6px;
}

.attendance-day-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

.stack-form {
  display: grid;
  gap: 10px;
}

.field-input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.attendance-corrections {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.mission-meta,
.training-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.mission-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.mission-tags span {
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(24, 24, 27, 0.06);
  font-size: 12px;
  font-weight: 500;
}

.mission-tags-actions {
  margin-top: 12px;
}

.alert-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.alert-card.severity-high,
.alert-row.severity-high,
.alert-card.severity-critical,
.alert-row.severity-critical {
  border-color: rgba(220, 38, 38, 0.22);
  background: rgba(220, 38, 38, 0.04);
}

.alert-card.severity-medium,
.alert-row.severity-medium {
  border-color: rgba(168, 100, 0, 0.2);
  background: rgba(168, 100, 0, 0.04);
}

.alert-card.severity-low,
.alert-row.severity-low {
  border-color: rgba(31, 92, 168, 0.2);
  background: rgba(31, 92, 168, 0.04);
}

.empty-state {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.status-banner {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.status-banner-ok {
  background: rgba(22, 117, 71, 0.08);
  border-color: rgba(22, 117, 71, 0.14);
}

.status-banner strong {
  color: var(--ink);
}

.status-banner span,
.status-banner p {
  margin: 0;
  color: var(--muted);
}

.shift-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 320px;
  gap: 16px;
}

.calendar-shell,
.team-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.range-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.range-switch-button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}

.range-switch-button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.calendar-date-grid {
  display: grid;
  gap: 10px;
}

.calendar-date-grid.is-week {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-date-grid.is-month {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.calendar-date-card {
  min-height: 148px;
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}

.calendar-date-card.is-today {
  border-color: rgba(37, 99, 235, 0.34);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

/* Día con turno: protagonista (lo que el usuario debe mirar primero). */
.calendar-date-card.has-shifts {
  border-color: rgba(37, 99, 235, 0.32);
  background: #fff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.12);
}

.calendar-date-card.has-shifts .calendar-date-head {
  background: rgba(37, 99, 235, 0.08);
  border-bottom: 1px solid rgba(37, 99, 235, 0.12);
}

.calendar-date-card.is-today.has-shifts {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow:
    0 0 0 2px rgba(37, 99, 235, 0.12),
    0 3px 14px rgba(37, 99, 235, 0.16);
}

/* Día libre: secundario, sin verde llamativo en toda la tarjeta. */
.calendar-date-card.is-free {
  background: #fafafa;
  border-color: var(--line);
  box-shadow: none;
}

.calendar-date-card.is-free .calendar-date-head {
  background: rgba(24, 24, 27, 0.03);
}

.calendar-date-card.is-past {
  opacity: 0.78;
}

.calendar-date-head {
  padding: 10px 12px 8px;
  background: rgba(15, 23, 42, 0.03);
}

.calendar-date-head span,
.calendar-date-head small {
  display: block;
  color: var(--muted);
}

.calendar-date-head span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.calendar-date-head strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  line-height: 1;
}

.calendar-date-body {
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.calendar-event {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.28);
  display: grid;
  gap: 6px;
}

.calendar-event strong,
.team-card strong {
  display: block;
}

.calendar-empty,
.team-card small,
.team-panel-head small,
.phone-missing {
  color: var(--muted);
}

.calendar-event strong {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.calendar-event span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(22, 117, 71, 0.12);
  color: var(--ok);
  font-size: 11px;
  font-weight: 600;
}

.calendar-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f4f4f5;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  border: 1px dashed #d4d4d8;
}

.calendar-event.is-past strong,
.calendar-empty.is-past {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.team-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.team-panel-head h4 {
  margin: 0;
}

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

.team-card {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.team-card.is-me {
  border-color: rgba(37, 99, 235, 0.28);
}

.team-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.team-card-actions {
  margin-top: 12px;
}

.phone-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 1120px) {
  .staff-app {
    grid-template-columns: 1fr;
  }

  .staff-sidebar {
    min-height: auto;
    position: static;
  }

  .summary-grid,
  .overview-grid,
  .operations-grid,
  .checklist-columns {
    grid-template-columns: 1fr 1fr;
  }

  .shift-layout {
    grid-template-columns: 1fr;
  }

  .calendar-date-grid.is-week,
  .calendar-date-grid.is-month {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body[data-page="dashboard"] {
    padding: 12px;
  }

  .staff-nav {
    display: none;
  }

  .staff-main {
    padding-bottom: 20px;
  }

  .section-back-button {
    min-height: 36px;
    padding: 0 12px;
    order: -1;
  }

  .summary-grid,
  .overview-grid,
  .operations-grid,
  .checklist-columns {
    grid-template-columns: 1fr;
  }

  .attendance-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .attendance-hero-copy h4 {
    font-size: 20px;
  }

  .attendance-summary-grid {
    grid-template-columns: 1fr;
  }

  .attendance-main-button {
    min-height: 68px;
    font-size: 20px;
  }

  .webapp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head,
  .mission-meta,
  .training-item-top,
  .team-card-top {
    flex-direction: column;
    align-items: start;
  }

  .calendar-date-grid.is-week,
  .calendar-date-grid.is-month {
    grid-template-columns: 1fr;
  }

  .calendar-date-card {
    min-height: auto;
  }

  .calendar-date-head strong {
    font-size: 16px;
  }

  .calendar-event strong {
    font-size: 15px;
  }
}

/* Mobile-first overrides: phone is the primary layout, larger screens enhance from there. */
body[data-page="dashboard"] {
  padding: 10px;
}

.staff-app {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.staff-sidebar {
  padding: 14px;
  min-height: auto;
  position: static;
  top: auto;
  gap: 12px;
}

.staff-brand h1 {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 600;
}

.staff-brand-lead {
  line-height: 1.5;
  margin-bottom: 0;
}

.staff-nav {
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  overflow-x: auto;
  margin-top: 4px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.staff-nav::-webkit-scrollbar {
  display: none;
}

.staff-nav-link {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.staff-sidebar-footer {
  margin-top: 0;
}

.staff-main {
  gap: 12px;
}

.staff-header {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 2px 2px 0;
}

.user-badge {
  max-width: min(40vw, 150px);
  padding: 6px 8px;
  border-radius: 8px;
}

.summary-grid,
.overview-grid,
.operations-grid,
.checklist-columns,
.calendar-date-grid.is-week,
.calendar-date-grid.is-month,
.shift-layout {
  grid-template-columns: 1fr;
}

.summary-grid {
  gap: 10px;
}

.summary-card,
.mini-panel,
.mission-card,
.training-item {
  padding: 16px;
}

.section-card:not(.section-card--home) {
  padding: 16px;
  border-radius: 8px;
}

.summary-card {
  border-radius: 8px;
}

.summary-card strong {
  font-size: 26px;
}

.section-head,
.mission-meta,
.training-item-top,
.team-card-top,
.alert-row,
.attendance-day-row,
.chat-form-actions,
.reminders-panel-head,
.checklist-actions {
  flex-direction: column;
  align-items: flex-start;
}

.section-head {
  gap: 10px;
  margin-bottom: 14px;
}

.section-head h3 {
  font-size: 18px;
  font-weight: 600;
}

.section-actions {
  justify-content: flex-start;
  width: 100%;
}

.reminder-item {
  flex-direction: column;
  padding: 12px 14px;
}

.chat-shell {
  padding: 14px;
  border-radius: 20px;
}

.chat-list {
  max-height: 420px;
  padding-right: 2px;
}

.chat-message {
  max-width: 92%;
}

.calendar-shell,
.team-panel {
  border-radius: 20px;
  padding: 14px;
}

.calendar-date-card {
  min-height: auto;
}

.calendar-date-head strong {
  font-size: 16px;
}

.attendance-panel p {
  font-size: 24px;
}

@media (min-width: 761px) {
  body[data-page="dashboard"] {
    padding: 16px;
  }

  .staff-header {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    padding: 8px 4px 0;
    gap: 10px 12px;
  }

  .user-badge {
    width: auto;
    max-width: min(36vw, 200px);
  }

  .summary-grid,
  .overview-grid,
  .operations-grid,
  .checklist-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-date-grid.is-week,
  .calendar-date-grid.is-month {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .section-head,
  .mission-meta,
  .training-item-top,
  .team-card-top,
  .alert-row,
  .attendance-day-row,
  .chat-form-actions {
    flex-direction: row;
  }

  .reminders-panel-head {
    flex-direction: row;
  }

  .section-actions {
    justify-content: flex-end;
  }
}

@media (min-width: 1121px) {
  body[data-page="dashboard"] {
    padding: 20px;
  }

  .staff-app {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0;
  }

  .staff-sidebar {
    padding: 16px;
    min-height: calc(100vh - 40px);
    position: sticky;
    top: 20px;
    gap: 0;
    border-radius: 8px;
  }

  .staff-nav {
    grid-auto-flow: row;
    grid-auto-columns: unset;
    overflow: visible;
    margin-top: 28px;
    padding-bottom: 0;
  }

  .staff-sidebar-footer {
    margin-top: auto;
  }

  .staff-main {
    gap: 18px;
  }

  .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .shift-layout {
    grid-template-columns: minmax(0, 1.7fr) 320px;
  }

  .calendar-date-grid.is-week {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .calendar-date-grid.is-month {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .calendar-date-card {
    min-height: 148px;
  }

  .chat-shell {
    padding: 16px;
    border-radius: 8px;
  }

  .chat-list {
    max-height: 520px;
    padding-right: 6px;
  }

  .chat-message {
    max-width: 82%;
  }
}

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

  .webapp-tile {
    min-height: 96px;
    padding: 14px;
  }

  .staff-brand-lead {
    font-size: 13px;
  }

  .staff-nav-link {
    min-height: 40px;
    padding: 0 12px;
    font-size: 14px;
  }

  .summary-card,
  .mini-panel,
  .mission-card,
  .training-item,
  .section-card:not(.section-card--home) {
    padding: 14px;
  }

  .section-head h3 {
    font-size: 22px;
  }

  .summary-card strong {
    font-size: 24px;
  }
}

@media (max-width: 760px) {
  body[data-page="dashboard"] {
    padding: 0;
    background: var(--bg);
  }

  .staff-app {
    width: 100%;
    gap: 0;
  }

  .staff-sidebar {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 10px 12px 0;
  }

  .staff-brand {
    padding: 14px 14px 12px;
    margin-bottom: 4px;
    border-radius: 16px;
    background: linear-gradient(165deg, #ffffff 0%, rgba(37, 99, 235, 0.06) 100%);
    border: 1px solid rgba(37, 99, 235, 0.12);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  }

  .staff-brand-kicker {
    margin-bottom: 6px;
    font-size: 11px;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #2563eb;
  }

  .staff-brand h1 {
    font-size: clamp(21px, 5.2vw, 27px);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
  }

  .staff-brand-lead {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.45;
    max-width: none;
    color: #475569;
  }

  .staff-sidebar-footer {
    display: none;
  }

  .staff-main {
    gap: 6px;
    padding: 0 12px calc(56px + env(safe-area-inset-bottom, 0px));
  }

  .staff-header {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0 -12px 2px;
    padding: max(6px, env(safe-area-inset-top, 0px)) 10px 8px;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.1) 0%, #ffffff 48%, #f8fafc 100%);
    border-bottom: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 3px 14px rgba(15, 23, 42, 0.06);
    overflow: hidden;
  }

  .staff-header::before {
    content: "";
    position: absolute;
    top: -22px;
    right: -16px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.14) 0%, transparent 72%);
    pointer-events: none;
  }

  .staff-nav-more {
    position: relative;
    z-index: 1;
    border-color: rgba(37, 99, 235, 0.22);
    background: rgba(255, 255, 255, 0.96);
  }

  .staff-header-titles,
  .staff-header-aside {
    position: relative;
    z-index: 1;
  }

  .staff-header-aside {
    align-items: center;
    padding-top: 0;
  }

  .staff-kicker {
    margin: 0 0 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #1d4ed8;
  }

  .staff-header h2 {
    font-size: clamp(15px, 3.4vw, 19px);
    line-height: 1.22;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
  }

  .user-badge {
    max-width: min(38vw, 132px);
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(37, 99, 235, 0.15);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  .user-badge strong {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-badge span {
    font-size: 11px;
    line-height: 1.2;
  }

  .staff-logout-btn {
    min-height: 40px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 10px;
    border-color: rgba(37, 99, 235, 0.25);
    background: rgba(255, 255, 255, 0.95);
    color: #1e40af;
    font-weight: 700;
  }

  .section-card:not(.section-card--home) {
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  .section-card.section-card--home {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .summary-card,
  .mini-panel,
  .mission-card,
  .training-item {
    border-radius: 6px;
  }

  .staff-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 0;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow: hidden;
    scrollbar-width: none;
    background: var(--dash-nav-dark);
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.22);
  }

  .staff-nav::-webkit-scrollbar {
    display: none;
  }

  .staff-nav-link {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    padding: 0 4px;
    border: 0;
    border-radius: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0;
  }

  .staff-nav-link:last-child {
    border-right: 0;
  }

  .staff-nav-link.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  .staff-nav-text {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0 2px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .staff-nav-badge {
    position: absolute;
    top: 6px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--brand);
    color: #fff;
    font-size: 10px;
  }

  .section-head h3 {
    font-size: 17px;
  }

  .summary-card strong,
  .attendance-panel p {
    font-size: 20px;
  }

  .chat-shell {
    padding: 12px;
    border-radius: 8px;
  }

  .chat-form {
    border-radius: 8px;
  }

  .calendar-shell,
  .team-panel {
    border-radius: 6px;
    padding: 12px;
  }

  .filter-chip {
    min-height: 44px;
    padding: 0 14px;
  }
}
