:root {
  --ink: #323c42;
  --muted: #6b7268;
  --paper: #fbfaf7;
  --line: #e6e1d6;
  --plum: #565a3f;
  --lilac: #f1ede3;
  --peach: #ebded1;
  --green: #dfeee5;
  --rose: #f7e4e1;
  --accent: #565a3f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Lato", system-ui, sans-serif;
}

.auth {
  width: min(440px, calc(100% - 32px));
  margin: 10vh auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 36px;
  box-shadow: 0 12px 50px #565a3f12;
}

.auth-mark, .brand-mark {
  display: grid;
  place-items: center;
  background: var(--plum);
  color: #fff;
  font: 700 22px Playfair Display, serif;
  border-radius: 50%;
}

.auth-mark {
  width: 42px;
  height: 42px;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  color: #8c938f;
  margin: 0 0 8px;
}

.accent {
  color: var(--accent);
}

h1, h2 {
  font-family: Playfair Display, Georgia, serif;
  margin: 0;
}

h1 {
  font-size: 38px;
  letter-spacing: -1.4px;
  line-height: 1.08;
}

h2 {
  font-size: 19px;
}

.auth form {
  display: grid;
  gap: 15px;
  margin: 24px 0;
}

.auth label, .settings-grid label, .form-grid label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #62706b;
}

.form-grid label input, .form-grid label select, .form-grid label textarea {
  font-weight: 400;
  color: var(--ink);
}

.currency-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

.currency-input span {
  padding: 0 0 0 11px;
  color: var(--muted);
  font-size: 14px;
}

.currency-input input {
  border: 0;
  flex: 1;
  padding: 11px 11px 11px 4px;
  border-radius: 0;
}

.currency-input input:focus {
  outline: none;
}

.patients-subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.patients-subnav button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 9px 16px;
  font: 600 13px "Lato", sans-serif;
  color: #62706b;
  cursor: pointer;
}

.patients-subnav button.active {
  background: var(--plum);
  color: #fff;
  border-color: var(--plum);
}

.auth input, input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 11px;
  font: 14px "Lato", sans-serif;
  outline-color: var(--accent);
}

.auth small {
  color: var(--muted);
  line-height: 1.55;
}

.primary {
  border: 0;
  border-radius: 9px;
  padding: 13px 17px;
  background: var(--plum);
  color: #fff;
  font: 700 14px "Lato", sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 9px #565a3f29;
}

.sidebar {
  position: fixed;
  width: 256px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 30px 17px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 28px/.78 Playfair Display, serif;
  color: var(--plum);
  padding: 0 12px 34px;
}

.brand-mark {
  width: 31px;
  height: 31px;
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: #62706b;
  font: 500 14px "Lato", sans-serif;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.nav-item span {
  display: inline-block;
  width: 25px;
  font-size: 18px;
  vertical-align: -2px;
}

.nav-item:hover, .nav-item.active {
  background: #f0ede2;
  color: var(--plum);
  font-weight: 700;
}

.profile {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 18px 5px 0;
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 12px;
}

.profile div {
  flex: 1;
}

.profile strong, .profile small {
  display: block;
}

.profile small {
  color: var(--muted);
  margin-top: 3px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--peach);
  color: #8c5c4a;
  font-weight: 700;
}

.workspace {
  margin-left: 256px;
  padding: 44px max(5vw, 50px);
  max-width: 1550px;
}

.demo-note {
  margin: 0 0 24px;
  padding: 11px 14px;
  border-radius: 9px;
  background: #f3eff7;
  color: #5c4b69;
  font-size: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 19px;
  display: flex;
  gap: 14px;
  min-height: 120px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}

.stat-card strong {
  font: 700 25px Playfair Display, serif;
  display: block;
  margin: 8px 0 5px;
}

.stat-card small {
  font-size: 11px;
  color: var(--muted);
}

.good {
  color: #39805d !important;
}

.stat-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 20px;
}

.lilac {
  background: var(--lilac);
  color: #75598d;
}

.peach {
  background: var(--peach);
  color: #a76643;
}

.green {
  background: var(--green);
  color: #40765b;
}

