:root {
  --primary: #18181B; /* Zinc 900 - Minimalist Dark */
  --primary-hover: #3F3F46; /* Zinc 700 */
  --bg-color: #F3F1EC; /* Warm paper background — easier on the eyes */
  --card-bg: #FFFFFF;
  --text-main: #18181B;
  --text-muted: #A1A1AA; /* Zinc 400 */
  --border: #E4E4E7; /* Zinc 200 */
  
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --accent-blue: #3b82f6;
  
  /* Header Height for Sticky Offsets */
  --header-height: 80px;
}

.desktop-only {
  display: block;
}
.mobile-only {
  display: none;
}

@media (max-width: 850px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
}

/* Minimalist Flat Shadows */
:root {
  --box-shadow-3d: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --inner-shadow-3d: none;
  --float-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.04);

  /* Specialty Colors (Softened but distinct) */
  --anest: #8B5CF6;
  --circul: #EC4899;
  --instr: #0D9488;
  --recobro: #D97706;
}

/* Selectable Badges for Multi-selection */
.badge-selector-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selectable-badge {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.6rem 0.9rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    color: var(--text-main);
}

.selectable-badge:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    border-color: var(--text-muted);
}

.selectable-badge input[type="checkbox"] {
    display: none;
}

.selectable-badge:has(input:checked) {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--success);
    color: var(--success);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}

