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

:root {
      --primary: #0d0d0d;
      --secondary: #1a1a1a;
      --accent: #111bd9;
      --success: #03fa6e;

      --bg-light: #f4f4f6;
      --bg-dark: #141414;

      --surface-light: #ededf0;
      --surface-dark: #1f1f1f;

      --text-light: #1a1a1a;
      --text-dark: #f2f2f2;

      --border-light: #dcdce0;
      --border-dark: #3a3a3a;

      --muted: #7c7c85;

      color-scheme: light;
}

html.dark-mode {
      --primary: #0f0f10;
      --secondary: #1a1a1d;

      --bg-light: #0f0f10;
      --bg-dark: #1a1a1d;

      --surface-light: #1f1f23;
      --surface-dark: #2a2a2f;

      --text-light: #f2f2f2;
      --text-dark: #c8c8c8;

      --border-light: #2e2e33;
      --border-dark: #3a3a40;

      --muted: #7a7a7a;

      --accent: #111bd9;

      color-scheme: dark;
}

body {
      font-family: "Inter", sans-serif;
      background-color: var(--bg-light);
      color: var(--text-light);
      transition: background-color 0.3s ease, color 0.3s ease;
      line-height: 1.6;
      display: flex;
      min-height: 100vh;
}

/* ======== SIDEBAR ======== */
.sidebar {
      width: 280px;
      background: var(--bg-light);
      border-right: 1px solid var(--border-light);
      display: flex;
      flex-direction: column;
      position: sticky;
      top: 0;
      height: 100vh;
      overflow-y: auto;
      z-index: 50;
}

.sidebar-header {
      padding: 28px 24px;
      border-bottom: 1px solid var(--border-light);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
}

.sidebar-logo {
      font-size: 30px;
      font-weight: 600;
      letter-spacing: 0px;
      color: var(--text-light);
}

.sidebar-content {
      flex: 1;
      padding: 28px 20px;
      overflow-y: auto;
}

.sidebar-section {
      margin-bottom: 32px;
}

.sidebar-section-title {
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.7px;
      color: var(--muted);
      margin-bottom: 12px;
}

.sidebar-card {
      background: var(--surface-light);
      border: 1px solid var(--border-light);
      border-radius: 8px;
      padding: 14px;
}

.sidebar-card.empty {
      text-align: center;
      color: var(--muted);
      font-size: 13px;
}

.sidebar-card-label {
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--muted);
      margin-bottom: 6px;
      display: block;
}

.sidebar-card-value {
      font-size: 16px;
      font-weight: 600;
      color: var(--text-light);
      line-height: 1.4;
}

.sidebar-actions-inline {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding-top: 10px;
      border-top: 1px solid var(--border-light);
}

.mobile-header {
      display: none;
      padding: 28px 24px;
      border-bottom: 1px solid var(--border-light);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
}

.mobile-sidebar-content {
      display: none;
      padding: 28px 20px;
      overflow-y: auto;
}

.btn-small {
      padding: 10px 14px;
      font-size: 13px;
}

