@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

    /* Variáveis CSS para tema claro/escuro */
    :root {
      --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
      --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
      --bg-color: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
      --text-color: #2d3748;
      --text-light: #718096;
      --card-bg: rgba(255, 255, 255, 0.95);
      --border-color: rgba(226, 232, 240, 0.8);
      --button-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      --button-hover: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
      --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
      --shadow-hover: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
      --input-bg: rgba(255, 255, 255, 0.9);
      --modal-bg: rgba(255, 255, 255, 0.98);
      --accent-color: #667eea;
      --danger-color: #f5576c;
      --danger-hover: #e53e3e;
      --info-color: #4299e1;
      --info-hover: #3182ce;
    }

    [data-theme="dark"] {
      --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
      --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
      --bg-color: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
      --text-color: #e2e8f0;
      --text-light: #a0aec0;
      --card-bg: rgba(26, 32, 56, 0.95);
      --border-color: rgba(75, 85, 99, 0.6);
      --button-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      --button-hover: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
      --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
      --shadow-hover: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
      --input-bg: rgba(45, 55, 72, 0.9);
      --modal-bg: rgba(26, 32, 56, 0.98);
      --accent-color: #667eea;
      --danger-color: #f5576c;
      --danger-hover: #e53e3e;
      --info-color: #4299e1;
      --info-hover: #3182ce;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: var(--bg-color);
      color: var(--text-color);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      min-height: 100vh;
      line-height: 1.6;
      font-size: 14px;
      padding: 20px;
    }

    /* Header Design */
    /*header {    
      border-radius: 20px;
      max-width: 1200px;
      margin: 0 auto;
      padding: 0.8rem 1.2rem;
      display: flex;
      justify-content: space-between;  
      align-items: center;             
      background: var(--card-bg);
      box-shadow: var(--shadow);
      backdrop-filter: blur(20px);
      border: 1px solid var(--border-color);
      transition: all 0.3s ease;
    }

    header .logo {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    header .logo img {
      height: 100px;   
      width: auto;
      display: block;
    }
*/

    header {
      display: flex;
      justify-content: center;   /* centraliza tudo no meio */
      align-items: center;       /* centraliza na vertical */
      gap: 20px;                 /* espaço entre logo e botões */
    }

    header .logo img {
      height: 200px;
      width: auto;
    }



    h1 {
      font-size: 2rem;
      font-weight: 700;
      background: var(--primary-gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .header-controls {
      display: flex;
      gap: 15px;
      align-items: center;
    }

    #logoutBtn, #themeToggle {
      padding: 12px 20px;
      border: none;
      border-radius: 15px;
      cursor: pointer;
      font-weight: 500;
      font-size: 14px;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      align-items: center;
      gap: 8px;
      position: relative;
      overflow: hidden;
    }

    #themeToggle {
      background: var(--button-bg);
      color: white;
      border: 2px solid transparent;
    }

    #logoutBtn {
      background: var(--secondary-gradient);
      color: white;
      display: none;
    }

    #logoutBtn:hover, #themeToggle:hover {
      transform: translateY(-2px);
      box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    }
    
    /* Main Navigation */
    #main-navigation {
      max-width: 1600px;
      margin: 0 auto 20px;
      display: flex;
      gap: 10px;
    }
    
    .nav-btn {
      flex: 1;
      padding: 15px 20px;
      font-size: 16px;
      font-weight: 600;
      border: 2px solid var(--border-color);
      border-radius: 15px;
      cursor: pointer;
      background: var(--card-bg);
      color: var(--text-light);
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }

    .nav-btn.active {
      border-color: var(--accent-color);
      color: var(--text-color);
      box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
      transform: translateY(-2px);
      background: var(--card-bg);
    }
    
    .nav-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    /* Calendar Container */
    #calendar {
      max-width: 1600px;
      margin: 0 auto;
      background: var(--card-bg);
      padding: 30px;
      border-radius: 25px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(20px);
      border: 1px solid var(--border-color);
      transition: all 0.3s ease;
    }
    
    #calendar:hover {
      box-shadow: var(--shadow-hover);
    }

    /* Remover scroll interno do FullCalendar */
    .fc-scroller {
      overflow: visible !important;
      height: auto !important;
    }

    .fc-timegrid-body {
      height: auto !important;
      overflow: visible !important;
    }

    .fc-daygrid-body {
      height: auto !important;
      overflow: visible !important;
    }

    .fc-scrollgrid {
      overflow: visible !important;
    }
    
    .fc-timegrid-slots {
      height: auto !important;
    }
    
    .fc-timegrid-slot {
      height: auto !important;
    }
    
    .fc .fc-scroller-harness {
      overflow: visible !important;
    }

    /* Garantir que o tema escuro funcione corretamente */
    [data-theme="dark"] .fc .fc-scrollgrid {
      border-color: var(--border-color);
    }

    [data-theme="dark"] .fc .fc-daygrid-day-frame {
      background: transparent;
    }

    [data-theme="dark"] .fc .fc-timegrid-slot-label {
      color: var(--text-color);
    }

    [data-theme="dark"] .fc .fc-daygrid-day-top {
      color: var(--text-color);
    }
    /* Sections */
    #pacientes-section, #usuarios-section {
      max-width: 1600px;
      margin: 0 auto;
      background: var(--card-bg);
      padding: 30px;
      border-radius: 25px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(20px);
      border: 1px solid var(--border-color);
      transition: all 0.3s ease;
    }

    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
      flex-wrap: wrap;
      gap: 20px;
    }
    
    .section-header h2 {
      font-size: 1.8rem;
      background: var(--primary-gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .filter-controls {
      display: flex;
      gap: 10px;
    }

    .patient-filters-row {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 20px;
      flex-wrap: wrap;
    }

    .filter-group {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .filter-group-label {
      font-size: 0.72rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted, rgba(255,255,255,0.4));
      white-space: nowrap;
    }

    .filter-group-divider {
      width: 1px;
      height: 28px;
      background: var(--border-color, rgba(255,255,255,0.12));
      flex-shrink: 0;
    }

    .patient-search {
      display: flex;
      flex: 1 1 280px;
      max-width: 380px;
      border: 2px solid var(--border-color);
      border-radius: 15px;
      background: var(--input-bg);
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
      overflow: hidden;
    }

    .patient-search:focus-within {
      border-color: var(--accent-color);
      box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

    .patient-search-label {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    .patient-search input {
      min-width: 0;
      flex: 1;
      padding: 11px 14px;
      border: 0;
      outline: 0;
      background: transparent;
      color: var(--text-color);
      font: inherit;
    }

    .patient-search-button {
      width: 46px;
      flex: 0 0 46px;
      border: 0;
      cursor: pointer;
      color: white;
      background: var(--button-bg);
      transition: background 0.2s ease;
    }

    .patient-search-button:hover {
      background: var(--button-hover);
    }

    /* Tabelas - Desktop */
    .table-container {
      overflow-x: auto;
      border-radius: 15px;
      border: 1px solid var(--border-color);
      background: var(--card-bg);
    }

    #patientList, #userList {
      width: 100%;
      border-collapse: collapse;
      margin: 0;
      min-width: 800px;
    }

    #patientList th, #patientList td,
    #userList th, #userList td {
      text-align: left;
      padding: 15px 20px;
      border-bottom: 1px solid var(--border-color);
      font-size: 14px;
      white-space: nowrap;
    }

    #patientList .anamnese-status {
      padding: 5px 9px;
      font-size: 0.75rem;
    }

    #patientList .patient-anamnese-column {
      width: 130px;
    }

    #patientList td.patient-search-empty {
      padding: 35px 20px;
      text-align: center;
      color: var(--text-light);
    }

    .patient-cards .patient-search-empty {
      grid-column: 1 / -1;
    }

    #patientList th, #userList th {
      background: var(--bg-color);
      font-weight: 600;
      color: var(--text-light);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      position: sticky;
      top: 0;
      z-index: 10;
    }

    #patientList tbody tr, #userList tbody tr {
      transition: all 0.2s ease-in-out;
    }

    #patientList tbody tr:hover, #userList tbody tr:hover {
      background: rgba(102, 126, 234, 0.05);
    }
    
    .patient-actions {
      display: flex;
      gap: 10px;
      justify-content: center;
    }
    
    .action-btn {
      background: none;
      border: none;
      font-size: 1rem;
      cursor: pointer;
      color: var(--text-light);
      transition: color 0.2s ease;
      padding: 8px;
      border-radius: 8px;
    }
    
    .action-btn:hover {
      color: var(--accent-color);
      background: rgba(102, 126, 234, 0.1);
    }
    
    .action-btn.delete-btn:hover {
      color: var(--danger-color);
      background: rgba(245, 87, 108, 0.1);
    }

    /* Cards - Mobile */
    .patient-cards, .user-cards {
      display: none;
      grid-template-columns: 1fr;
      gap: 20px;
    }

    .patient-card {
      background: var(--card-bg);
      border-radius: 15px;
      padding: 20px;
      border: 1px solid var(--border-color);
      box-shadow: var(--shadow);
      transition: all 0.3s ease;
    }

    .patient-card:hover {
      box-shadow: var(--shadow-hover);
      transform: translateY(-2px);
    }

    .patient-card-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 15px;
    }

    .patient-card-title {
      font-size: 1.2rem;
      font-weight: 600;
      color: var(--text-color);
      margin: 0;
    }

    .patient-card-status {
      padding: 5px 12px;
      border-radius: 20px;
      font-size: 0.8rem;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .patient-card-status.active {
      background: rgba(79, 172, 254, 0.1);
      color: #4facfe;
    }

    .patient-card-status.inactive {
      background: rgba(245, 87, 108, 0.1);
      color: #f5576c;
    }

    .patient-card-info {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 15px;
      margin-bottom: 20px;
    }

    .patient-card-field {
      display: flex;
      flex-direction: column;
    }

    .patient-card-label {
      font-size: 0.8rem;
      color: var(--text-light);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 5px;
    }

    .patient-card-value {
      font-size: 0.95rem;
      color: var(--text-color);
      font-weight: 500;
    }

    .patient-card-actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      padding-top: 15px;
      border-top: 1px solid var(--border-color);
    }

    .card-action-btn {
      padding: 10px 20px;
      border: none;
      border-radius: 10px;
      cursor: pointer;
      font-size: 0.9rem;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 8px;
      transition: all 0.3s ease;
    }

    .card-action-btn.edit {
      background: rgba(102, 126, 234, 0.1);
      color: var(--accent-color);
    }

    .card-action-btn.delete {
      background: rgba(245, 87, 108, 0.1);
      color: var(--danger-color);
    }

    .card-action-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    }

    /* Login Area */
    #login-area {
      max-width: 420px;
      margin: 80px auto;
      background: var(--card-bg);
      padding: 40px;
      border-radius: 25px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(20px);
      border: 1px solid var(--border-color);
      text-align: center;
    }

    #login-area h2 {
      font-size: 1.8rem;
      font-weight: 600;
      margin-bottom: 30px;
      background: var(--primary-gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    #login-area form input {
      width: 100%;
      margin: 15px 0;
      padding: 18px 20px;
      font-size: 16px;
      background: var(--input-bg);
      border: 2px solid var(--border-color);
      color: var(--text-color);
      border-radius: 15px;
      transition: all 0.3s ease;
      font-family: inherit;
    }

    #login-area form input:focus {
      outline: none;
      border-color: var(--accent-color);
      box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
      transform: translateY(-1px);
    }

    #login-area form button {
      width: 100%;
      padding: 18px;
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      background: var(--button-bg);
      color: white;
      border: none;
      border-radius: 15px;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      margin-top: 20px;
    }

    #login-area form button:hover {
      background: var(--button-hover);
      transform: translateY(-2px);
      box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
    }

    #adminLink a {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 12px 20px;
      border: 2px solid var(--accent-color);
      border-radius: 15px;
      text-decoration: none;
      color: var(--accent-color);
      font-weight: 500;
      transition: all 0.3s ease;
    }

    #adminLink a:hover {
      background: var(--accent-color);
      color: white;
      transform: translateY(-2px);
    }

    /* Modal Design */
    .modal {
      display: none;
      position: fixed;
      z-index: 1000;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(10px);
      animation: fadeIn 0.3s ease;
      overflow: auto;
    }

    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    @keyframes slideUp {
      from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
      }
      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    .modal-content {
      background: var(--modal-bg);
      margin: 5% auto;
      padding: 40px;
      border-radius: 25px;
      width: 500px;
      max-width: 90%;
      color: var(--text-color);
      box-shadow: var(--shadow-hover);
      backdrop-filter: blur(20px);
      border: 1px solid var(--border-color);
      animation: slideUp 0.3s ease;
      position: relative;
    }

    .modal h2 {
      margin: 0 0 30px 0;
      font-size: 1.5rem;
      font-weight: 600;
      background: var(--primary-gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .form-group {
      margin-bottom: 25px;
      text-align: left;
    }

    .form-group label {
      display: block;
      margin-bottom: 8px;
      font-weight: 500;
      color: var(--text-color);
      font-size: 14px;
    }

    .form-group input, .form-group select, .form-group textarea {
      width: 100%;
      padding: 15px 18px;
      border: 2px solid var(--border-color);
      border-radius: 12px;
      background: var(--input-bg);
      color: var(--text-color);
      transition: all 0.3s ease;
      font-family: inherit;
      font-size: 14px;
    }

    .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
      outline: none;
      border-color: var(--accent-color);
      box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
      transform: translateY(-1px);
    }
    
    .form-group textarea {
      min-height: 100px;
    }

    .form-group input[type="checkbox"] {
      width: auto;
      margin-right: 10px;
      transform: scale(1.2);
    }

    .checkbox-group {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 15px 0;
    }

    .modal-buttons {
      display: flex;
      gap: 15px;
      justify-content: flex-end;
      margin-top: 35px;
      flex-wrap: wrap;
    }

    .holiday-header-actions, .holiday-filters {
      display: flex;
      gap: 12px;
      align-items: end;
      flex-wrap: wrap;
    }

    .holiday-filters {
      margin: 0 0 24px;
      padding: 16px;
      border-radius: 12px;
      background: var(--input-bg);
    }

    .holiday-filters .form-group {
      margin: 0;
      min-width: 120px;
      flex: 1 1 140px;
    }

    .user-location-fields {
      display: grid;
      grid-template-columns: 100px 1fr;
      gap: 14px;
    }

    .user-location-fields .form-group { margin-bottom: 0; }

    .fc .holiday-calendar-event {
      border: 0;
      border-left: 3px solid rgba(102, 126, 234, .72);
      border-radius: 5px;
      background: rgba(102, 126, 234, .13);
      color: var(--text-color);
      font-size: .76rem;
      font-weight: 600;
      padding: 1px 4px;
      pointer-events: auto;
    }

    .fc .holiday-calendar-estadual { border-left-color: rgba(66, 153, 225, .82); background: rgba(66, 153, 225, .12); }
    .fc .holiday-calendar-municipal { border-left-color: rgba(237, 137, 54, .84); background: rgba(237, 137, 54, .12); }
    .fc .holiday-calendar-event .fc-event-title::before { content: 'Feriado · '; color: var(--text-light); font-weight: 500; }

    #feriados-section {
      max-width: 1600px;
      padding: 34px;
      background: linear-gradient(145deg, var(--card-bg), color-mix(in srgb, var(--card-bg) 78%, var(--accent-color)));
    }

    #feriados-section .section-header {
      align-items: flex-end;
      margin-bottom: 38px;
    }

    #feriados-section .section-header h2 {
      margin-bottom: 4px;
      font-size: 2rem;
    }

    #feriados-section .section-header .form-hint {
      margin-top: 0;
      font-size: .88rem;
    }

    .holiday-header-actions {
      align-items: center;
      gap: 14px;
      margin-top: 10px;
    }

    .holiday-header-actions .btn {
      min-height: 44px;
      padding-inline: 18px;
    }

    .holiday-filters {
      display: grid;
      grid-template-columns: minmax(130px, .7fr) minmax(160px, 1fr) minmax(100px, .55fr) minmax(140px, .8fr) auto;
      align-items: end;
      gap: 20px;
      padding: 24px;
      border: 1px solid var(--border-color);
      box-shadow: 0 8px 24px rgba(31, 41, 55, .06);
    }

    .holiday-filters .form-group label {
      margin-bottom: 7px;
      font-size: .72rem;
      font-weight: 700;
      letter-spacing: .06em;
      text-transform: uppercase;
      color: var(--text-light);
    }

    .holiday-filters .form-group input,
    .holiday-filters .form-group select {
      min-height: 42px;
      border-radius: 10px;
    }

    #applyHolidayFilters {
      min-height: 42px;
      padding-inline: 18px;
    }

    #feriados-section .table-container {
      overflow: hidden;
      border-radius: 16px;
      box-shadow: 0 12px 30px rgba(31, 41, 55, .07);
    }

    #holidayList {
      width: 100%;
      border-collapse: collapse;
      min-width: 760px;
    }

    #holidayList th,
    #holidayList td {
      padding: 20px 24px;
      line-height: 1.45;
      border-bottom: 1px solid var(--border-color);
      text-align: left;
    }

    #holidayList th {
      background: color-mix(in srgb, var(--input-bg) 80%, var(--accent-color));
      color: var(--text-light);
      font-size: .7rem;
      font-weight: 700;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    #holidayList tbody tr {
      background: transparent;
      transition: background .18s ease, transform .18s ease;
    }

    #holidayList tbody tr:hover {
      background: color-mix(in srgb, var(--accent-color) 6%, transparent);
    }

    #holidayList tbody tr:last-child td { border-bottom: 0; }

    .holiday-date-cell { width: 92px; white-space: nowrap; }
    .holiday-day { display: block; font-size: 1.15rem; font-weight: 800; line-height: 1.1; }
    .holiday-month { display: block; margin-top: 3px; color: var(--text-light); font-size: .72rem; }
    .holiday-name { font-weight: 650; }
    .holiday-badge, .holiday-status, .holiday-origin { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
    .holiday-badge { padding: 5px 10px; border-radius: 999px; background: rgba(102,126,234,.12); color: var(--accent-color); font-size: .72rem; font-weight: 700; text-transform: capitalize; }
    .holiday-type-estadual { background: rgba(66,153,225,.13); color: var(--info-color); }
    .holiday-type-municipal { background: rgba(237,137,54,.15); color: #c05621; }
    .holiday-origin { color: var(--text-light); font-size: .78rem; }
    .holiday-origin i { color: var(--accent-color); }
    .holiday-status { font-size: .78rem; font-weight: 650; }
    .holiday-status i { font-size: .42rem; }
    .holiday-status.is-active { color: #269d71; }
    .holiday-status.is-inactive { color: var(--text-light); }
    .holiday-empty { padding: 52px 20px !important; text-align: center !important; color: var(--text-light); }
    .holiday-empty i, .holiday-empty strong, .holiday-empty span { display: block; }
    .holiday-empty i { margin-bottom: 10px; color: var(--accent-color); font-size: 1.8rem; }
    .holiday-empty strong { color: var(--text-color); font-size: 1rem; }
    .holiday-empty span { margin-top: 4px; font-size: .82rem; }

    #holidayModal .modal-content,
    #holidaySyncModal .modal-content { border-top: 4px solid var(--accent-color); }

    #holidayModal h2, #holidaySyncModal h2 { margin-bottom: 22px; }

    #holidaySyncPreview { margin-top: 20px; padding: 18px; border: 1px solid var(--border-color); border-radius: 14px; background: var(--input-bg); }
    #holidaySyncPreview h3 { margin-bottom: 12px; font-size: 1.05rem; }
    #holidaySyncPreview ul { display: grid; gap: 9px; padding-left: 18px; }
    #holidaySyncPreview details { margin-top: 5px; color: var(--text-light); font-size: .82rem; }

    @media screen and (max-width: 900px) {
      .holiday-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .holiday-filters .btn { width: 100%; }
    }

    @media screen and (max-width: 600px) {
      #feriados-section { padding: 20px 14px; }
      #feriados-section .section-header { align-items: stretch; }
      #feriados-section .section-header h2 { font-size: 1.55rem; }
      .holiday-header-actions { flex-direction: column; align-items: stretch; }
      .holiday-header-actions .btn { width: 100%; }
      .holiday-filters { grid-template-columns: 1fr; padding: 14px; }
      #feriados-section .table-container { overflow-x: auto; }
    }

    .recurrence-conflict-content {
      width: 560px;
    }

    .recurrence-conflict-message {
      padding: 16px 18px;
      border: 1px solid rgba(245, 87, 108, 0.35);
      border-radius: 12px;
      background: rgba(245, 87, 108, 0.09);
      font-weight: 600;
      line-height: 1.55;
    }

    .recurrence-conflict-warning {
      margin-top: 16px;
      color: var(--text-light);
      line-height: 1.5;
    }

    .recurrence-conflict-actions {
      flex-direction: column;
      align-items: stretch;
    }

    .recurrence-conflict-actions .btn {
      width: 100%;
    }

    .btn {
      padding: 14px 24px;
      border: none;
      border-radius: 12px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 500;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 120px;
      justify-content: center;
    }

    .btn:disabled {
      cursor: wait;
      opacity: 0.6;
      transform: none !important;
      box-shadow: none !important;
    }
    
    .btn.full-width {
      width: 100%;
    }

    .btn-primary {
      background: var(--button-bg);
      color: white;
    }

    .btn-primary:hover {
      background: var(--button-hover);
      transform: translateY(-2px);
      box-shadow: 0 8px 15px rgba(102, 126, 234, 0.3);
    }

    .btn-secondary {
      background: rgba(108, 117, 125, 0.1);
      color: var(--text-color);
      border: 2px solid var(--border-color);
    }

    .btn-secondary:hover {
      background: rgba(108, 117, 125, 0.2);
      transform: translateY(-1px);
    }

    .btn-danger {
      background: var(--secondary-gradient);
      color: white;
    }

    .btn-danger:hover {
      background: linear-gradient(135deg, #e53e3e 0%, #e53e3e 100%);
      transform: translateY(-2px);
      box-shadow: 0 8px 15px rgba(229, 62, 62, 0.3);
    }
    
    .btn-info {
      background: var(--info-color);
      color: white;
    }
    
    .btn-info:hover {
      background: var(--info-hover);
    }

/* FullCalendar Dark Theme */
    [data-theme="dark"] .fc {
      background: transparent;
    }

    [data-theme="dark"] .fc .fc-toolbar {
      color: var(--text-color);
    }

    [data-theme="dark"] .fc .fc-button-primary {
      background: var(--button-bg);
      border: none;
      border-radius: 8px;
    }

    [data-theme="dark"] .fc .fc-button-primary:hover {
      background: var(--button-hover);
    }

    [data-theme="dark"] .fc .fc-daygrid-day {
      background: transparent;
      border-color: var(--border-color);
    }

    [data-theme="dark"] .fc .fc-col-header-cell {
      background: transparent;
      color: var(--text-color);
      border-color: var(--border-color);
    }

    [data-theme="dark"] .fc .fc-timegrid-slot {
      border-color: var(--border-color);
    }

    [data-theme="dark"] .fc .fc-timegrid-axis {
      color: var(--text-color);
    }

    [data-theme="dark"] .fc .fc-daygrid-day-number {
      color: var(--text-color);
    }

    /* Loading Animation */
    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.5; }
    }

    .loading {
      animation: pulse 2s infinite;
    }

    /* Responsive Design */
    /* Troca tabelas largas por cards conforme o espaço disponível. */
    @media screen and (max-width: 900px) and (min-width: 769px) {
      #pacientes-section .table-container {
        display: none;
      }

      #pacientes-section .patient-cards {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media screen and (max-width: 1600px) and (min-width: 769px) {
      #usuarios-section .table-container {
        display: none;
      }

      #usuarios-section .user-cards {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media screen and (max-width: 768px) {
      body {
        padding: 10px;
      }
      
      /* Header responsivo */
      header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
      }

      h1 {
        font-size: 1.5rem;
      }
      
      /* Seções responsivas */
      #pacientes-section, #usuarios-section {
        padding: 20px;
      }
      
      .section-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 15px;
      }
      
      .section-header h2 {
        margin-bottom: 0;
      }
      
      .filter-controls {
        justify-content: center;
        flex-wrap: wrap;
      }

      .patient-filters-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
      }

      .filter-group {
        flex-wrap: wrap;
      }

      .filter-group-divider {
        display: none;
      }
      
      #openNewPatientModal, #openNewUserModal {
        width: 100%;
        max-width: none;
      }

      .patient-search {
        width: 100%;
        max-width: none;
        flex: 0 0 auto;
      }

      /* Esconder tabela e mostrar cards no mobile */
      .table-container {
        display: none;
      }

      .patient-cards, .user-cards {
        display: grid;
      }

      /* Cards responsivos */
      .patient-card-info {
        grid-template-columns: 1fr;
        gap: 10px;
      }

      .patient-card-actions {
        flex-direction: column;
        gap: 10px;
      }

      .card-action-btn {
        justify-content: center;
        width: 100%;
      }
      
      /* Calendar responsivo */
      #calendar {
        padding: 15px;
        border-radius: 15px;
      }

      /* Modal responsivo */
      .modal-content {
        width: 95%;
        padding: 25px;
        margin: 10% auto;
      }

      .modal-buttons {
        flex-direction: column;
      }

      .btn {
        width: 100%;
      }

      /* Login responsivo */
      #login-area {
        margin: 40px auto;
        padding: 30px 20px;
      }

      /* FullCalendar responsivo */
      .fc .fc-toolbar {
        flex-direction: column;
        gap: 10px;
      }

      .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
      }

      .fc .fc-button {
        font-size: 0.8em;
        padding: 8px 12px;
      }
      
      /* Navegação responsiva */
      #main-navigation {
        flex-direction: column;
        padding: 0 10px;
      }
    }

    .btn-success {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}