.selectable-badge:has(input:checked)::before {
    content: "\F26E"; /* bi-check-circle */
    font-family: "bootstrap-icons";
    margin-right: 8px;
    font-size: 1rem;
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

html, body {
  max-width: 100vw;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* UTILS & MODALS */
.hidden {
  display: none !important;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: var(--float-shadow);
  width: 100%;
  position: relative;
  overflow: hidden;
  animation: modal-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

@keyframes modal-appear {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: #F8FAFC;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

/* FLATPICKR CUSTOM THEME OVERRIDES */
.flatpickr-calendar {
  box-shadow: var(--float-shadow) !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  padding: 12px !important;
  font-family: inherit !important;
  width: 328px !important;
}

.flatpickr-current-month {
  font-size: 1.1rem !important;
  font-weight: 600 !important;
}

.flatpickr-month {
  height: 38px !important;
}

.flatpickr-weekdays {
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  justify-content: space-around !important;
  margin-bottom: 8px !important;
}

.flatpickr-weekday {
  flex: 1 0 14.28% !important;
  max-width: 14.28% !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
  font-size: 0.8rem !important;
}

.flatpickr-days {
  width: 100% !important;
}

.dayContainer {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: space-around !important;
}

.flatpickr-day {
  flex: 1 0 14.28% !important;
  max-width: 14.28% !important;
  height: 40px !important;
  line-height: 40px !important;
  margin: 2px 0 !important;
  border-radius: 10px !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease !important;
}

.flatpickr-day:hover {
  background: var(--border) !important;
  color: var(--text-main) !important;
}

.flatpickr-day.today {
  border-color: var(--primary) !important;
  font-weight: 700 !important;
}

.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, 
.flatpickr-day.selected.prevMonthDay, 
.flatpickr-day.startRange.prevMonthDay, 
.flatpickr-day.endRange.prevMonthDay, 
.flatpickr-day.selected.nextMonthDay, 
.flatpickr-day.startRange.nextMonthDay, 
.flatpickr-day.endRange.nextMonthDay {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(24, 24, 27, 0.2) !important;
  font-weight: 700 !important;
}


/* SIDEBAR */
.sidebar {
  width: 100px;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.5rem;
  z-index: 2000; /* High z-index to overlay everything */
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1), visibility 0.4s;
  overflow: hidden;
  margin: 0;
  position: fixed;
  left: -105px; /* Fully hidden */
  visibility: hidden;
  top: 0;
  height: 100vh;
  justify-content: center;
  box-shadow: 20px 0 50px rgba(0,0,0,0.1);
}


.sidebar.show {
  left: 0;
  visibility: visible;
}

/* Trigger area for desktop */
.sidebar-trigger {
  position: fixed;
  left: 0;
  top: 0;
  width: 15px;
  height: 100vh;
  z-index: 1000;
  background: transparent;
}




.brand {
  margin-bottom: clamp(0.5rem, 2vh, 1.5rem);
  display: flex;
  justify-content: center;
}

.brand h1 {
  display: none; /* Hide text in slim sidebar */
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: clamp(0.3rem, 1vh, 0.75rem) 0.25rem;
  margin-bottom: clamp(0.1rem, 0.5vh, 0.5rem);
  border-radius: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  text-align: center;
}

.nav-link-text {
  font-size: 0.65rem;
  margin-top: 4px;
  opacity: 0; /* Hidden by default */
  transition: all 0.2s;
  pointer-events: none;
  display: block;
  max-width: 90px;
  line-height: 1.1;
  font-weight: 600;
}

.nav-item:hover .nav-link-text {
  opacity: 1;
  transform: translateY(0);
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.8);
  box-shadow: var(--box-shadow-3d);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--border);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: none;
  border: none;
}

.nav-icon {
  font-size: clamp(1.1rem, 2.5vh, 1.5rem);
}

/* MAIN CONTENT */
.main-content {
  display: block;
  width: 95%;
  max-width: 2500px;
  margin: 0 auto !important; /* Força o centramento horizontal */
  padding: 1.5rem;
  transition: all 0.3s ease;
}

@media (min-width: 851px) {
  .main-content {
    padding: 2rem; /* Margens internas equilibradas e reduzidas */
  }
}


.header {
  position: sticky;
  top: 0;
  z-index: 1010;
  background-color: rgba(243, 241, 236, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  
  /* Margins and padding adjustment to align with main-content margins */
  margin: -1.5rem -1.5rem 2.5rem -1.5rem;
  padding: 1.25rem 1.5rem 1rem 1.5rem;
  
  transition: all 0.3s ease;
}

@media (min-width: 851px) {
  :root {
    --header-height: 88px;
  }
  .header {
    margin: -2rem -2rem 2.5rem -2rem;
    padding: 1.5rem 2rem 1.25rem 2rem;
  }
}

.page-title {
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: -1px;
  color: var(--text-main);
  margin: 0;
  transition: all 0.3s ease;
  line-height: normal;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Sidebar Toggle */
.sidebar-toggle {
  background: white;
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.sidebar-toggle:hover {
  background: var(--bg-color);
  color: var(--primary);
  border-color: var(--primary);
}

.sidebar-toggle i {
  font-size: 1.25rem;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-main);
}

/* VIEW CONTROLS */
.view-panel {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.view-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes notePulse {
  0%, 100% { opacity: 0.05; }
  50% { opacity: 0.85; }
}

.note-dot-pulse {
  animation: notePulse 2.8s ease-in-out infinite;
  background: #d97706 !important;
}

/* STATS CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background-color: white;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--box-shadow-3d);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-info h3 {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.stat-info p {
  font-size: 1.5rem;
  font-weight: 700;
}

/* PREMIUM GAUGE STAT CARDS */
.stat-card-gauge {
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  min-height: 110px;
  border-radius: 18px;
  background: white;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.01);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.stat-card-gauge:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  border-color: rgba(203, 213, 225, 0.9);
}

.stat-card-gauge .stat-icon-large {
  width: 48px;
  height: 48px;
  font-size: 1.45rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
}

.stat-card-gauge .gauge-chart-wrapper {
  position: relative;
  width: 130px;
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-gauge .gauge-chart-wrapper svg {
  width: 130px;
  height: 65px;
}

.stat-card-gauge .gauge-val-text {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  font-family: inherit;
}

/* DASHBOARD - LIVE ROOM BOARD */
.room-board {
  display: flex;
  flex-direction: column; /* Stack rooms vertically */
  gap: 2rem;
  padding-bottom: 2rem;
}

.room-column {
  width: 100%; /* Take full width */
}

.room-column-header {
  padding: 1rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

.room-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden; /* Desktop keeps clipped */
  box-shadow: var(--box-shadow-3d);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
}

.room-card:hover {
  transform: scale(1.01);
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  align-items: start;
}

.room-matrix {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 1fr; 
  width: 100%;
  border-top: 1px solid #f1f5f9;
}

.matrix-header {
  background: white; 
  color: #334155;
  padding: 0.5rem 0.25rem; /* Reduced padding */
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  border-right: 1px solid #f1f5f9;
  border-bottom: 2px solid #e2e8f0; 
  letter-spacing: 0.05em;
}

.matrix-period-label {
  background: #ffffff;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
}

.matrix-cell {
  padding: 0.5rem;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  min-height: 55px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  background-color: white;
  transition: all 0.2s;
}

.matrix-cell:hover {
  background-color: #f8fafc;
  box-shadow: var(--inner-shadow-3d);
}

.matrix-cell:last-child {
  border-right: none;
}

.matrix-cell .btn-add {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 2px 6px;
  font-size: 0.6rem;
  background: #F1F5F9;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.matrix-cell:hover .btn-add {
  opacity: 1;
}
.room-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.125rem;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.room-header.bg-anest { background-color: rgba(139, 92, 246, 0.05); border-left: 4px solid var(--primary); }
.room-header.bg-circul { background-color: rgba(236, 72, 153, 0.05); border-left: 4px solid var(--circul); }

.room-body {
  padding: 1.5rem;
}

.role-group {
  margin-bottom: 1.25rem;
}
.role-group:last-child {
  margin-bottom: 0;
}

.role-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.staff-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem; /* Removed vertical padding in favor of height */
  background-color: var(--bg-color);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  transition: all 0.2s;
  height: 46px; /* Fixed height for alignment */
}

.staff-placeholder {
  height: 46px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
  background-color: transparent;
}

.staff-row:hover {
  border-color: var(--border);
  background-color: #F8FAFC;
}

.staff-row.active {
  background-color: #EEF2FF !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 1px var(--primary);
}

.staff-row.active .name {
  color: var(--primary);
}

.staff-row.active:hover {
  background-color: #EEF2FF !important;
}

/* SHIFT CHIPS */
.shift-chip {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  background: white;
  margin-bottom: 0.25rem;
}

.shift-chip:hover {
  border-color: var(--primary);
  background-color: #F8FAFC;
}

.shift-chip.active {
  background-color: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

.shift-chip.active:hover {
  background-color: var(--primary) !important;
}

.staff-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.staff-info .name {
  font-weight: 500;
  font-size: 0.95rem;
}

.staff-info .mec {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #E2E8F0;
  padding: 2px 6px;
  border-radius: 4px;
}

/* DASHBOARD MATRIX SPECIFIC STYLES */
.matrix-staff-row {
  height: auto;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 0.7rem;
  margin-bottom: 4px;
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
  transition: all 0.2s;
}

.matrix-staff-row:hover {
  border-color: var(--primary);
  background-color: #f8fafc;
}

.matrix-staff-row.placeholder-row {
  background: transparent;
  border: 1px dashed #cbd5e1;
  cursor: pointer;
  justify-content: center;
  color: #94a3b8;
}

.matrix-staff-row.placeholder-row:hover {
  background: rgba(241, 245, 249, 0.5);
  border-color: var(--primary);
  color: var(--primary);
}

.matrix-staff-info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  gap: 4px;
}

.matrix-staff-info .name {
  font-weight: 700;
  line-height: 1.2;
  color: #1e293b;
  word-break: break-word;
}

.matrix-staff-info .badge {
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  border-radius: 4px;
  white-space: nowrap;
  margin-left: auto;
  text-align: center;
  border: 1px solid currentColor;
}

.badge.shift-8 { background-color: #DBEAFE; color: #1E40AF; }
.badge.shift-16 { background-color: #FEF3C7; color: #92400E; }
.badge.shift-22 { background-color: #FCE7F3; color: #9D174D; }

/* SALAS LADO A LADO — grelha apenas em desktop; mobile mantém o layout original */
@media (min-width: 1100px) {
  .room-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 1.5rem;
  }
  .room-board > .room-column-recobro { grid-column: 1 / -1; }
}

@media (min-width: 1500px) {
  .room-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 851px) {
  .matrix-staff-info > .staff-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .staff-name-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .staff-name-line .name { min-width: 0; word-break: normal; font-size: 0.8rem; }
  .staff-name-line .staff-suffix {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 600;
  }
  .matrix-staff-info .name > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .staff-icons { display: flex; align-items: center; min-height: 14px; }
  .staff-icons .badge { margin-left: auto; flex-shrink: 0; }
  .matrix-cell .placeholder-row { flex: 1; }
  .room-notes-box {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
  }
  .room-notes-box > span { white-space: normal !important; }
}

/* ── AVALIAÇÃO FUNCIONAL ── */
/* Fluxo de Material: o cartão mantém o mesmo grafismo, mas quando fica
   estreito (coluna "Agendado") as 3 colunas internas empilham em vez de
   espremer. Container query = reage à largura do cartão, não do ecrã. */
.mf-card {
  container-type: inline-size;
}
@container (max-width: 560px) {
  .mf-card-body {
    grid-template-columns: 1fr !important;
  }
  .mf-card-body > div {
    border-right: none !important;
    border-bottom: 1px solid #f3f4f6;
  }
  .mf-card-body > div:last-child {
    border-bottom: none;
  }
}

.aval-comp-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.aval-comp-row:last-child { border-bottom: none; }

.aval-comp-nome {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--text-main);
}

.aval-score-group {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.aval-score-btn {
  border: 1px solid var(--border);
  background: white;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.aval-score-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--text-main); }
.aval-score-btn:disabled { cursor: default; opacity: 0.7; }
.aval-score-btn.active { font-weight: 800; }

@media (max-width: 850px) {
  .aval-comp-row { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .aval-score-group { width: 100%; }
  .aval-score-btn { flex: 1; padding: 8px 4px; }
  .aval-header { display: none; }
}

/* Disponibilidade Equipa: linha sem qualquer disponibilidade no mês */
.roster-row.sem-disponibilidade {
  background: #fef2f2;
}

.roster-row.sem-disponibilidade .roster-cell {
  background: transparent;
}

.roster-row.sem-disponibilidade .roster-cell.weekend-holiday-bg {
  background: rgba(254, 226, 226, 0.55);
}

.roster-row.sem-disponibilidade .availability-input-box {
  background: rgba(255, 255, 255, 0.75) !important;
  border-color: #fecaca !important;
}

/* ── FAIXA DE DISPONIBILIDADES POR SALA (Plano de Trabalho) ── */
.dispo-strip {
  background: #FDFCF9;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  margin: 0 10px;
  padding: 0.35rem 0.8rem 0.55rem;
}

.dispo-strip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0;
  user-select: none;
}

.dispo-count {
  background: #e0e7ff;
  color: #4338ca;
  border-radius: 99px;
  padding: 0 7px;
  font-size: 0.65rem;
}

.dispo-grid {
  display: grid;
  gap: 6px;
  align-items: start;
}

.dispo-col-title {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  text-align: center;
}

.dispo-period {
  font-size: 0.75rem;
  font-weight: 800;
  color: #71717A;
  padding-top: 5px;
}

.dispo-period-row {
  border-top: 1px solid #EDEAE2;
  padding-top: 6px;
  margin-top: 6px;
}

.dispo-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dispo-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 3px;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}

.dispo-line:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.dispo-line .dispo-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispo-pct {
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.3;
  padding: 0 2px;
  background: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.dispo-shift {
  font-size: 0.68rem;
  font-weight: 700;
  color: #047857;
  border: 1px solid #A7F3D0;
  border-radius: 5px;
  padding: 0 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Mobile: reconstrói o layout original da célula (ícones à esquerda, na linha do nome) */
@media (max-width: 850px) {
  .staff-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1;
    min-width: 0;
  }
  .staff-name-line { display: flex; align-items: center; min-width: 0; }
  .staff-icons { order: -1; display: flex; align-items: center; flex-shrink: 0; }
}

.mobile-role-label {
  display: none; /* Desktop hides labels, we use headers */
}

.mobile-only {
  display: none !important;
}

/* Continuity Highlighting */
.badge-continuous {
  background-color: #fffbeb !important; /* Yellow-50 */
  color: #92400E !important; /* Yellow-800 */
  border: 1px solid #F59E0B !important;
  box-shadow: var(--box-shadow-3d);
}

.badge-gap {
  background-color: #fef2f2 !important; /* bg-red-50 */
  color: #991b1b !important; /* text-red-800 */
  border: 1px solid #ef4444 !important;
  box-shadow: var(--box-shadow-3d);
}


/* ROSTER BUILDER */
.roster-grid {
  background-color: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--box-shadow-3d);
  overflow: hidden;
  width: 100%;
  padding: 1rem;
}

.roster-header.config-input:focus {
  background: rgba(var(--primary-rgb), 0.05) !important;
  outline: none;
  border-radius: 4px;
}

.config-sections-wrapper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.config-category .roster-cell,
.config-category .roster-header-cell {
  border-right: 1px solid var(--border);
}

.config-category .roster-cell:last-child,
.config-category .roster-header-cell:last-child {
  border-right: none;
}

/* Precise Sync for Shift Config */
.config-grid-layout {
  display: grid !important;
  grid-template-columns: 70px 1fr 1fr 80px !important;
  align-items: stretch !important;
}

.config-category .roster-header-cell,
.config-category .roster-cell {
  padding: 0.75rem 0.5rem !important;
  white-space: nowrap;
}

.config-category .roster-header-cell {
  background-color: #F1F5F9;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.025rem;
}

@media (max-width: 1200px) {
  .config-sections-wrapper {
    grid-template-columns: 1fr;
  }
}

.config-category h4 {
  font-size: 0.9rem;
  letter-spacing: 0.05rem;
  font-weight: 700;
}

.roster-header-row {
  display: grid;
  background-color: #F8FAFC;
  border-bottom: 1px solid var(--border);
}

.roster-header-cell {
  padding: 0.35rem 0.1rem;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.65rem;
  text-align: center;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.roster-row {
  display: grid;
  border-bottom: 1px solid var(--border);
}

.roster-cell {
  padding: 2px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}

#nurseCoverageContainer .roster-cell {
  min-height: 28px;
}

.roster-cell.staff-detail {
  justify-content: flex-start;
  gap: 0.5rem;
}

.shift-input {
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  font-weight: 700;
  color: var(--text-main);
  transition: all 0.2s;
  background: transparent;
  font-size: 0.65rem;
}

.shift-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.valencia-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.valencia-anest { background-color: var(--anest); }
.valencia-circul { background-color: var(--circul); }
.valencia-instr { background-color: var(--instr); }

/* UTIL CLASSES */
.text-anest { color: var(--anest); }
.text-circul { color: var(--circul); }
.text-instr { color: var(--instr); }
.bg-anest-light { background-color: rgba(139, 92, 246, 0.1); }
.bg-circul-light { background-color: rgba(236, 72, 153, 0.1); }
.bg-instr-light { background-color: rgba(20, 184, 166, 0.1); }

/* ACTIONS */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px; /* Clean minimalist */
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
  font-size: 0.85rem;
  background-color: white;
  color: var(--text-main);
  box-shadow: var(--box-shadow-3d);
}

.btn:hover {
  background-color: var(--bg-color);
  border-color: #D4D4D8; /* Slightly darker */
  transform: translateY(-1px);
}

.btn-remove {
  width: 20px !important;
  height: 20px !important;
  min-height: 20px !important;
  padding: 0 !important;
  margin-left: 2px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #94a3b8 !important;
  border-radius: 6px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  opacity: 0.6;
}

.btn-remove:hover {
  background: #fee2e2 !important;
  color: #ef4444 !important;
  opacity: 1;
  transform: scale(1.1);
}

.btn-remove i {
  font-size: 0.8rem !important;
  line-height: 1;
}

.btn:active {
  background-color: #E4E4E7;
  box-shadow: none;
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  font-weight: 500;
  border: 1px solid transparent;
  box-shadow: var(--box-shadow-3d);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: white;
  border-color: transparent;
  transform: translateY(-1px);
}

.controls-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

/* Sticky primary controls bar for views - sticks cleanly below global header */
.view-panel > .controls-bar,
#checklists-container > .controls-bar {
  position: sticky;
  top: var(--header-height); /* Sticky offset to sit precisely below global header */
  z-index: 1005;
  background-color: rgba(243, 241, 236, 0.9) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  margin-left: -1.5rem !important;
  margin-right: -1.5rem !important;
  padding: 0.75rem 1.5rem !important;
  margin-top: -0.5rem !important;
  margin-bottom: 1.5rem !important;
  border-radius: 0 !important;
  transition: all 0.3s ease;
}

@media (min-width: 851px) {
  .view-panel > .controls-bar,
  #checklists-container > .controls-bar {
    margin-left: -2rem !important;
    margin-right: -2rem !important;
    padding: 1rem 2rem !important;
  }
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 3000;
}

