/* front/css/styles.css */

/* --- Importação de Fonte Externa --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

/* Estilos Específicos para o Modal de Medicamentos */
.medication-controls-row {
    display: flex;
    flex-direction: row;
    align-items: flex-end; /* Alinha labels e inputs na base */
    gap: 1.5rem;
    padding: 1.5rem;
    background-color: var(--gray-990);
    border-bottom: 1px solid var(--gray-900);
}

.medication-controls-row .form-group {
    margin-bottom: 0; /* Remove margem inferior padrão para alinhamento horizontal */
}

.medication-results-container {
    padding: 1rem;
    height: 30rem; /* Altura fixa para permitir scroll */
    overflow-y: auto;
    background-color: var(--bg-dark-input);
}

.medication-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.medication-item {
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid var(--gray-900);
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: var(--fs-std);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.medication-item:hover {
    background-color: var(--gray-950);
}

.medication-item.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color-hover);
}

@media (max-width: 768px) {
    .medication-controls-row {
        flex-direction: column;
        align-items: stretch;
    }
    .medication-controls-row .form-group {
        width: 100%;
    }
}

/* --- Variáveis (Tema Escuro - Padrão) --- */
:root {
  color-scheme: dark; /* Garante renderização legível de elementos nativos do SO, como o <select> */

  /* Cores Base */
  --color-black: black;
  --color-white: #F9F9F9; /* Req 5 */

  /* Escala de Cinzas (Grayscale) */
  --gray-100: #e0e0e0;
  --gray-200: #ccc;
  --gray-300: #ddd;
  --gray-400: #aaa;
  --gray-500: #999;
  --gray-600: #888;
  --gray-700: #777;
  --gray-800: #555;
  --gray-900: #6D95B1; /* Req 2: Borders alteradas para #6D95B1 */
  --gray-950: #333; /* Hover, Secondary bg */
  --gray-970: #2a2a2a;
  --gray-980: #222;
  --gray-990: #1f1f1f;
  --gray-995: #1e1e1e;
  
  /* --- Novas Variáveis Padronizadas para Inputs --- */
  --input-font-family: 'Inter', sans-serif;
  --input-font-weight: 500;
  --input-font-size: 1.6rem;
  
  --input-bg-color: #333333; /* Cinza escuro */
  --input-text-color: #ffffff; /* Branco */
  --input-border-color: #6D95B1; /* Req 2: Bordas dos inputs alteradas */
  
  --label-font-size: 1.2rem;
  --label-text-color: #aaaaaa;
  
  --input-height: 3.6rem;
  --input-border-radius: 1.8rem; /* Bordas laterais perfeitamente arredondadas */
  --input-padding: 0.4rem 1.2rem; /* Compacto */
  --form-group-margin: 0.8rem; /* Compacto */

  /* Cores Semânticas */
  --bg-color: #000000; /* Fundo de página preto (Regra 7) */
  --text-color: #F9F9F9; /* Req 5: Fonte com cor F9F9F9 no tema escuro */
  --border-color: #6D95B1; /* Req 2: Border global alterada */
  --muted-text: var(--gray-200);

  /* Scrollbar Thumb Custom Color */
  --scrollbar-thumb-color: #6D95B1; /* Req 4 */

  /* Palette de Cores */
  --primary-color: #007bff;
  --primary-color-hover: #0056b3;
  --success-color: #28a745;
  --error-color: #dc3545;
  --error-hover: #c82333;
  --info-color: #17a2b8;
  --info-hover: #138496;
  --warning-color: #ffc107;
  --warning-bg: #332700;

  /* Cor de Botão Padrão */
  --btn-default-bg: #8cff38;
  --btn-default-bg-hover: #72db2b;
  --btn-text-color: var(--color-black);

  --btn-default-bg-acess: #8cff38;
  --btn-default-bg-acess-hover: #72db2b;

  /* Agenda specific */
  --booked-slot-bg: #4a2d04;
  --selected-slot-border: #ffc107;
  --blocked-slot-bg: var(--gray-900);

  /* Font Family Geral */
  --font-family-base: 'Inter', Arial, sans-serif;
  --font-family-mono: 'Courier New', Courier, monospace;

  /* Font Sizes */
  --base-font-size: 9px;

  --fs-xs: 1.05rem;
  --fs-sm: 1.2rem;
  --fs-md: 1.3rem;
  --fs-base: 1.4rem;

  --fs-std: 1.5rem;
  --fs-reg: 1.6rem;
  --fs-lg: 1.8rem;
  --fs-xl: 2.5rem;
  --fs-2xl: 2.6rem;
  --fs-3xl: 2.2rem;
  --fs-4xl: 2.4rem;
  --fs-5xl: 2.5rem;
  --fs-6xl: 2.8rem;
  --fs-7xl: 3.0rem;
  --fs-8xl: 3.2rem;
  --fs-9xl: 2.3rem;

  /* Font Weights */
  --fw-normal: 300;
  --fw-bold: 700;

  /* Dimensões Gerais */
  --border-radius: 22px;
  --border-width: 4px;
  --margin-sm: 0.4rem;
  --padding-md: 0.8rem;

  /* Ajuda */
  --color-back-white: black;
  --color-white-black: white;
}

/* --- Variáveis (Tema Claro) --- */
body.light-theme {
  color-scheme: light; /* Garante renderização legível de elementos nativos do SO, como o <select> */

  /* Variáveis Padronizadas para Inputs no modo Claro */
  --input-bg-color: #ffffff; /* Branco */
  --input-text-color: #0b1c2c; /* Azul quase preto */
  --input-border-color: #829ab1; /* Cor mantida como borda do modo claro */
  --label-text-color: #627d98; /* Menos intensa para labels/placeholders */

  /* Cores Base Invertidas para Ícones */
  --color-black: #ffffff;
  --color-white: #102a43;

  --color-back-white: white;

  /* Paleta de Fundo (Backgrounds) */
  --bg-gradient: linear-gradient(
     135deg,
     #1a416c 0%,
     #598dbd 45%,
     #5da5a4 88%,
     #acc569 100%
    );
  --bg-color: #ffffff; /* Mantido conforme Regra 7 */
  --bg-dark-input: #ffffff; 

  /* Escala de Cinzas / Tons Neutros */
  --gray-995: #ffffff;
  --gray-990: #f8f9fa;
  --gray-980: #d1d0d0;
  --gray-970: #d9e2ec;
  --gray-950: #bcccdc;

  /* Bordas da Estrutura Geral */
  --gray-900: #829ab1;
  --border-color: #acc569;

  /* Scrollbar Thumb Custom Color (Manter distinção no tema claro) */
  --scrollbar-thumb-color: #829ab1;

  /* Texto Geral */
  --text-color: #102a43;
  --muted-text: #020304;
  --gray-300: #060000;
  --gray-400: #627d98;
  --gray-500: #829ab1;
  --gray-600: #9fb3c8;

  /* Cores Semânticas */
  --primary-color: #acc569;
  --primary-color-hover: #003d80;
  --success-color: #218838;
  --error-color: #c82333;
  --error-hover: #bd2130;
  --info-color: #598dbd;
  --warning-color: #856404;
  --warning-bg: #fff3cd;

  /* Botões Padrão */
  --btn-default-bg: #5da5a4;
  --btn-default-bg-hover: #29706f;
  --btn-text-color: #ecf0f3;

  --btn-default-bg-acess: #ddbe0c;
  --btn-default-bg-acess-hover: #a48e0e;

  /* Agenda Específicos */
  --booked-slot-bg: #fff8c4;
  --selected-slot-border: #d35400;
  --blocked-slot-bg: #e0e0e0;
}

/* --- Reset e Base --- */
* {box-sizing: border-box;margin: 0;padding: 0;}
html { font-size: var(--base-font-size); }
body {
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-color);
  font-family: var(--font-family-base), sans-serif;
  font-size: var(--fs-reg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  /* Retirados os bloqueios de visualização do scrollbar originais */
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-color) var(--bg-color); /* Req 4 */
  -ms-overflow-style: auto;
  transition: background-color 0.3s, color 0.3s;
}

/* Configuração universal de Scrollbars (Tema Escuro/Claro) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb-color); /* Req 4 */
    border-radius: 5px;
    border: 2px solid var(--bg-color);
}

a { color: var(--text-color); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: none; border-top: var(--border-width) solid var(--gray-900); margin: var(--padding-md) 0; }

/* Tipografia Básica */
h1 { font-size: var(--fs-4xl); margin-bottom: 1rem; }
h2 { font-size: var(--fs-2xl); margin-bottom: 1rem; color: var(--text-color); font-weight: var(--fw-bold); }
h3 { font-size: var(--fs-xl); margin-bottom: 0.8rem; color: var(--text-color); font-weight: var(--fw-bold); }

/* =========================================
   CLASSES UTILITÁRIAS
   ========================================= */