.btn-success:hover {
  background: linear-gradient(135deg, #128c7e, #075e54);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-success:active {
  transform: translateY(0);
}

.btn-success i {
  font-size: 16px;
}

    /* Tablets - comportamento intermediário */
    @media screen and (max-width: 1024px) and (min-width: 769px) {
      .section-header {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
      }
      
      .filter-controls {
        order: 1;
        width: 100%;
        justify-content: center;
      }

      #pacientes-section .patient-search {
        order: 1;
        width: 100%;
        max-width: 500px;
      }
      
      #openNewPatientModal, #openNewUserModal {
        order: 2;
        width: auto;
      }
      
      .section-header h2 {
        order: 0;
        width: 100%;
        text-align: center;
        margin-bottom: 0;
      }
      
      .table-container {
        overflow-x: auto;
      }
      
      #userList {
        min-width: 900px;
      }

      #patientList {
        min-width: 780px;
      }

      #patientList th, #patientList td {
        padding: 12px 10px;
        font-size: 13px;
      }
    }

    /* Custom Scrollbar */
    ::-webkit-scrollbar {
      width: 8px;
      height: 14px;
    }

    ::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.1);
      border-radius: 10px;
    }

    ::-webkit-scrollbar-thumb {
      background: var(--primary-gradient);
      border-radius: 10px;
    }

    ::-webkit-scrollbar-thumb:hover {
      background: var(--button-hover);
    }

    @media (max-width: 600px) {
    header .logo img {
      height: 70px;     /* diminui em telas pequenas */
    }
  }
  /* Estilo do texto de ajuda do novo campo de Título */