.toast {
  min-width: 300px;
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.4s ease;
  border-left: 4px solid var(--border);
  pointer-events: auto;
}

.toast.visible {
  opacity: 1;
}

.toast.fading {
  opacity: 0;
}

.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.success { border-left-color: var(--success); }
.toast.info { border-left-color: var(--primary); }

.toast-icon {
  font-size: 1.25rem;
}

.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.success .toast-icon { color: var(--success); }
.toast.info .toast-icon { color: var(--primary); }

.toast-content h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text-main);
}

.toast-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.input-error {
  border-color: var(--danger) !important;
  background-color: #FEF2F2 !important;
  color: var(--danger) !important;
}

/* LOGIN OVERLAY */
.auth-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.auth-wrapper.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  background: white;
  padding: 3rem;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  box-shadow: var(--float-shadow);
  text-align: center;
}

.login-card .brand-icon {
  margin: 0 auto 1.5rem auto;
  width: 60px;
  height: 60px;
  font-size: 1.5rem;
}

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

.login-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.form-group {
  text-align: left;
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.login-btn {
  width: 100%;
  padding: 0.875rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 1rem;
  transition: all 0.2s;
  box-shadow: var(--box-shadow-3d);
}

.login-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}


/* AVAILABILITY ROSTER (SINGLE ROW) */
.availability-roster-container {
  background: white;
  padding: 1.5rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  margin-top: 1rem;
}

.shift-selection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding: 5px;
}

.sigla-option-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafc;
}

.sigla-option-card:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-2px);
}

.sigla-option-card.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.sigla-option-tag {
  font-weight: 700;
  display: block;
  font-size: 1.1rem;
}

.sigla-option-time {
  font-size: 0.7rem;
  opacity: 0.8;
}

.roster-cell.clickable {
  cursor: pointer;
  transition: all 0.2s;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 4px !important;
}

/* Feriados e Fins de Semana Columns Highlight (Global for all Rosters) */
.roster-cell.weekend-holiday-bg,
.roster-header-cell.weekend-holiday-bg,
.stat-card.weekend-holiday-bg {
  background-color: #fde68a; /* Brighter, more saturated yellow */
  border-left: 1px solid rgba(0,0,0,0.03);
  border-right: 1px solid rgba(0,0,0,0.03);
}

.roster-cell.recobro-cell.weekend-holiday-recobro-bg {
  background-color: #fde68a; /* Saturated yellow for Recobro highlights */
}

/* Estilo para os Badges de Lacunas (Tabela 2) */
.gap-badge-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.gap-badge-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
  filter: brightness(0.95);
}
.gap-badge-btn:active {
  transform: translateY(0);
}

.availability-input-box {
  width: 100%;
  height: 100%;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  box-shadow: var(--box-shadow-3d); /* Added 3D effect */
  transition: all 0.2s;
}
.roster-cell.clickable:hover .availability-input-box {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.prof-info-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.prof-name-main {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
}

.prof-mec-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ROOM MANAGER REFINEMENTS (3D) */
#view-salas .roster-cell i {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 8px;
  border-radius: 50%;
}

#view-salas .roster-cell i.bi-check-circle-fill {
  color: var(--primary);
  background: white;
  box-shadow: var(--box-shadow-3d);
}

#view-salas .roster-cell i.bi-circle {
  color: #cbd5e1;
  background: transparent;
}

#view-salas .roster-cell i:hover {
  transform: scale(1.2) translateY(-2px);
  box-shadow: var(--float-shadow);
}

#view-salas .roster-row:hover {
  background-color: #ffffff;
}

#view-salas .roster-header-cell {
  border-bottom: 2px solid var(--primary);
  font-size: 0.75rem;
}

/* ROOM MANAGER SHIFT TOGGLES (3D) - VERTICAL STACK */
.shift-toggle-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 4px 0;
}


.shift-toggle-btn {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  background: #ffffff;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  line-height: 1;
}

.shift-toggle-btn.active {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border-color: #10b981;
  font-weight: 800;
}

.shift-toggle-btn:hover {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.shift-toggle-btn.active:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #059669;
}

/* RECOBRO SPECIFIC */
.recobro-shift-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
}

/* Recobro element cycling badge */
.elem-count-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 900;
  cursor: pointer;
  background: #DC2626; /* Deep distinct red */
  color: white;
  border: 1px solid white; /* Ensures contrast against elements below it */
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.15s ease;
  line-height: 1;
  z-index: 10;
}

.shift-time-badge {
  position: absolute;
  top: -6px;
  right: -10px;

  width: 36px;
  text-align: center;

  border-radius: 10px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: #ef4444;
  font-size: 0.55rem;
  font-weight: 900;





  border: 1px solid #ef4444; /* Red border */
  white-space: nowrap;
  pointer-events: none;
  z-index: 15;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  line-height: 1;
}



.elem-count-badge:hover {
  transform: scale(1.15);
}

/* MATRIX CLOSED STATE */
.matrix-period-row.closed {
  opacity: 0.5;
  background: #f1f5f9;
  position: relative;
  pointer-events: none;
}

.matrix-period-row.closed::after {
  content: 'SALA FECHADA';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-5deg);
  font-size: 0.7rem;
  font-weight: 900;
  color: #94a3b8;
  letter-spacing: 0.1em;
  opacity: 0.3;
  pointer-events: none;
}

#view-salas .roster-cell {
  padding: 4px;
}

#view-salas .roster-header-cell {
  font-weight: 800;
  text-transform: uppercase;
}

/* Recobro cell: column stack for M/T/N rows */
#view-salas .roster-cell.recobro-cell {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px;
  padding: 4px;
}

/* Continuity Indicators */
.badge-continuous {
  color: #059669 !important; /* Emerald Green */
  border-color: #059669 !important;
  background-color: #ecfdf5 !important;
}
.badge-gap {
  color: #DC2626 !important; /* Red for gaps/overlaps */
  border-color: #DC2626 !important;
  background-color: #fef2f2 !important;
}
.badge-training-diff {
  color: #d97706 !important; /* Amber Yellow text */
  border-color: #f59e0b !important; /* Amber border */
  background-color: #fffbeb !important; /* Light amber bg */
}

/* VALENCIA ICONS (SMALL) */
.valencia-icon {
  font-size: 0.85rem;
  margin-right: -2px;
  transition: transform 0.2s;
}

.valencia-icon:hover {
  transform: scale(1.3);
  z-index: 10;
}

.v-anest { color: var(--warning) !important; }
.v-circul { color: var(--danger) !important; }
.v-instr { color: var(--instr) !important; }
.v-recobro { color: #8b5cf6 !important; } /* Purple/Amethyst for Recobro */

/* ########################################## */
/* 📱 RESPONSIVE MEDIA QUERIES (App Native Look) */
/* ########################################## */

/* General Mobile Toggle Button */
.mobile-toggle-btn {
  display: none !important;
  background: transparent;
  border: none;
  padding: 0.25rem;
  font-size: 1.6rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--primary);
  box-shadow: none;
}

.header-right {
  display: flex;
  align-items: center;
}