.d-flex { display: flex; }
.d-none { display: none; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-grow-1 { flex-grow: 1; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-around { justify-content: space-around; }
.gap-1 { gap: 1rem; }
.gap-2 { gap: 2rem; }
.gap-05 { gap: 0.5rem; }
.m-0 { margin: 0 !important; }
.mt-05 { margin-top: 0.5rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.mt-4 { margin-top: 4rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }
.mb-4 { margin-bottom: 4rem; }
.mb-5 { margin-bottom: 5rem; }
.ml-auto { margin-left: auto; }
.ml-1 { margin-left: 1rem; }
.ml-2 { margin-left: 2rem; }
.mr-1 { margin-right: 1rem; }
.p-0 { padding: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.pt-05 { padding-top: 0.5rem; }
.pb-05 { padding-bottom: 0.5rem; }
.pl-0 { padding-left: 0 !important; }
.p-2 { padding: 2rem; }
.p-3 { padding: 3rem; }
.w-100 { width: 100%; }
.max-w-30 { max-width: 30rem; }
.max-w-60 { max-width: 60rem; }
.max-w-80 { max-width: 80rem; }
.max-w-90 { max-width: 90rem; }
.max-w-120 { max-width: 120rem; }
.h-100 { height: 100%; }
.border-none { border: none !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }
.font-bold { font-weight: var(--fw-bold); }
.fs-large { font-size: var(--fs-lg); }
.fs-xl { font-size: var(--fs-3xl); }
.text-underline { text-decoration: underline; }
.no-wrap { white-space: nowrap; }
.color-warning { color: var(--warning-color); }
.color-error { color: var(--error-color); }
.color-muted { color: var(--muted-text); }
.color-selected { color: var(--selected-slot-border); }
.iframe-full { width: 100%; height: 100%; border: none; }
.overflow-hidden {overflow: visible;}
.cursor-pointer { cursor: pointer; }
.h-10vh { height: 10vh; }
.h-20vh { height: 20vh; }
.h-25vh { height: 25vh; }
.h-40vh { height: 40vh; }
.overflow-y-auto { overflow-y: auto; }

/* --- Layout Principal --- */
.app-header {
  width: calc(100% - (var(--margin-sm) * 2));
  padding: 0.4rem var(--padding-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  height: 10vh;
  border: none !important;
  border-radius: var(--border-radius);
  margin: var(--margin-sm);
  background-color: transparent !important;
}
.app-header.download-header, .app-header.portal-header {
    width: 100%; margin: 0; border: none !important; border-radius: 0; padding: 1.5rem 0;
    flex-direction: column; justify-content: center; align-items: center; text-align: center; height: auto;
}
.app-header h1 { font-size: var(--fs-6xl); margin: 0; font-weight: var(--fw-bold); }
.app-header h2 { font-size: var(--fs-xl); margin: 0.5rem 0 0 0; font-weight: var(--fw-normal); color: var(--selected-slot-border); }

/* Theme Toggle Header Button */
.header-theme-btn {
    background: transparent;
    border: 1px solid var(--gray-600);
    color: var(--muted-text);
    border-radius: 12px;
    padding: 0;
    font-size: 1.1rem;
    cursor: pointer;
    text-transform: capitalize; 
    height: 2.2rem;
    width: 6.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.header-theme-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-color);
    background-color: var(--gray-950);
}
body.light-theme .header-theme-btn {
    border-color: var(--gray-400);
    color: var(--gray-500);
}
body.light-theme .header-theme-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-color);
    background-color: var(--gray-200);
}

/* Footer Fixo */
.app-footer-fixed {
    width: calc(100% - (var(--margin-sm) * 2));
    height: auto;
    flex-shrink: 0;
    border: none !important;
    border-radius: var(--border-radius);
    background-color: transparent !important;
    text-align: center;
    font-size: 0.8rem;
    font-weight: var(--fw-bold);
    padding: var(--padding-md);
    margin: var(--margin-sm);
    z-index: 10;
}

.app-main {
  flex-grow: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--margin-sm);
  overflow: auto;
}

.app-main-index {
  flex-grow: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--margin-sm);
  overflow: auto;
  flex-direction: column;
}
.app-footer {
  width: 100%; padding: var(--padding-md); flex-shrink: 0;
  border: none !important; text-align: center; font-size: var(--fs-sm);
  background-color: transparent !important;
}
.header-title-group {display: flex;align-items: center;height: 100%;margin: 0;border-radius: 14px;background: transparent;}
.header-logo {height: 5.7rem;overflow: hidden;}
.header-logo img {width: 100%; height: 100%; object-fit: cover; object-position: center;}
.header-title { font-size: var(--fs-xl); font-weight: var(--fw-bold); white-space: nowrap; }
.header-user-info { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.header-user-name { font-size: var(--fs-2xl); color: var(--muted-text); }
.header-clock { font-size: 1.5rem; font-family: var(--font-family-base), sans-serif; font-weight: 600; }

.dropdown-container { position: relative; display: flex; align-items: center; gap: 1.5rem; }

/* Modificação: Fundo e cor do Dropdown Menu para ambos os temas */
.dropdown-menu { display: none; position: absolute; right: 0; top: 120%; background-color: #527085 !important; border: var(--border-width) solid var(--border-color); border-radius: var(--border-radius); padding: var(--padding-md); z-index: 1000; min-width: 20rem; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.dropdown-menu.show { display: block; }
.dropdown-menu a { display: block; padding: var(--padding-md); color: #F9F9F9 !important; }
.dropdown-menu a:hover { background-color: rgba(0,0,0,0.2) !important; color: #FFFFFF !important;}

.area {
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius);
  margin: var(--margin-sm);
  padding: 1.6rem;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
}

.main-single-area {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.main-dual-area {display: flex;justify-content: space-around;align-items: stretch;width: 100%; gap: 1rem;flex-grow: 1;}
.main-dual-area > .area { flex: 1; }
.main-dual-area > .agenda-schedule-area { flex-basis: 40%; }
.main-dual-area > .patient-management-area { flex-basis: 60%; }

/* Caixa exclusiva e de alta legibilidade para a seção "Quem Somos" */
.quem-somos-box {
    background-color: #1A2A3A !important;
    border-color: #41607A !important;
}

body.light-theme .quem-somos-box {
    background-color: #F0F4F8 !important;
    border-color: #829AB1 !important;
    color: #102A43 !important;
}

.quem-somos-box h2, .quem-somos-box h3 {
    color: var(--selected-slot-border) !important;
}

/* =========================================================
   FORMS & CONTROLS (PADRONIZAÇÃO UNIFICADA)
   ========================================================= */

.form-group { margin-bottom: var(--form-group-margin); }

label, .std-label {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--label-text-color);
    font-family: 'Inter', sans-serif;
    font-size: var(--label-font-size);
    font-weight: 400;
    font-style: italic;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
select,
textarea,
.std-input {
    width: 100%;
    background-color: var(--input-bg-color);
    color: var(--input-text-color);
    border: 1px solid var(--input-border-color);
    border-radius: var(--input-border-radius);
    padding: var(--input-padding);
    margin: 0;
    font-family: var(--input-font-family);
    font-size: var(--input-font-size);
    font-weight: var(--input-font-weight);
    font-style: normal;
    line-height: normal;
    box-sizing: border-box;
    transition: border-color 0.2s, background-color 0.2s;
}

/* Forçar os mesmos parâmetros de cor e fundo para as opções do seletor para evitar problemas com as renderizações nativas */
select option {
    background-color: var(--input-bg-color);
    color: var(--input-text-color);
}

/* PADRONIZAÇÃO OBRIGATÓRIA DOS BOTÕES */
button,
.btn,
.tag-button,
.status-btn {
    width: auto;
    min-width: 4rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.2s, background-color 0.2s;
    font-family: var(--input-font-family);
    line-height: normal; 
    height: var(--input-height); 
    border: 1px solid var(--gray-900); 
    border-radius: var(--input-border-radius); 
    background-color: var(--btn-default-bg); 
    color: var(--btn-text-color); 
    font-size: 1.5rem; 
    font-weight: 500; 
    padding: 0 1.6rem; 
}

#change-password-form{
    display: flex;
    flex-direction: column;
    align-items: center;
}

.checkbox-group input:checked::before {
    background-color: #007bff !important;
    border-color: #007bff;
}

input:not([type="checkbox"]):not([type="radio"]),
select {
    height: var(--input-height);
    display: inline-flex;
    align-items: center;
}

textarea {
    height: auto;
    resize: vertical;
    min-height: 8rem;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23999%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem top 50%;
    background-size: 1rem auto;
    padding-right: 3rem;
}

::placeholder {
    font-family: var(--input-font-family);
    font-size: var(--input-font-size);
    font-weight: var(--input-font-weight);
    font-style: normal;
    color: var(--label-text-color);
}

input:focus, select:focus, textarea:focus, button:focus, .btn:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 1px var(--primary-color);
}

/* Oculta o ícone nativo (relógio) de inputs type time, mantendo apenas a digitação livre */
input[type="time"]::-webkit-calendar-picker-indicator {
    display: none;
}

input:disabled, select:disabled, textarea:disabled, button:disabled, .btn:disabled {
    background-color: var(--gray-800);
    border-color: var(--gray-700);
    color: var(--gray-500);
    cursor: not-allowed;
    opacity: 0.7;
}

input.valid { border-color: var(--success-color); }
input.invalid { border-color: var(--error-color); }

.validation-message { color: var(--error-color); font-size: var(--fs-sm); display: block; height: 1.4rem; margin-top: 0.4rem; }
.required-star { color: var(--error-color); margin-left: 0.3rem; }

/* Assegurar que os inputs customizados tipo checkbox não percam a estrutura para o pill-shape da classe .std-input */
input[type="checkbox"], input[type="radio"] {
    width: auto !important;
    height: auto !important;
    padding: 0;
    cursor: pointer;
    border: none;
}

.btn:hover:not(:disabled), button:hover:not(:disabled) {
    background-color: var(--btn-default-bg-hover);
    border-color: var(--gray-600);
    color: var(--text-color);
}

.btn-primary {background-color: var(--primary-color);border-color: var(--primary-color);color: white;}
.btn-primary:hover:not(:disabled) {background-color: var(--primary-color-hover);}

.btn-danger { background-color: var(--error-color); border-color: var(--error-color); color: white; }
.btn-danger:hover:not(:disabled) { background-color: var(--error-hover); }

.btn-info { background-color: var(--btn-default-bg); border-color: var(--info-color); }
.btn-info:hover:not(:disabled) { background-color: var(--info-hover); }

/* --- Ajuste Geral do Gap de Tags --- */
.tag-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tag-button {
    background-color: var(--gray-980);
    border-color: var(--gray-900);
    color: var(--text-color);
    min-width: 4rem;
    padding: 0 1.6rem;
}
.tag-button:hover:not(.active) { background-color: var(--gray-950); color: var(--text-color); }
.tag-button.active { background-color: var(--primary-color); border-color: var(--primary-color-hover); font-weight: var(--fw-bold); color: white; }

.form-status { margin-top: 1rem; text-align: center; font-weight: var(--fw-bold); }
.form-status.success { color: var(--success-color); }
.form-status.error { color: var(--error-color); }
.form-status.info { color: var(--info-color); }

/* --- Modals --- */
.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.7); justify-content: center; align-items: center; }
.modal.show { display: flex; }
.modal-content { background-color: var(--gray-995); margin: auto; padding: 0; border: var(--border-width) solid var(--border-color); border-radius: var(--border-radius); width: 80%; max-width: 70rem; display: flex; flex-direction: column; box-shadow: 0 5px 15px rgba(0,0,0,0.5); color: var(--text-color); }
.modal-content.large { max-width: 90rem; height: 80vh; }
.modal-content.medium { max-width: 80rem; height: 80vh; }
.modal-content.small { max-width: 60rem; }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--gray-900); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: var(--fs-lg); }
.close-modal-btn { background: none; border: none; color: var(--text-color); font-size: var(--fs-5xl); cursor: pointer; line-height: 1; height: var(--input-height); width: auto; padding: 0; display: block; min-width: 0; }
.modal-body {padding: 1.5rem;flex-grow: 1;}
.modal-footer {padding: 1.5rem;border-top: 1px solid var(--gray-900);display: flex;justify-content: center;align-items: center;gap: 0.8rem;} /* Regra 6: gap ajustado para agrupamento */
.modal-footer .form-status {margin: 0 auto 0 0;text-align: left;}
.modal-checkbox-group { display: flex; align-items: center; margin-top: 2rem; }
.modal-checkbox-group input[type="checkbox"] { margin-right: 1rem; }