/* ========== THEME-SPECIFIC REFINEMENTS ========== */
html.dark-mode .day-cell:hover:not(.disabled):not(.other-month) {
      background: var(--accent);
      box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

html.dark-mode .appointment-item:hover {
      background: rgba(74, 144, 226, 0.05);
      border-color: rgba(74, 144, 226, 0.2);
}

html.dark-mode .btn-contact-client:hover {
      box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* ========== FOCUS STATES ========== */
.form-group input:focus,
.form-group textarea:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.btn:focus {
      outline: none;
      box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
}

/* ========== SCROLLBAR STYLING ========== */
::-webkit-scrollbar {
      width: 8px;
}

::-webkit-scrollbar-track {
      background: var(--surface-light);
}

::-webkit-scrollbar-thumb {
      background: var(--muted);
      border-radius: 4px;
}

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

.main-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 100vh;
}

/* Stat Badge */
.stat-badge {
      display: flex;
      align-items: center;
      gap: 8px;
      background: var(--surface-light);
      padding: 8px 16px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 500;
}

.stat-badge.hidden {
      display: none;
}

/* Appointments List */
.appointments-list {
      background: var(--bg-light);
      border: 1px solid var(--border-light);
      border-radius: 8px;
      padding: 20px;
      margin-top: 32px;
}

.appointments-list-title {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 16px;
      color: var(--text-light);
}

.appointment-item {
      background: var(--surface-light);
      border: 1px solid var(--border-light);
      border-radius: 6px;
      padding: 14px 16px;
      margin-bottom: 10px;
      transition: all 0.2s ease;
}

.appointment-item.resolved {
      opacity: 0.7;
      border-left: 4px solid var(--success);
      background: linear-gradient(90deg, rgba(3, 250, 110, 0.04), transparent);
}

.appointment-item:hover {
      background: var(--bg-light);
      border-color: var(--accent);
      box-shadow: 0 4px 12px rgba(74, 144, 226, 0.08);
}

.appointment-name {
      font-weight: 600;
      font-size: 14px;
      color: var(--text-light);
      margin-bottom: 8px;
}

.appointment-meta {
      font-size: 12px;
      color: var(--text-light);
      opacity: 0.6;
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
}

.appointment-meta span {
      display: flex;
      align-items: center;
}

.appointment-actions {
      display: flex;
      gap: 8px;
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px solid var(--border-light);
}

.btn-contact-client {
      padding: 8px 12px;
      background: transparent;
      border: 1px solid var(--accent);
      border-radius: 6px;
      color: var(--accent);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      gap: 6px;
}

.btn-contact-client:hover {
      background: var(--accent);
      color: white;
}

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

.empty-state-icon {
      font-size: 48px;
      margin-bottom: 12px;
}

.empty-state-text {
      font-size: 14px;
}

.text-small {
      font-size: 12px;
      text-align: center;
      color: var(--text-light);
      opacity: 0.6;
}

/* Header */
.header {
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 40px;
      border-bottom: 1px solid var(--border-light);
      background-color: var(--bg-light);
      position: sticky;
      top: 0;
      z-index: 40;
}

.header-title {
      font-size: 18px;
      font-weight: 500;
      letter-spacing: -0.2px;
      color: var(--text-light);
}

.logo {
      font-size: 18px;
      font-weight: 600;
      letter-spacing: -0.5px;
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
}

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

.theme-toggle {
      background: var(--surface-light);
      border: 1px solid var(--border-light);
      border-radius: 8px;
      padding: 8px 12px;
      cursor: pointer;
      font-size: 16px;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--text-light);
}

.theme-toggle:hover {
      background: var(--surface-dark);
      color: #fff;
}

/* Mostrar o controle de tema para permitir troca manual;
         ainda assim o site será forçado para modo claro ao carregar. */
#themeToggle {
      display: inline-flex !important;
}

/* Main Container */
.container {
      flex: 1;
      padding: 36px 40px;
      overflow-y: auto;
}

/* Notification modal (WhatsApp / Email) */
.notify-modal {
      position: fixed;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      background: rgba(0, 0, 0, 0.35);
      z-index: 1200;
}

.notify-modal.open {
      display: flex;
}

.notify-modal-content {
      width: 360px;
      max-width: calc(100% - 40px);
      background: var(--surface-light);
      color: var(--text-light);
      padding: 20px;
      border-radius: 10px;
      box-shadow: 0 10px 30px rgba(2, 6, 23, 0.25);
      position: relative;
}

.notify-modal-close {
      position: absolute;
      right: 10px;
      top: 8px;
      border: none;
      background: transparent;
      font-size: 20px;
      cursor: pointer;
}

.notify-modal-actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      margin-top: 16px;
}

.notify-temp-notice {
      position: fixed;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      bottom: 20px;
      background: var(--surface-light);
      padding: 10px 16px;
      border-radius: 8px;
      box-shadow: 0 8px 20px rgba(2, 6, 23, 0.15);
      opacity: 0;
      transition: opacity 0.25s, transform 0.25s;
      z-index: 1300;
}

.notify-temp-notice.visible {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
}

.success-icon {
      color: #03fa6e;
}


/* Calendar Section */
.calendar-section {
      margin-bottom: 40px;
}

.section-header {
      margin-bottom: 28px;
}

.section-title {
      font-size: 24px;
      font-weight: 500;
      margin-bottom: 4px;
      letter-spacing: -0.3px;
      color: var(--text-light);
}