@media (max-width: 850px) {
  .mobile-toggle-btn {
    display: none !important;
  }

  .sidebar {
    position: fixed;
    left: -140px; /* Hidden state */
    visibility: hidden;
    top: 0;
    height: 100vh;
    margin: 0;
    z-index: 2000;
    background: white;
    box-shadow: 20px 0 50px rgba(0,0,0,0.1);
    transition: left 0.4s cubic-bezier(0.19, 1, 0.22, 1), visibility 0.4s;
  }

  .sidebar.show {
    left: 0;
    width: 100px;
    visibility: visible;
  }

  .main-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1rem 1.25rem;
  }

  .sidebar-trigger {
    display: none !important;
  }

  :root {
    --header-height: 68px;
  }

  .header {
    position: sticky;
    top: 0.75rem;
    z-index: 1010;
    background-color: rgba(243, 241, 236, 0.92) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    margin: 0 0 1.5rem 0 !important;
    padding: 0 1rem !important;
    height: 64px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.75rem !important;
    flex-wrap: nowrap !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    cursor: pointer !important;
  }

  .view-panel > .controls-bar,
  #checklists-container > .controls-bar,
  .material-sticky-header {
    position: relative !important;
    top: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 1rem !important;
    background: white !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    z-index: auto !important;
    margin-top: 0 !important;
    margin-bottom: 1.5rem !important;
  }

  .page-title {
    font-size: 1.2rem;
    letter-spacing: -0.5px;
    color: var(--text-main);
    text-shadow: none;
  }

  #pageSubtitle {
    display: none !important;
  }

  /* Rotação e cor do chevron indicador do cabeçalho quando o menu lateral está aberto */
  .sidebar.show ~ .main-content #headerMenuChevron {
    transform: rotate(180deg);
    color: var(--primary) !important;
  }

  .notification-center {
    position: static !important;
  }

  /* Centro de notificações móvel - estica horizontalmente abaixo do cabeçalho sem sair do ecrã */
  #notifDropdown {
    position: absolute !important;
    top: calc(100% + 0.5rem) !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: 480px !important;
    margin: 0 auto !important;
    z-index: 10000 !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15) !important;
  }

  /* Barra de submissão do mercado de turnos em mobile */
  #marketSubmitBar {
    padding: 0.65rem 0.9rem !important;
    gap: 0.5rem !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
  }

  #marketSubmitBar #marketClearBtn {
    padding: 0.4rem 0.7rem !important;
    font-size: 0.75rem !important;
  }

  #marketSubmitBar #marketSubmitBtn {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.75rem !important;
  }

  /* Stats Grid in Mobile - More compact */
  .stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .stat-card {
    padding: 0.75rem;
    border-radius: 12px;
    gap: 0.5rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
    border-radius: 8px;
  }

  .stat-info h3 {
    font-size: 0.6rem;
    line-height: 1.1;
    margin-bottom: 2px;
  }

  .stat-info p {
    font-size: 1.1rem;
  }

  .roster-grid {
    display: block; /* Allows container scroll override */
    overflow-x: auto;
    width: calc(100% + 1.5rem);
    margin-left: -0.75rem; /* Matches main-content padding */
    margin-right: -0.75rem;
    border-radius: 0;
    padding: 0;
  }

  #staffAvailabilityRoster.roster-grid {
    display: grid !important;
    width: 100% !important;
    margin-left: 0 !important;
    overflow-x: hidden !important;
    border-radius: 12px !important;
  }

  .availability-roster-container {
    padding: 0.75rem !important;
  }

  /* Freeze only the first column */
  .roster-header-row, .roster-row {
    width: max-content; /* Ensure row expands to children */
    min-width: 100%;
  }

  .roster-header-cell:first-child, 
  .roster-cell:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 10;
    border-right: 2px solid var(--border);
    min-width: 90px;
    box-shadow: 4px 0 8px rgba(0,0,0,0.05);
  }

  /* Fix for availability calendar to have equal widths */
  #staffAvailabilityRoster .roster-cell:first-child,
  #staffAvailabilityRoster .roster-header-cell:first-child {
    position: static !important;
    min-width: 0 !important;
    box-shadow: none !important;
    z-index: auto !important;
  }

  .roster-header-cell:first-child {
    background: #f8fafc;
  }

  .room-matrix {
    display: flex !important;
    flex-direction: column;
    min-width: 0 !important;
    border-top: none;
  }

  .matrix-header {
    display: none; /* Desktop headers not needed in stacked mobile view */
  }

  /* Period separators for mobile */
  .matrix-period-label {
    width: 100% !important;
    background: #f1f5f9 !important;
    padding: 8px 16px !important;
    justify-content: flex-start !important;
    font-weight: 800 !important;
    font-size: 0.8rem !important;
    color: var(--accent-blue) !important;
    border-bottom: 1px solid var(--border) !important;
    border-right: none !important;
    position: relative !important;
  }

  .matrix-cell {
    width: 100%;
    border-right: none !important;
    border-bottom: 1px solid #f8fafc !important;
    padding: 12px 16px !important;
    min-height: auto !important;
  }
  
  .matrix-cell:last-child {
    border-bottom: none !important;
  }

  .mobile-role-label {
    display: block !important;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 6px;
  }

  .matrix-staff-row {
    padding: 10px 12px !important;
    gap: 12px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
  }

  .matrix-staff-info {
    flex: 1 !important;
    flex-direction: row !important; /* Back to horizontal row for better use of width */
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
  }

  .matrix-staff-info .name {
    font-size: 0.85rem !important; /* Slightly larger for readability */
  }

  .matrix-staff-info .badge {
    font-size: 0.7rem !important;
    padding: 3px 8px !important;
  }

  /* Visibility toggles */
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
  .mobile-only.inline { display: inline-block !important; }

  .room-column-header {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  /* Controls Bar optimization */
  .controls-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
    margin-bottom: 1.5rem !important;
  }
  
  .controls-bar > div {
     display: flex !important;
     flex-wrap: wrap !important;
     gap: 0.5rem !important;
     width: 100% !important;
     justify-content: space-between !important;
     margin-top: 0 !important;
     margin-bottom: 0 !important;
  }


  .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }

  .controls-bar .btn, .modal-actions .btn {
    flex: 1; /* Layout buttons take equal space */
    min-width: 0;
  }

  .btn-remove {
    width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    background: #f1f5f9 !important;
    border: none !important;
    color: #94a3b8 !important;
    flex: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
    opacity: 1;
  }

  .btn-primary {
    width: 100%;
  }

  /* User Profile Adjustment */
  .user-profile span {
    display: none; /* Hide name, keep avatar */
  }
  
  .header-right {
    gap: 0.5rem;
  }

  #superAdminHospitalSelector {
    margin-right: 0.5rem !important;
  }
  
  #globalHospitalSelect {
    min-width: 140px !important;
    font-size: 0.75rem !important;
  }

  /* Login Form Sizing for Mobile */
  .login-card {
    padding: 1.5rem !important;
    max-width: 90% !important;
  }
}

/* Modal sizing for mobile */
@media (max-width: 500px) {
  .modal-content {
    margin: auto;
    border-radius: 16px;
    max-height: 85vh;
  }
  
  .modal-overlay {
    padding: 1rem;
    align-items: center;
  }
}

/* ########################################## */
/* 🖨️ FICHA DE CONTAGEM (Inventário) — folha de impressão independente das   */
/* regras de impressão da escala: esconde tudo o resto e mostra só isto.     */
/* ########################################## */
.inventario-print-only {
  display: none;
}

