/* =============================================
   seuprontuario.online — Base CSS
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary:    #2563eb;
  --color-primary-dk: #1d4ed8;
  --color-bg:         #f8fafc;
  --color-surface:    #ffffff;
  --color-border:     #e2e8f0;
  --color-text:       #1e293b;
  --color-text-muted: #64748b;
  --color-error:      #dc2626;
  --radius:           8px;
  --shadow:           0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}

/* --- Auth --- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1.75rem;
  text-align: center;
}

.auth-logo span { color: var(--color-primary); }

.auth-box h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-group input {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .95rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color .15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--color-error);
  padding: .6rem .75rem;
  font-size: .875rem;
  margin-bottom: .75rem;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: .65rem 1rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.btn-primary:hover:not([disabled]) { background: var(--color-primary-dk); }
.btn-primary[disabled] { opacity: .6; cursor: not-allowed; }

.auth-switch {
  text-align: center;
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-top: 1.25rem;
}

.auth-switch a { color: var(--color-primary); text-decoration: none; font-weight: 600; }

.auth-link-row { text-align: center; font-size: .875rem; margin-top: .75rem; }
.auth-link-row a { color: var(--color-text-muted); text-decoration: underline; }

/* Divisor "ou" entre Google e email/senha */
.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1rem 0;
  color: var(--color-text-muted);
  font-size: .85rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* Wrap do botão Google (centraliza o iframe que o GSI injeta) */
.google-btn-wrap { display: flex; justify-content: center; margin: .5rem 0; min-height: 44px; }

/* Preview do usuário Google no consentimento LGPD */
.google-user-preview {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}
.google-avatar { width: 40px; height: 40px; border-radius: 50%; }
.google-user-preview strong { display: block; font-size: .95rem; }
.google-user-preview .text-muted { font-size: .82rem; color: var(--color-text-muted); }

/* --- App Shell --- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2rem;
  padding-left: .5rem;
}

.sidebar-logo span { color: var(--color-primary); }

.sidebar-nav { list-style: none; flex: 1; }

.sidebar-nav li a {
  display: block;
  padding: .55rem .75rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
  font-size: .925rem;
  transition: background .12s;
}

.sidebar-nav li a:hover { background: var(--color-bg); }

.sidebar-footer { padding-top: 1rem; border-top: 1px solid var(--color-border); }

.btn-logout {
  width: 100%;
  padding: .5rem .75rem;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: .875rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.btn-logout:hover { border-color: var(--color-error); color: var(--color-error); }

.main-content {
  flex: 1;
  padding: 2rem;
}

.main-content h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }

/* --- Workspace selector --- */
.workspace-selector { position: relative; margin: .75rem 1rem 0; }

.workspace-btn {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: .5rem .75rem;
  font-size: .85rem; color: var(--color-text); cursor: pointer;
  transition: border-color .15s;
}
.workspace-btn:hover { border-color: var(--color-primary); }
.workspace-label { flex: 1; text-align: left; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-icon  { font-size: 1rem; flex-shrink: 0; }
.workspace-caret { font-size: .7rem; color: var(--color-text-muted); flex-shrink: 0; }

.workspace-dropdown {
  position: absolute; top: calc(100% + .25rem); left: 0; right: 0;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,.1);
  z-index: 200; overflow: hidden;
}
.workspace-dropdown-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .75rem; font-size: .85rem; cursor: pointer;
  color: var(--color-text); transition: background .1s;
}
.workspace-dropdown-item:hover { background: var(--color-bg); }
.workspace-dropdown-active { background: var(--color-bg); font-weight: 600; }
.workspace-role {
  margin-left: auto; font-size: .7rem; color: var(--color-text-muted);
  background: var(--color-border); border-radius: 99px; padding: .1rem .4rem;
}

/* --- Impersonation banner --- */
.impersonate-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #dc2626; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: .5rem 1rem; font-size: .85rem; font-weight: 500;
}
.impersonate-banner button {
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4);
  color: #fff; border-radius: var(--radius); padding: .25rem .75rem;
  font-size: .8rem; cursor: pointer; transition: background .15s;
}
.impersonate-banner button:hover { background: rgba(255,255,255,.35); }

/* --- Sidebar active link --- */
.sidebar-nav li a.active,
.sidebar-nav li.active a { background: var(--color-bg); font-weight: 600; color: var(--color-primary); }

/* --- Card --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; }

/* --- Form row --- */
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