.section-subtitle {
      font-size: 14px;
      font-weight: 400;
      color: var(--muted);
}

.hidden {
      display: none !important;
}

/* Calendar Controls */
.calendar-controls {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      gap: 16px;
}

.month-navigation {
      display: flex;
      align-items: center;
      gap: 14px;
      font-weight: 500;
      font-size: 15px;
}

.nav-button {
      background: transparent;
      border: 1px solid var(--border-light);
      border-radius: 6px;
      padding: 6px 10px;
      cursor: pointer;
      color: var(--text-light);
      font-size: 16px;
      transition: all 0.2s ease;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
}

.nav-button:hover {
      background: var(--surface-light);
      border-color: var(--accent);
}

.view-mode-selector {
      display: flex;
      gap: 6px;
      background: transparent;
      padding: 0;
      border: none;
      width: 45%;
}

.view-mode-btn {
      padding: 6px 12px;
      border: 1px solid var(--border-light);
      background: transparent;
      color: var(--muted);
      cursor: pointer;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 500;
      transition: all 0.2s ease;
}

.view-mode-btn.active {
      background: transparent;
      color: white;
      border-color: var(--text-light);
}

.view-mode-btn:hover:not(.active) {
      border-color: var(--muted);
      color: var(--text-light);
      background: transparent;
}

/* Calendar Grid */
.calendar-grid {
      background: var(--bg-light);
      border: 1px solid var(--border-light);
      border-radius: 8px;
      padding: 16px;
      margin-bottom: 32px;
      width: 100%;
      max-width: 960px;
}

.day-headers {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 1px;
      margin-bottom: 6px;
}

.day-header {
      text-align: center;
      font-weight: 500;
      font-size: 10px;
      padding: 6px 0;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.3px;
}

.days-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);

      gap: 2px;
}

.day-cell {
      aspect-ratio: 1 / 1;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 5px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      background: var(--surface-light);
      color: var(--text-light);
      transition: all 0.15s ease;
      border: 1px solid transparent;
      position: relative;
}

.day-cell:hover:not(.disabled):not(.other-month) {
      background: var(--accent);
      color: white;
      border-color: var(--accent);
}

.day-cell.other-month {
      opacity: 0.25;
      cursor: not-allowed;
}

.day-cell.disabled {
      opacity: 0.35;
      cursor: not-allowed;
}

/* Garantir que o dia "hoje" tenha sempre a cor de sucesso (#03fa6e) */
.day-cell.today {
      background: var(--success);
      color: white;
      font-weight: 600;
}

.day-cell.today:hover {
      background: var(--success);
}

.day-cell.has-events::after {
      content: "";
      position: absolute;
      bottom: 3px;
      width: 3px;
      height: 3px;
      background: var(--success);
      border-radius: 50%;
}

.day-cell.selected {
      background: var(--accent);
      color: white;
}

/* Available Hours */
.available-hours {
      margin-top: 20px;
      padding-top: 20px;
      border-top: 1px solid var(--border-light);
}

.hours-label {
      font-size: 11px;
      font-weight: 600;
      margin-bottom: 12px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
}

.hours-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
      gap: 5px;
}

.hour-option {
      padding: 9px 8px;
      background: var(--surface-light);
      border: 1px solid var(--border-light);
      border-radius: 5px;
      text-align: center;
      cursor: pointer;
      font-size: 12px;
      font-weight: 500;
      transition: all 0.15s ease;
      color: var(--text-light);
}

.hour-option:hover:not(.unavailable) {
      border-color: var(--accent);
      color: #000;
      background: rgba(255, 255, 255, 0);
}

html.dark-mode  .hour-option:hover:not(.unavailable) {
      border-color: var(--accent);
      background: var(--bg-dark);
      color:#fff; ;
}

.hour-option.selected {
      background: var(--accent);
      color: white;
      border-color: var(--accent);
}

.hour-option.unavailable {
      opacity: 0.3;
      cursor: not-allowed;
}

/* Modal */
.modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.3);
      -webkit-backdrop-filter: blur(3px);
      backdrop-filter: blur(3px);
      z-index: 1000;
      animation: fadeIn 0.25s ease;
}

.modal-overlay.active {
      display: flex;
      align-items: center;
      justify-content: center;
}