.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.4;
}

/* Anamneses e modelos dinâmicos */
.module-section {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--card-bg);
  padding: 30px;
  border-radius: 25px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

#modelos-section {
  max-width: 1600px;
}

.model-list {
  display: grid;
  gap: 15px;
}

.model-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 20px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 15px;
  background: var(--input-bg);
}

.model-card h3,
.model-card p {
  margin: 0;
}

.model-card p {
  margin-top: 6px;
  color: var(--text-light);
}

.anamnese-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
}

.anamnese-title {
  text-align: center;
}

.anamnese-title h2,
.builder-heading h3,
.anamnese-form-section h3 {
  margin: 0;
}

.anamnese-status {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-pendente,
.status-rascunho {
  color: #8a6500;
  background: rgba(255, 193, 7, 0.15);
}

.status-aguardando_resposta {
  color: #7c4dff;
  background: rgba(124, 77, 255, 0.12);
}

.status-respondida,
.status-em_revisao {
  color: #0069a6;
  background: rgba(3, 169, 244, 0.13);
}

.status-concluida {
  color: #087f5b;
  background: rgba(32, 201, 151, 0.14);
}

.empty-state {
  padding: 45px 20px;
  text-align: center;
  color: var(--text-light);
}

.empty-state > i {
  display: block;
  margin-bottom: 15px;
  color: var(--accent-color);
  font-size: 3rem;
}

.empty-state #anamneseCreateControls {
  max-width: 620px;
  margin: 25px auto 0;
  text-align: left;
}