/* --- Componentes Específicos e Layouts --- */
.client-selection-list { list-style-type: none; padding: 0; max-height: 40vh; overflow-y: auto; }
.client-selection-list li, .client-selection-list div { padding: 1.2rem; border-bottom: 1px solid var(--gray-900); cursor: pointer; transition: background-color 0.2s; }
.client-selection-list li:hover, .client-selection-list div:hover { background-color: var(--primary-color-hover); color: white; }
.form-group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.5rem; }
.terms-box { height: 30rem; width: 100%; overflow-y: scroll; border: var(--border-width) solid var(--gray-800); padding: 1.5rem; margin-bottom: 2rem; background-color: var(--bg-dark-input); }
.terms-box.transparent { height: 100%; border: none; padding: 0; background-color: transparent; }
.checkbox-group { display: flex; align-items: center; gap: 0.8rem; }
.checkbox-group label { cursor: pointer; font-size: var(--fs-base); font-style: normal; margin-bottom: 0; }
.checkbox-group input { width: 1.8rem !important; height: 1.8rem !important; }

.password-wrapper { position: relative; width: 100%; display: flex; align-items: center; }
.password-wrapper input { padding-right: 4rem; width: 100%; flex-grow: 1; }
.toggle-password { position: absolute; right: 1rem; width: 2.4rem; height: 2.4rem; cursor: pointer; background-size: contain; background-repeat: no-repeat; background-position: center; user-select: none; opacity: 0.7; transition: opacity 0.2s; }
.toggle-password:hover { opacity: 1; }
.toggle-password.show { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="gray" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>'); }
.toggle-password.hide { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="gray" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>'); }

.ai-fab { position: fixed; top: 25rem; left: 50%; transform: translateX(-50%); width: var(--input-height); height: var(--input-height); color: white; border: none; border-radius: var(--input-border-radius); display: flex; justify-content: center; align-items: center; font-size: var(--fs-xl); cursor: pointer; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); z-index: 1000; transition: background-color 0.2s, transform 0.2s; padding: 0; min-width: 0; }
.ai-fab:hover { transform: translateX(-50%) scale(1.1); }
.help-index-column .ai-fab { position: static; transform: none; background-color: var(--primary-color); }
.help-index-column .ai-fab:hover { background-color: var(--primary-color-hover); }

.menu-icon-css {
    width: 38px;
    height: 38px;
    background-color: transparent;
    border: 1px solid var(--gray-600);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.menu-icon-css:hover {
    border-color: var(--primary-color);
    background-color: var(--gray-950);
}

body.light-theme .menu-icon-css:hover {
    border-color: var(--primary-color);
    background-color: var(--gray-200);
}

/* A linha central */
.menu-icon-css::before {
    content: "";
    width: 20px;
    height: 2px;
    background-color: var(--muted-text);
    position: absolute;
    box-shadow: 0 -6px 0 var(--muted-text), 
                0 6px 0 var(--muted-text);
    transition: none;
}

/* =========================================
   PÁGINAS ESPECÍFICAS
   ========================================= */

/* index */
.button-landing{
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 4rem;
}

/* Admin Conta */
.user-list-item { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem; border-bottom: 1px solid var(--gray-900); }
.user-list-item:last-child { border-bottom: none; }
.user-info span { display: block; }
.user-info .name { font-size: var(--fs-std); font-weight: var(--fw-bold); }
.user-info .email { font-size: var(--fs-md); color: var(--muted-text); }
.user-info .profiles { font-size: var(--fs-sm); color: var(--gray-400); font-style: italic; margin-top: 0.4rem; }
.status-ativo { background-color: var(--success-color); border-color: var(--success-color); color: white; }
.status-desativado { background-color: #6c757d; border-color: #6c757d; color: white; }
.status-fixo { background-color: var(--info-color); cursor: default; font-weight: var(--fw-bold); }
.cpf-search-group { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.cpf-search-group label { flex-shrink: 0; }
.cpf-search-group input { flex-grow: 1; }
.terapeuta-toggle, .terapeuta-toggle + label { cursor: pointer; }
.contract-info { margin-top: 2rem; font-size: var(--fs-std); color: var(--muted-text); border-top: 1px solid var(--gray-900); padding-top: 1.5rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin-top: 1rem; } /* Regra 6: gap ajustado */

.terapeuta-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 38px !important;
    height: 38px !important;
    border: 2px solid #ccc !important;
    border-radius: 5px !important;
    background-color: #fff;
    cursor: pointer;
    display: grid;
    place-content: center;
    flex-shrink: 0;
    margin: 0;
    transition: all 0.2s ease;
}

.terapeuta-toggle:checked {
    background-color: #acc569;
    border-color: #acc569;
}

.terapeuta-toggle::before {
    content: "";
    width: 18px;
    height: 18px;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    background-color: white;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.terapeuta-toggle:checked::before {
    transform: scale(1);
}

.terapeuta-toggle + label {
    cursor: pointer;
    user-select: none;
    line-height: 1;
}

/* Agenda */
.agenda-controls-header { text-align: center; margin-bottom: 1rem; }
.date-navigator { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
#current-date-display { text-align: center; font-size: var(--fs-reg); text-transform: capitalize; }
.schedule-slots-container { flex-grow: 1; overflow-y: auto; max-height: 55vh; border: 1px solid var(--gray-900); border-radius: var(--border-radius); padding: 0.5rem; }
.schedule-slot { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem; border: 2px solid transparent; border-bottom: 1px solid var(--gray-900); cursor: pointer; transition: background-color 0.2s; }
.schedule-slot:hover { background-color: var(--gray-970); }
.schedule-slot.booked { background-color: var(--booked-slot-bg); }
.schedule-slot.blocked { background-color: var(--blocked-slot-bg); background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.1) 10px, rgba(0,0,0,0.1) 20px); font-style: italic; color: var(--muted-text); }
.schedule-slot.booked .free-slot-text { display: none; }
.schedule-slot .free-slot-text { color: var(--gray-600); font-style: italic; }
.schedule-slot.selected { border-color: var(--selected-slot-border); background-color: var(--gray-950); }
.schedule-actions { display: flex; justify-content: space-around; margin-top: 1.5rem; gap: 0.8rem; } /* Regra 6: gap ajustado */
.search-group { display: flex; gap: 0.5rem; align-items: center; width: 100%; }
.search-group input[type="text"] { flex-grow: 1; width: auto; }
.patient-form-actions { display: flex; justify-content: space-between; gap: 0.8rem; margin-top: 2rem; } /* Regra 6: gap ajustado */
.date-quick-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.5rem 0; flex-wrap: wrap; }
.date-input-group { display: flex; align-items: center; gap: 0.5rem; }
#nav-date-input { color-scheme: dark; cursor: pointer;}
#patient-birthdate { color-scheme: dark; cursor: pointer;}
body.light-theme #nav-date-input { color-scheme: light; }
body.light-theme #nav-date-birthdate { color-scheme: light; }
.all-patients-list { list-style: none; padding: 0; margin: 0; max-height: 50vh; overflow-y: auto; border: 1px solid var(--gray-900); border-radius: var(--border-radius); }
.all-patients-list-item { padding: 0.8rem 1.2rem; border-bottom: 1px solid var(--gray-900); cursor: pointer; transition: background-color 0.2s; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.all-patients-list-item:hover { background-color: var(--primary-color-hover); color: white; }

/* Ajuda */
.help-layout-container { display: flex; height: calc(100vh - 15vh - (var(--margin-sm) * 4)); width: 100%; border: var(--border-width) solid var(--border-color); border-radius: var(--border-radius); overflow: hidden; }
.help-index-column { flex: 0 0 30rem; padding: 1.6rem; border-right: var(--border-width) solid var(--border-color); overflow-y: auto; display: flex; flex-direction: column;  background: var(--color-back-white); }
.help-content-column { flex: 1; padding: 2.4rem; overflow-y: auto; background: var(--color-back-white);}
.help-index-column h2 { margin-bottom: 1.5rem; font-size: 2rem; color: var(--selected-slot-border); }
#help-index ul { list-style: none; padding-left: 0; }
#help-index ul ul { padding-left: 2rem; margin-top: 0.5rem; }
#help-index li { margin-bottom: 1rem; }
#help-index a { text-decoration: none; color: var(--color-white); font-size: var(--fs-std); transition: color 0.2s; }
#help-index a:hover { color: var(--selected-slot-border); text-decoration: underline; }
.help-content-column section { margin-bottom: 4rem; }
.help-content-column h2 { font-size: var(--fs-4xl); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--gray-900); }
.help-content-column h3 { font-size: var(--fs-xl); margin-top: 2rem; margin-bottom: 1rem; }
.help-content-column p, .help-content-column li { font-size: var(--fs-reg); line-height: 1.6; color: var(--color-white)}
.help-content-column ul, .help-content-column ol { padding-left: 3rem; margin-top: 1rem; }
#ai-fab-container { text-align: center; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--gray-900); }
#ai-response-area { height: 60vh; background-color: var(--bg-dark-input); border: 1px solid var(--gray-900); border-radius: var(--border-radius); padding: 1rem; overflow-y: auto; margin-bottom: 1rem; white-space: pre-wrap; word-wrap: break-word; }
#ai-modal-footer { display: flex; gap: 0.8rem; } /* Regra 6: gap ajustado */
#ai-question-input { flex-grow: 1; resize: vertical; }

/* Anotar & Resultados */
.anotar-headers { width: calc(100% - (var(--margin-sm) * 2)); display: flex; align-items: center; gap: 1rem; margin: var(--margin-sm); padding: 0 var(--margin-sm); }
.anotar-header-left, .anotar-header-right { display: flex; align-items: center; gap: 0.5rem; padding: 0.8rem 0.8rem; border: var(--border-width) solid var(--border-color); border-radius: var(--border-radius); flex-grow: 1; min-height: 6rem; background-color: var(--bg-color); }
.patient-name-title { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--selected-slot-border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.patient-header-controls { display: flex; gap: 1.5rem; align-items: center; }
#atencao-btn.has-attention { background-color: var(--error-color); border-color: var(--error-color); color: white; }
.active-tag-title { font-size: var(--fs-lg); font-weight: var(--fw-bold); text-align: left; flex-shrink: 0; }

/* MODIFICADO: Ajuste na altura e posicionamento global da área principal no contexto da página Anotar */
body.page-anotar .app-main {
    align-items: stretch; /* Garante que o contêiner interno preencha 100% do espaço vertical disponível */
}

.history-area, .current-session-area { 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    height: 100%; /* Força ocupação de 100% da altura da div mãe .main-dual-area */
    margin: 0; /* Remove margem individual que poderia desnivelar posições caso empilhados inadequadamente */
}
.history-area { flex-basis: 50%; }
.current-session-area { flex-basis: 50%; }

/* MODIFICADO: Adição de min-height: 0 para as subáreas de conteúdo de anotação prevenirem overflow-y indevido no pai flexbox */
#history-content, #current-notes-content { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 0; 
    padding-right: 0.5rem; 
    background-color: transparent; 
    border: none; 
    border-radius: 0; 
    min-height: 0; 
}

.placeholder-text { color: var(--gray-600); text-align: center; margin-top: 3rem; font-style: italic; }
.history-date-header { font-size: var(--fs-reg); color: var(--selected-slot-border); margin-top: 1.5rem; margin-bottom: 0.5rem; font-weight: var(--fw-bold); border-bottom: 1px solid var(--gray-900); padding-bottom: 0.5rem; }
.history-tag-group-header { font-size: var(--fs-base); color: var(--muted-text); font-weight: var(--fw-bold); text-transform: uppercase; margin-top: 0.8rem; margin-bottom: 0.3rem; }
.session-tag-group-title { font-size: var(--fs-reg); color: var(--warning-color); margin: 1.5rem 0 1rem 0; font-weight: var(--fw-bold); border-bottom: 1px solid var(--gray-900); padding-bottom: 0.5rem; text-transform: uppercase; }
body.light-theme .session-tag-group-title { color: #d39e00; }

/* REGRAS 2, 3, 4, 5: FORMATAÇÃO DE TEXTOS DO HISTÓRICO VS SESSÃO ATUAL */
.note-item {
    /* Tema Escuro (Padrão) */
    background-color: var(--input-bg-color) !important; 
    color: var(--input-text-color) !important;            
    border: 1px solid var(--input-border-color) !important;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

body.light-theme .note-item {
    /* Tema Claro */
    background-color: #E1FCD6 !important; 
    color: var(--text-color) !important;            
    border: 1px solid var(--border-color) !important;
}

.note-item.session-note,
body.light-theme .note-item.session-note {
    /* Utiliza as cores padronizadas dos inputs interativos para o tema corrente */
    background-color: var(--input-bg-color) !important;
    color: var(--input-text-color) !important;
    border: 1px solid var(--input-border-color) !important;
    cursor: context-menu;
}
/* ------------------------------------------------------------------------- */

.session-footer {
    display: flex;
    padding: var(--margin-sm);
    gap: 1rem;
    flex-shrink: 0;
    height: auto;
    min-height: 15vh;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--border-radius);
    margin: var(--margin-sm);
    background-color: var(--bg-color);
    align-items: center;
}

/* Modificação no alinhamento dos botões laterais da Anotação */
.footer-buttons {
    display: flex;
    flex-direction: column; /* 2 linhas */
    gap: 0.8rem;
    align-items: stretch;
    justify-content: center;
    width: auto;
}

.footer-center-container {
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
    margin: 0 1rem;
}

.footer-textarea-wrapper {
    flex-grow: 1;
    height: 100%;
}

.footer-side-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 12rem;
}

.med-btn {
    font-family: serif; 
    font-weight: bold;
    font-style: italic;
    background-color: var(--gray-800);
}
.med-btn:not(:disabled) {
    background-color: var(--success-color);
    color: white;
    border-color: var(--success-color);
}
.med-btn:not(:disabled):hover {
    background-color: #218838;
}

#annotation-text { width: 100%; height: 100%; resize: none; font-size: var(--fs-reg); }
.context-menu { display: none; position: fixed; z-index: 1000; background-color: var(--gray-990); border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 0.5rem 0; box-shadow: 0 0.2rem 1rem rgba(0,0,0,0.5); font-size: var(--fs-base); min-width: 15rem; }
.context-menu a { display: block; padding: 1rem 1.5rem; text-decoration: none; color: var(--text-color); cursor: pointer; }
.context-menu a:hover { background-color: var(--primary-color); color: white; }
.preview-area { width: 100%; height: 70vh; border: 2px dashed var(--gray-900); border-radius: var(--border-radius); display: flex; justify-content: center; align-items: center; overflow: hidden; background-color: var(--bg-dark-input); position: relative; }
.preview-area img { max-width: 100%; max-height: 100%; object-fit: contain; }
.placeholder-message { color: var(--gray-600); font-size: 2rem; text-align: center; }
.action-hint { position: absolute; bottom: 1rem; right: 1rem; background-color: rgba(0, 0, 0, 0.7); color: #ccc; padding: 0.5rem 1rem; border-radius: 8px; font-size: var(--fs-sm); }

/* --- Reduções da Página Anotar (Regras 1 a 5) --- */
body.page-anotar .anotar-header-right .btn,
body.page-anotar .anotar-header-right .tag-button,
body.page-anotar .checkbox-group label {
    font-size: 1.05rem !important;
    height: 3rem !important;
    padding: 0 1rem !important;
    flex-shrink: 0;
}

body.page-anotar .checkbox-group label {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.page-anotar .checkbox-group input {
    width: 1.5rem !important;
    height: 1.5rem !important;
}

/* O mesmo para o mobile anotarmf */
body.page-anotarmf .mf-btn-small,
body.page-anotarmf .tag-button,
body.page-anotarmf .mf-checkbox-group label {
    font-size: 1.05rem !important;
    height: 2.8rem !important;
    padding: 0 0.8rem !important;
    flex-shrink: 0;
}

body.page-anotarmf .mf-checkbox-group label {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.page-anotarmf .mf-checkbox-group input {
    width: 1.4rem !important;
    height: 1.4rem !important;
}

/* =========================================
   Configurar (Desktop) - Layout Compacto e em Grade
   ========================================= */

.config-container {
    width: 100%;
    max-width: 80rem; /* Mantém bem centralizado e com largura suficiente */
    margin: 0 auto;
}

.config-header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.config-duration-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
}

.config-duration-group label {
    margin: 0;
    font-size: var(--fs-lg);
}

.config-duration-group input {
    width: 10rem;
    text-align: center;
}

.days-grid-container {
    border: 1px solid var(--gray-900);
    border-radius: var(--border-radius);
    padding: 1rem 2rem;
    background-color: var(--bg-dark-input);
    margin-bottom: 2rem;
}

/* A estrutura em grid para garantir a mesma linha com checkbox e inputs */
.day-config-row {
    display: grid;
    grid-template-columns: 18rem 1fr 1fr;
    gap: 2rem;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px dashed var(--gray-900);
}

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

.day-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
}

.day-header label {
    font-size: var(--fs-lg) !important;
    font-weight: var(--fw-bold) !important;
    text-transform: capitalize;
    margin: 0;
    cursor: pointer;
}

.time-inputs-compact {
    display: contents; /* Os filhos assumem a grade do .day-config-row */
}

.time-inputs-compact .form-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
}

.time-inputs-compact .form-group label {
    margin: 0;
    font-size: var(--fs-reg);
    white-space: nowrap;
    color: var(--muted-text);
}

.time-inputs-compact input[type="time"] {
    width: 100%;
    text-align: center;
}

/* Custom Checkbox (Reaproveitado do original) */
.day-header .std-input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid #ccc !important;
    border-radius: 4px !important;
    background-color: #fff !important;
    cursor: pointer;
    display: grid;
    place-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin: 0;
}

.day-header .std-input[type="checkbox"]:checked {
    background-color: #acc569 !important;
    border-color: #acc569 !important;
}

.day-header .std-input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.day-header .std-input[type="checkbox"]:checked::before {
    transform: scale(1);
}

/* Consultar */
.app-main.consult-main { flex-direction: column; align-items: center; gap: 0.5rem; padding-top: 0.5rem; }
#consult-controls-container { width: 100%; max-width: 120rem; flex-shrink: 0; gap: 1rem; padding: 1rem; }
#patient-search-row { width: 100%; }
#patient-search-row form { display: flex; flex-direction: column; gap: 0.5rem; }
#patient-search-row .search-group { display: flex; align-items: center; width: 100%; }
#patient-info-display { flex-grow: 1; padding-left: 2rem; min-height: auto; padding-top: 0; margin-top: 0; }
#patient-info-display .form-status { margin-top: 0; text-align: left; }
#filters-area { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; border-top: none; padding-top: 0; }
.filter-group { display: flex; align-items: center; gap: 1.5rem; }
.date-navigation-group { display: flex; align-items: center; gap: 1rem; }
#current-date-display { font-size: var(--fs-reg); font-weight: var(--fw-bold); min-width: 15rem; text-align: center; }
#consult-notes-container { width: 100%; max-width: 120rem; flex-grow: 1; overflow: hidden; display: flex; flex-direction: column; }
.notes-title { font-size: var(--fs-lg); color: var(--selected-slot-border); font-weight: var(--fw-bold); text-align: center; flex-shrink: 0; padding-bottom: 0.5rem; border-bottom: 1px solid var(--gray-900); margin-bottom: 0.5rem; }
#notes-content { flex-grow: 1; overflow-y: auto; padding-right: 1rem; }

/* Controle */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(25rem, 1fr)); gap: 2rem; width: 100%; margin-bottom: 4rem; }
.stat-item { background-color: var(--bg-dark-input); padding: 1.5rem; border-radius: var(--border-radius); border: 1px solid var(--gray-900); text-align: center; }
.stat-item .value { font-size: var(--fs-6xl); font-weight: var(--fw-bold); color: var(--selected-slot-border); display: block; margin-bottom: 0.8rem; }
.stat-item .label { font-size: var(--fs-base); color: var(--muted-text); }
.actions-container { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; padding-top: 2rem; border-top: 1px solid var(--gray-900); width: 100%; }
.actions-container .btn { min-width: 20rem; }