@media print {
  body.inventario-a-imprimir > *:not(#inventarioPrintSheet) {
    display: none !important;
  }

  body.inventario-a-imprimir .inventario-print-only {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* Margem lateral visual: a margem física da página (@page) é partilhada com a
       impressão da escala, por isso a "respiração" nas laterais é feita aqui, por
       padding, sem mexer nessa regra partilhada. */
    padding: 0 2cm;
    box-sizing: border-box;
  }

  .inventario-print-only .print-header {
    text-align: center;
    margin-bottom: 1rem;
  }

  .inventario-print-only .print-header h1 {
    font-size: 15pt;
    margin: 0;
    color: #000;
  }

  .inventario-print-only .print-header h2 {
    font-size: 10pt;
    margin: 4px 0 0 0;
    color: #333;
    font-weight: 500;
  }

  .inventario-print-only table {
    /* auto (não 100%): as colunas encolhem para o conteúdo, em vez de a
       Designação ser esticada para preencher a largura da página — assim a
       Contagem fica logo a seguir ao texto, não lá para o lado direito.
       margin auto centra essa tabela (mais estreita que a folha) horizontalmente. */
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 9pt;
  }

  .inventario-print-only th,
  .inventario-print-only td {
    border: 1px solid #999;
    padding: 5px 8px;
    text-align: left;
  }

  .inventario-print-only th {
    background: #eee !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .inventario-print-only td.inventario-print-contagem,
  .inventario-print-only th.inventario-print-contagem {
    width: 90px;
  }
}

/* ########################################## */
/* 🖨️ ESCALA — folha de impressão dedicada                                   */
/*                                                                           */
/* Não se imprime o painel da escala: imprime-se uma tabela gerada de raiz    */
/* por _gerarFolhaImpressaoEscala(). O painel tem uma área com scroll de      */
/* 72vh, cabeçalho sticky e sombras que o Chrome converte em imagem — um PDF  */
/* real desta escala saiu com 87 páginas e 4 MB, quase metade rasterizada.    */
/* ########################################## */
.escala-print-only {
  display: none;
}

@media print {
  body.escala-a-imprimir > *:not(#escalaPrintSheet) {
    display: none !important;
  }

  /* Anula o zoom global da impressão: a folha já se dimensiona sozinha, pela
     altura de linha calculada a partir do número de profissionais. */
  body.escala-a-imprimir {
    zoom: 1 !important;
  }

  body.escala-a-imprimir .escala-print-only {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .escala-print-only .escala-print-cabecalho {
    text-align: center;
    margin-bottom: 8px;
  }

  .escala-print-only .escala-print-cabecalho h1 {
    font-size: 13pt;
    font-weight: 800;
    margin: 0;
    color: #000;
  }

  .escala-print-only .escala-print-cabecalho h2 {
    font-size: 9pt;
    font-weight: 500;
    margin: 2px 0 0 0;
    color: #333;
  }

  .escala-print-only table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: var(--escala-fonte, 7px);
  }

  .escala-print-only th,
  .escala-print-only td {
    height: var(--escala-linha, 14px);
    border: 0.5px solid #94a3b8;
    padding: 0 1px;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    line-height: 1;
  }

  /* Nome do profissional: alinhado à esquerda e cortado se não couber, em vez
     de alargar a coluna e empurrar os dias para fora da folha. */
  .escala-print-only th.esq,
  .escala-print-only td.esq {
    text-align: left;
    padding-left: 3px;
    text-overflow: ellipsis;
  }

  .escala-print-only thead th {
    background: #1e293b !important;
    color: #fff !important;
    font-weight: 700;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Fins de semana e feriados, o mesmo destaque do ecrã. */
  .escala-print-only td.fds {
    background: #fef9c3 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .escala-print-only thead th.fds {
    background: #2563eb !important;
  }
}

/* ########################################## */
/* 🖨️ PRINT STYLES */
/* ########################################## */
@media print {
  @page {
    size: A4 landscape;
    margin: 0.4cm; /* Small margin to maximize print area */
  }

  html, body {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    max-width: none !important;
    width: auto !important;
    height: auto !important;
  }

  /* Force background colors and styles to print exactly as they look on screen */
  * {
    animation: none !important;
    transition: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: white !important;
    min-height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    /* Redução para a escala caber numa folha A4. O fator é calculado em
       _prepararImpressaoEscala() (app_v3.js) a partir do número de linhas que a
       grelha tem de facto: estava fixo em 0.68, valor que só servia para uma
       dimensão de equipa em concreto e repartia a escala por várias folhas
       assim que o hospital tinha mais profissionais. */
    zoom: var(--escala-print-zoom, 0.68) !important; 
  }

  .print-header {
    display: block !important;
    margin-bottom: 12px !important;
    text-align: center;
  }
  
  .print-header h1 {
    font-size: 15pt !important;
    color: var(--primary) !important;
    font-weight: 800 !important;
    margin: 0 !important;
  }
  
  .print-header h2 {
    font-size: 11pt !important;
    color: var(--text-main) !important;
    font-weight: 600 !important;
    margin: 3px 0 0 0 !important;
  }

  .sidebar, 
  .header, 
  .controls-bar, 
  .mobile-toggle-btn,
  .btn-remove,
  .staff-placeholder,
  .toast-container,
  .auth-wrapper,
  .btn {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    overflow: visible !important;
  }

  .view-panel {
    display: none !important;
  }

  .view-panel.active {
    display: block !important;
    width: 100% !important;
  }

  .roster-grid {
    box-shadow: none !important;
    border: 1px solid var(--border) !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    /* Sem limite de altura nem área que rola: no ecrã a grelha é uma caixa de
       72vh com scroll interno (ver "#view-escala .roster-grid"), e essa regra
       tem mais especificidade do que esta. Sem a anular aqui, a impressão fazia
       a grelha transbordar de uma caixa curta e repartia-a por muitas folhas —
       e a paginação desse transbordo é o que a tornava lenta a gerar. */
    max-height: none !important;
    height: auto !important;
    padding: 0.5rem !important;
    margin: 0 !important;
    background: white !important;
    border-radius: 12px !important;
  }

  /* O cabeçalho fixo só faz sentido enquanto há scroll. Em papel, sticky pode
     deixá-lo repetido ou fora do sítio. */
  .roster-header-row {
    position: static !important;
  }

  .roster-header-row, .roster-row {
    width: 100% !important;
    display: grid !important;
    page-break-inside: avoid;
  }

  .roster-header-cell, .roster-cell {
    font-size: 6.2pt !important;
    padding: 0px 1px !important;
    min-height: 20px !important;
    height: 20px !important; /* Make rows extremely compact */
    min-width: 0 !important; /* Allow cells to shrink */
    border-right: 1px solid #cbd5e1 !important;
    border-bottom: 1px solid #cbd5e1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Retain original header color styles */
  .roster-header-cell {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 800 !important;
  }

  .roster-cell.staff-detail {
    min-width: 100px !important;
    justify-content: flex-start !important;
    padding-left: 4px !important;
  }

  .weekend-holiday-bg {
    background-color: #fef9c3 !important; 
  }

  .availability-input-box {
    box-shadow: none !important;
    border: 1px solid var(--border) !important;
    height: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  
  .availability-input-box.live-allocation {
    border-color: #2563eb !important;
    color: #2563eb !important;
    background: #eff6ff !important;
  }

  .shift-input {
    border: none !important;
    font-size: 6.2pt !important;
    background: transparent !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    font-weight: 700 !important;
    color: inherit !important;
    height: 14px !important;
  }
}


/* MAIN MENU */
.main-menu-container {
  max-width: 1000px;
  margin: 4rem auto;
  padding: 0 1rem;
}

.main-menu-header {
  text-align: center;
  margin-bottom: 4rem;
}

.main-menu-header h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -2px;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.main-menu-header p {
  font-size: 1.125rem;
  color: var(--text-muted);
}

.main-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
}

.menu-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.menu-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.1);
}

.menu-card-icon {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: all 0.4s;
}

.menu-card-content {
  min-width: 0;
}

.menu-card:hover .menu-card-icon {
  transform: scale(1.1);
}

.menu-card-content {
  flex: 1;
}

.menu-card-content h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.menu-card-content p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.menu-card-arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
  opacity: 0.3;
  transition: all 0.4s;
}

.menu-card:hover .menu-card-arrow {
  opacity: 1;
  transform: translateX(5px);
  color: var(--primary);
}

/* EMPTY STATE */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem;
  text-align: center;
  background: white;
  border-radius: 24px;
  border: 1px dashed var(--border);
  margin: 2rem auto;
  max-width: 600px;
}

.empty-state h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .main-menu-header h1 {
    font-size: 2.25rem;
  }
  
  .main-menu-grid {
    grid-template-columns: 1fr;
  }
  
  .menu-card {
    padding: 1.5rem;
    gap: 1.25rem;
  }
  
  .menu-card-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
}

.btn-item-opt {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
}

.btn-item-opt:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.btn-item-opt.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.btn-scope {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}

.btn-scope.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(30, 41, 59, 0.2);
}

/* CHECKLIST MODULE STYLES */
.checklist-table th {
  font-weight: 700;
  letter-spacing: 0.05em;
}

.checklist-table tr:hover {
  background-color: #f8fafc;
}

.btn-check-option {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 60px;
}

.btn-check-option:hover {
  border-color: var(--primary);
  background: #f1f5f9;
}

.btn-check-option.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-check-option.active.sim {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: white !important;
}

.btn-check-option.active.nao {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: white !important;
}

.btn-check-option.active.na {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: white !important;
}

.phase-tab.active {
  opacity: 1 !important;
}

.checklist-row:hover {
  border-color: var(--border);
  background: #f1f5f9 !important;
}