.fill-mode-options {
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
}

.fill-mode-options label,
.anamnese-choice {
  display: flex;
  align-items: center;
  gap: 8px;
}

.anamnese-form-section {
  margin: 25px 0;
  padding: 25px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--input-bg);
}

.anamnese-form-section h3 {
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.anamnese-question small {
  margin: -3px 0 9px;
}

.anamnese-choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  padding: 12px 0;
}

.anamnese-choice input {
  width: auto;
}

.required-mark {
  color: var(--danger-color);
}

.anamnese-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.anamnese-respondent {
  font-weight: 600;
  color: var(--text-light);
}

.notice {
  padding: 15px 18px;
  margin: 15px 0;
  border-radius: 12px;
  line-height: 1.5;
}

.notice-info {
  background: rgba(3, 169, 244, 0.1);
  border: 1px solid rgba(3, 169, 244, 0.25);
}

.notice-warning {
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.share-box {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 15px;
  background: var(--input-bg);
}

.share-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 12px;
}

.share-row input {
  min-width: 0;
  padding: 14px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text-color);
}

.audit-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.audit-item {
  display: grid;
  gap: 5px;
  padding: 15px;
  border-left: 4px solid var(--accent-color);
  border-radius: 8px;
  background: var(--input-bg);
}

.audit-item small,
.audit-item p {
  margin: 0;
  color: var(--text-light);
}