/* Criar Conta */
.highlight-notice { border: 1px solid var(--warning-color); padding: 1.5rem; margin: 2rem 0; border-radius: var(--border-radius); background-color: var(--warning-bg); }
.highlight-notice p { margin: 0; font-size: var(--fs-base); }
.highlight-notice strong { color: var(--warning-color); }
body.light-theme .highlight-notice strong { color: #856404; }
.highlight-notice small { display: block; margin-top: 0.8rem; color: var(--muted-text); font-style: italic; }
.highlight-notice .checkbox-container { margin-top: 1.5rem; display: flex; align-items: center; }
.highlight-notice input[type="checkbox"] { width: auto; margin-right: 1rem; }

/* Download */
.download-container { width: 100%; max-width: 120rem; text-align: left; }
.intro-area p { font-size: var(--fs-base); line-height: 1.5; margin-bottom: 0.5rem; }
.entity-title { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--selected-slot-border); margin: 2rem 0; padding-bottom: 1rem; border-bottom: 1px solid var(--gray-800); text-align: center; }
.consent-area { display: flex; align-items: center; justify-content: center; gap: 2rem; margin-bottom: 2rem; }
.download-actions { margin-top: 3rem; text-align: center; }

/* Index / Landing Antigo */
.landing-page-main .main-single-area {
    justify-content: flex-start;
    height: auto;
    min-height: 100%;
}