/* --- Textarea --- */
textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  resize: vertical;
  transition: border-color .15s;
}

textarea:focus { outline: none; border-color: var(--color-primary); }

/* --- Disabled input --- */
input[disabled] { opacity: .55; cursor: not-allowed; }

/* --- Success message --- */
.form-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  color: #166534;
  padding: .6rem .75rem;
  font-size: .875rem;
  margin-bottom: .75rem;
}

/* --- Secondary button --- */
.btn-secondary {
  display: inline-block;
  padding: .6rem 1.25rem;
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.btn-secondary:hover:not([disabled]) { background: var(--color-primary); color: #fff; }
.btn-secondary[disabled] { opacity: .6; cursor: not-allowed; }

/* --- Loading --- */
.loading-msg { color: var(--color-text-muted); padding: 2rem 0; }

/* --- Page header --- */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: 0; }
.back-link { display: block; font-size: .8rem; color: var(--color-text-muted); text-decoration: none; margin-bottom: .25rem; }
.back-link:hover { color: var(--color-primary); }

/* --- Button sizes --- */
.btn-primary.btn-sm, .btn-secondary.btn-sm { padding: .4rem .85rem; font-size: .85rem; }

/* --- Search bar --- */
.search-bar { margin-bottom: 1.25rem; }
.search-bar input { width: 100%; max-width: 380px; padding: .55rem .75rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: .95rem; }
.search-bar input:focus { outline: none; border-color: var(--color-primary); }

/* --- Data table --- */
.data-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.data-table th { background: var(--color-bg); text-align: left; padding: .65rem 1rem; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); }
.data-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--color-border); font-size: .9rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .clickable-row { cursor: pointer; transition: background .1s; }
.data-table .clickable-row:hover { background: var(--color-bg); }
.link-arrow { color: var(--color-text-muted); font-size: 1.2rem; }

/* --- Pagination --- */
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.pagination button { padding: .4rem .8rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); cursor: pointer; font-size: .875rem; }
.pagination button[disabled] { opacity: .4; cursor: not-allowed; }

/* --- Empty state --- */
.empty-state { color: var(--color-text-muted); padding: 2rem 0; text-align: center; }