.checklist-row.item-missing {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

.checklist-row.item-missing:hover {
  background: #fee2e2 !important;
}

.badge-modulo {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.badge-modulo:hover {
    background: #e2e8f0;
}

.badge-modulo.active {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border-color: #10b981;
}
/* INTERNAL ADMIN NAVIGATION (Vertical Tabs) */
.admin-layout {
  display: flex;
  gap: 2rem;
  min-height: 70vh;
}

/* Recolhível por hover, tal como a .sidebar principal dos outros módulos:
   escondida fora do ecrã por omissão, revelada ao pairar sobre a faixa
   invisível .admin-sidebar-trigger encostada à margem esquerda. Mesma
   largura/estrutura (logo + .nav-item ícone-sobre-texto) — .admin-nav-item
   fica só como gancho para switchAdminTab() saber qual está ativo, o
   visual em si vem inteiramente de .nav-item, partilhado com os módulos. */
.admin-sidebar {
  width: 100px;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  padding: 0.75rem 0.5rem;
  box-shadow: 20px 0 50px rgba(0,0,0,0.1);
  position: fixed;
  left: -105px;
  visibility: hidden;
  top: 0;
  height: 100vh;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  transition: left 0.4s cubic-bezier(0.19, 1, 0.22, 1), visibility 0.4s;
}

.admin-sidebar.show {
  left: 0;
  visibility: visible;
}

.admin-sidebar-trigger {
  position: fixed;
  left: 0;
  top: 0;
  width: 15px;
  height: 100vh;
  z-index: 1000;
  background: transparent;
}

.admin-nav-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.admin-content {
  flex: 1;
}

.admin-tab-panel {
  display: block;
}

.admin-tab-panel.hidden {
  display: none;
}

@media (max-width: 850px) {
  .date-nav-wrapper {
    display: flex;
    width: 100%;
    justify-content: space-between !important;
    align-items: center;
    gap: 0.25rem !important;
  }
  .date-nav-wrapper #currentDateDisplay {
    flex: 1;
    min-width: 0 !important;
    font-size: 0.85rem !important;
    padding: 0.3rem 0.5rem !important;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .date-nav-wrapper .btn-text-nav {
    display: none !important; /* Esconde texto "Anterior", "Próximo", "Hoje" */
  }
  .date-nav-wrapper .btn {
    padding: 0.4rem 0.6rem !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-layout {
    flex-direction: column;
    gap: 1.5rem;
  }
  /* Em ecrãs estreitos o menu volta a ficar sempre visível (sem recolher por
     hover — não há hover no táctil), anulando as regras fixas/escondidas de desktop. */
  .admin-sidebar {
    width: 100%;
    display: flex;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0.5rem;
    gap: 0.5rem;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    position: sticky;
    left: auto;
    visibility: visible;
    height: auto;
    top: var(--header-height);
    z-index: 10;
    box-shadow: none;
  }
  .admin-sidebar-trigger {
    display: none;
  }
  /* .brand e .nav-menu vêm da .sidebar principal (coluna vertical) — em
     ecrã estreito o admin-sidebar volta a ser a barra horizontal de
     sempre, por isso precisa dos seus próprios overrides aqui. */
  .admin-sidebar .brand {
    display: none;
  }
  .admin-sidebar .nav-menu {
    flex-direction: row;
    flex: 1;
  }
  .admin-nav-item {
    flex-direction: row;
    margin-bottom: 0;
    white-space: nowrap;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    flex-shrink: 0;
  }
  .admin-nav-item .nav-link-text {
    opacity: 1;
    margin-top: 0;
    margin-left: 6px;
  }
  
  /* Roster Grid Mobile - Stacked Cards */
  .roster-grid {
    background: transparent !important;
    border: none !important;
    gap: 1rem;
    display: flex;
    flex-direction: column;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .roster-header-row {
    display: none !important;
  }
  .roster-row {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    height: auto !important;
    background: white !important;
    border-radius: 16px !important;
    padding: 1.25rem !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    gap: 0.75rem !important;
    position: relative;
  }
  .roster-cell {
    width: 100% !important;
    justify-content: flex-start !important;
    padding: 0.5rem 0 !important;
    border: none !important;
    background: transparent !important;
    height: auto !important;
  }
  .roster-cell::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.25rem;
    width: 100%;
  }

  /* Specific Admin Row Overrides */
  #hospitalsListContainer .roster-row,
  #professionalsListContainer .roster-row {
    align-items: flex-start !important;
  }
}

/* Global Table Responsiveness */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

.gestao-stocks-table-wrap {
  max-height: 65vh;
  overflow-y: auto;
}

/* Cabeçalho fixo ao rolar a tabela. As tabelas de Gestão de Stocks já trazem
   isto inline em cada <th>; esta regra faz o mesmo para as do Inventário, sem
   repetir o estilo dezenas de vezes no HTML gerado. O border-bottom tem de ir
   no <th> e não no <tr>: com position:sticky a borda da linha não acompanha o
   cabeçalho e a separação desaparece ao rolar. */
.gestao-stocks-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

/* Checklist Mobile Adjustments */
@media (max-width: 600px) {
  .checklist-form-wrapper {
    padding: 1rem !important;
  }
  .checklist-section-card {
    padding: 1rem !important;
    border-radius: 12px !important;
  }
  .checklist-item-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem !important;
  }
}

/* Mobile Overrides for Specific Complex Layouts */
@media (max-width: 850px) {
  /* Template Builder Header */
  #checklists-container .card > div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  
  /* Template Item in Manager */
  .template-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem !important;
  }
  .template-item > div:last-child {
    width: 100% !important;
    justify-content: flex-end !important;
  }
  
  /* Checklist Rows in Submission Form */
  .checklist-row.sub-row {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    padding: 1rem !important;
  }
  .checklist-row.sub-row > div {
    justify-content: space-between !important;
    width: 100% !important;
  }

  /* History Table specific for Checklist */
  .checklist-table tr {
    display: flex !important;
    flex-direction: column !important;
    background: white !important;
    margin-bottom: 1rem !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    padding: 1rem !important;
  }
  .checklist-table thead {
    display: none !important;
  }
}

/* CONFIG GRID LAYOUT */
.config-grid-layout {
  display: grid !important;
  grid-template-columns: 65px 80px 80px 1fr 80px !important;
  gap: 0.5rem;
  align-items: center;
}

.config-sections-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  align-items: start;
}

@media (max-width: 600px) {
  .config-sections-wrapper {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.config-category {
  background: white;
  padding: 1.5rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--box-shadow-3d);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.config-category:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px rgba(0,0,0,0.1);
}

.config-category h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1rem;
}

/* Premium Missing Shifts Table */
.premium-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.premium-table th {
  background: #f8fafc;
  padding: 1.25rem 1.5rem;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  border-bottom: 2px solid var(--border);
}

.premium-table td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-main);
}

.premium-table tr:last-child td {
  border-bottom: none;
}

.premium-table tr:hover td {
  background: rgba(248, 250, 252, 0.8);
}

.missing-shifts-table .cell-date {
  font-weight: 700;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace, sans-serif; /* Mono for dates looks techy/premium */
  font-size: 0.85rem;
}

.missing-shifts-table .cell-day {
  text-transform: capitalize;
  font-weight: 500;
}

.row-weekend {
  background-color: rgba(24, 24, 27, 0.02);
}

.missing-sigla-badge {
  background: var(--danger);
  color: white;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
}

.time-range {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.time-pill {
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.75rem;
  background: var(--bg-hover, #f1f5f9);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.time-pill.start { border-left: 3px solid var(--success); }
.time-pill.end { border-left: 3px solid var(--danger); }

.badge-valency {
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.val-anest { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.val-circul { background: #fff1f2; color: #e11d48; border: 1px solid #fecdd3; }
.val-instr { background: #f0fdfa; color: #0d9488; border: 1px solid #99f6e4; }
.val-recobro { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }

/* Missing Shifts Matrix Styles */
.missing-shifts-matrix .roster-cell {
  min-height: 90px !important;
  padding: 6px !important;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: flex-start !important;
  align-items: center !important;
}

.missing-shifts-matrix .gap-item-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  width: 100%;
}

.missing-shifts-matrix .roster-pill {
  background: white;
  border: 1.5px solid #2563eb; /* Blue-600 */
  color: #2563eb;
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.1);
  transition: all 0.2s;
}

.missing-shifts-matrix .roster-pill i {
  font-size: 0.7rem;
}

.missing-shifts-matrix .roster-pill.val-anest { border-color: var(--anest); color: var(--anest); }
.missing-shifts-matrix .roster-pill.val-circul { border-color: var(--circul); color: var(--circul); }
.missing-shifts-matrix .roster-pill.val-instr { border-color: var(--instr); color: var(--instr); }
.missing-shifts-matrix .roster-pill.val-recobro { border-color: var(--recobro); color: var(--recobro); }

.missing-shifts-matrix .roster-header-cell.weekend-holiday-bg {
  background-color: #fde68a !important; 
  color: var(--primary) !important;
}

.missing-shifts-matrix .roster-cell.weekend-holiday-bg {
  background-color: #fde68a !important;
}

/* Month Navigation Container - Single Line with Month in between Buttons */
.month-nav-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  width: auto;
  margin: 0;
}

.month-nav-display {
  font-weight: 800 !important;
  font-size: 1.15rem !important; /* Larger font size */
  color: var(--primary);
  background: var(--primary-light, #eff6ff);
  padding: 0.5rem 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(37,99,235,0.15);
  text-align: center;
  white-space: nowrap;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  box-shadow: var(--box-shadow-3d); /* Added premium 3D lift */
}

.month-nav-container .btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  margin: 0;
}

/* Date Navigation Container (Dashboard) */
.date-nav-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  width: auto;
  margin: 0;
  flex-wrap: nowrap;
}

.date-display-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light, #eff6ff);
  padding: 0.25rem 0.5rem 0.25rem 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(37,99,235,0.15);
  height: 38px;
  box-shadow: var(--box-shadow-3d);
}

.date-nav-display {
  font-weight: 800 !important;
  font-size: 1.15rem !important;
  color: var(--primary);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.date-calendar-btn {
  background: white !important;
  border: 1px solid rgba(37,99,235,0.15) !important;
  color: var(--primary) !important;
  height: 28px !important;
  width: 28px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  font-size: 0.9rem !important;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--box-shadow-3d);
}

.date-calendar-btn:hover {
  background: var(--primary-light, #eff6ff) !important;
  transform: translateY(-1px);
}

.date-nav-container .btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  margin: 0;
}

@media (max-width: 850px) {
  /* On mobile, keep single line layout but hide button text if necessary for space */
  .month-nav-container {
    width: 100%;
    justify-content: center;
  }
  .month-nav-display {
    font-size: 1rem !important;
    min-width: 110px;
    flex: 1;
  }
  .month-nav-container .btn {
    flex-shrink: 0;
  }

  .date-nav-container {
    width: 100%;
    justify-content: center;
  }
  .date-display-wrapper {
    flex: 1;
    justify-content: space-between;
    min-width: 0;
  }
  .date-nav-display {
    font-size: 0.95rem !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .date-nav-container .btn {
    flex-shrink: 0;
  }
}

@media (max-width: 500px) {
  .month-nav-container .nav-btn-text,
  .date-nav-container .nav-btn-text {
    display: none; /* Hide text on small screens, show only chevrons */
  }
  .date-nav-display {
    font-size: 0.8rem !important;
  }
}

/* --- PREMIUM STYLING: MÓDULO FLUXO DE MATERIAL --- */
.material-sticky-header {
  position: sticky;
  top: var(--header-height);
  z-index: 1005;
  background-color: rgba(243, 241, 236, 0.92) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid var(--border);
  margin-left: -1.5rem !important;
  margin-right: -1.5rem !important;
  padding: 1rem 1.5rem !important;
  margin-top: -1.5rem !important;
  margin-bottom: 1.5rem !important;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: all 0.3s ease;
}

@media (min-width: 851px) {
  .material-sticky-header {
    margin-left: -2rem !important;
    margin-right: -2rem !important;
    margin-top: -2rem !important;
    padding: 1.25rem 2rem !important;
  }
}

/* Removed old material-card transitions */

/* Custom form elements within fluxo de material request page */
#materialRequestForm .form-input {
  transition: all 0.2s ease-in-out !important;
  border: 1px solid var(--border) !important;
}

#materialRequestForm .form-input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.08) !important;
  outline: none !important;
}

/* Modals overlays & transitions */
.modal-overlay {
  transition: opacity 0.25s ease-out !important;
}

.modal-overlay.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  display: none !important;
}