.landing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
    width: 100%;
    text-align: center;
    margin: auto 0;
    justify-content: flex-start; 
    gap: 4rem; 
    padding: 4rem 1rem;
}

.branding-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}
.landing-logo {width: 60rem;margin-top: 2rem; align-items: initial;}
.landing-title { font-size: var(--fs-8xl); font-weight: var(--fw-bold); color: var(--text-color); }
.welcome-section { margin: 0; }
.welcome-title { font-size: var(--fs-9xl); font-weight: 300; color: var(--text-color); }
.slogans-section { display: flex; justify-content: center; gap: 5rem; max-width: 250rem; width: 100%; margin: 1rem 0; }
.slogan-item { flex: 1; min-width: 30rem; max-width: 110rem; display: flex; flex-direction: column; gap: 0.8rem; }
.slogan-title { font-size: var(--fs-2xl); font-weight: 700; color: var(--selected-slot-border); line-height: 1.3; }
.slogan-tagline { font-size: var(--fs-std); color: var(--muted-text); line-height: 1.5; }
.cta-section { display: flex; flex-direction: column; align-items: center; gap: 4rem; margin: 0; }
.cta-buttons { display: flex; justify-content: center; gap: 1.6rem; } /* Regra 6: gap ajustado para garantir harmonia */
.cta-buttons .btn {min-width: 26rem;}
.summary-link-container a { font-size: var(--fs-base); color: var(--muted-text); text-decoration: underline; transition: color 0.2s; }
.summary-link-container a:hover { color: var(--selected-slot-border); }
.footer-section { width: 100%; max-width: 60rem; padding-top: 2rem; margin-top: 0; border-top: 1px solid var(--gray-900); font-size: var(--fs-md); color: var(--gray-400); line-height: 1.6; }

/* Paciente / Portal */
.patient-portal-container { width: 100%; max-width: 90rem; display: flex; flex-direction: column; gap: 1.5rem; }
.patient-portal-header { text-align: center; padding: 1rem; }
.patient-portal-header h2 { font-size: var(--fs-2xl); color: var(--selected-slot-border); margin-bottom: 0.8rem; }
.patient-portal-header p { font-size: var(--fs-std); color: var(--muted-text); font-style: italic; margin: 0; }
#event-content-container { padding: 1.5rem; }
.event-content-block { display: none; }
.event-content-block h3 { font-size: var(--fs-lg); }
.portal-actions { text-align: center; margin-top: 2rem; border-top: 1px solid var(--gray-900); padding-top: 2rem; }
@media (min-width: 768px) {
    .patient-portal-header h2 { font-size: var(--fs-4xl); }
    .patient-portal-header p { font-size: var(--fs-reg); }
    #event-content-container { padding: 2rem; }
    .event-content-block h3 { font-size: var(--fs-xl); }
}

/* Sobre */
.sobre-container {
    font-family: var(--font-family-base), sans-serif; font-size: var(--fs-reg); line-height: 1.6; color: var(--gray-100); max-width: 80rem; width: 100%; }