.rose {
  background: var(--rose);
  color: #aa5e5a;
}

.page-header {
  margin: 0 0 25px;
}

.subtitle {
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 15px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
  margin-bottom: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 17px;
}

.panel-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  margin-top: 16px;
}

.form-grid .primary {
  align-self: stretch;
}

.list-panel {
  padding: 18px 24px;
}

.row {
  display: flex !important;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0 !important;
  border: 0 !important;
  border-top: 1px solid #f0eee9 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.row b {
  font-size: 14px;
}

.detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.row select {
  min-width: 130px;
  padding: 8px;
  font-size: 12px;
}

.row button {
  margin-left: 6px;
}

.settings {
  max-width: 780px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin-top: 18px;
}

.settings-grid > * { min-width: 0; }
.settings-grid input, .settings-grid select, .settings-grid textarea { width: 100%; min-width: 0; box-sizing: border-box; }
.settings-grid textarea { max-width: 100%; resize: none; overflow-y: hidden; }
.settings-grid textarea[readonly] { background: #f8fafc; color: var(--ink, #1e293b); cursor: default; }

.settings-grid button {
  width: max-content;
}

.phone-input {
  display: flex;
  align-items: stretch;
}

.phone-input span {
  display: grid;
  place-items: center;
  min-width: 52px;
  padding: 0 10px;
  border: 1px solid var(--line, #e2e8f0);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  color: var(--muted, #64748b);
  background: #f8fafc;
  font-weight: 700;
}

.phone-input input {
  width: 100%;
  border-radius: 0 10px 10px 0;
}

.settings-grid label:last-of-type {
  grid-column: span 2;
}

dialog {
  border: 0;
  border-radius: 15px;
  width: min(620px, 92vw);
  padding: 0;
  box-shadow: 0 18px 50px #0003;
}

dialog::backdrop {
  background: #26333277;
}

.modal-top {
  display: flex;
  justify-content: space-between;
  padding: 24px 24px 16px;
}

.close {
  background: transparent;
  border: 0;
  font-size: 26px;
  color: var(--muted);
  cursor: pointer;
}

dialog textarea {
  width: calc(100% - 48px);
  margin: 0 24px;
  resize: vertical;
}

.modal-actions {
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

@media(max-width: 900px) {
  .sidebar {
    width: 74px;
    padding: 24px 10px;
  }
  .brand {
    padding: 0 10px 28px;
  }
  .brand > span:last-child, .sidebar .eyebrow, .profile div {
    display: none;
  }
  .nav-item {
    font-size: 0;
    padding: 13px;
    text-align: center;
  }
  .nav-item span {
    width: auto;
    font-size: 21px;
  }
  .workspace {
    margin-left: 74px;
    padding: 36px 28px;
  }
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media(max-width: 600px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 14px;
    display: block;
  }
  .brand {
    padding: 0 0 15px;
  }
  .profile {
    display: none;
  }
  .sidebar nav {
    display: flex;
    gap: 4px;
    overflow: auto;
  }
  .nav-item {
    font-size: 12px;
    padding: 9px;
    white-space: nowrap;
  }
  .nav-item span {
    display: none;
  }
  .workspace {
    margin: 0;
    padding: 24px 16px;
  }
  .summary-grid, .form-grid, .settings-grid {
    grid-template-columns: 1fr;
  }
  .settings-grid label:last-of-type {
    grid-column: auto;
  }
  .stat-card {
    min-height: auto;
  }
  .row {
    align-items: flex-start;
    flex-direction: column;
  }
  .row button {
    margin-left: 0;
  }
  .page-header h1 {
    font-size: 31px;
  }
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 14px;
}

.cal-weekday {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  padding: 4px 0 8px;
}

.cal-day {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cal-day.cal-outside {
  background: #fbfaf7;
  opacity: .45;
}

.cal-day.cal-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.cal-daynum {
  font-size: 11px;
  font-weight: 700;
  color: #62706b;
  margin-bottom: 2px;
}

.cal-appt {
  font-size: 10px;
  line-height: 1.35;
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--lilac);
  color: #5c4b69;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.cal-appt.cal-realizada {
  background: var(--green);
  color: #2f6b4c;
}

.cal-appt.cal-falta, .cal-appt.cal-desmarque {
  background: var(--rose);
  color: #9a4f4b;
}

.cal-more {
  font-size: 10px;
  color: var(--muted);
}

@media(max-width: 900px) {
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(34px, 1fr));
    gap: 3px;
  }
  .cal-day {
    min-height: 56px;
    padding: 3px;
  }
  .cal-weekday {
    font-size: 8px;
    padding: 2px 0 4px;
  }
  .cal-daynum {
    font-size: 9px;
  }
  .cal-appt {
    font-size: 8px;
    padding: 1px 3px;
  }
}

/* --- modernizacao: contraste, profundidade, estados de foco/hover --- */
:root {
  --muted: #5c6a65;
  --shadow-sm: 0 2px 10px #26333209;
  --shadow-md: 0 10px 30px #26333216;
  --shadow-lift: 0 16px 36px #565a3f20;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.detail {
  color: var(--muted);
}

.subtitle {
  color: #535f5b;
}

button, .nav-item, .row, .stat-card, .cal-day, input, select, textarea, .currency-input, .patients-subnav button {
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease, color .16s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #565a3f24;
}

.currency-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #565a3f24;
}