.modal-content.modal-wide {
  width: 980px;
}

.builder-heading,
.builder-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.builder-heading {
  margin: 25px 0 15px;
}

.builder-section {
  margin-bottom: 20px;
  padding: 20px;
  border: 2px solid var(--border-color);
  border-radius: 16px;
}

.builder-field {
  margin: 15px 0;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--input-bg);
}

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

.builder-grid .form-group {
  margin-bottom: 10px;
}

.public-header {
  width: min(960px, calc(100% - 40px));
  max-width: none;
  margin: 28px auto 20px;
  padding: 16px 20px;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.public-header:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.public-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.public-brand img,
.public-header .public-brand img {
  width: auto;
  height: 58px;
  flex: 0 0 auto;
}

.public-brand div {
  display: grid;
}

.public-brand strong {
  color: var(--text-color);
  font-size: 1rem;
}

.public-brand span {
  color: var(--text-light);
  font-size: 0.78rem;
}

.public-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text-color);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .2s ease, border-color .2s ease;
}

.public-theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--accent-color);
}

.public-anamnese {
  width: min(900px, calc(100% - 40px));
  max-width: none;
  margin: 0 auto 24px;
  padding: 36px;
}

.public-response-page {
  padding: 0;
  background: var(--bg-color);
}

.public-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.public-form-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  line-height: 1.2;
}