body.light-theme .sobre-container { color: var(--text-color); }
.sobre-container h1 { font-size: var(--fs-6xl); font-weight: 700; margin-bottom: 1.5rem; color: var(--selected-slot-border); }
.sobre-container p { margin-top: 0; margin-bottom: 1.6rem; }
.sobre-container strong { font-weight: 700; }
.sobre-container ul { padding-left: 2rem; margin-top: 1.6rem; margin-bottom: 1.6rem; }
.sobre-container li { margin-bottom: 0.8rem; }
.sobre-container li:last-child { margin-bottom: 0; }
.footer-info { margin-top: 3.2rem; text-align: center; font-size: var(--fs-base); color: var(--gray-400); }
.footer-info p { margin-bottom: 0.4rem; }

/* =========================================
   ESTILOS PARA DOCUMENTOS (Assets)
   ========================================= */
.doc-body {
    background-color: transparent;
    color: var(--text-color);
    font-family: var(--font-family-base), sans-serif;
    font-size: var(--fs-base);
    line-height: 1.6;
    width: 100%;
    padding: 1.5rem;
    height: 100%;
    overflow-y: auto;
    }
.doc-body.policy { font-size: var(--fs-reg); background-color: var(--color-black); padding: 2.5rem; max-width: 80rem; margin: 0 auto; }
body.light-theme .doc-body.policy { background-color: var(--bg-color); }
.doc-body h1 { font-size: var(--fs-4xl); font-weight: 700; margin-bottom: 1.5rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--color-white); color: var(--selected-slot-border); }
body.light-theme .doc-body h1 { border-bottom-color: var(--gray-900); }
.doc-body.contract h1 { font-size: 2rem; margin-bottom: 0.5rem; padding-bottom: 1rem; color: var(--text-color); }
.doc-body.policy h2 { color: var(--text-color); font-size: var(--fs-xl); margin-top: 2.5rem; margin-bottom: 1.2rem; }
.doc-body.resumo h2 { font-size: var(--fs-2xl); border-bottom: 1px solid var(--color-white); padding-bottom: 1rem; margin-bottom: 2rem; text-align: center; color: var(--text-color); }
body.light-theme .doc-body.resumo h2 { border-bottom-color: var(--gray-900); }
.doc-body h3 { font-size: 1.9rem; margin-top: 2.5rem; margin-bottom: 1.5rem; }
.doc-body p { margin-bottom: 1rem; text-align: justify; }
.doc-body strong { font-weight: 700; }
.doc-body ul { padding-left: 3rem; list-style-type: disc; margin-bottom: 1.2rem; }
.doc-body.resumo ul { list-style-type: none; padding-left: 0; margin-bottom: 1rem; }
.doc-body li { margin-bottom: 0.8rem; }
.doc-body.resumo li { margin-bottom: 1rem; padding-left: 2rem; position: relative; }
.doc-body.resumo li::before { content: '•'; position: absolute; left: 0; color: var(--color-white); font-weight: var(--fw-bold); }
body.light-theme .doc-body.resumo li::before { color: var(--text-color); }
.doc-body.resumo ul ul li::before { content: '-'; }
.doc-body .subtitle { font-size: var(--fs-sm); color: var(--muted-text); margin-bottom: 3rem; text-align: right; }

/* =========================================
   SCROLL HORIZONTAL PARA PÁGINA ANOTAR
   ========================================= */
body.page-anotar {
    overflow-x: auto;
    overflow-y: hidden;
}

body.page-anotar .anotar-headers,
body.page-anotar .app-main,
body.page-anotar .session-footer,
body.page-anotar .app-header {
    min-width: fit-content;
}

#medicoes-modal .modal-content {
    max-width: 90rem;
    height: auto;
}

/* =========================================
   CUSTOM TOOLTIP
   ========================================= */
.custom-tooltip {
    position: absolute;
    background-color: #000080;
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 1.1rem;
    border: 1px solid #000080;
    z-index: 10000;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* =========================================
   PÁGINA RESULTADOS
   ========================================= */

.results-main .results-list-area {
    flex-basis: 40%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.results-main .results-detail-area {
    flex-basis: 60%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 1rem;
}

.results-section-title {
    font-size: var(--fs-md);
    color: var(--muted-text);
    margin-bottom: 0.2rem;
    font-weight: normal;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--gray-900);
}

.exams-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--gray-900);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    background-color: var(--bg-dark-input);
    min-height: 0;
}

.exam-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-900);
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-style: italic;
    font-size: var(--fs-std);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exam-item:hover {
    background-color: var(--gray-950);
}

.exam-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color-hover);
}

.exam-image-viewer {
    flex-grow: 2;
    background-color: var(--color-black);
    border: 1px solid var(--gray-900);
    border-radius: var(--border-radius);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    min-height: 30vh;
    padding: 0;
    position: relative;
}

.upload-prompt {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px dashed var(--gray-600);
    background-color: var(--bg-dark-input);
    cursor: pointer;
    text-align: center;
    color: var(--gray-400);
    font-size: var(--fs-lg);
    padding: 2rem;
    transition: border-color 0.2s, color 0.2s;
}
.upload-prompt:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.exam-image-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.exam-notes-section {
    flex: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-top: 1px solid var(--gray-900);
    padding-top: 0.5rem;
}

.exam-notes-section h4 {
    font-size: var(--fs-base);
    color: var(--muted-text);
    margin-bottom: 0.5rem;
}

.exam-notes-list {
    flex-grow: 1;
    overflow-y: auto;
    background-color: var(--bg-color);
    border: 1px solid var(--gray-900);
    border-radius: var(--border-radius);
    padding: 0.5rem;
}

.exam-note-item {
    background-color: var(--gray-990);
    padding: 0.4rem 0.8rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--gray-900);
    white-space: pre-wrap;
    cursor: context-menu;
    font-style: normal;
    font-weight: normal;
    font-size: var(--fs-std);
    border-radius: 0;
}

.exam-note-item .note-time {
    font-size: var(--fs-xs);
    color: var(--gray-500);
    display: inline;
    margin-right: 0.5rem;
    font-weight: bold;
}

.exam-note-item .note-text {
    display: inline;
}

.results-footer {
    justify-content: space-between;
}

.exam-upload-options {
    display: flex;
    align-items: center;
}

.exam-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.5rem;
    font-family: var(--font-family-base), sans-serif;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 4px;
    border: none;
    color: white;
    cursor: pointer;
    margin-right: 0.8rem;
    vertical-align: middle;
    text-transform: uppercase;
    line-height: 1;
    transition: opacity 0.2s ease-in-out;
}

.exam-indicator:hover {
    opacity: 0.8;
}

.exam-indicator.pending {
    background-color: var(--error-color);
}

.exam-indicator.done {
    background-color: var(--success-color);
}

/* ===============================
   MEMOCLIN - TEMA CLARO AJUSTADO
   =============================== */

:root {
    --background-light: #c2dcff;
    --text-primary: #1a416c;
    --primary-blue-dark: #1a416c;
    --primary-blue: #598dbd;
    --primary-green: #5da5a4;
    --primary-green-light: #acc569;
    --warning-yellow: #ddbe0c;
}

body.light-theme {
    background-color: var(--background-light);
    color: var(--text-primary);
}

.btn-contratar {
    background-color: var(--primary-green);
    color: #ffffff;
}

.btn-usar {
    background-color: var(--primary-blue);
    color: #ffffff;
}

.atencao-btn{
    background-color: var(--warning-yellow);
    color: var(--text-color);
}

.card,
.quadro {
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    backdrop-filter: blur(6px);
}

.topbar {
    background: linear-gradient(
        180deg,
        #1a416c 0%,
        #598dbd 45%,
        #5da5a4 75%,
        #acc569 100%
    );
}

.btn-buscar {
    background-color: var(--primary-green);
    color: #ffffff;
}

.btn-resultado {
    background-color: var(--primary-green-light);
    color: var(--text-primary);
}

.text-selecione-paciente {
    color: var(--warning-yellow);
    font-weight: bold;
}

.btn-cancelar {
    background-color: var(--warning-yellow);
    color: var(--text-primary);
}

.btn-acesse{
    background-color: var(--btn-default-bg-acess);
    color: var(--color-black);
}

.btn-acesse:hover{
    color: var(--color-black) !important;
    background-color: var(--btn-default-bg-acess-hover)!important;
}

.assistente-memoclin {
    background-color: var(--primary-blue);
    color: #ffffff;
    border-radius: 50%;
}
.informativo-box-total{
    display: flex;
    width: 100%;
    justify-content: space-around;
}
.informativo-box{
    padding: 1.5rem 1.5rem;
    border: var(--border-width) solid var(--border-color);
    border-radius: 24px;
    background-color: var(--primary-blue-dark);
    color: var(--btn-text-color);
}
.informativo-box span{
    color: var(--color-black);
    font-size:2rem;
}
.footer-text-up{
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 2.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--text-color);
}
.footer-text-down{
    margin-top: 0.8rem;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px !important; 
    height: 18px !important;
    border: 2px solid #ccc !important;
    border-radius: 4px !important;
    background: #fff !important;
    cursor: pointer;
    display: grid;
    place-content: center;
    flex-shrink: 0; 
    margin: 0;
    transition: all 0.2s;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: #acc569 !important;
    border-color: #acc569 !important;
}