.modal-content {
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.modal-overlay:not(.hidden) .modal-content {
  transform: scale(1) !important;
}

/* Hover interativo nos botões do Departamento de Compras */
.compras-hospital-pill {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.compras-hospital-pill:hover {
  transform: translateY(-2px);
  filter: brightness(0.95);
}

/* FLUXO DE MATERIAL: PREMIUM REDESIGNED CARDS */
.material-card {
  display: flex !important;
  flex-direction: column;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.03), 0 8px 10px -6px rgba(15, 23, 42, 0.01);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  position: relative;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.material-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.08), 0 12px 14px -8px rgba(15, 23, 42, 0.04) !important;
  border-color: rgba(203, 213, 225, 0.9) !important;
}

.material-card-status-indicator {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  z-index: 1;
}

.material-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid rgba(241, 245, 249, 0.8);
  background: linear-gradient(to right, rgba(248, 250, 252, 0.5), transparent);
  gap: 1rem;
  flex-wrap: wrap;
  padding-left: 2rem;
}

.material-card-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.mc-gts-badge {
  font-weight: 800;
  font-size: 1.1rem;
  color: #0f172a;
  font-family: 'JetBrains Mono', monospace;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.8);
}

.mc-provider-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
}

.mc-hospital-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.material-card-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mc-status-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.mc-compras-validado {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.mc-compras-pendente {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.material-card-body-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding: 1.75rem 2rem;
  padding-bottom: 0.5rem;
  align-items: start;
}

.material-card-body-bottom {
  padding: 0 2rem 1.75rem 2rem;
}

/* COLUMNS SHARED */
.material-card-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100%;
}

/* LEFT COLUMN */
.mc-info-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mc-meta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: #475569;
}

.mc-meta-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.mc-meta-label-inline {
  font-weight: 500;
}

.mc-meta-val {
  color: #0f172a;
  font-weight: 700;
}

/* TIMELINE */
.mc-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-color);
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid rgba(226, 232, 240, 0.6);
}

.mc-timeline-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mc-timeline-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  z-index: 2;
  box-shadow: 0 0 0 4px var(--bg-color);
}

