/*
  ReMind — views.css  (Design System v2)
  Clínico · Clean · Responsivo
  Desktop ≥ 1024px · Tablet 640–1023px · Mobile < 640px

  Carregue DEPOIS do app.css no layout.php:
    <link rel="stylesheet" href=".../app.css" />
    <link rel="stylesheet" href=".../views.css" />
*/

/* ─── TOKENS ─────────────────────────────────────────────── */
:root {
  --blue:       #2563eb;
  --blue-50:    #eff6ff;
  --blue-100:   #dbeafe;
  --blue-600:   #1d4ed8;
  --blue-700:   #1e40af;

  --slate-50:   #f8fafc;
  --slate-100:  #f1f5f9;
  --slate-200:  #e2e8f0;
  --slate-300:  #cbd5e1;
  --slate-400:  #94a3b8;
  --slate-500:  #64748b;
  --slate-600:  #475569;
  --slate-700:  #334155;
  --slate-800:  #1e293b;
  --slate-900:  #0f172a;

  --green-50:   #f0fdf4;
  --green-100:  #dcfce7;
  --green-600:  #16a34a;
  --green-700:  #15803d;

  --amber-100:  #fef3c7;
  --amber-600:  #d97706;

  --red-50:     #fef2f2;
  --red-100:    #fee2e2;
  --red-600:    #dc2626;

  --purple-50:  #f5f3ff;
  --purple-100: #ede9fe;
  --purple-600: #7c3aed;

  --r-xs:  5px;
  --r-sm:  7px;
  --r:     10px;
  --r-lg:  14px;
  --r-xl:  18px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.12);
}

/* ─── RESET BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--slate-50);
  color: var(--slate-900);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ─── SHELL ──────────────────────────────────────────────── */
.clinic-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--slate-50);
}

/* ─── HEADER / TOPBAR ────────────────────────────────────── */
.saas-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--blue);
  border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 54px;
  gap: 12px;
}

.saas-left  { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.saas-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Brand */
.saas-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}

.saas-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.24);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  flex-shrink: 0;
}

.saas-name {
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -.3px;
}

/* Nav links */
.saas-nav {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.saas-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.88);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}

.saas-link:hover {
  background: rgba(255,255,255,.14);
  color: #fff;
}

.saas-link.is-active {
  background: rgba(0,0,0,.25);
  border-color: rgba(0,0,0,.18);
  color: #fff;
}

/* Hamburger (mobile) */
.saas-hamburger {
  display: none;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--r-sm);
  color: #fff;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}

/* Mobile nav drawer */
.saas-nav-drawer {
  display: none;
  position: fixed;
  inset: 54px 0 0 0;
  background: var(--blue-700);
  z-index: 39;
  padding: 12px;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.saas-nav-drawer.open { display: flex; }

.saas-nav-drawer .saas-link {
  font-size: 14px;
  padding: 10px 12px;
}

/* Search */
.saas-gsearch {
  position: relative;
  width: min(360px, 38vw);
}

.saas-gsearch-input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--r);
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: background .15s, border-color .15s;
}

.saas-gsearch-input::placeholder { color: rgba(255,255,255,.7); }
.saas-gsearch-input:focus {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.4);
}

.saas-gsearch-dd {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
}

.saas-gsearch-item {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 0;
  padding: 10px 14px;
  cursor: pointer;
  display: block;
  transition: background .1s;
}

.saas-gsearch-item:hover { background: var(--slate-50); }
.saas-gsearch-name { font-weight: 800; color: var(--slate-900); font-size: 13px; }
.saas-gsearch-meta { font-size: 12px; color: var(--slate-500); font-weight: 600; margin-top: 2px; }

