/* Portal de Cuidado — cores da marca (Logo_v2) e campos de formulário, para todo o sistema.
   Carregado POR ÚLTIMO em todas as páginas (depois de ui.css, portal.css, portal-tema.css e responsivo.css).
   Paleta tirada da logo: marinho #15355A (mão e texto), azul #43A3CE (nuvem), verde-água #50D5C7 (nuvem),
   azul-claro #A9D8EE (brilho). Tema: html[data-theme="light"|"dark"]; sem atributo, segue o aparelho. */

/* ========================= CLARO ========================= */
:root, html[data-theme="light"] {
  color-scheme: light;
  /* marca */
  --pc-navy: #15355A; --pc-blue: #43A3CE; --pc-teal: #50D5C7; --pc-sky: #A9D8EE;
  --pc-top: #1B4A77; --pc-top-2: #15355A;
  --pc-hero: linear-gradient(180deg, #1B4A77 0%, #1E5C8E 58%, #2370A3 100%);
  --pc-grad: linear-gradient(135deg, #15355A 0%, #1F6FA3 58%, #2793B6 100%);
  --pc-bar: linear-gradient(180deg, #50D5C7 0%, #43A3CE 100%);
  --pc-bubble: linear-gradient(135deg, #1E5C8E 0%, #2A86B9 100%);
  --pc-icon: #1F7AB0; --pc-link: #1A6FA6; --pc-glow: rgba(31, 111, 163, 0.28);
  --pc-ink: #12263D; --pc-gray: #55687C; --pc-card: #ffffff; --pc-page: #F5F9FC; --pc-line: #DCE6EE;
  --pc-shadow: 0 6px 18px rgba(21, 53, 90, 0.08), 0 1px 3px rgba(21, 53, 90, 0.06);
  /* campos */
  --pc-field: #ffffff; --pc-field-border: #C9D7E3; --pc-field-hover: #9FB6CA; --pc-field-focus: #2B8FC6;
  --pc-field-ring: rgba(67, 163, 206, 0.22); --pc-label: #2A3F55; --pc-placeholder: #8597A9;
  /* variáveis do portal (portal-tema.css) */
  --bg: #F5F9FC; --surface: #ffffff; --surface-2: #EEF4F9; --text: #12263D;
  --muted: #5A6C80; --border: rgba(21, 53, 90, 0.12);
  --blue: #1F7AB0; --blue-2: #2BA6B5; --glow: rgba(31, 122, 176, 0.25); --gradient: var(--pc-bar);
  --sidebar: rgba(240, 246, 251, 0.86);
  /* variáveis do design system (ui.css: login, cadastro, site, portfólio) */
  --bg-2: #ffffff; --bg-grouped: #EEF4F9; --surface-solid: #ffffff; --surface-strong: rgba(255, 255, 255, 0.92);
  --text-2: rgba(18, 38, 61, 0.72); --text-3: rgba(18, 38, 61, 0.46); --separator: rgba(21, 53, 90, 0.14);
  --accent: #1F7AB0; --accent-2: #2BA6B5; --accent-3: #50D5C7; --accent-ink: #ffffff; --accent-soft: rgba(31, 122, 176, 0.12);
  --gradient-text: linear-gradient(120deg, #15355A 0%, #1F6FA3 45%, #2BA6B5 100%);
}

/* ========================= ESCURO ========================= */
html[data-theme="dark"] {
  color-scheme: dark;
  --pc-navy: #15355A; --pc-blue: #4AAAD6; --pc-teal: #5ED9CC; --pc-sky: #A9D8EE;
  --pc-top: #0F2B47; --pc-top-2: #0B1F35;
  --pc-hero: linear-gradient(180deg, #0F2B47 0%, #123A5E 58%, #164A72 100%);
  --pc-grad: linear-gradient(135deg, #1F6FA3 0%, #2793B6 58%, #33AFB9 100%);
  --pc-bar: linear-gradient(180deg, #5ED9CC 0%, #4AAAD6 100%);
  --pc-bubble: linear-gradient(135deg, #1E5C8E 0%, #2A86B9 100%);
  --pc-icon: #66C6EA; --pc-link: #7CCBEE; --pc-glow: rgba(74, 170, 214, 0.32);
  --pc-ink: #EAF2F8; --pc-gray: #A3B6C8; --pc-card: #12243A; --pc-page: #0A1626; --pc-line: #22405F;
  --pc-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px rgba(0, 0, 0, 0.35);
  --pc-field: #0E1D31; --pc-field-border: #2A4A6B; --pc-field-hover: #3D6489; --pc-field-focus: #5FC4E8;
  --pc-field-ring: rgba(95, 196, 232, 0.24); --pc-label: #C9D8E6; --pc-placeholder: #7890A8;
  --bg: #0A1626; --surface: #12243A; --surface-2: #18304C; --text: #EAF2F8;
  --muted: rgba(214, 228, 241, 0.68); --border: rgba(120, 160, 200, 0.2);
  --blue: #5FC4E8; --blue-2: #5ED9CC; --glow: rgba(95, 196, 232, 0.25); --gradient: var(--pc-bar);
  --sidebar: rgba(14, 29, 49, 0.86);
  --bg-2: #0E1C30; --bg-grouped: #0E1C30; --surface-solid: #12243A; --surface-strong: rgba(18, 36, 58, 0.92);
  --text-2: rgba(214, 228, 241, 0.72); --text-3: rgba(214, 228, 241, 0.46); --separator: rgba(120, 160, 200, 0.2);
  --accent: #5FC4E8; --accent-2: #5ED9CC; --accent-3: #7FE3D4; --accent-ink: #04121F; --accent-soft: rgba(95, 196, 232, 0.14);
  --gradient-text: linear-gradient(120deg, #A9D8EE 0%, #5FC4E8 45%, #5ED9CC 100%);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --pc-navy: #15355A; --pc-blue: #4AAAD6; --pc-teal: #5ED9CC; --pc-sky: #A9D8EE;
    --pc-top: #0F2B47; --pc-top-2: #0B1F35;
    --pc-hero: linear-gradient(180deg, #0F2B47 0%, #123A5E 58%, #164A72 100%);
    --pc-grad: linear-gradient(135deg, #1F6FA3 0%, #2793B6 58%, #33AFB9 100%);
    --pc-bar: linear-gradient(180deg, #5ED9CC 0%, #4AAAD6 100%);
    --pc-bubble: linear-gradient(135deg, #1E5C8E 0%, #2A86B9 100%);
    --pc-icon: #66C6EA; --pc-link: #7CCBEE; --pc-glow: rgba(74, 170, 214, 0.32);
    --pc-ink: #EAF2F8; --pc-gray: #A3B6C8; --pc-card: #12243A; --pc-page: #0A1626; --pc-line: #22405F;
    --pc-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px rgba(0, 0, 0, 0.35);
    --pc-field: #0E1D31; --pc-field-border: #2A4A6B; --pc-field-hover: #3D6489; --pc-field-focus: #5FC4E8;
    --pc-field-ring: rgba(95, 196, 232, 0.24); --pc-label: #C9D8E6; --pc-placeholder: #7890A8;
    --bg: #0A1626; --surface: #12243A; --surface-2: #18304C; --text: #EAF2F8;
    --muted: rgba(214, 228, 241, 0.68); --border: rgba(120, 160, 200, 0.2);
    --blue: #5FC4E8; --blue-2: #5ED9CC; --glow: rgba(95, 196, 232, 0.25); --gradient: var(--pc-bar);
    --sidebar: rgba(14, 29, 49, 0.86);
    --bg-2: #0E1C30; --bg-grouped: #0E1C30; --surface-solid: #12243A; --surface-strong: rgba(18, 36, 58, 0.92);
    --text-2: rgba(214, 228, 241, 0.72); --text-3: rgba(214, 228, 241, 0.46); --separator: rgba(120, 160, 200, 0.2);
    --accent: #5FC4E8; --accent-2: #5ED9CC; --accent-3: #7FE3D4; --accent-ink: #04121F; --accent-soft: rgba(95, 196, 232, 0.14);
    --gradient-text: linear-gradient(120deg, #A9D8EE 0%, #5FC4E8 45%, #5ED9CC 100%);
  }
}

body { background-color: var(--bg); color: var(--text); }

/* ---------- logo: no escuro, a mão e o texto (marinho) ficam claros ---------- */
html[data-theme="dark"] img[src$="marca2/simbolo.png"] { content: url("/assets/marca2/simbolo-escuro.png"); }
html[data-theme="dark"] img[src$="marca2/logo-horizontal.png"] { content: url("/assets/marca2/logo-horizontal-escuro.png"); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) img[src$="marca2/simbolo.png"] { content: url("/assets/marca2/simbolo-escuro.png"); }
  html:not([data-theme="light"]) img[src$="marca2/logo-horizontal.png"] { content: url("/assets/marca2/logo-horizontal-escuro.png"); }
}
/* o símbolo é transparente: sem o fundo branco e a sombra pensados para o ícone antigo */
.brand-logo:has(img[src*="marca2/simbolo"]), .mark[src*="marca2/simbolo"], .fala-convite-logo, #portalCarregando img {
  background: transparent !important; box-shadow: none !important; border-radius: 0 !important; object-fit: contain;
}

/* ---------- botão principal ---------- */
.primary-btn, html[data-theme="dark"] .primary-btn, .btn.primary, .btn-primary {
  background: var(--pc-grad) !important; color: #fff !important; border: 0 !important;
  box-shadow: 0 6px 16px var(--pc-glow) !important;
}
.primary-btn:hover, .btn.primary:hover { filter: brightness(1.06); }
.primary-btn:active, .btn.primary:active { transform: translateY(1px); }
a { color: inherit; }

/* =========================================================
   CAMPOS (portal, login, cadastro, site): altura confortável, borda nítida,
   foco no azul da logo, seta desenhada nas listas e erro só depois de mexer.
   ========================================================= */
html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"]):not(.m-search > input):not(.addr-input > input),
html body select,
html body textarea:not(.fala-msg-form > textarea) {
  -webkit-appearance: none; appearance: none;
  min-height: 48px; padding: 12px 14px !important;
  border: 1.5px solid var(--pc-field-border) !important; border-radius: 14px !important;
  background-color: var(--pc-field) !important; color: var(--text) !important;
  font: inherit; font-size: 16px !important; line-height: 1.35;
  box-shadow: 0 1px 2px rgba(21, 53, 90, 0.04) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
html body textarea:not(.fala-msg-form > textarea) { min-height: 104px; resize: vertical; line-height: 1.5; }
html body input:hover:not(:focus):not(:disabled), html body select:hover:not(:focus):not(:disabled), html body textarea:hover:not(:focus):not(:disabled) {
  border-color: var(--pc-field-hover) !important;
}
html body input:focus, html body select:focus, html body textarea:focus {
  outline: none !important; border-color: var(--pc-field-focus) !important;
  box-shadow: 0 0 0 4px var(--pc-field-ring) !important;
}
html body input::placeholder, html body textarea::placeholder { color: var(--pc-placeholder); opacity: 1; }
html body input:disabled, html body select:disabled, html body textarea:disabled, html body input[readonly] {
  background-color: var(--surface-2) !important; color: var(--muted) !important; cursor: not-allowed;
}
html body input[readonly] { cursor: text; }
/* erro: só depois que a pessoa mexeu no campo (não pinta o formulário vazio de vermelho) */
html body input:user-invalid, html body select:user-invalid, html body textarea:user-invalid {
  border-color: #D64545 !important; box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.14) !important;
}
/* listas: seta desenhada, mesma altura dos outros campos */
html body select {
  padding-right: 42px !important; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2343A3CE' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 14px center !important; background-size: 14px 14px !important;
}
html body input[type="date"], html body input[type="time"], html body input[type="datetime-local"] { min-width: 0; }
html body input[type="search"] { -webkit-appearance: none; }
/* caixas de marcar e opções na cor da marca */
html body input[type="checkbox"], html body input[type="radio"] { accent-color: var(--pc-field-focus); width: 18px; height: 18px; }

/* rótulos: texto acima do campo, legível e alinhado */
.portal-content label:not(.fala-switch):not(.portal-switch):not(.check-row):not(.consent-line),
.portal-dialog label:not(.fala-switch):not(.portal-switch):not(.check-row):not(.consent-line),
.fala-modal label:not(.fala-switch), .fala-nova label:not(.fala-switch),
.field > span, .field > label {
  color: var(--pc-label); font-size: 13.5px; font-weight: 600; letter-spacing: 0;
}
.portal-content label:not(.fala-switch):not(.portal-switch):not(.check-row):not(.consent-line),
.portal-dialog label:not(.fala-switch):not(.portal-switch):not(.check-row):not(.consent-line) {
  display: grid; gap: 7px; align-content: start;
}
.portal-content label:not(.fala-switch):not(.portal-switch):not(.check-row):not(.consent-line) > :is(input, select, textarea),
.portal-dialog label:not(.fala-switch):not(.portal-switch):not(.check-row):not(.consent-line) > :is(input, select, textarea) {
  margin: 0 !important;
}
/* janelas de formulário sólidas: o conteúdo de trás não aparece por baixo dos campos */
html body .portal-dialog { background: var(--surface) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html body .portal-dialog::backdrop { background: rgba(6, 18, 32, 0.55); }
/* campo de busca da lista de pacientes: lupa à esquerda */
/* :not(#…) só dá peso ao seletor (vence a regra geral dos campos, que define o padding) */
html body input.search:not(#_a):not(#_b) {
  padding-left: 44px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238597A9' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: 15px center !important; background-size: 18px 18px !important;
}
/* grupos de campos nos formulários do portal: espaço uniforme */
.portal-content .form-grid, .portal-dialog .form-grid { gap: 14px 16px !important; }
.portal-dialog .dialog-actions { gap: 10px; }

/* campos especiais com desenho próprio (busca de Serviços, chat da sala) */
html body .fala-msg-form > textarea { min-height: 44px; border: 1.5px solid var(--pc-field-border) !important; background-color: var(--pc-field) !important; color: var(--text) !important; }
html body .fala-msg-form > textarea:focus { outline: none; border-color: var(--pc-field-focus) !important; box-shadow: 0 0 0 4px var(--pc-field-ring) !important; }

/* botão principal do design system (login, cadastro, site): degradê da marca; as variações (tinted, gray, plain, danger) continuam iguais */
.btn:not(.tinted):not(.gray):not(.plain):not(.danger):not(.glass-btn):not(.icon) { --btn-bg: var(--pc-grad); --btn-fg: #fff; box-shadow: 0 6px 16px var(--pc-glow); }

/* topo do portal: sem foto do médico, mostra só o símbolo da marca (sem moldura, sem brilho animado) */
html body .brand-logo:not(.has-photo) { background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; overflow: visible !important; }
html body .brand-logo:not(.has-photo)::after { display: none !important; }
html body .brand-logo:not(.has-photo) img { width: 100% !important; height: 100% !important; object-fit: contain !important; background: transparent !important; border-radius: 0 !important; padding: 0 !important; }
/* o ui.css punha fundo branco no símbolo antigo no tema escuro; o novo já tem versão própria para fundo escuro */
html body img[src*="marca2/simbolo"] { background: transparent !important; }