.checkbox-group input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    background-color: white;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.checkbox-group input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.checkbox-group label {
    cursor: pointer;
    line-height: 1;
    user-select: none;
    margin: 0;
}

/* =========================================================
   NORMALIZAÇÃO TIPOGRÁFICA (TÍTULOS, INFORMAÇÕES E REGRAS)
   ========================================================= */

/* Tipo 1: Títulos de Seções */
.app-main h1, .app-main h2, .app-main h3, .app-main h4,
.modal-body h1, .modal-body h2, .modal-body h3, .modal-body h4,
.results-section-title, .notes-title, .doc-body h1, .doc-body h2, .doc-body h3,
.help-content-column h2, .help-content-column h3 {
    font-family: 'Inter', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.7rem !important;
    color: var(--text-color);
    margin-bottom: 1.2rem;
    line-height: 1.3;
}

.doc-body h1, .doc-body h2, .help-content-column h2, .help-content-column h3 {
    color: var(--selected-slot-border) !important; 
}

/* Tipos 2, 3 e Geral: Explicações, Regras e outros textos informativos */
.app-main p, .app-main ul li, .app-main ol li,
.modal-body p, .modal-body ul li, .modal-body ol li,
.highlight-notice p, .highlight-notice ul li,
.contract-info p, .sobre-container p, .sobre-container li {
    font-family: 'Inter', sans-serif !important;
    font-weight: 400 !important;
    font-size: 1.4rem !important;
    color: var(--text-color) !important;
    line-height: 1.5;
}

/* Tipo 4: Mensagens de Erro e Status */
.validation-message, .form-status {
    font-family: 'Inter', sans-serif !important;
    font-weight: 700 !important;
    font-size: var(--input-font-size) !important;
    line-height: 1.4;
}
.form-status.error, .validation-message { color: var(--error-color) !important; }
.form-status.success { color: var(--success-color) !important; }
.form-status.info { color: var(--info-color) !important; }

/* Tipos 5 e 6: Contratos, Informações Legais, Textos de Ajuda */
.doc-body p, .doc-body li, 
.help-content-column p, .help-content-column li, #help-index a,
.terms-box p, .terms-box li,
.event-content-block p {
    font-family: 'Inter', sans-serif !important;
    font-weight: 400 !important;
    font-size: var(--input-font-size) !important; 
    color: var(--text-color) !important;
    line-height: 1.6;
}

/* Exceções explícitas */
.user-info .name, .all-patients-list-item strong, .patient-name-title {
    font-size: 1.6rem !important; 
    font-weight: 700 !important;
}

.stat-item .value {
    font-size: 3.2rem !important; 
}

/* =========================================
   ESTILOS PARA IMPRESSÃO NATIVA
   ========================================= */
.print-only {
    display: none;
}

@media print {
    body * {
        visibility: hidden;
    }
    
    #print-area, #print-area * {
        visibility: visible;
    }
    
    #print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: block;
        padding: 2cm;
        color: black !important;
        background-color: white !important;
        font-family: Arial, sans-serif;
        font-size: 14pt;
        white-space: pre-wrap;
    }
}

/* =========================================
   NOVAS CLASSES: LANDING & PRODUCT
   ========================================= */

/* Landing Page Específicos */
.landing-page-main {
    padding-top: 1rem;
    position: relative;
}

/* Controles Centralizados na Landing Page */
.center-controls {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    width: 100%;
    z-index: 100;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    width: 100%;
    max-width: 90rem;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    background-color: var(--bg-dark-input);
    border: 1px solid var(--gray-900);
    border-radius: var(--border-radius);
    padding: 2.5rem 2rem;
    text-align: center; /* Regra 3: Textos centralizados */
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.feature-card h3 {
    font-size: 1.8rem !important;
    margin-bottom: 1rem;
    color: var(--selected-slot-border) !important;
}

.feature-card p {
    font-size: 1.4rem !important;
    line-height: 1.6;
}

.landing-footer {
    width: 100%;
    max-width: 80rem;
    margin: 4rem auto 0 auto;
    padding-top: 2rem;
    border: none !important;
    background-color: transparent !important;
}

/* Product Page Específicos */
.product-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40rem, 1fr));
    gap: 2rem;
}

.product-info-grid .area {
    margin: 0;
    padding: 2.5rem;
}

/* Páginas 'index' e 'quem-somos': Blocos de texto no tema escuro */
body:not(.light-theme) .feature-card,
body:not(.light-theme) .product-info-grid .area,
body:not(.light-theme) .informativo-box {
    background-color: var(--input-bg-color) !important;
    border-color: var(--input-border-color) !important;
}

body:not(.light-theme) .feature-card p,
body:not(.light-theme) .product-info-grid .area p,
body:not(.light-theme) .informativo-box span {
    color: var(--input-text-color) !important;
}

.three-column-footer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    font-size: 1.1rem;
    line-height: 1.4;
    color: var(--gray-400);
    padding-top: 2rem;
    text-align: left;
}

/* Ajustes e Adições Específicas para o Tema Claro nos Blocos do Rodapé */
body.light-theme .three-column-footer {
    border-top: none; /* Remove a linha superior para visual mais limpo com os blocos de fundo fechado */
}

body.light-theme .three-column-footer div {
    background-color: rgba(0, 0, 0, 0.2); /* Fundo levemente mais escuro que a página */
    color: #ffffff; /* Texto em branco */
    padding: 1.5rem; /* Espaçamento interno para formar o bloco */
    border-radius: var(--border-radius); /* Bordas arredondadas */
}

body.light-theme .three-column-footer strong {
    color: #ffffff !important; /* Texto em branco para os negritos */
}

.three-column-footer strong {
    color: var(--gray-200);
}