/* User meta */
.saas-user { display: flex; align-items: center; gap: 10px; }
.saas-user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.saas-user-name { font-weight: 800; font-size: 13px; color: #fff; }
.saas-user-sub  { font-size: 11px; color: rgba(255,255,255,.75); font-weight: 600; }

.saas-btn {
  background: rgba(0,0,0,.25);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.saas-btn:hover  { background: rgba(0,0,0,.35); }
.saas-btn:active { transform: translateY(1px); }

/* ─── MAIN CONTAINER ─────────────────────────────────────── */
.clinic-saas-container {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

/* ─── FOOTER ─────────────────────────────────────────────── */
.saas-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--slate-900);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  z-index: 30;
}

.saas-footer a { color: rgba(255,255,255,.8); font-weight: 700; }
.saas-footer a:hover { color: #fff; }

/* ─── PAGE HEAD ──────────────────────────────────────────── */
.page-head, .phead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-head h2, .phead h2, .phead h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  color: var(--slate-900);
  letter-spacing: -.3px;
}

.page-sub, .phead .sub {
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 600;
  margin-top: 3px;
}

.page-wrap, .pwrap {
  max-width: 1180px;
  margin: 0 auto;
}

/* ─── BUTTONS ────────────────────────────────────────────── */
.tab-button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--blue);
  border-radius: var(--r-sm);
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s, transform .1s;
  line-height: 1;
}

.tab-button:hover, .btn:hover { background: var(--blue-600); border-color: var(--blue-600); }
.tab-button:active, .btn:active { transform: translateY(1px); }

/* Ghost (outline) */
.btn-ghost,
.tab-button.ghost {
  background: #fff;
  border-color: var(--slate-200);
  color: var(--slate-700);
}

.btn-ghost:hover,
.tab-button.ghost:hover {
  background: var(--slate-50);
  border-color: var(--slate-300);
  color: var(--slate-900);
}

/* Dark / secondary */
.btn.secondary,
.btn-dark {
  background: var(--slate-900);
  border-color: var(--slate-900);
  color: #fff;
}

.btn.secondary:hover,
.btn-dark:hover { background: var(--slate-800); border-color: var(--slate-800); }

/* Danger */
.btn-danger {
  background: var(--red-50);
  border-color: var(--red-100);
  color: var(--red-600);
}

.btn-danger:hover { background: var(--red-100); }

/* Small */
.btn-sm, .tab-button.sm { height: 30px; padding: 0 10px; font-size: 12px; }

/* Full width */
.btn-full { width: 100%; }

/* ─── KPI CARDS ──────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.kpi {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.kpi-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
  margin-top: 4px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 900;
  color: var(--slate-900);
  letter-spacing: -.5px;
  line-height: 1;
}

.kpi-delta {
  font-size: 11px;
  margin-top: 5px;
  font-weight: 600;
}

.kpi-delta.up   { color: var(--green-600); }
.kpi-delta.down { color: var(--red-600); }
.kpi-delta.muted{ color: var(--slate-400); }

/* ─── CARDS ──────────────────────────────────────────────── */
.card,
.clinic-card,
.grid-card,
.dash-card,
.wa-admin-card,
.financial-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.clinic-card,
.dash-card,
.wa-admin-card,
.financial-card { padding: 14px; }

.card-body { padding: 16px 18px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--slate-700);
}

/* Card com header separado por borda */
.card-section-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── BADGES / PILLS ─────────────────────────────────────── */
.badge,
.wa-admin-badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-blue   { background: var(--blue-50);   color: var(--blue-700); }
.badge-green  { background: var(--green-100); color: var(--green-700); }
.badge-amber  { background: var(--amber-100); color: var(--amber-600); }
.badge-red    { background: var(--red-100);   color: var(--red-600); }
.badge-purple { background: var(--purple-100);color: var(--purple-600); }
.badge-gray   { background: var(--slate-100); color: var(--slate-600); }

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Status financeiro */
.financial-status         { font-weight: 800; }
.financial-status.status-paid    { color: var(--green-600); }
.financial-status.status-pending { color: var(--amber-600); }

/* ─── AVATAR / CHIP ──────────────────────────────────────── */
.avatar,
.chip-av {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* ─── FORMS ──────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label,
.form-label,
.financial-filter-field > span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-600);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--slate-800);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