@keyframes fadeIn {
      from {
            opacity: 0;
      }

      to {
            opacity: 1;
      }
}

.modal {
      background: var(--bg-light);
      border-radius: 10px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
      border: 1px solid var(--border-light);
      max-width: 480px;
      width: 100%;
      max-height: 90vh;
      overflow-y: auto;
      padding: 36px;
      position: relative;
      animation: slideUp 0.25s ease;
}

@keyframes slideUp {
      from {
            opacity: 0;
            transform: translateY(15px);
      }

      to {
            opacity: 1;
            transform: translateY(0);
      }
}

.modal-close {
      position: absolute;
      top: 16px;
      right: 16px;
      background: transparent;
      border: none;
      border-radius: 5px;
      width: 28px;
      height: 28px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      color: var(--muted);
      transition: all 0.2s ease;
}

.modal-close:hover {
      background: var(--surface-light);
      color: var(--text-light);
}

.modal-title {
      font-size: 22px;
      font-weight: 500;
      margin-bottom: 20px;
      color: var(--text-light);
}

.selected-date-display {
      background: var(--surface-light);
      border: 1px solid var(--border-light);
      border-radius: 8px;
      padding: 12px 14px;
      margin-bottom: 20px;
      font-size: 13px;
      color: var(--muted);
      font-weight: 500;
}

.form-group {
      margin-bottom: 16px;
}

.form-group label {
      display: block;
      font-size: 13px;
      font-weight: 600;
      margin-bottom: 6px;
      color: var(--text-light);
      letter-spacing: 0.2px;
}

.form-group .required {
      color: var(--accent);
}

.form-group input,
.form-group textarea {
      width: 100%;
      padding: 10px 12px;
      border: 1px solid var(--border-light);
      border-radius: 6px;
      background: var(--surface-light);
      color: var(--text-light);
      font-family: inherit;
      font-size: 13px;
      transition: all 0.2s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
      color: var(--muted);
}