@media (max-width: 768px) {
    .three-column-footer {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* =========================================
   PÁGINA ANOTAR MOBILE (anotarmf)
   ========================================= */

.page-anotarmf {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Adapta-se melhor a navegadores móveis com barras dinâmicas */
    overflow: hidden;
}

/* Flex Container Principal Mobile */
.page-anotarmf .mf-main {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: flex-start;
    align-items: stretch; /* ADICIONADO: Forçar áreas a ocuparem a largura total */
}

/* Header e Itens do Header em 1 linha forçada */
.page-anotarmf .mf-header {
    flex-wrap: nowrap;
    height: auto;
    min-height: 4rem;
    padding: 0 0.5rem;
    margin: 0.5rem;
}

.page-anotarmf .mf-logo {
    height: 2.66rem;
}

.page-anotarmf .mf-user-info {
    flex: 1;
    min-width: 0;
    margin: 0 0.5rem;
}

.page-anotarmf .mf-user-info .header-user-name {
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.page-anotarmf .mf-theme-btn {
    height: 2.4rem;
    padding: 0;
    width: 6.5rem;
    font-size: 1.1rem;
}

.page-anotarmf .mf-menu-icon {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 8px;
}

.page-anotarmf .mf-menu-icon::before {
    width: 14px;
    height: 2px;
    box-shadow: 0 -5px 0 var(--muted-text), 0 5px 0 var(--muted-text);
}

.page-anotarmf .mf-dropdown {
    gap: 0.8rem;
}

/* Blocos / Areas (Redução drástica de margens) */
.page-anotarmf .mf-area {
    padding: 0.5rem;
    margin: 0;
    flex-shrink: 0;
    border-radius: 8px;
    width: 100%; /* ADICIONADO: Garantir largura máxima do viewport */
}

/* Otimizações Universais de Botão Mobile */
.page-anotarmf .mf-btn {
    height: 2.8rem;
    padding: 0 0.5rem;
    font-size: 1.2rem;
    border-radius: 6px;
    min-width: auto;
}

.page-anotarmf .mf-btn-block {
    width: 100%;
}

.page-anotarmf .mf-btn-atencao {
    padding: 0 0.8rem;
}

.page-anotarmf .tag-button {
    height: 2.6rem;
    padding: 0 0.8rem;
    font-size: 1.1rem !important;
    min-width: 0;
    border-radius: 6px;
}

/* Entradas de Texto (Textarea) */
.page-anotarmf .mf-textarea {
    min-height: 6rem;
    height: 6rem;
    padding: 0.5rem;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

/* Grids e Espaçamentos (Helpers Mobile) */
.page-anotarmf .mf-row {
    display: flex;
    flex-direction: row;
    width: 100%;
}

.page-anotarmf .mf-justify-between { justify-content: space-between; }
.page-anotarmf .mf-justify-center { justify-content: center; }
.page-anotarmf .mf-align-center { align-items: center; }
.page-anotarmf .mf-gap-half { gap: 0.5rem; }
.page-anotarmf .mf-mb-half { margin-bottom: 0.5rem; }
.page-anotarmf .mf-mb-0 { margin-bottom: 0; }
.page-anotarmf .mf-flex-1 { flex: 1; }
.page-anotarmf .mf-border-bottom { border-bottom: 1px solid var(--gray-900); }
.page-anotarmf .mf-border-top { border-top: 1px solid var(--gray-900); }

/* Elementos de Título Mobile */
.page-anotarmf .mf-title {
    font-size: 1.4rem;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-anotarmf .mf-tag-title {
    font-size: 1.3rem !important;
}

.page-anotarmf .mf-section-title {
    text-align: center;
    margin: 0 0 0.5rem 0;
    color: var(--selected-slot-border);
    font-size: 1.4rem !important;
}

/* Checkbox e Componentes Menores */
.page-anotarmf .mf-checkbox-group label {
    font-size: 1.2rem;
}
.page-anotarmf .mf-checkbox-group input {
    width: 1.4rem !important;
    height: 1.4rem !important;
}

.page-anotarmf .mf-tags-container {
    justify-content: flex-start;
    padding-bottom: 0.2rem;
}

/* Containers de Rolagem (Histórico e Sessão) */
.page-anotarmf .mf-box-container {
    display: flex;
    flex-direction: column;
    height: 40vh; /* MODIFICADO: Aumentado de 25vh para 40vh para exibir mais anotações */
    min-height: 250px; /* ADICIONADO: Altura mínima garantida para ao menos 3 anotações */
}

.page-anotarmf .mf-scroll-box {
    flex-grow: 1;
    overflow-y: auto;
    background-color: var(--bg-dark-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
}

/* =========================================
   PÁGINA AGENDA MOBILE (agendamf)
   ========================================= */

.page-agendamf {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.page-agendamf .mf-main {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: flex-start;
    align-items: stretch;
}

.page-agendamf .mf-header {
    flex-wrap: nowrap;
    height: auto;
    min-height: 4rem;
    padding: 0 0.5rem;
    margin: 0.5rem;
}

.page-agendamf .mf-logo { height: 2.66rem; }
.page-agendamf .mf-theme-btn { height: 2.4rem; padding: 0; width: 6.5rem; font-size: 1.1rem; }
.page-agendamf .mf-menu-icon { width: 2.4rem; height: 2.4rem; border-radius: 8px; }
.page-agendamf .mf-menu-icon::before { width: 14px; height: 2px; box-shadow: 0 -5px 0 var(--muted-text), 0 5px 0 var(--muted-text); }
.page-agendamf .mf-dropdown { gap: 0.8rem; }

.page-agendamf .mf-area {
    padding: 1rem;
    margin: 0;
    flex-shrink: 0;
    border-radius: 8px;
    width: 100%;
    background-color: var(--bg-color);
    border: var(--border-width) solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.page-agendamf .mf-row { display: flex; flex-direction: row; width: 100%; }
.page-agendamf .mf-justify-between { justify-content: space-between; }
.page-agendamf .mf-align-center { align-items: center; }
.page-agendamf .mf-gap-half { gap: 0.5rem; }
.page-agendamf .mf-mb-half { margin-bottom: 0.5rem; }
.page-agendamf .mf-mb-1 { margin-bottom: 1rem; }
.page-agendamf .mf-flex-1 { flex: 1; }

.page-agendamf .schedule-slots-container {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 25rem; /* ~250px garante espaço para visualização de no mínimo 4 itens na lista */
    max-height: 45vh;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    background-color: var(--bg-dark-input);
}

.page-agendamf .schedule-slot {
    padding: 1.2rem 0.5rem;
}

.page-agendamf .date-navigator h4 {
    font-size: 1.3rem;
    margin: 0;
    text-align: center;
}

.page-agendamf .mf-btn {
    height: 3.2rem;
    padding: 0 0.5rem;
    font-size: 1.3rem;
    border-radius: 6px;
    min-width: auto;
    white-space: nowrap;
}

/* =========================================
   PÁGINA CONSULTAR MOBILE (consultarmf)
   ========================================= */

.page-consultarmf {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.page-consultarmf .mf-main {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: flex-start;
    align-items: stretch;
}

.page-consultarmf .mf-header {
    flex-wrap: nowrap;
    height: auto;
    min-height: 4rem;
    padding: 0 0.5rem;
    margin: 0.5rem;
}

.page-consultarmf .mf-logo { height: 2.66rem; }
.page-consultarmf .mf-theme-btn { height: 2.4rem; padding: 0; width: 6.5rem; font-size: 1.1rem; }
.page-consultarmf .mf-menu-icon { width: 2.4rem; height: 2.4rem; border-radius: 8px; }
.page-consultarmf .mf-menu-icon::before { width: 14px; height: 2px; box-shadow: 0 -5px 0 var(--muted-text), 0 5px 0 var(--muted-text); }
.page-consultarmf .mf-dropdown { gap: 0.8rem; }

.page-consultarmf .mf-area {
    padding: 1rem;
    margin: 0;
    flex-shrink: 0;
    border-radius: 8px;
    width: 100%;
    background-color: var(--bg-color);
    border: var(--border-width) solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.page-consultarmf #consult-notes-container {
    flex-grow: 1;
    min-height: 25rem; /* Garante no mínimo a visualização de cerca de 4 ou mais itens */
    display: flex;
    flex-direction: column;
}

.page-consultarmf #notes-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* =========================================
   PÁGINA RESULTADOS MOBILE (resultadosmf)
   ========================================= */
.page-resultadosmf {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.page-resultadosmf .mf-main {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.page-resultadosmf .exam-image-viewer {
    min-height: 35vh;
    max-height: 50vh;
}
.page-resultadosmf .upload-prompt {
    padding: 1rem;
}
.page-resultadosmf .upload-prompt h3 {
    font-size: 1.5rem;
}

/* =========================================
   PÁGINA ADMIN CONTA MOBILE (admin-contamf)
   ========================================= */
.page-admincontamf {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.page-admincontamf .mf-main {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: flex-start;
    align-items: stretch;
}
.page-admincontamf .mf-header {
    flex-wrap: nowrap;
    height: auto;
    min-height: 4rem;
    padding: 0 0.5rem;
    margin: 0.5rem;
}
.page-admincontamf .mf-logo { height: 2.66rem; }
.page-admincontamf .mf-theme-btn { height: 2.4rem; padding: 0; width: 6.5rem; font-size: 1.1rem; }
.page-admincontamf .mf-menu-icon { width: 2.4rem; height: 2.4rem; border-radius: 8px; }
.page-admincontamf .mf-menu-icon::before { width: 14px; height: 2px; box-shadow: 0 -5px 0 var(--muted-text), 0 5px 0 var(--muted-text); }
.page-admincontamf .mf-dropdown { gap: 0.8rem; }

.page-admincontamf .mf-area {
    padding: 1rem;
    margin: 0;
    flex-shrink: 0;
    border-radius: 8px;
    width: 100%;
    background-color: var(--bg-color);
    border: var(--border-width) solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.page-admincontamf #user-list-container {
    min-height: 25rem; /* Permite visualizar pelo menos 4 itens (Regra estrita) */
    max-height: 40vh;
    overflow-y: auto;
    background-color: var(--bg-dark-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
}

/* Adaptação dos itens da lista de usuários para mobile */
.page-admincontamf .user-list-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-900);
}

.page-admincontamf .user-list-item > div.d-flex {
    justify-content: space-between;
    width: 100%;
}

/* =========================================
   PÁGINA CONFIGURAR MOBILE (configurarmf)
   ========================================= */
.page-configurarmf {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.page-configurarmf .mf-main {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: flex-start;
    align-items: stretch;
}

.page-configurarmf .mf-header {
    flex-wrap: nowrap;
    height: auto;
    min-height: 4rem;
    padding: 0 0.5rem;
    margin: 0.5rem;
}

.page-configurarmf .mf-logo { height: 2.66rem; }
.page-configurarmf .mf-theme-btn { height: 2.4rem; padding: 0; width: 6.5rem; font-size: 1.1rem; }
.page-configurarmf .mf-menu-icon { width: 2.4rem; height: 2.4rem; border-radius: 8px; }
.page-configurarmf .mf-menu-icon::before { width: 14px; height: 2px; box-shadow: 0 -5px 0 var(--muted-text), 0 5px 0 var(--muted-text); }
.page-configurarmf .mf-dropdown { gap: 0.8rem; }

.page-configurarmf .mf-area {
    padding: 1rem;
    margin: 0;
    flex-shrink: 0;
    border-radius: 8px;
    width: 100%;
    background-color: var(--bg-color);
    border: var(--border-width) solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.page-configurarmf #days-container {
    min-height: 25rem; /* Garante espaço para a visualização de pelo menos 4 dias/itens simultaneamente */
    max-height: 50vh;
    overflow-y: auto;
    background-color: var(--bg-dark-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
}

/* Ajustes no HTML dinâmico injetado pelo configurar.js para uso em telas mobile, usando o novo formato de classe gerado no JS */
.page-configurarmf .day-config-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background-color: var(--gray-990);
    border: 1px solid var(--gray-900);
    border-radius: 8px;
}
body.light-theme .page-configurarmf .day-config-row {
    background-color: #ffffff;
}

.page-configurarmf .day-header {
    margin-bottom: 1rem;
}

.page-configurarmf .time-inputs-compact {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.page-configurarmf .time-inputs-compact .form-group {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    margin: 0;
}

.page-configurarmf .time-inputs-compact input[type="time"] {
    text-align: center;
    width: 15rem;
}

/* Zera as bordas de grid-container da versão desktop quando em mobile */
.page-configurarmf .days-grid-container { 
    border: none; 
    background: transparent; 
    padding: 0; 
}