.mc-icon-blue { color: #2563eb; background: #dbeafe; }
.mc-icon-red { color: #ffffff; background: #ef4444; box-shadow: 0 0 0 4px #fef2f2; }
.mc-icon-gray { color: #475569; background: #e2e8f0; }

.mc-timeline-connector {
  width: 2px;
  height: 16px;
  background: #e2e8f0;
  margin-left: 15px;
  margin-top: -4px;
  margin-bottom: -4px;
  z-index: 1;
}

.mc-timeline-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.mc-timeline-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mc-timeline-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}

.mc-text-red {
  color: #ef4444 !important;
}

/* CENTER / WIDE COLUMN */
.mc-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mc-section-title i {
  color: #94a3b8;
  font-size: 1rem;
}

.mc-requisition-panel-wide {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
}

.mc-requisition-text {
  color: #334155;
  white-space: pre-line;
  overflow-y: auto;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.6;
  flex: 1;
  max-height: 250px;
  padding-right: 8px;
}

.mc-requisition-text::-webkit-scrollbar { width: 6px; }
.mc-requisition-text::-webkit-scrollbar-track { background: transparent; }
.mc-requisition-text::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.mc-requisition-text::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.mc-requisition-obs {
  border-top: 1px dashed #cbd5e1;
  padding-top: 1rem;
  font-style: italic;
  color: #64748b;
  font-size: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mc-requisition-obs i {
  color: #f59e0b;
  margin-top: 2px;
}

/* RIGHT COLUMN - ACTIONS & STATUS */
.mc-logistics-status-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #ffffff;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.mc-logistics-item-vertical {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.mc-logistics-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mc-logistics-value {
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mc-logistics-value.success { color: #15803d; }
.mc-logistics-value.pending { color: #94a3b8; font-style: italic; }

.mc-actions-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
}

.mc-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  width: 100%;
}

.mc-btn:active {
  transform: scale(0.97);
}

.mc-btn-validate { background: #10b981; color: white; }
.mc-btn-validate:hover { background: #059669; box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2); }

.mc-btn-success { background: #10b981; color: white; }
.mc-btn-success:hover { background: #059669; box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2); }

.mc-btn-primary { background: #3b82f6; color: white; }
.mc-btn-primary:hover { background: #2563eb; box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2); }

.mc-btn-secondary { background: #ffffff; color: #475569; border: 1px solid #cbd5e1; }
.mc-btn-secondary:hover { background: #f8fafc; color: #0f172a; border-color: #94a3b8; }

.mc-btn-disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; box-shadow: none; border: 1px solid #e2e8f0; }

/* ADMIN NOTES */
.mc-admin-notes {
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  padding: 1rem 1.75rem;
  padding-left: 2rem;
}

.mc-admin-notes-title {
  font-weight: 800;
  font-size: 0.8rem;
  color: #b45309;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mc-admin-notes-list {
  margin: 0;
  padding-left: 1.5rem;
  color: #78350f;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
  .material-card-body-top {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .material-card-body-top {
    grid-template-columns: 1fr;
    padding: 1.25rem 1.5rem;
    padding-bottom: 0.5rem;
  }
  .material-card-body-bottom {
    padding: 0 1.5rem 1.25rem 1.5rem;
  }
  .material-card-header {
    padding: 1.25rem;
    padding-left: 1.5rem;
  }
  .mc-admin-notes {
    padding: 1.25rem;
    padding-left: 1.5rem;
  }
}

/* --- PREMIUM GLOBAL ADMIN DASHBOARD STYLES --- */
.global-kpi-card {
  background: white;
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--box-shadow-3d);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 20px -8px rgba(15, 23, 42, 0.08);
  border-color: rgba(37, 99, 235, 0.15);
}

.hospital-dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.hospital-dashboard-wide-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.03), 0 8px 10px -6px rgba(15, 23, 42, 0.01);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  margin-bottom: 0.5rem;
  padding: 1.5rem 1.75rem;
}

.hospital-dashboard-wide-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.08), 0 12px 14px -8px rgba(15, 23, 42, 0.04);
  border-color: rgba(37, 99, 235, 0.25);
}

.hospital-card-status-indicator {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  z-index: 1;
}

.hospital-card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(241, 245, 249, 0.8);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.hospital-card-title-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hospital-card-title-group h4 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.hospital-card-id-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.hospital-card-month-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hospital-card-avg-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.03);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.hospital-card-avg-badge span.pct {
  font-size: 1.2rem;
  font-weight: 900;
}

.hospital-card-avg-badge span.label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hospital-card-grid-body {
  display: grid;
  grid-template-columns: 1.2fr 2.2fr 0.6fr;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 1200px) {
  .hospital-card-grid-body {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .hospital-card-grid-body {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.hospital-card-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: center;
}

.coverage-rings-row {
  display: flex;
  gap: 1rem;
  justify-content: space-around;
  align-items: center;
  background: #f8fafc;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
}

.coverage-ring {
  position: relative;
  min-width: 55px;
  min-height: 55px;
  width: 55px;
  height: 55px;
  border-radius: 50% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  box-sizing: border-box;
}

.coverage-ring:hover {
  transform: scale(1.1) rotate(5deg);
}

.coverage-ring-inner {
  position: absolute;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.health-strip-container {
  display: flex;
  gap: 3px;
  background: #f8fafc;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
  width: 100%;
}

.health-strip-bar {
  height: 14px;
  flex: 1;
  border-radius: 3px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.health-strip-bar:hover {
  transform: translateY(-2px) scaleY(1.2);
  filter: brightness(1.08);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hospital-kpis-vertical-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff5f5;
  border: 1px solid #fee2e2;
  padding: 0.75rem 1rem;
  border-radius: 14px;
}

.hospital-kpis-vertical-summary.good {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.hospital-kpi-pill-item {
  display: flex;
  flex-direction: column;
}

.hospital-kpi-pill-item span.num {
  font-size: 1rem;
  font-weight: 800;
}

.hospital-kpi-pill-item span.lbl {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* PREMIUM TOGGLE SWITCH FOR GAPS VISIBILITY (LARGE WITH INNER ON/OFF TEXT) */
.premium-switch-large {
  position: relative;
  display: inline-block;
  width: 72px;
  height: 32px;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.premium-switch-large input {
  opacity: 0;
  width: 0;
  height: 0;
}

.premium-switch-large .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ef4444; /* Default: red (OFF) */
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.premium-switch-large .slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.premium-switch-large .text-on,
.premium-switch-large .text-off {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  font-weight: 900;
  color: white;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 1;
  transition: opacity .2s ease;
  line-height: 1;
}

.premium-switch-large .text-on {
  opacity: 0;
}

.premium-switch-large .text-off {
  opacity: 1;
  margin-left: auto;
}

.premium-switch-large input:checked + .slider {
  background-color: #10b981; /* Green */
}

.premium-switch-large input:checked + .slider:before {
  transform: translateX(40px);
}

.premium-switch-large input:checked + .slider .text-on {
  opacity: 1;
}

.premium-switch-large input:checked + .slider .text-off {
  opacity: 0;
}

/* Premium App Spinner Styles */
@keyframes app-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spinner-border {
  display: inline-block;
  width: 2.5rem;
  height: 2.5rem;
  vertical-align: -0.125em;
  border: 0.25em solid rgba(24, 24, 27, 0.1) !important;
  border-top-color: var(--primary, #18181b) !important;
  border-radius: 50% !important;
  animation: app-spin 0.75s linear infinite !important;
  box-sizing: border-box;
}

.spinner-border.spinner-border-sm {
  width: 1.2rem;
  height: 1.2rem;
  border-width: 0.15em;
}





/* Touch devices: show TROCAR badge always (no hover available) */
@media (hover: none) and (pointer: coarse) {
  .ceder-turno-cell .ceder-hint {
    display: flex !important;
    background: rgba(37, 99, 235, 0.75) !important;
    font-size: 0.5rem !important;
  }
  .ceder-turno-cell {
    touch-action: manipulation;
  }
}


/* ══════════════════════════════════════════════════════════════════
   MÓDULO INTERNAMENTO — valências, timeline de siglas, plano de camas
   ══════════════════════════════════════════════════════════════════ */

.cama-n-inp::-webkit-inner-spin-button,
.cama-n-inp::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cama-n-inp { -moz-appearance: textfield; }

.v-medicina-agudos { color: #0ea5e9 !important; }
.v-pediatria { color: #f59e0b !important; }
.v-cirurgia-adulto { color: var(--danger) !important; }
.v-cirurgia-crianca { color: #ec4899 !important; }
.v-neonatologia { color: #6366f1 !important; }
.v-intermedios { color: #14b8a6 !important; }
.v-medicina-cronicos { color: #10b981 !important; }
.v-psiquiatria { color: #a855f7 !important; }
.config-timeline-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.config-timeline-row:last-child {
  border-bottom: none;
}

.config-timeline-sigla {
  min-width: 34px;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-main);
}

.config-timeline-track {
  flex: 1;
  position: relative;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
}

.config-timeline-fill {
  position: absolute;
  top: 0;
  height: 8px;
  border-radius: 4px;
}

.config-timeline-hours {
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 92px;
  text-align: right;
  white-space: nowrap;
}

.config-timeline-hosp {
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 60px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.config-timeline-actions {
  display: flex;
  gap: 0.35rem;
}

.config-timeline-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 0.4rem 0 0.2rem;
}

/* Plano de Trabalho — Internamento */
.internamento-cama-seletor {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  grid-column: 1 / -1;
}

.internamento-cama-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  grid-column: 1 / -1;
}

.internamento-cama-header {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.internamento-cama-periods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.internamento-period-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.internamento-period-count {
  color: var(--primary);
}

.internamento-slot-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.internamento-slots-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

/* Reaproveita exatamente o grafismo dos cartões de alocação do Bloco
   (.matrix-staff-row e afins) — só a largura fixa e a remoção da margem
   inferior (substituída pelo gap da fila) são específicas do Internamento. */
.internamento-slots-row .matrix-staff-row {
  width: 240px;
  flex: 0 0 240px;
  margin-bottom: 0;
  min-height: 54px;
}

.internamento-slots-row .matrix-staff-row.placeholder-row {
  justify-content: center;
}

/* --- Camas no Plano de Trabalho ---
   Enfermeiros em cima (com as suas camas por baixo do nome), camas vazias
   numa caixa independente por baixo, uma por turno. Arrastar uma bolinha
   de um lado para o outro ocupa/liberta a cama. */
.internamento-period-corpo {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.internamento-period-slots {
  flex: 1;
  min-width: 0;
}

/* A linha do enfermeiro deixa de ser só um cabeçalho: passa a empilhar
   identificação em cima e camas por baixo. */
.internamento-slots-row .matrix-staff-row[data-camas] {
  flex-direction: column;
  align-items: stretch;
  height: auto;
  min-height: 54px;
  position: relative;
}

.cama-drop-zona {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 6px;
  padding: 5px;
  min-height: 32px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8fafc;
  transition: background 0.12s, border-color 0.12s;
}

.cama-drop-zona.a-receber {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.cama-drop-zona.acima-racio {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.06);
}

/* Bolinhas de cama — círculo pequeno com o código da cama lá dentro,
   arrastável para a caixa do enfermeiro. */
.cama-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  padding: 0;
  font-size: 0.62rem;
  font-weight: 700;
  user-select: none;
  white-space: nowrap;
  flex: 0 0 auto;
  position: relative;
}

/* Mesmo amarelo torrado dos fins de semana (.weekend-holiday-bg) */
.cama-chip.atribuida {
  background: #fde68a;
  color: #92400e;
  border: 1px solid #f3cd5c;
}

.cama-chip.livre {
  background: #fff;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Selecção por toque, a alternativa ao arrasto */
.cama-chip.selecionada {
  border-color: #92400e;
  box-shadow: 0 0 0 2px rgba(146, 64, 14, 0.3);
}

/* Arrasto por ponteiro: o original esbate-se e a cópia segue o cursor.
   touch-action:none impede o browser de interpretar o gesto como scroll.
   Cursor fica a seta normal — sem mãozinha. */
.cama-chip[data-cama-id] {
  cursor: default;
  touch-action: none;
}

.cama-chip.em-arrasto {
  opacity: 0.3;
}

.cama-chip.a-arrastar {
  cursor: default;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  transform: scale(1.12);
}

.cama-zona-vazia {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Contador camas/rácio, encostado à direita da zona */
.cama-contador {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-muted);
}

.cama-contador.acima { color: var(--danger); }

.camas-lateral {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  max-height: 140px;
  overflow-y: auto;
}

.camas-lateral.a-receber {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.camas-lateral-titulo {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.camas-lateral-titulo span { color: var(--primary); }

.camas-lateral-lista {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

/* ─── Escala Mensal: cabeçalho dos dias fixo ao rolar ───────────────────────
   A grelha passa a ser ela própria a área que rola, em vez de se rolar a
   página toda. É a mesma solução das tabelas de Gestão de Stocks, e aqui
   evita um problema de alinhamento: o cabeçalho global e a barra de controlos
   já são sticky no topo, portanto o cabeçalho dos dias teria de ficar por
   baixo dos dois, a uma distância que muda com a altura de cada um. Com o
   scroll dentro da grelha, o topo de referência é a própria grelha e não há
   contas a fazer.

   Só no desktop: abaixo de 851px a Escala Mensal é desenhada em cartões
   (renderRosterMobile), sem cabeçalho de dias para fixar. */
@media (min-width: 851px) {
  #view-escala .roster-grid {
    /* Substitui o overflow:hidden da regra base, que impedia qualquer scroll
       interno e, com ele, o sticky do cabeçalho. */
    overflow: auto;
    max-height: 72vh;
    /* Sem espaço no topo: com o scroll dentro da grelha, o padding de 1rem da
       regra base deixava uma faixa acima do cabeçalho por onde as linhas
       passavam à vista antes de lhe chegarem por baixo. O cabeçalho tem de
       encostar ao limite da área que rola. */
    padding-top: 0;
  }

  #view-escala .roster-header-row {
    position: sticky;
    top: 0;
    /* Acima das células e dos inputs da escala, que rolam por baixo. */
    z-index: 6;
    /* Opaco de ponta a ponta: a regra base já dá este fundo, mas aqui é ele
       que impede ver as linhas a passar por trás. */
    background-color: #F8FAFC;
  }
}

/* Escala Mensal Urgência: turnos sem a caixa à volta. A grelha é muito mais
   vazia do que a Escala Mensal (nos dias úteis só passam S2/N2), e a moldura
   de cada célula tornava-se ruído. O !important é preciso porque a cor da
   borda dos turnos vindos do Plano de Trabalho é aplicada por style inline. */
.roster-grid.roster-urgencia .availability-input-box {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Escala Mensal Urgência: turnos todos a preto. Por omissão a caixa pinta o
   texto com a cor primária (azul) e os turnos vindos do Plano de Trabalho
   levam ainda um azul mais forte por style inline — daí o !important. O input
   herda a cor (color:inherit), por isso basta fixá-la na caixa, mas fixa-se
   também no input para o caso de algum estilo lhe tocar diretamente. */
.roster-grid.roster-urgencia .availability-input-box,
.roster-grid.roster-urgencia .availability-input-box .shift-input {
  color: #111827 !important;
}