.form-group input:focus,
.form-group textarea:focus {
      outline: none;
      border-color: var(--accent);
      background: var(--bg-light);
      box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group textarea {
      resize: vertical;
      min-height: 80px;
}

.modal-buttons {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-top: 24px;
}

.btn {
      padding: 11px 20px;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      border: none;
      letter-spacing: 0.2px;
}

.btn-primary {
      background: var(--text-light);
      color: rgb(255, 255, 255);
}

.btn-primary:hover {
      background: var(--accent);
      color: #ffffff;
}

html.dark-mode .btn-primary {
      background: var(--text-dark);
      color: #000000;
}

html.dark-mode .btn-primary:hover {
      background: var(--accent);
      color: #ffffff;
}

.btn-outline {
      background: transparent;
      border: 1px solid var(--border-light);
      color: var(--text-light);
}

.btn-outline:hover {
      background: var(--surface-light);
}

/* Success Message */
.success-message {
      display: none;
      position: fixed;
      bottom: 24px;
      right: 24px;
      background: var(--success);
      color: #ffffff;
      padding: 14px 22px;
      border-radius: 6px;
      box-shadow: 0 4px 12px rgba(52, 199, 89, 0.2);
      font-weight: 500;
      font-size: 13px;
      z-index: 1001;
      animation: slideInUp 0.25s ease;
}

.success-message.active {
      display: block;
}

/* Admin-only elements: hidden para todos por padrão, visíveis quando em modo admin */
.admin-only {
      display: none !important;
}

html.admin-mode .admin-only {
      display: inline-flex !important;
}

@keyframes slideInUp {
      from {
            opacity: 0;
            transform: translateY(20px);
      }

      to {
            opacity: 1;
            transform: translateY(0);
      }
}

/* Footer */
.footer {
      margin-top: 64px;
      padding-top: 32px;
      border-top: 1px solid var(--border-light);
      text-align: center;
      color: var(--text-light);
      opacity: 0.5;
      font-size: 13px;
      letter-spacing: 0.3px;
}

/* Responsive */
@media (max-width: 1024px) {
      .sidebar {
            width: 300px;
      }

      .container {
            padding: 32px 24px;
      }

      .header {
            padding: 0 24px;
      }

      .calendar-grid {
            padding: 12px;
      }

      .section-title {
            font-size: 22px;
      }

      .section-subtitle {
            font-size: 13px;
      }
}

@media (max-width: 768px) {
      body {
            flex-direction: column;
      }

      .sidebar {
            width: 100%;
            height: auto;
            margin-top: 20px;
            max-height: 300px;
            position: relative;
            border-right: none;
            border-bottom: 1px solid var(--border-light);
            overflow-y: auto;
      }

      .sidebar-content {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 16px;
            padding: 16px;
      }

      .sidebar-section {
            margin-bottom: 0;
      }

      .sidebar-card {
            padding: 12px;
      }

      .sidebar-card-value {
            font-size: 14px;
      }

      .sidebar-actions-inline {
            grid-column: span 2;
            flex-direction: row;
            justify-content: center;
      }

      .mobile-header {
            display: block;
      }

      .mobile-sidebar-content {
            display: block;
            margin-top: 32px;
      }

      .header {
            display: none;
      }

      .sidebar-content {
            display: none;
      }

      .main-content {
            flex: 1;
      }

      .container {
            padding: 24px 16px;
      }

      .header {
            padding: 0 16px;
            height: 50px;
      }

      .header-title {
            font-size: 16px;
      }

      .calendar-grid {
            padding: 12px;
      }

      .day-cell {
            font-size: 12px;
            min-height: 40px;
      }

      .modal {
            padding: 24px;
            margin: 16px;
            max-width: calc(100vw - 32px);
      }

      .modal-buttons {
            grid-template-columns: 1fr;
      }

      .hours-grid {
            grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
            gap: 8px;
      }

      .hour-option {
            font-size: 13px;
            padding: 10px;
      }

      .section-title {
            font-size: 20px;
      }

      .section-subtitle {
            font-size: 14px;
      }

      .appointment-actions {
            flex-wrap: wrap;
      }

      .btn-contact-client {
            font-size: 11px;
            padding: 6px 10px;
      }

      .stat-badge {
            font-size: 12px;
            padding: 6px 12px;
      }
}

@media (max-width: 480px) {
      .sidebar {
            max-height: 250px;
      }

      .sidebar-content {
            grid-template-columns: 1fr;
            gap: 12px;
            padding: 12px;
      }

      .sidebar-section {
            padding: 8px;
      }

      .sidebar-card {
            padding: 10px;
      }

      .sidebar-card-value {
            font-size: 13px;
      }

      .day-cell {
            font-size: 11px;
            min-height: 35px;
      }

      .hour-option {
            font-size: 12px;
            padding: 8px;
      }

      .modal {
            padding: 16px;
            margin: 8px;
      }

      .modal-title {
            font-size: 18px;
      }

      .form-group label {
            font-size: 13px;
      }

      .btn {
            font-size: 13px;
            padding: 10px 14px;
      }

      .appointment-meta {
            flex-direction: column;
            gap: 6px;
      }

      .appointment-actions {
            gap: 6px;
      }

      .btn-contact-client {
            font-size: 10px;
            padding: 5px 8px;
      }

      .header-controls {
            gap: 8px;
      }

      .stat-badge {
            font-size: 11px;
            padding: 5px 10px;
      }

      .calendar-controls {
            flex-direction: column;
            gap: 12px;
      }

      .month-navigation {
            font-size: 18px;
      }

      .nav-button {
            width: 28px;
            height: 28px;
            font-size: 14px;
      }
}

@media (max-width: 360px) {
      .sidebar {
            max-height: 200px;
      }

      .sidebar-content {
            padding: 8px;
      }

      .sidebar-card {
            padding: 8px;
      }

      .day-cell {
            font-size: 10px;
            min-height: 30px;
      }

      .hour-option {
            font-size: 11px;
            padding: 6px;
      }

      .modal {
            padding: 12px;
      }

      .modal-title {
            font-size: 16px;
      }

      .form-group input,
      .form-group textarea {
            font-size: 12px;
            padding: 8px 10px;
      }

      .btn {
            font-size: 12px;
            padding: 8px 12px;
      }

      .appointment-name {
            font-size: 13px;
      }

      .appointment-meta {
            font-size: 11px;
      }

      .header-title {
            font-size: 14px;
      }
}