.public-form-heading > i {
  color: var(--accent-color);
  font-size: 2.4rem;
  opacity: .8;
}

.public-eyebrow {
  color: var(--accent-color);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.public-instructions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.public-instructions i {
  margin-top: 4px;
}

.public-respondent-card {
  margin: 26px 0;
  padding: 24px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--input-bg);
}

.public-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.public-card-title > i {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: rgba(102, 126, 234, .14);
  color: var(--accent-color);
}

.public-card-title h3,
.public-card-title p {
  margin: 0;
}

.public-card-title p {
  color: var(--text-light);
  font-size: .82rem;
}

.public-actions {
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  margin: 25px -12px -12px;
  padding: 18px 12px 12px;
  background: linear-gradient(to bottom, transparent, var(--card-bg) 24%);
  z-index: 5;
}

.public-footer {
  width: min(900px, calc(100% - 40px));
  margin: 0 auto 30px;
  color: var(--text-light);
  font-size: .8rem;
  text-align: center;
}

.public-footer i {
  margin-right: 6px;
}

@media screen and (max-width: 768px) {
  .module-section {
    padding: 20px;
  }

  .model-card,
  .anamnese-header,
  .builder-grid,
  .share-row {
    grid-template-columns: 1fr;
  }

  .model-card,
  .anamnese-header {
    text-align: center;
  }

  .anamnese-header .btn,
  .model-card .btn {
    width: 100%;
  }

  .anamnese-form-section,
  .builder-section {
    padding: 15px;
  }

  .public-header {
    width: calc(100% - 24px);
    margin-top: 12px;
    padding: 12px;
    flex-direction: row;
  }

  .public-brand div {
    display: none;
  }

  .public-brand img,
  .public-header .public-brand img {
    height: 46px;
  }

  .public-theme-toggle span {
    display: none;
  }

  .public-anamnese {
    width: calc(100% - 24px);
    padding: 20px 15px;
    border-radius: 18px;
  }

  .public-form-heading > i {
    display: none;
  }

  .public-respondent-card {
    padding: 18px 15px;
  }

  .public-actions {
    position: static;
    margin: 20px 0 0;
    padding: 18px 0 0;
    background: transparent;
  }
}