textarea { min-height: 100px; resize: vertical; line-height: 1.5; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.form-section, .field-group {
  border: 1px solid var(--slate-100);
  border-radius: var(--r-lg);
  padding: 16px;
  background: var(--slate-50);
  margin-bottom: 12px;
}

.form-section:last-child,
.field-group:last-child { margin-bottom: 0; }

.form-section legend,
.field-group legend {
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
  color: var(--slate-800);
}

.form-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.form-section-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: var(--slate-800);
}

.form-section-title span {
  color: var(--slate-400);
  font-size: 12px;
  font-weight: 600;
}

.form-actions, .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* ─── GRID 12 COLUNAS ────────────────────────────────────── */
.form-grid, .grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.col-1  { grid-column: span 1; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

/* ─── TABELAS ────────────────────────────────────────────── */
.table-wrap,
.table-responsive,
.financial-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.widefat,
.clinic-table {
  width: 100%;
  border-collapse: collapse;
}

table.widefat thead th,
.clinic-table thead th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--slate-100);
  white-space: nowrap;
  background: var(--slate-50);
}

table.widefat tbody td,
.clinic-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--slate-50);
  color: var(--slate-700);
  font-size: 13px;
  vertical-align: middle;
}

table.widefat tbody tr:hover,
.clinic-table tbody tr:hover { background: var(--slate-50); }

/* Coluna de ações */
.col-actions {
  width: 220px;
  min-width: 220px;
  text-align: right !important;
  white-space: nowrap;
}

.financial-table {
  width: max-content;
  min-width: 1200px;
  table-layout: auto;
}

.financial-table th,
.financial-table td { white-space: nowrap; }

.financial-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 200px;
}

/* ─── ALERTAS / FLASH ────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 12px;
  border: 1px solid transparent;
}

.alert.success, .alert-success {
  background: var(--green-100);
  color: var(--green-700);
  border-color: #bbf7d0;
}

.alert.error, .alert-error {
  background: var(--red-100);
  color: var(--red-600);
  border-color: #fecaca;
}

.alert.warning, .alert-warning {
  background: var(--amber-100);
  color: var(--amber-600);
  border-color: #fde68a;
}

/* ─── TABS (perfil paciente) ─────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 10px 10px 0;
  border-bottom: 1px solid var(--slate-100);
  background: #fff;
}

.tab {
  padding: 7px 14px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-500);
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  transition: color .15s, background .15s;
  margin-bottom: -1px;
}

.tab:hover { color: var(--slate-800); background: var(--slate-50); }

.tab.active {
  color: var(--blue);
  background: #fff;
  border-color: var(--slate-200);
  border-bottom-color: #fff;
}

.panel { display: none; padding: 16px; }
.panel.active { display: block; }

/* ─── PAGE TABS (navegação interna) ──────────────────────── */
.page-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.page-tab {
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-500);
  cursor: pointer;
  border: none;
  background: none;
  transition: all .15s;
}

.page-tab:hover { background: var(--slate-100); color: var(--slate-700); }
.page-tab.active { background: var(--blue-50); color: var(--blue); }

/* ─── MODAIS ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,.45);
  z-index: 2000;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal-backdrop.open { display: flex; }

.modal-box {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
}

.modal-header.dark   { background: var(--slate-900); }
.modal-header.danger { background: var(--red-600); }

.modal-close {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,.8);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color .15s, background .15s;
}

.modal-close:hover { color: #fff; background: rgba(255,255,255,.15); }
.modal-body { padding: 16px; }

/* ─── UTILITÁRIOS ────────────────────────────────────────── */
.muted        { color: var(--slate-400); font-size: 12px; font-weight: 600; }
.text-muted   { color: var(--slate-400); }
.text-soft    { color: var(--slate-500); }
.fw-700       { font-weight: 700; }
.fw-800       { font-weight: 800; }
.fw-900       { font-weight: 900; }
.stack        { display: grid; gap: 12px; }
.divider      { border: 0; border-top: 1px solid var(--slate-100); margin: 12px 0; }
.nowrap       { white-space: nowrap; }
.text-right   { text-align: right; }
.overflow-auto{ overflow: auto; }

