/* ============================================================
   ClinixWise — Tema clínico claro compartilhado
   Carregado depois do CSS de cada painel para preservar o layout
   e substituir somente a identidade visual escura.
   ============================================================ */

:root {
  color-scheme: light;
  --bg-0: #f6fbf8;
  --bg-1: #ffffff;
  --bg-2: #eaf7f0;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-2: #eff9f3;
  --surface-solid: #ffffff;
  --card: #ffffff;
  --bg-elev: #eff9f3;
  --border: rgba(15, 118, 85, 0.16);
  --border-strong: rgba(15, 118, 85, 0.36);
  --text: #15382d;
  --text-dim: #456b5e;
  --text-muted: #5f7d72;
  --brand: #087f5b;
  --brand-2: #066647;
  --brand-3: #166534;
  --primary: #066647;
  --accent: #16a34a;
  --accent-2: #15803d;
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.09);
  --warning: #b45309;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --info: #0369a1;
  --info-bg: rgba(2, 132, 199, 0.1);
  --success-bg: rgba(22, 163, 74, 0.1);
  --grad-primary: linear-gradient(135deg, #15966a 0%, #066647 100%);
  --grad-accent: linear-gradient(135deg, #16a34a 0%, #087f5b 100%);
  --grad-text: linear-gradient(135deg, #087f5b 0%, #066647 58%, #166534 100%);
  --grad-text-2: linear-gradient(135deg, #15803d 0%, #087f5b 100%);
  --shadow-glow: 0 0 50px rgba(15, 139, 99, 0.14);
  --shadow-card: 0 20px 45px -30px rgba(15, 61, 47, 0.34), 0 8px 22px -16px rgba(15, 118, 85, 0.2);
}

html,
body {
  background: #ffffff;
  color: var(--text);
}

body {
  background-image:
    radial-gradient(circle at 92% 2%, rgba(34, 197, 94, 0.07), transparent 24rem),
    linear-gradient(180deg, #ffffff 0%, #f7fbf9 100%);
}

/* O canvas antigo criava o fundo 3D escuro. */
#bg-canvas {
  display: none;
}

::selection {
  color: #ffffff;
  background: rgba(8, 127, 91, 0.72);
}

::-webkit-scrollbar-thumb {
  background: rgba(15, 139, 99, 0.34);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 139, 99, 0.52);
  background-clip: padding-box;
}

* {
  scrollbar-color: rgba(15, 139, 99, 0.34) transparent;
}

.brand-mark {
  filter: drop-shadow(0 4px 9px rgba(15, 139, 99, 0.2));
}

.brand-mark stop:first-child { stop-color: #22c55e; }
.brand-mark stop:last-child { stop-color: #087f5b; }

.kicker {
  color: var(--brand-2);
  background: rgba(15, 139, 99, 0.08);
  border-color: rgba(15, 139, 99, 0.24);
}

/* Estrutura principal */
.app-sidebar {
  background: rgba(255, 255, 255, 0.97);
  border-right-color: var(--border);
  box-shadow: 12px 0 36px -30px rgba(15, 61, 47, 0.3);
}

.app-topbar {
  background: rgba(255, 255, 255, 0.91);
  border-bottom-color: var(--border);
  box-shadow: 0 8px 28px -26px rgba(15, 61, 47, 0.42);
}

.app-main,
.app-content {
  background: transparent;
}

.sidebar-nav a:hover,
.sidebar-nav button:hover,
.sidebar-user:hover,
.settings-nav a:hover {
  color: var(--brand-2);
  background: rgba(15, 139, 99, 0.07);
}

.sidebar-nav a.active,
.sidebar-nav button.active,
.settings-nav a.active {
  color: var(--brand-2);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.13), rgba(15, 139, 99, 0.07));
  border-color: rgba(15, 139, 99, 0.28);
  box-shadow: inset 3px 0 0 var(--brand-2);
}

.topbar-search input,
.icon-btn,
.topbar-toggle {
  color: var(--text-dim);
  background: #f8fcfa;
  border-color: var(--border);
}

.topbar-search input:focus,
.icon-btn:hover,
.topbar-toggle:hover {
  color: var(--brand-2);
  background: #ffffff;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(15, 139, 99, 0.08);
}

.icon-btn .dot-alert {
  box-shadow: 0 0 0 2px #ffffff;
}

/* Cartões, tabelas e superfícies */
.card,
.stat-card,
.table-wrap,
.dropdown-menu,
.toast,
.modal,
.empty-state,
.appt-card,
.agenda-period-day,
.agenda-month-day {
  background: var(--surface);
  border-color: var(--border);
}

.card,
.stat-card,
.table-wrap,
.appt-card {
  box-shadow: 0 14px 34px -30px rgba(15, 61, 47, 0.42);
}

.card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: 0 18px 38px -25px rgba(15, 118, 85, 0.28);
}

.stat-card-icon {
  color: #ffffff;
  background: var(--grad-primary) !important;
  box-shadow: 0 10px 22px -12px rgba(8, 127, 91, 0.65);
}

.stat-card-value,
.calls-clock .time,
.calling-now .patient-name,
.appt-date-block .appt-day,
.vital-chip .vital-value,
.rich-text-content h2,
.rich-text-content h3 {
  color: var(--text);
}

.badge-success { color: #15803d; }
.badge-danger { color: #b91c1c; }
.badge-info { color: #0369a1; }
.badge-neutral { background: #edf5f1; }

.quick-action-btn:hover {
  color: var(--brand-2);
}

.data-table thead th {
  background: #f0f8f4;
}

.data-table tbody tr:hover,
.pagination-btns button:hover:not(:disabled) {
  color: var(--brand-2);
  background: rgba(15, 139, 99, 0.055);
}

.pagination-btns button.active {
  color: #ffffff;
  background: var(--grad-primary);
}

/* Botões e controles */
.btn-primary,
.btn-success {
  color: #ffffff;
  background: var(--grad-primary);
  box-shadow: 0 10px 24px -14px rgba(8, 127, 91, 0.7);
}

.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
  box-shadow: 0 14px 28px -14px rgba(8, 127, 91, 0.68);
}

.btn-secondary {
  color: var(--brand-2);
  background: #ffffff;
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  color: #066647;
  background: #eff9f3;
  border-color: rgba(8, 127, 91, 0.48);
}

.btn-ghost:hover:not(:disabled),
.modal-close:hover,
.dropdown-menu a:hover,
.dropdown-menu button:hover,
.rich-text-toolbar button:hover,
.rich-text-toolbar button:focus-visible,
.evolution-toolbar button:hover {
  color: var(--brand-2);
  background: rgba(15, 139, 99, 0.08);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="search"],
input[type="url"],
select,
textarea,
.modal-close,
input[type="file"]::file-selector-button {
  color: var(--text);
  background-color: #ffffff;
  border-color: var(--border);
}

input:focus,
select:focus,
textarea:focus {
  background-color: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 139, 99, 0.09);
}

select,
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  color-scheme: light;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23456b5e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.switch-track {
  background: #dcebe4;
  border-color: rgba(15, 118, 85, 0.2);
}

/* Modais e mensagens */
.modal {
  border-color: var(--border-strong);
  box-shadow: 0 28px 70px -28px rgba(15, 61, 47, 0.42);
}

.modal-header {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.09), rgba(255, 255, 255, 0));
  border-color: var(--border);
}

.modal-footer {
  background: #fbfefc;
}

.modal-discard-prompt {
  background: #fffaf0;
}

.modal-inline-confirm__card {
  background: #ffffff;
}

.skeleton {
  background: linear-gradient(90deg, #eaf4ef 25%, #f8fcfa 50%, #eaf4ef 75%);
  background-size: 200% 100%;
}

/* Agenda da clínica */
.agenda-date-toolbar,
.agenda-search,
.agenda-metric,
.agenda-calendar-card,
.agenda-day-panel,
.agenda-slot-picker,
.agenda-detail-grid > div,
.agenda-detail-notes,
.association-picker {
  background: #ffffff;
}

.agenda-date-arrow,
.agenda-date-input input,
.agenda-filter-select select,
.agenda-week-day,
.agenda-time-option,
.agenda-period-day__head,
.agenda-period-appointment {
  color: var(--text-dim);
  background: #f7fbf9;
}

.agenda-week-day:hover,
.agenda-week-day.is-selected {
  color: var(--brand-2);
  background: rgba(15, 139, 99, 0.08);
  border-color: var(--brand);
}

.agenda-board > * {
  background: #ffffff;
}

.agenda-board__corner,
.agenda-board__professional {
  background: #edf8f2;
}

.agenda-slot--free {
  color: var(--text-muted);
  background: #fbfefc;
}

.agenda-slot--free:hover,
.agenda-slot--free:focus-visible {
  color: var(--brand-2);
  background: rgba(15, 139, 99, 0.08);
  box-shadow: inset 0 0 0 1px rgba(15, 139, 99, 0.36);
}

.agenda-slot--covered {
  background: repeating-linear-gradient(135deg, rgba(15, 118, 85, 0.04) 0, rgba(15, 118, 85, 0.04) 6px, transparent 6px, transparent 12px);
}

.agenda-slot--occupied { background: rgba(15, 139, 99, 0.06); }
.agenda-slot--past,
.agenda-slot--unavailable { background: #f4f7f5; }

.agenda-time-option:hover,
.agenda-time-option.is-selected,
.weekday-picker input:checked + span {
  color: #ffffff;
  background: var(--brand-2);
  border-color: var(--brand-2);
}

.agenda-booking-intro,
.agenda-result-count,
.agenda-month-day__appointments button,
.settings-nav a.active,
.rich-model-intro {
  background: rgba(15, 139, 99, 0.07);
  border-color: rgba(15, 139, 99, 0.22);
}

.agenda-booking-intro > span,
.agenda-board__professional-avatar,
.agenda-appointment__avatar {
  color: #ffffff;
  background: var(--grad-primary);
}

/* Portal do paciente */
.booking-page {
  background:
    radial-gradient(circle at 10% 2%, rgba(34, 197, 94, 0.09), transparent 28rem),
    radial-gradient(circle at 92% 22%, rgba(15, 139, 99, 0.06), transparent 26rem),
    #ffffff;
}

.booking-progress {
  background: #f4faf7;
}

.booking-progress-track span {
  background: #dcebe4;
}

.booking-progress-track .is-current {
  box-shadow: 0 0 10px rgba(15, 139, 99, 0.34);
}

.booking-card {
  border-color: rgba(15, 139, 99, 0.25);
}

.booking-continue:disabled {
  color: var(--text-muted);
  background: #e8f2ed;
  border-color: var(--border);
}

.appt-date-block {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(15, 139, 99, 0.06));
}

.telemed-card,
.calling-now {
  background: linear-gradient(155deg, #ffffff 0%, #eef9f3 100%);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}

.bottom-nav {
  background: rgba(255, 255, 255, 0.95);
  border-top-color: var(--border);
  box-shadow: 0 -12px 30px -26px rgba(15, 61, 47, 0.45);
}

/* Prontuário e painel de chamadas */
.vital-chip,
.rich-text-toolbar,
.evolution-toolbar,
.rich-text-preview,
.anamnesis-fields-panel,
.rich-text-editor {
  background: #f8fcfa;
}

.rich-text-canvas {
  background: #ffffff;
}

.custom-field-chip,
.rich-text-content blockquote {
  background: rgba(15, 139, 99, 0.09);
}

.calling-now::before {
  opacity: 0.035;
}

.calling-now .call-destination {
  color: var(--brand-2);
  background: rgba(15, 139, 99, 0.08);
  border-color: rgba(15, 139, 99, 0.25);
}

/* Administração SaaS */
.plan-tag.starter,
.usage-bar {
  background: #e8f2ed;
}

.plan-tag.pro,
.plan-tag.enterprise {
  color: var(--brand-2);
  background: rgba(15, 139, 99, 0.1);
}

.mrr-figure,
.plan-config-card .plan-price {
  color: var(--text);
}

.plan-config-card.featured {
  background: linear-gradient(145deg, #ffffff, #edf9f2);
  border-color: var(--border-strong);
}

@media (max-width: 1024px) {
  .app-sidebar {
    box-shadow: 18px 0 48px -26px rgba(15, 61, 47, 0.42);
  }
}
