/* PsiTodoDia V5.48 — acabamento total. Camada visual, sem mudanças de regras de negócio. */
:root {
  --psi-forest: #355b45;
  --psi-forest-dark: #274734;
  --psi-sage: #718b70;
  --psi-linen: #eee8de;
  --psi-cream: #fbf8f2;
  --psi-surface: #f9f5ed;
  --psi-surface-alt: #f3eee3;
  --psi-line: #e2d9cb;
  --psi-text: #283d31;
  --psi-muted: #667465;
  --psi-shadow: 0 12px 36px rgba(58,69,48,.065);
  --psi-ring: 0 0 0 3px rgba(94,134,98,.28);
}
html { scroll-padding-top: 94px; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.ui-icon { display: inline-block; width: 22px; height: 22px; flex: 0 0 22px; stroke: currentColor; fill: none; vertical-align: middle; }
.nav-icon, .admin-tab-icon, .action-leading-icon { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
button, input, select, textarea { font-family: inherit; }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #5c8968 !important;
  outline-offset: 3px !important;
}
button:not(:disabled), [role="button"] { touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .6; }

/* Organização editorial: sutileza, contraste e ritmo vertical. */
.app-shell { background: linear-gradient(155deg,#f3eee5 0%,#eee7dc 50%,#f1ebe2 100%) !important; }
.app-shell h1, .app-shell h2, .auth-card h1, .patient-join-card h1 { color: var(--psi-text); }
.app-shell .muted-copy, .app-shell .privacy-note, .app-shell small,
.auth-card .privacy-note { color: var(--psi-muted); }
.app-shell .eyebrow, .auth-card .eyebrow { color:#687e68; font-weight:750; }
.app-shell .screen-title-row h1 { font-weight:750; line-height:1.12; }
.app-shell .section-heading h2 { line-height:1.2; }
.app-shell .section-heading, .app-shell .screen-title-row { min-width:0; }
.app-shell .section-block { min-width:0; }
.app-shell .brand { color:var(--psi-forest-dark); }
.app-shell .sidebar-brand .brand-mark { filter:drop-shadow(0 5px 11px rgba(50,79,43,.1)); }

/* Navegação: ícones de um mesmo conjunto vetorial. */
.app-shell .sidebar-link .nav-icon {
  flex:0 0 35px; width:35px; height:35px;
  display:inline-flex!important; align-items:center; justify-content:center;
  border-radius:11px; color:#627e62!important;
}
.app-shell .sidebar-link .nav-icon .ui-icon { width:20px; height:20px; flex-basis:20px; }
.app-shell .sidebar-link.active .nav-icon {
  background:#dce6d9; color:#2e6045!important;
}
.app-shell .sidebar-link:hover .nav-icon { color:#315c44!important; }
.app-shell .sidebar-link strong { font-weight:660; letter-spacing:-.01em; }
.app-shell .sidebar-link:focus-visible { outline-offset:-3px!important; }
.app-shell .sidebar-nature-note { box-shadow:inset 0 1px rgba(255,255,255,.65); }
.app-shell .sidebar-nature-note span { text-wrap:balance; }
.app-shell .bottom-nav .nav-item .nav-icon,
.app-shell .bottom-nav .admin-nav-only .nav-icon {
  display:grid!important; place-items:center!important; min-height:24px; line-height:1!important;
  width:100%; color:#697b66!important;
}
.app-shell .bottom-nav .nav-item .ui-icon { width:21px!important; height:21px!important; flex-basis:21px!important; }
.app-shell .bottom-nav .nav-item.active .nav-icon { color:var(--psi-forest)!important; }
.app-shell .bottom-nav .nav-item small { font-weight:640!important; letter-spacing:.005em; }
.app-shell .bottom-nav { border-top:1px solid #d9d4c7!important; backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); }
.app-shell .bottom-nav .nav-item.active { color:#285440!important; }
.app-shell .admin-mobile-entry.admin-nav-only .nav-icon { width:auto!important; color:#fff!important; }
.app-shell .admin-mobile-entry.admin-nav-only .ui-icon { width:17px!important; height:17px!important; flex-basis:17px!important; }

/* Sidebar, cabeçalho e painel com materiais leves. */
.app-shell .workspace-sidebar, .app-shell .app-header {
  border-color:#e4dbcd!important;
  box-shadow:0 12px 36px rgba(65,67,46,.045)!important;
}
.app-shell .workspace-search { min-height:44px; background:#f7f1e8!important; }
.app-shell .workspace-search .nav-icon { color:#71846f; width:21px; }
.app-shell .workspace-search .ui-icon { width:19px; height:19px; }
.app-shell .workspace-search input { min-width:0; }
.app-shell .profile-pill { border:1px solid #e0d6c8!important; }
.app-shell .hero-card.clinical-hero { border:1px solid #ded6c7!important; }
.app-shell .hero-card.clinical-hero h1 { text-wrap:balance; }
.app-shell .hero-card.clinical-hero p { line-height:1.55; }
.app-shell .hero-card.clinical-hero .hero-stat { border-radius:16px!important; }

/* Cards e atalhos: contornos suaves, sem parecerem todos brancos. */
.app-shell .metric-card,
.app-shell .patient-card,
.app-shell .focus-grid>.card,
.app-shell .finance-summary>.card,
.app-shell .settings-card,
.app-shell .notice-card,
.app-shell .appointment-card,
.app-shell .clinical-field,
.app-shell .form-card,
.app-shell .insight-card,
.app-shell .timeline-item {
  border:1px solid var(--psi-line)!important;
  background:linear-gradient(165deg,rgba(252,249,243,.98),rgba(245,239,229,.98))!important;
  box-shadow:var(--psi-shadow)!important;
}
.app-shell .mock-shortcuts { align-items:stretch; }
.app-shell .mock-shortcut {
  gap:11px; min-width:0; text-align:left;
  border:1px solid #e3d9c9!important;
  box-shadow:0 8px 24px rgba(54,76,50,.055)!important;
}
.app-shell .mock-shortcut .nav-icon {
  width:44px; height:44px; min-width:44px;
  border-radius:14px; background:rgba(218,229,206,.58);
  display:grid; place-items:center; color:#456b4d!important;
}
.app-shell .mock-shortcut .ui-icon { width:23px; height:23px; flex-basis:23px; }
.app-shell .mock-shortcut.warm .nav-icon { background:rgba(229,213,179,.60); color:#6f674c!important; }
.app-shell .mock-shortcut.peach .nav-icon { background:rgba(231,218,192,.70); color:#667953!important; }
.app-shell .mock-shortcut.cream .nav-icon { background:rgba(220,220,185,.52); }
.app-shell .mock-shortcut strong { line-height:1.25; }
.app-shell .mock-shortcut:hover:not(:disabled) {
  border-color:#b6cbb3!important; transform:translateY(-2px);
  box-shadow:0 14px 28px rgba(50,75,43,.09)!important;
}
.app-shell .metric-card strong, .app-shell .finance-summary strong { font-variant-numeric:tabular-nums; }
.app-shell .metric-card small { line-height:1.4; }
.app-shell .metric-card:hover, .app-shell .patient-card:hover { border-color:#ccd6c1!important; }

/* Formulários, ações, etiquetas e tabulações. */
.app-shell button.primary, .auth-card button.primary,
.app-shell .primary, body.patient-room-body:not(.patient-call-active) .primary {
  background:linear-gradient(135deg,#426f52,#2e5540)!important;
  color:#fff!important; border-radius:14px!important;
  box-shadow:0 8px 18px rgba(51,94,63,.16)!important;
}
.app-shell button.primary:hover:not(:disabled), .auth-card button.primary:hover:not(:disabled) {
  background:linear-gradient(135deg,#497a5a,#345f48)!important;
}
.app-shell button.secondary, .app-shell .secondary,
.auth-card button.secondary, body.patient-room-body:not(.patient-call-active) .secondary {
  background:linear-gradient(180deg,#f1ecdf,#e9e5d7)!important;
  color:#345642!important; border:1px solid #d9d4c6!important;
  border-radius:14px!important;
}
.app-shell .ghost, .app-shell button.ghost { border-radius:14px!important; }
.app-shell .primary, .app-shell .secondary, .app-shell .ghost,
.auth-card .primary, .auth-card .secondary { min-height:42px; }
.app-shell .new-patient-action { border-radius:14px!important; }
.app-shell .new-patient-action .action-leading-icon .ui-icon,
.app-shell .agenda-new-btn .action-leading-icon .ui-icon { width:19px; height:19px; flex-basis:19px; }
.app-shell input:not([type="checkbox"]):not([type="radio"]),
.app-shell select, .app-shell textarea,
.auth-card input:not([type="checkbox"]):not([type="radio"]), .auth-card select {
  background:rgba(255,252,247,.98)!important;
  border:1px solid #ddd5c8!important; border-radius:12px!important;
  font-size:16px; color:#2c4436;
}
.app-shell select, .app-shell input, .auth-card input, .auth-card select { min-height:42px; }
.app-shell textarea { min-height:88px; line-height:1.55; }
.app-shell input:focus, .app-shell textarea:focus, .app-shell select:focus,
.auth-card input:focus, .auth-card select:focus {
  outline:2px solid #6b946f!important; outline-offset:1px!important;
  box-shadow:var(--psi-ring)!important;
}
.app-shell .pill, .app-shell .secure-chip { border-radius:999px!important; }
.app-shell .clinical-tabs, .app-shell .finance-filter-switch {
  background:rgba(245,239,230,.97)!important;
  border:1px solid #e1d8c9;
}
.app-shell .clinical-tab, .app-shell .finance-filter-switch button {
  min-height:39px; border-radius:12px!important;
}
.app-shell .clinical-tab.active, .app-shell .finance-filter-switch button.active {
  background:#dfebdd!important; color:#2d5841!important;
  border-color:#c9d8c5!important;
}
.app-shell .setting-line { align-items:center; }
.app-shell .setting-line strong { text-align:right; }

/* Estado vazio afetivo, mantendo textos existentes e sem inventar dados. */
.app-shell .empty-state, .app-shell .agenda-empty {
  background:linear-gradient(155deg,rgba(250,247,240,.95),rgba(239,238,224,.84))!important;
  border:1px dashed #cdd8c7!important;
  border-radius:21px!important;
  min-height:138px; padding:23px!important;
  text-align:center;
}
.app-shell .illustrated-empty img {
  width:64px; height:64px; margin:0 auto 8px;
  object-fit:contain; filter:drop-shadow(0 4px 7px rgba(74,100,56,.07));
}
.app-shell .agenda-empty-symbol {
  display:inline-grid; place-items:center; width:50px; height:50px;
  margin:0 auto 10px; color:#577859; background:#e3ebdf; border-radius:16px;
}
.app-shell .agenda-empty-symbol .ui-icon { width:25px; height:25px; }
.app-shell .agenda-empty p, .app-shell .empty-state p { line-height:1.55; }

/* Diálogos: conteúdo rolável, rodapés com área de toque e foco claro. */
.app-dialog { max-width:calc(100vw - 24px)!important; max-height:calc(100dvh - 24px)!important; }
.app-dialog::backdrop { background:rgba(29,43,31,.45)!important; backdrop-filter:blur(3px); }
.app-dialog .dialog-body { max-height:calc(100dvh - 28px); overflow-y:auto; overscroll-behavior:contain; }
.app-dialog .dialog-head { gap:12px; }
.app-dialog .dialog-close { width:42px; height:42px; min-width:42px; min-height:42px; }
.app-dialog label { line-height:1.45; }
.app-dialog .button-row button { min-height:44px; }

/* Administração só existe no shell carregado depois da autorização; mantém privacidade. */
.secure-admin-mount { background:linear-gradient(155deg,#f2ecdf,#ebe4d8)!important; }
.secure-admin-surface { color:#2b4032; }
.secure-admin-surface .admin-hub-tabs {
  background:rgba(250,246,237,.96)!important;
  border:1px solid #e0d6c8; box-shadow:0 10px 26px rgba(59,70,52,.06);
  border-radius:17px!important;
}
.secure-admin-surface .admin-hub-tab {
  display:inline-flex; align-items:center; justify-content:center;
  gap:7px; min-height:43px; border-radius:12px!important;
}
.secure-admin-surface .admin-tab-icon { color:#637b67; }
.secure-admin-surface .admin-tab-icon .ui-icon { width:18px; height:18px; flex-basis:18px; }
.secure-admin-surface .admin-hub-tab.active .admin-tab-icon { color:#305c43; }
.secure-admin-surface .card {
  background:linear-gradient(175deg,#fbf8f2,#f5eee4)!important;
  border:1px solid #e2d8c8!important;
  box-shadow:var(--psi-shadow)!important;
}
.secure-admin-surface .admin-metric strong { color:#315840; }
.secure-admin-surface .error-log-list { overflow-wrap:anywhere; }
.secure-admin-surface .error-log-meta { gap:6px; }
.secure-admin-surface .error-log-item-head { align-items:flex-start; }
.secure-admin-surface .admin-usage-row, .secure-admin-surface .admin-crp-review-item { min-width:0; }

/* Login, recuperação e convite: visual sereno, sem alterar validações. */
.auth-card { background:linear-gradient(175deg,rgba(251,248,242,.96),rgba(245,239,229,.96))!important; }
.auth-card label { font-size:13px; font-weight:650; }
.auth-card .auth-brand { margin-bottom:2px; }
.auth-card .nature-login-tagline { line-height:1.5; }
.auth-card .primary { min-height:48px!important; }
.auth-card .privacy-note { line-height:1.5; }
.auth-card .password-field-wrap { min-width:0; }
.auth-card .password-toggle { width:42px; min-width:42px; min-height:42px; }
body.patient-room-body:not(.patient-call-active) .patient-join-card {
  border:1px solid #ded7c8!important;
  box-shadow:0 24px 65px rgba(51,66,44,.11)!important;
  background:linear-gradient(170deg,rgba(252,248,241,.97),rgba(246,240,230,.98))!important;
}
body.patient-room-body:not(.patient-call-active) .invite-summary {
  background:rgba(250,247,239,.72);
  border:1px solid #e2d8c9; border-radius:17px;
}
body.patient-room-body:not(.patient-call-active) .invite-summary strong { color:#304738; }
body.patient-room-body:not(.patient-call-active) .invite-simple-tip {
  background:#e9eddf!important; color:#3c634d!important;
  border:1px solid #d7e1ce!important; border-radius:13px;
  line-height:1.48;
}
body.patient-room-body:not(.patient-call-active) #patientJoinBtn { min-height:49px; }
body.patient-room-body:not(.patient-call-active) #patientConsentModal .patient-consent-dialog {
  background:#faf6ee!important; border:1px solid #e5d9c9!important;
  border-radius:23px!important;
}
body.patient-room-body:not(.patient-call-active) #patientConsentModal .consent-simple-item,
body.patient-room-body:not(.patient-call-active) #patientConsentModal fieldset.recording-simple-choice {
  background:#f4efe6!important; border-color:#dfd7c9!important;
  border-radius:15px!important;
}
body.patient-room-body:not(.patient-call-active) #patientConsentModal .recording-simple-choice label {
  background:#fcf9f2!important; border-color:#e3d9cb!important;
  border-radius:13px!important;
  cursor:pointer;
}
body.patient-room-body:not(.patient-call-active) #patientConsentModal .recording-simple-choice label:has(input:checked) {
  background:#e7efe4!important; border-color:#86ab8b!important;
  box-shadow:0 0 0 2px rgba(97,146,102,.14) inset;
}
body.patient-room-body:not(.patient-call-active) #patientConsentModal button {
  min-height:44px;
}
/* Não alterar a tela de vídeo ativa, gravação, fullscreen, toolbar ou posição das câmeras. */

/* Página de pareamento exclusiva do tablet. */
body.auxiliary-bridge { color:var(--psi-text); background:linear-gradient(rgba(244,239,230,.84),rgba(243,238,228,.96)),url('/assets/media/leaf-sunlight.jpg') center/cover fixed; }
body.auxiliary-bridge main { background:linear-gradient(170deg,#fbf7f0,#f5eee3); border-color:#ded4c5; box-shadow:0 22px 55px rgba(42,72,49,.13); }
body.auxiliary-bridge .ok { background:#e8efe5; color:#375c45; }
body.auxiliary-bridge .ok.bad { background:#f9e9e4; color:#863e34; }
body.auxiliary-bridge .button { background:linear-gradient(135deg,#426e52,#2d5740); min-height:49px; }

@media (max-width:1100px) {
  .app-shell .bottom-nav { background:rgba(249,245,237,.97)!important; }
  .app-shell .bottom-nav .nav-item { min-width:0!important; }
  .secure-admin-surface .admin-hub-tabs { scroll-snap-type:x proximity; }
  .secure-admin-surface .admin-hub-tab { flex:0 0 auto; scroll-snap-align:start; }
}
@media (max-width:760px) {
  /* Garantir cinco abas sem sobreposição; ADM continua em botão flutuante separado. */
  .app-shell .bottom-nav, body.platform-admin-user .bottom-nav {
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    padding:5px 4px calc(6px + env(safe-area-inset-bottom))!important;
  }
  .app-shell .bottom-nav>.nav-item:not(.admin-nav-only) { min-width:0!important; padding:5px 1px!important; }
  .app-shell .bottom-nav .nav-item .ui-icon { width:20px!important; height:20px!important; }
  .app-shell .bottom-nav .nav-item small { font-size:10px!important; max-width:100%!important; }
  .app-shell .app-main { padding-bottom:calc(100px + env(safe-area-inset-bottom))!important; }
  body.platform-admin-user .app-main { padding-bottom:calc(105px + env(safe-area-inset-bottom))!important; }
  .app-shell .mock-shortcut { min-height:94px!important; padding:13px 12px!important; gap:7px; }
  .app-shell .mock-shortcut .nav-icon { width:37px; height:37px; min-width:37px; border-radius:12px; }
  .app-shell .mock-shortcut .ui-icon { width:20px; height:20px; }
  .app-shell .mock-shortcut strong { font-size:13px!important; }
  .app-shell .clinical-tabs {
    background:rgba(244,239,231,.97)!important;
    border-radius:13px!important;
    overflow-x:auto!important; max-width:100%;
    scrollbar-width:none;
  }
  .app-shell .screen-title-row h1 { font-size:clamp(25px,6vw,32px); }
  .app-shell .hero-card.clinical-hero h1 { font-size:clamp(23px,6.7vw,31px)!important; }
  .app-shell .metric-card { padding:16px; }
  .app-shell .finance-summary { grid-template-columns:1fr!important; }
  .app-shell .finance-summary strong { font-size:23px; }
  .app-shell .new-patient-action { min-height:46px; }
  .app-dialog { max-height:calc(100dvh - 16px)!important; }
  .app-dialog .dialog-body { max-height:calc(100dvh - 18px); }
  .secure-admin-surface .admin-hub-tabs { gap:5px!important; padding:5px!important; }
  .secure-admin-surface .admin-hub-tab { padding:10px 12px!important; white-space:nowrap; }
  .secure-admin-surface .admin-section-intro { gap:12px; }
  body.patient-room-body:not(.patient-call-active) #patientConsentModal .patient-consent-dialog {
    max-height:calc(100dvh - 16px)!important; overflow-y:auto!important; overscroll-behavior:contain;
  }
}
@media (max-width:390px) {
  .app-shell .bottom-nav .nav-item small, body.platform-admin-user .bottom-nav>.nav-item small { font-size:9px!important; }
  .app-shell .mock-shortcut strong { font-size:12.5px!important; }
  .app-shell .hero-card.clinical-hero .hero-stat { max-width:100%; }
  .app-shell .section-block, .app-shell .clinical-overview-grid { min-width:0; }
  .app-shell .admin-mobile-entry.admin-nav-only:not(.hidden) { right:8px!important; }
}
@media (max-height:650px) and (max-width:760px) {
  .app-dialog .dialog-body { padding-bottom:max(16px,env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior:auto!important; transition:none!important; animation-duration:.01ms!important; animation-iteration-count:1!important; }
}

/* Ajuste final de legibilidade nos campos de busca: uma só borda, sem efeito de input dentro de input. */
.app-shell .workspace-search,
.app-shell .search-box {
  display:flex; align-items:center; gap:10px;
  border:1px solid #e0d7ca!important;
  border-radius:15px!important;
  background:#fbf8f2!important;
  min-height:48px;
  padding:0 14px!important;
}
.app-shell .workspace-search input,
.app-shell .search-box input {
  flex:1; width:100%; min-width:0!important;
  border:0!important; border-radius:0!important;
  outline:0!important; box-shadow:none!important;
  background:transparent!important;
  margin:0!important; padding:10px 0!important;
  min-height:44px;
}
.app-shell .workspace-search:focus-within,
.app-shell .search-box:focus-within {
  border-color:#83a18b!important;
  box-shadow:var(--psi-ring)!important;
}
.app-shell .workspace-search .nav-icon,
.app-shell .search-box .nav-icon { display:flex;align-items:center;justify-content:center; flex:0 0 21px; color:#55755e!important; }
.app-shell .search-box .ui-icon { width:20px;height:20px;flex-basis:20px; }
/* Mantém o rótulo explicativo na ação mais usada do cadastro. */
@media(max-width:760px) {
  .app-shell .new-patient-action > strong { display:inline!important; font-size:14px; font-weight:750; }
  .app-shell .new-patient-action > .action-leading-icon { font-size:0!important; width:20px; height:20px; }
  .app-shell .new-patient-action > .action-leading-icon .ui-icon { width:19px;height:19px; }
}
#appShell .screen[data-screen="patients"] label.search-box input#patientSearch,
#appShell header.app-header label.workspace-search input#globalSearch {
  appearance:none!important;
  border:0!important; border-width:0!important;
  outline:0!important; box-shadow:none!important;
  background:transparent!important;
  margin:0!important; padding:10px 0!important;
}