/* ─── FINANCEIRO ─────────────────────────────────────────── */
.financial-page { display: flex; flex-direction: column; gap: 12px; }

.financial-highlight {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(2,132,199,.2);
  background: rgba(2,132,199,.07);
  font-weight: 800;
  font-size: 14px;
}

.financial-filters {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.financial-filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.financial-actions-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.financial-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.financial-card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}

.financial-card-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--slate-900);
  letter-spacing: -.4px;
}

/* ─── WHATSAPP ADMIN ─────────────────────────────────────── */
.wa-admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.wa-admin-kpi { font-size: 28px; font-weight: 900; margin-top: 6px; }
.wa-admin-muted { color: var(--slate-400); font-size: 12px; }

.wa-admin-table { width: 100%; border-collapse: collapse; }
.wa-admin-table th,
.wa-admin-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--slate-100);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

.wa-admin-table thead th {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--slate-50);
}

/* ─── PRONTUÁRIOS ────────────────────────────────────────── */
.evo {
  border: 1px solid var(--slate-100);
  border-radius: var(--r-lg);
  padding: 12px;
  margin-bottom: 8px;
  background: #fff;
}

.evo .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── AGENDA (sessões do dia) ────────────────────────────── */
.sched-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 4px;
  border-left: 3px solid var(--blue);
  background: var(--blue-50);
  flex-wrap: wrap;
}

.sched-item.done     { border-color: var(--green-600); background: var(--green-50); }
.sched-item.canceled { border-color: var(--slate-300); background: var(--slate-50); opacity: .65; }