/* --- Tabs --- */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--color-border); margin-bottom: 1.25rem; }
.tab-btn { background: none; border: none; padding: .6rem 1.1rem; font-size: .9rem; font-weight: 500; color: var(--color-text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }
.tab-content { margin-top: 0; }

/* --- Section title --- */
.section-title { font-size: .9rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .06em; margin: 1.25rem 0 .75rem; border-top: 1px solid var(--color-border); padding-top: 1rem; }

/* --- Card header row --- */
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.card-header-row h2 { margin-bottom: 0; }

/* --- Record cards --- */
.record-form { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.25rem; margin-top: 1rem; }
.record-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: .75rem; }
.record-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.record-actions { display: flex; gap: .4rem; }
.record-date { font-size: .8rem; font-weight: 600; color: var(--color-primary); }
.record-time { font-size: .8rem; color: var(--color-text-muted); }
.tag-linked { font-size: .75rem; background: #eff6ff; color: #2563eb; border-radius: 4px; padding: 1px 6px; margin-left: .4rem; }
.record-desc { margin-bottom: .5rem; margin-top: .4rem; }
.record-extras { font-size: .875rem; color: var(--color-text-muted); }
.record-extras div { margin-top: .25rem; }

/* --- Timeline --- */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--color-border); }
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-dot { position: absolute; left: -1.5rem; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--color-primary); border: 2px solid var(--color-surface); }
.timeline-dot-appt { background: #059669; }
.timeline-date { font-size: .8rem; font-weight: 600; color: var(--color-primary); }
.timeline-content { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: .75rem 1rem; margin-top: .25rem; }

/* --- Upload --- */
.upload-form { display: flex; align-items: center; gap: 1rem; }

/* --- Danger button --- */
.btn-danger-sm { background: transparent; border: 1px solid var(--color-error); color: var(--color-error); border-radius: var(--radius); padding: .3rem .65rem; font-size: .8rem; cursor: pointer; transition: background .15s, color .15s; }
.btn-danger-sm:hover { background: var(--color-error); color: #fff; }

/* --- Text muted --- */
.text-muted { color: var(--color-text-muted); font-size: .85rem; }

/* --- Agenda / FullCalendar wrapper --- */
.agenda-main { overflow: hidden; }
.fc-wrapper { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: .5rem; }
.legend { display: flex; align-items: center; gap: .75rem; font-size: .8rem; color: var(--color-text-muted); flex-wrap: wrap; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .2rem; }

/* --- Modal --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--color-surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.2); width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; padding: 1.5rem; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-header h2 { font-size: 1.1rem; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--color-text-muted); }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }
.modal-section-title { font-size: .8rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }

/* --- Appointment detail --- */
.appt-detail { margin-bottom: 1rem; }
.appt-row { padding: .4rem 0; border-bottom: 1px solid var(--color-border); font-size: .9rem; }
.appt-row:last-child { border-bottom: none; }

/* --- Status badges --- */
.status-badge { display: inline-block; padding: .2rem .65rem; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.status-agendado   { background: #dbeafe; color: #1d4ed8; }
.status-confirmado { background: #e0e7ff; color: #4338ca; }
.status-realizado  { background: #dcfce7; color: #166534; }
.status-cancelado  { background: #f3f4f6; color: #6b7280; }
.status-faltou     { background: #fee2e2; color: #b91c1c; }
.status-pay-pendente { background: #fef9c3; color: #854d0e; }
.status-pay-pago     { background: #dcfce7; color: #166534; }
.status-pay-isento   { background: #f3f4f6; color: #6b7280; }
.td-money  { text-align: right; font-variant-numeric: tabular-nums; }
.td-actions { white-space: nowrap; display: flex; gap: .3rem; align-items: center; }
.text-warning { color: #b45309; }
.month-nav { display: flex; align-items: center; gap: 1rem; }


/* --- Status action buttons --- */
.status-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-status { padding: .35rem .85rem; border-radius: 99px; border: none; font-size: .82rem; font-weight: 600; cursor: pointer; }
.btn-status-confirmado { background: #e0e7ff; color: #4338ca; }
.btn-status-realizado  { background: #dcfce7; color: #166534; }
.btn-status-cancelado  { background: #f3f4f6; color: #6b7280; }
.btn-status-faltou     { background: #fee2e2; color: #b91c1c; }

/* --- Select --- */
select { width: 100%; padding: .6rem .75rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: .95rem; color: var(--color-text); background: var(--color-bg); }
select:focus { outline: none; border-color: var(--color-primary); }

/* --- Badge --- */
.badge { display: inline-block; background: var(--color-error); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 99px; padding: .1rem .45rem; margin-left: .4rem; vertical-align: middle; }

/* --- Dashboard cards --- */
.dashboard-cards { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }
.dash-card { display: block; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem; text-decoration: none; color: var(--color-text); min-width: 180px; transition: box-shadow .15s; }
.dash-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.dash-card-accent { border-color: var(--color-primary); }
.dash-card-label  { font-weight: 600; font-size: 1rem; margin-bottom: .35rem; }
.dash-card-number { font-size: 1.8rem; font-weight: 700; color: var(--color-primary); }
.dash-card-sub    { font-size: .85rem; color: var(--color-text-muted); }

/* --- Check-in / Check-out --- */
.checkin-bar { display: flex; align-items: center; gap: .75rem; margin: 1rem 0; padding: .75rem; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius); }
.btn-checkin  { background: #16a34a; color: #fff; border: none; border-radius: var(--radius); padding: .45rem 1rem; font-weight: 600; font-size: .875rem; cursor: pointer; }
.btn-checkin:hover { background: #15803d; }
.btn-checkout { background: #dc2626; color: #fff; border: none; border-radius: var(--radius); padding: .45rem 1rem; font-weight: 600; font-size: .875rem; cursor: pointer; }
.btn-checkout:hover { background: #b91c1c; }
.in-progress-badge { font-size: .82rem; font-weight: 700; color: #16a34a; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.5 } }

/* --- Stat boxes --- */
.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat-box { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem 1.25rem; min-width: 100px; text-align: center; }
.stat-num   { font-size: 1.75rem; font-weight: 700; color: var(--color-text); }
.stat-label { font-size: .75rem; color: var(--color-text-muted); margin-top: .2rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-green .stat-num { color: #16a34a; }
.stat-red   .stat-num { color: #dc2626; }
.stat-gray  .stat-num { color: #6b7280; }
.stat-blue  .stat-num { color: var(--color-primary); }

/* --- Flatpickr override --- */
.flatpickr-input { width: 100%; padding: .6rem .75rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: .95rem; color: var(--color-text); background: var(--color-bg); font-family: inherit; }
.flatpickr-input:focus { outline: none; border-color: var(--color-primary); }
.flatpickr-calendar { font-family: inherit; border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.12); border: 1px solid var(--color-border); }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--color-primary); border-color: var(--color-primary); }
.flatpickr-day:hover { background: var(--color-bg); }
.flatpickr-months .flatpickr-month { background: var(--color-primary); border-radius: var(--radius) var(--radius) 0 0; }
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year { color: #fff; font-weight: 600; }
.flatpickr-weekday { color: var(--color-text-muted); font-weight: 600; font-size: .78rem; }

/* =============================================
   RESPONSIVIDADE MOBILE
   ============================================= */

/* --- Hambúrguer --- */
.hamburger {
  display: none;
  position: fixed;
  top: .85rem;
  left: .85rem;
  z-index: 200;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .4rem .55rem;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform .2s;
}

/* --- Sidebar overlay (mobile) --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 149;
}

@media (max-width: 768px) {
  /* Hambúrguer visível */
  .hamburger { display: flex; }

  /* Sidebar off-canvas */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.12);
  }
  .sidebar.sidebar-open { transform: translateX(0); }

  /* Overlay visível */
  .sidebar-overlay { display: block; }

  /* Main content sem margem de sidebar */
  .main-content { padding: 1rem; padding-top: 3.5rem; }

  /* form-row quebra em coluna */
  .form-row { flex-direction: column; gap: 0; }

  /* Tabelas: scroll horizontal */
  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 500px; }

  /* Stat boxes: 2 por linha */
  .stat-row { gap: .6rem; }
  .stat-box  { min-width: calc(50% - .3rem); flex: 1 1 calc(50% - .3rem); }

  /* Modal: tela cheia no mobile */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.25rem 1rem;
  }

  /* Tabs: scroll horizontal */
  .tabs { overflow-x: auto; white-space: nowrap; padding-bottom: .25rem; }
  .tab-btn { flex-shrink: 0; }

  /* Page header: stack */
  .page-header { flex-direction: column; align-items: flex-start; gap: .75rem; }

  /* td-actions: wrap */
  .td-actions { flex-wrap: wrap; }

  /* Dashboard cards: coluna */
  .dashboard-cards { flex-direction: column; }
  .dash-card { min-width: auto; }

  /* Calendar: reduz padding */
  .agenda-main .fc { font-size: .82rem; }

  /* Oculta colunas menos importantes nas tabelas de pacientes */
  .hide-mobile { display: none; }
}

@media (max-width: 480px) {
  .main-content { padding: .75rem; padding-top: 3.5rem; }
  .card { padding: 1rem; }
  .stat-box { min-width: 100%; }
  .modal-actions { flex-direction: column; }
  .modal-actions button,
  .modal-actions a { width: 100%; text-align: center; }
}

/* --- Consent checkbox (LGPD) --- */
.consent-group { margin-top: .25rem; }
.consent-label { display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; font-size: .9rem; line-height: 1.5; }
.consent-label input[type="checkbox"] { margin-top: .2rem; flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
.consent-label a { color: var(--color-primary); text-decoration: underline; }

/* --- Plano / Upgrade --- */
.nav-locked { opacity: .6; cursor: pointer; }
.nav-locked:hover { opacity: 1; }

.upgrade-modal { max-width: 520px; width: 100%; }

.upgrade-plan-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
}
.upgrade-plan-highlight {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.plan-badge {
  position: absolute;
  top: -.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 99px;
  white-space: nowrap;
}
.plan-name  { font-weight: 700; font-size: 1rem; margin-bottom: .25rem; }
.plan-price { font-size: 1.6rem; font-weight: 700; color: var(--color-primary); margin-bottom: .75rem; }
.plan-price span { font-size: .85rem; font-weight: 400; color: var(--color-text-muted); }
.plan-features { list-style: none; font-size: .875rem; display: flex; flex-direction: column; gap: .35rem; }
.plan-features li::before { content: '✓ '; color: #16a34a; font-weight: 700; }
.plan-feature-no { opacity: .45; }
.plan-feature-no::before { content: '✗ '; color: var(--color-error) !important; }

/* --- Modal upgrade 3 colunas --- */
.upgrade-modal { max-width: 780px; }
.upgrade-plan-card { display: flex; flex-direction: column; }
.upgrade-plan-col-span { grid-column: span 1; } /* Pro quando Free está oculto */

/* --- Barra de uso de pacientes --- */
.usage-bar-track {
  width: 100%;
  height: 8px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .3s ease;
}
.patient-usage-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}
.patient-usage-warning {
  border-color: var(--color-danger, #dc2626);
  background: #fef2f2;
}

/* --- Membro da clínica --- */
.member-row {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: .85rem 0; border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.member-row:last-child { border-bottom: none; }
.member-identity { min-width: 160px; flex-shrink: 0; }
.member-perms    { display: flex; flex-wrap: wrap; gap: .4rem; flex: 1; align-items: center; }
.member-actions  { margin-left: auto; flex-shrink: 0; }

.perm-toggle {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .6rem; border-radius: 99px; font-size: .78rem; font-weight: 500;
  background: var(--color-bg); border: 1px solid var(--color-border);
  cursor: pointer; user-select: none; transition: background .12s, border-color .12s;
}
.perm-toggle input[type=checkbox] { display: none; }
.perm-toggle::before {
  content: '○'; font-size: .7rem; color: var(--color-text-muted);
}
.perm-toggle.perm-on {
  background: #dbeafe; border-color: var(--color-primary); color: var(--color-primary);
}
.perm-toggle.perm-on::before { content: '●'; color: var(--color-primary); }

/* --- Badges de plano inline (perfil) --- */
.plan-badge-inline {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: .2rem .65rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.plan-badge-free   { background: #f1f5f9; color: var(--color-text-muted); }
.plan-badge-pro    { background: #dbeafe; color: var(--color-primary); }
.plan-badge-clinic { background: #ede9fe; color: #7c3aed; }

:root { --color-danger: #dc2626; }

/* --- Stripe card element --- */
.stripe-card-element {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  background: var(--color-surface);
  transition: border-color .2s;
}
.stripe-card-element:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* =============================================================
   PUBLIC PAGES — landing, sobre, ajuda, privacidade, termos
   ============================================================= */

/* Reset body flex for public pages */
body.public-body {
  display: block;
  background: #fff;
}

/* ── Public Nav ─────────────────────────────────────────────── */
.pub-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 2rem;
  gap: 1.5rem;
}
.pub-nav-logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.pub-nav-logo span { color: var(--color-primary); }
.pub-nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}
.pub-nav-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: .9rem;
  transition: color .15s;
}
.pub-nav-links a:hover { color: var(--color-text); }
.pub-nav-actions { display: flex; gap: .75rem; align-items: center; }
.pub-btn {
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-block;
  transition: background .15s, color .15s;
}
.pub-btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.pub-btn-ghost:hover { background: var(--color-bg); }
.pub-btn-primary { background: var(--color-primary); color: #fff; }
.pub-btn-primary:hover { background: var(--color-primary-dk); }

/* ── Hero ───────────────────────────────────────────────────── */
.pub-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  padding: 6rem 2rem 5rem;
  text-align: center;
}
.pub-hero-badge {
  display: inline-block;
  background: rgba(37,99,235,.3);
  color: #93c5fd;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .3rem .85rem;
  border-radius: 99px;
  margin-bottom: 1.5rem;
}
.pub-hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  max-width: 780px;
  margin: 0 auto 1.25rem;
}
.pub-hero h1 span { color: #60a5fa; }
.pub-hero p {
  font-size: 1.1rem;
  color: #94a3b8;
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.65;
}
.pub-hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.pub-hero-cta {
  padding: .85rem 2rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-block;
  transition: background .15s;
}
.pub-hero-cta-primary { background: var(--color-primary); color: #fff; }
.pub-hero-cta-primary:hover { background: var(--color-primary-dk); }
.pub-hero-cta-ghost {
  background: rgba(255,255,255,.08);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,.2);
}
.pub-hero-cta-ghost:hover { background: rgba(255,255,255,.15); }

/* ── Sections ───────────────────────────────────────────────── */
.pub-section {
  padding: 5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}
.pub-section-gray { background: var(--color-bg); }
.pub-section-gray .pub-section { margin: 0 auto; }
.pub-section-full { max-width: none; padding: 5rem 2rem; }

.pub-section-header {
  text-align: center;
  margin-bottom: 3rem;
}
.pub-section-header h2 {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: .65rem;
}
.pub-section-header p {
  color: var(--color-text-muted);
  font-size: 1rem;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Feature Cards ──────────────────────────────────────────── */
.pub-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.pub-feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
}
.pub-feature-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}
.pub-feature-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.pub-feature-card p {
  font-size: .9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ── Plans ──────────────────────────────────────────────────── */
.pub-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}
.pub-plan-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  position: relative;
}
.pub-plan-card.pub-plan-highlight {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.pub-plan-card.pub-plan-clinic {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
.pub-plan-recommended {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .25rem .85rem;
  border-radius: 99px;
}
.pub-plan-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .35rem;
}
.pub-plan-price {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  line-height: 1;
}
.pub-plan-price small {
  font-size: .9rem;
  font-weight: 400;
  color: var(--color-text-muted);
}
.pub-plan-features {
  list-style: none;
  margin-bottom: 1.75rem;
  flex: 1;
}
.pub-plan-features li {
  font-size: .88rem;
  padding: .3rem 0;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.pub-plan-features li::before { content: '✓'; color: var(--color-primary); font-weight: 700; }
.pub-plan-features li.no::before { content: '✕'; color: #cbd5e1; }
.pub-plan-features li.no { color: var(--color-text-muted); }

/* ── Register section ───────────────────────────────────────── */
.pub-register-wrap {
  max-width: 440px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
}
.pub-register-wrap h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* ── Help page ──────────────────────────────────────────────── */
.pub-help-nav {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}
.pub-help-nav-btn {
  padding: .45rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 99px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: all .15s;
}
.pub-help-nav-btn.active,
.pub-help-nav-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.pub-help-section { display: none; }
.pub-help-section.active { display: block; }
.pub-help-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.75rem 0 .6rem;
}
.pub-help-section h3:first-child { margin-top: 0; }
.pub-help-section p, .pub-help-section li {
  font-size: .93rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}
.pub-help-section ul { margin-left: 1.25rem; margin-top: .4rem; }

/* ── CTA Section ─────────────────────────────────────────────── */
.pub-cta-section {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 50%, #2563eb 100%);
  padding: 5rem 2rem;
  text-align: center;
}
.pub-cta-content { max-width: 600px; margin: 0 auto; }
.pub-cta-section h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: .75rem;
}
.pub-cta-section p {
  font-size: 1.1rem;
  color: #bfdbfe;
  margin-bottom: 2rem;
}
.pub-cta-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.pub-btn-lg { padding: .85rem 2rem; font-size: 1rem; }
.pub-cta-section .pub-btn-primary {
  background: #fff;
  color: #1d4ed8;
  border-color: #fff;
}
.pub-cta-section .pub-btn-primary:hover { background: #eff6ff; }
.pub-cta-section .pub-btn-ghost {
  border-color: rgba(255,255,255,.5);
  color: #fff;
}
.pub-cta-section .pub-btn-ghost:hover { background: rgba(255,255,255,.1); }
.pub-cta-note { font-size: .82rem; color: #93c5fd; margin: 0; }

/* ── Footer ─────────────────────────────────────────────────── */
.pub-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 3rem 2rem 2rem;
  text-align: center;
}
.pub-footer-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: .75rem;
}
.pub-footer-logo span { color: #60a5fa; }
.pub-footer p { font-size: .85rem; margin-bottom: 1rem; }
.pub-footer-links { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.pub-footer-links a { color: #64748b; text-decoration: none; font-size: .83rem; transition: color .15s; }
.pub-footer-links a:hover { color: #94a3b8; }
.pub-footer-copy { font-size: .8rem; color: #475569; }

/* ── Cookie Banner ──────────────────────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: 0 -2px 12px rgba(0,0,0,.2);
}
.cookie-banner p { font-size: .875rem; margin: 0; flex: 1; min-width: 220px; }
.cookie-banner a { color: #93c5fd; }
.cookie-banner-actions { display: flex; gap: .75rem; }
.cookie-btn-accept {
  padding: .5rem 1.25rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
}
.cookie-btn-reject {
  padding: .5rem 1.25rem;
  background: transparent;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: var(--radius);
  font-size: .875rem;
  cursor: pointer;
}

/* ── Onboarding Tour ────────────────────────────────────────── */
.tour-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
}
.tour-fab:hover { background: var(--color-primary-dk); transform: scale(1.08); }

/* Responsive public */
@media (max-width: 640px) {
  .pub-nav { padding: .75rem 1rem; }
  .pub-nav-links { display: none; }
  .pub-hero { padding: 3.5rem 1.25rem 3rem; }
  .pub-section { padding: 3rem 1.25rem; }
  .pub-section-full { padding: 3rem 1.25rem; }
}