.currency-input input:focus {
  box-shadow: none;
}

button:focus-visible, .nav-item:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.panel {
  box-shadow: var(--shadow-sm);
}

.stat-card {
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.primary {
  background: linear-gradient(180deg, #6d7350, var(--plum));
}

.primary:hover {
  box-shadow: 0 10px 24px #565a3f40;
  transform: translateY(-1px);
}

.primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 9px #565a3f29;
}

.row:hover {
  background: #f7f5f1 !important;
  border-radius: 8px;
}

.nav-item:hover {
  transform: translateX(1px);
}

.cal-day:hover {
  border-color: var(--accent);
  box-shadow: 0 3px 12px #565a3f1c;
}

.patients-subnav button:hover:not(.active) {
  border-color: var(--accent);
  color: var(--plum);
}

.patients-subnav button.active:hover {
  color: #fff;
}

button:not(.primary):not(.nav-item):not(.close):not(.pp-nav-item):not(.patients-subnav button) {
  border: 1px solid var(--line);
  background: #fff;
  color: #54615c;
  border-radius: 8px;
  padding: 7px 14px;
  font: 600 12px "Lato", sans-serif;
  cursor: pointer;
  letter-spacing: .01em;
}

button:not(.primary):not(.nav-item):not(.close):not(.pp-nav-item):not(.patients-subnav button):hover {
  border-color: var(--accent);
  color: var(--plum);
  background: #faf8fc;
}

.primary {
  padding: 11px 18px;
  font-size: 13px;
  letter-spacing: .01em;
  border-radius: 10px;
}

.sidebar {
  background: linear-gradient(180deg, #fff, #fdfbf8);
}

h1, h2 {
  letter-spacing: -.3px;
}

.eyebrow {
  letter-spacing: .16em;
}

.stat-icon {
  transition: transform .2s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.08);
}

.auth {
  position: relative;
  overflow: hidden;
}

.auth::before {
  content: '';
  position: absolute;
  top: -90px;
  right: -90px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, #565a3f1e, transparent 70%);
  pointer-events: none;
}

.auth-mark, .brand-mark {
  box-shadow: 0 6px 16px #565a3f33;
}

dialog {
  box-shadow: 0 24px 60px #26333233;
}

/* --- pagina do paciente: menu lateral estilo Clinvi --- */
.pp-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.pp-nav {
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  position: sticky;
  top: 20px;
}

.pp-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 11px 12px;
  font: 600 13px "Lato", sans-serif;
  color: #62706b;
  text-align: left;
  cursor: pointer;
}

.pp-nav-item span {
  width: 20px;
  text-align: center;
  font-size: 15px;
}

.pp-nav-item:hover {
  background: #f7f5f1;
}