/* ─── LOGIN ──────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at top left, rgba(59,130,246,.14), transparent 32%),
    radial-gradient(circle at bottom right, rgba(16,185,129,.12), transparent 30%),
    linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #ecfeff 100%);
}

.auth-shell {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.auth-side {
  padding: 40px;
  color: #fff;
  background: linear-gradient(155deg, #0f172a 0%, #1d4ed8 60%, #0891b2 100%);
  position: relative;
  overflow: hidden;
}

.auth-side::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  filter: blur(1px);
}

.auth-logo          { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-side .auth-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 900;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand-title   { font-size: 26px; font-weight: 900; line-height: 1; }
.auth-brand-sub     { opacity: .8; margin-top: 3px; font-size: 13px; }
.auth-headline      { font-size: 30px; line-height: 1.15; font-weight: 900; margin: 24px 0 12px; }
.auth-text          { font-size: 14px; line-height: 1.7; opacity: .9; }
.auth-points        { display: grid; gap: 10px; margin-top: 24px; }

.auth-point {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  padding: 12px 14px;
  border-radius: 14px;
}

.auth-point strong  { display: block; font-size: 13px; }
.auth-point span    { display: block; font-size: 12px; opacity: .82; }

.auth-main {
  padding: 36px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card          { width: 100%; max-width: 380px; }
.auth-kicker        { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); margin-bottom: 8px; }
.auth-title         { font-size: 26px; font-weight: 900; color: var(--slate-900); margin: 0 0 6px; letter-spacing: -.4px; }
.auth-sub           { font-size: 13px; color: var(--slate-500); margin-bottom: 20px; }
.auth-alert         { margin-bottom: 14px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid #fecaca; background: #fff1f2; color: #b91c1c; font-size: 13px; font-weight: 700; }
.auth-form          { display: grid; gap: 14px; }

.auth-label         { display: grid; gap: 7px; }
.auth-label span    { font-size: 12px; font-weight: 700; color: var(--slate-600); }

.auth-input {
  height: 44px;
  border-radius: var(--r);
  border: 1px solid var(--slate-200);
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
  color: var(--slate-900);
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}

.auth-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.auth-options       { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }

.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--slate-700);
  cursor: pointer;
}

.auth-check input   { margin-top: 2px; accent-color: var(--blue); }
.auth-check small   { display: block; color: var(--slate-400); font-size: 11px; margin-top: 1px; }

.auth-btn {
  height: 44px;
  border: none;
  border-radius: var(--r);
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  transition: background .15s;
}

.auth-btn:hover  { background: var(--blue-600); }
.auth-footer-note { margin-top: 14px; text-align: center; font-size: 11px; color: var(--slate-400); }

/* ─── DASHBOARD ──────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  margin-top: 14px;
}

/* ─── PRINT ──────────────────────────────────────────────── */
@media print {
  .no-print, .saas-header, .saas-footer, .saas-nav-drawer { display: none !important; }
  .clinic-saas-container { padding: 0; max-width: none; }
  body { background: #fff; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — TABLET  640px – 1023px
══════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {

  /* Header */
  .saas-nav          { display: none; }
  .saas-hamburger    { display: flex; }
  .saas-gsearch      { width: min(260px, 40vw); }
  .saas-user-meta    { display: none; }

  /* Container */
  .clinic-saas-container { padding: 16px 16px 70px; }

  /* KPI grid: 2 colunas */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  /* WA admin grid: 2 colunas */
  .wa-admin-grid { grid-template-columns: repeat(2, 1fr); }

  /* Form grid: col-3 e col-4 viram col-6 */
  .col-3, .col-4 { grid-column: span 6; }

  /* Auth: esconde lado ilustrativo */
  .auth-side   { display: none; }
  .auth-shell  { grid-template-columns: 1fr; max-width: 460px; }
  .auth-main   { padding: 28px 24px; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE  < 640px
══════════════════════════════════════════════════════════ */
@media (max-width: 639px) {

  /* Header */
  .saas-header    { padding: 0 12px; height: 50px; }
  .saas-gsearch   { display: none; }
  .saas-name      { display: none; }

  /* Container */
  .clinic-saas-container { padding: 12px 12px 68px; }

  /* Page head: stack vertical */
  .page-head, .phead {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .page-head h2, .phead h2 { font-size: 18px; }

  /* KPI: 2 por linha, valores menores */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-value { font-size: 20px; }
  .kpi { padding: 10px 12px; }

  /* Todos os col-* viram col-12 */
  .col-2, .col-3, .col-4,
  .col-5, .col-6, .col-7,
  .col-8, .col-9, .col-10 {
    grid-column: span 12;
  }

  /* WA admin: 2 colunas */
  .wa-admin-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .wa-admin-kpi  { font-size: 22px; }

  /* Tabelas: scroll horizontal */
  .table-wrap,
  .table-responsive,
  .financial-table-wrap { overflow-x: auto; }

  table.widefat,
  .clinic-table { min-width: 560px; }

  /* Botões: full-width em ações de formulário */
  .form-actions, .actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn,
  .form-actions .tab-button,
  .actions .btn,
  .actions .tab-button { width: 100%; justify-content: center; }

  /* Tabs */
  .tabs { padding: 8px 8px 0; gap: 2px; }
  .tab  { padding: 6px 10px; font-size: 12px; }

  /* Modal: full screen quase */
  .modal-backdrop { padding: 8px; align-items: flex-end; }
  .modal-box { border-radius: var(--r-xl) var(--r-xl) 0 0; max-width: 100%; }

  /* Cards: sem padding lateral extra */
  .card-body { padding: 12px; }

  /* Financial filters: stack */
  .financial-filters { flex-direction: column; align-items: stretch; }
  .financial-filter-field { width: 100%; }
  .financial-filter-field input,
  .financial-filter-field select { min-width: 0; width: 100%; }

  /* Auth */
  .auth-screen { padding: 12px; }
  .auth-main   { padding: 20px 16px; }
  .auth-title  { font-size: 22px; }

  /* Buttons na topbar do header */
  .saas-btn { padding: 5px 9px; font-size: 12px; }

  /* Form sections */
  .form-section, .field-group { padding: 12px; }

  /* Dashboard quick stats */
  .dash-grid { gap: 8px; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE SMALL  < 400px
══════════════════════════════════════════════════════════ */
@media (max-width: 399px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .wa-admin-grid { grid-template-columns: 1fr; }
}