.pp-nav-item.active {
  background: var(--lilac);
  color: var(--plum);
}

.pp-body {
  flex: 1;
  min-width: 0;
}

@media(max-width: 900px) {
  .pp-layout {
    flex-direction: column;
  }
  .pp-nav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    position: static;
  }
  .pp-nav-item {
    white-space: nowrap;
  }
  .pp-nav-item span {
    display: none;
  }
}

/* --- dialogs largos para os formularios de criacao (paciente/sessao/lancamento) --- */
dialog.wide {
  width: min(860px, 94vw);
}

.modal-body {
  padding: 0 24px 24px;
}

.modal-body .form-grid {
  margin-top: 0;
}

/* --- cards do topo menores, agora com 5 (inclui evolucao pendente) --- */
.summary-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.stat-card {
  padding: 13px 14px;
  gap: 10px;
  min-height: auto;
}

.stat-card span {
  font-size: 9px;
}

.stat-card strong {
  font-size: 19px;
  margin: 5px 0 2px;
}

.stat-card small {
  font-size: 10px;
}

.stat-icon {
  width: 31px;
  height: 31px;
  font-size: 16px;
}

@media(max-width: 1100px) {
  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media(max-width: 900px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- card de evolucao pendente: chamar atencao com leveza quando houver pendencia --- */
@keyframes pp-pulse-ring {
  0% { box-shadow: 0 0 0 0 #aa5e5a55; transform: scale(1); }
  50% { transform: scale(1.015); }
  70% { box-shadow: 0 0 0 16px #aa5e5a00; transform: scale(1); }
  100% { box-shadow: 0 0 0 0 #aa5e5a00; }
}

.stat-card.pulse {
  animation: pp-pulse-ring 1.5s ease-out infinite;
  border-color: #dba09c;
}

.stat-card.pulse .stat-icon {
  background: var(--rose);
  color: #aa5e5a;
}

/* --- ficha cadastral em modo leitura (antes de clicar em "Editar cadastro") --- */
.form-grid input:disabled, .form-grid select:disabled {
  background: #faf9f6;
  color: var(--ink);
  opacity: 1;
  cursor: default;
  border-color: var(--line);
}

.currency-input input:disabled {
  background: transparent;
}

/* --- etiqueta de status no historico de sessoes do paciente --- */
.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.status-badge.status-ok {
  background: var(--green);
  color: #2f6b4c;
}

.status-badge.status-bad {
  background: var(--rose);
  color: #9a4f4b;
}

.status-badge.status-neutral {
  background: var(--lilac);
  color: #5c4b69;
}

/* --- Modernização da Dashboard --- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  padding: 0 24px 24px;
}

.stat-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition: all 0.3s ease;
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-color: #cbd5e1;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-card div {
  display: flex;
  flex-direction: column;
}

.stat-card span {
  font-size: 11px;
  font-weight: 700;
  color: #a0aec0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 24px;
  color: #2d3748;
  line-height: 1.2;
  margin: 4px 0;
}
/* --- calendario mais compacto, pra caber a semana toda sem rolar --- */
.fc .fc-timegrid-slot{height:34px!important}
.fc .fc-timegrid-slot-label-cushion{font-size:11px}
.fc .fc-col-header-cell-cushion{font-size:12px;padding:4px 2px}
.fc .fc-timegrid-axis-cushion{font-size:10px}
.fc-event,.fc-event .fc-event-main{font-size:10px;line-height:1.25}
.fc-timegrid-event{padding:1px 3px!important;border-radius:4px}
.fc-timegrid-event .fc-event-time{font-size:9px;font-weight:600}
.fc-timegrid-event .fc-event-title{font-size:10px}
.fc-toolbar-title{font-size:1.05rem!important}
.fc-button{padding:.3em .55em!important;font-size:.8em!important}

/* --- visao de mes do calendario: mais arrumada, sem cortar o nome --- */
.fc .fc-daygrid-day-frame{padding:3px}
.fc .fc-daygrid-day-number{font-size:12px;font-weight:700;color:#4a5568;padding:5px 7px}
.fc .fc-daygrid-day-top{flex-direction:row}
.fc .fc-daygrid-event{border-radius:5px!important;padding:2px 6px!important;margin:2px 4px!important;font-size:11px;line-height:1.35;white-space:normal!important;overflow:visible!important;box-shadow:none}
.fc .fc-daygrid-event .fc-event-time{font-weight:700;font-size:10px}
.fc .fc-daygrid-event .fc-event-title{font-size:11px;font-weight:600}
.fc .fc-daygrid-day-events{margin-bottom:2px}
.fc .fc-daygrid-more-link{font-size:10px;font-weight:700;color:var(--plum,#565a3f);margin:2px 4px}
.fc .fc-daygrid-day.fc-day-today{background:#fbf7fd}

/* --- design system unificado: acabamento visual Entre Sessões --- */
:root {
  --surface: #ffffff;
  --surface-soft: #f7f5f0;
  --surface-selected: #eeecdf;
  --text-subtle: #66716d;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --shadow-card: 0 2px 10px rgba(50, 60, 66, .055);
  --shadow-card-hover: 0 12px 28px rgba(50, 60, 66, .10);
}

body { background: #f9f8f4; line-height: 1.45; }

h1 { font-size: clamp(30px, 3vw, 38px); line-height: 1.12; }
h2 { font-size: 20px; line-height: 1.25; }

.workspace { padding-top: 40px; }
.page-header { margin-bottom: 28px; }
.subtitle { max-width: 680px; line-height: 1.55; }

.panel {
  border-color: #e7e4dc;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
}

.panel-heading { gap: var(--space-3); margin-bottom: 20px; }
.panel-heading p { line-height: 1.5; }

/* Ações: menos altas, mais legíveis e coerentes entre telas. */
.primary,
.c-btn-primary {
  min-height: 38px;
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.2;
  box-shadow: 0 3px 10px rgba(86, 90, 63, .20);
}

.primary:hover,
.c-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(86, 90, 63, .25);
}

.nav-item,
.pp-nav-item {
  min-height: 38px;
  border-radius: 9px;
}

.nav-item { padding: 10px 12px; }
.nav-item.active { background: var(--surface-selected); }

button:not(.primary):not(.nav-item):not(.close):not(.pp-nav-item):not(.patients-subnav button) {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 9px;
  color: #4f5c57;
}

.patients-subnav { gap: 6px; }
.patients-subnav button { min-height: 36px; padding: 8px 13px; }

input, select, textarea { min-height: 40px; border-radius: 10px; padding: 10px 12px; }
textarea { min-height: 96px; }
.form-grid { gap: 16px; }
.form-grid label, .settings-grid label { gap: 7px; }
.form-grid > .primary {
  width: fit-content;
  min-width: 142px;
  align-self: end;
  justify-self: start;
}

.summary-grid { padding: 0; gap: 14px; margin-bottom: 30px; }
.stat-card {
  min-height: 112px;
  border-color: #e7e4dc;
  border-radius: var(--radius-lg);
  padding: 18px;
  gap: 14px;
  box-shadow: var(--shadow-card);
  cursor: default;
}
.stat-card:hover { transform: translateY(-2px); border-color: #d9d5c8; box-shadow: var(--shadow-card-hover); }
.stat-card .stat-icon { width: 42px; height: 42px; border-radius: 12px; font-size: 18px; }
.stat-card span { color: var(--text-subtle); font-size: 10px; letter-spacing: .08em; }
.stat-card strong { color: var(--ink); font-size: 23px; margin: 4px 0 2px; }

.row { padding: 16px 4px !important; gap: 14px; }
.row:hover { background: var(--surface-soft) !important; }

.pp-layout { gap: 20px; }
.pp-nav { border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 8px; }
.pp-nav-item { padding: 10px 11px; }
.pp-nav-item.active { background: var(--surface-selected); }

dialog { border-radius: 18px; overflow: hidden; }
.modal-top { padding: 24px 24px 18px; }
.modal-actions { gap: 8px; align-items: center; }

@media (max-width: 1100px) {
  .workspace { padding-left: 32px; padding-right: 32px; }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .panel { padding: 18px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading > button, .page-header > button { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .form-grid > .primary { width: 100%; justify-self: stretch; }
  .modal-top, .modal-body { padding-left: 18px; padding-right: 18px; }
  .modal-actions { padding: 14px 18px; }
}

/* Ajuda contextual da calculadora: informativa, sem aparência de alerta. */
#f .field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

#f button.field-help {
  position: relative;
  display: inline-block !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 1px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--plum);
  font: 700 12px/1 "Lato", system-ui, sans-serif !important;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  cursor: help;
  box-shadow: none !important;
  transition: color .16s ease, transform .16s ease;
}

#f button.field-help:hover,
#f button.field-help:focus-visible {
  background: transparent;
  color: #30351f;
  outline: none;
  transform: translateY(-1px);
}

#f button.field-help::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(250px, 72vw);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font: 400 12px/1.45 "Lato", system-ui, sans-serif;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .16s ease, transform .16s ease;
  box-shadow: 0 10px 25px rgba(50, 60, 66, .22);
}

#f button.field-help::before {
  content: "";
  position: absolute;
  z-index: 21;
  left: 50%;
  bottom: calc(100% + 5px);
  width: 8px;
  height: 8px;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) rotate(45deg);
  transition: opacity .16s ease;
}

#f button.field-help:hover::after,
#f button.field-help:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

#f button.field-help:hover::before,
#f button.field-help:focus-visible::before { opacity: 1; }

/* Conexão individual com Google Calendar */
.dashboard-header { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:24px; padding:0 4px; }
.dashboard-actions { display:flex; gap:12px; align-items:center; }
.google-connect-button { display:inline-flex; align-items:center; gap:9px; min-height:40px; padding:0 14px 0 11px; border:1px solid #d9d9d1; border-radius:10px; background:#fff; color:#323c42; font:700 13px "Lato", sans-serif; box-shadow:0 1px 2px rgba(50,60,66,.08); cursor:pointer; transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease; white-space:nowrap; }
.google-connect-button:hover { transform:translateY(-1px); border-color:#b9b8aa; box-shadow:0 5px 14px rgba(50,60,66,.11); }
.google-connect-button:focus-visible { outline:3px solid rgba(86,90,63,.25); outline-offset:2px; }
.google-connect-button:disabled { opacity:.62; cursor:wait; transform:none; }
.google-connect-button.is-connected { background:#f5f6ef; border-color:#cbd2b3; color:#4b5634; }
.google-g { display:grid; place-items:center; width:20px; height:20px; border-radius:50%; background:conic-gradient(from -45deg, #4285f4 0 25%, #34a853 0 50%, #fbbc05 0 75%, #ea4335 0); color:#fff; font:800 12px Arial, sans-serif; }
.google-calendar-panel { border-color: #dddccf; }
.google-calendar-actions { display:flex; align-items:center; justify-content:space-between; gap:20px; padding-top:4px; }
.google-calendar-actions strong { display:block; font-size:14px; color:var(--ink); }
.google-calendar-actions p { margin:5px 0 0; }
.google-calendar-buttons { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.google-calendar-badge { display:inline-flex; align-items:center; min-height:25px; padding:4px 9px; border-radius:999px; background:#f0efe8; color:var(--muted); font:700 10px "Lato", sans-serif; letter-spacing:.04em; text-transform:uppercase; white-space:nowrap; }
.google-calendar-badge.connected { background:var(--green); color:#2f6b4c; }
.google-calendar-badge.disconnected { background:var(--peach); color:#875d42; }
.google-calendar-badge.warning { background:var(--rose); color:#9a4f4b; }
@media(max-width:700px){ .dashboard-header { align-items:flex-start; flex-direction:column; } .dashboard-actions { width:100%; flex-wrap:wrap; } .dashboard-actions #global-search { flex:1; min-width:210px; width:auto !important; } }
@media(max-width:600px){ .google-calendar-actions { align-items:flex-start; flex-direction:column; } .google-calendar-buttons { width:100%; } .google-calendar-buttons button { flex:1; } .google-connect-button { min-height:38px; } }
