/* ============================================================
   FisioSystem â€” app.css  |  Design System v2 â€” Verde SaÃºde
   ============================================================ */

/* â”€â”€ Google Fonts â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* â”€â”€ Design Tokens â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
:root {
  /* Paleta Verde SaÃºde */
  --primary:        #10B981;
  --primary-dark:   #047857;
  --primary-lite:   #D1FAE5;
  --primary-xlite:  #ECFDF5;
  --accent:         #34D399;
  --accent-dark:    #059669;

  /* SemÃ¢nticos */
  --success:        #10B981;
  --success-lite:   #D1FAE5;
  --error:          #EF4444;
  --error-lite:     #FEE2E2;
  --warning:        #F59E0B;
  --warning-lite:   #FEF3C7;
  --info:           #3B82F6;
  --info-lite:      #EFF6FF;

  /* SuperfÃ­cies */
  --bg:             #ECFDF5;
  --surface:        #FFFFFF;
  --surface-2:      #F0FDF4;
  --border:         #A7F3D0;
  --border-soft:    #D1FAE5;

  /* Texto */
  --text:           #064E3B;
  --text-mid:       #065F46;
  --text-muted:     #6EE7B7;
  --text-muted-alt: #374151;

  /* Estrutura */
  --sidebar-w:      260px;
  --topbar-h:       66px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-xs:      4px;
  --shadow:         0 1px 4px rgba(4,120,87,.07), 0 6px 20px rgba(4,120,87,.05);
  --shadow-md:      0 4px 24px rgba(16,185,129,.18);
  --shadow-lg:      0 12px 48px rgba(4,120,87,.14);
  --transition:     .20s ease;
}

/* â”€â”€ Reset â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--primary); }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* â”€â”€ Scrollbar Customizada â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.layout-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
}
.auth-bg {
  position: fixed; inset: 0;
  background: linear-gradient(145deg, var(--primary-dark) 0%, var(--primary) 55%, var(--accent) 100%);
  z-index: 0;
}
.auth-bg::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='40' cy='40' r='30'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-card {
  position: relative; z-index: 1;
  background: var(--surface);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 80px rgba(4,120,87,.3), 0 0 0 1px rgba(255,255,255,.15);
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-top: 12px;
  letter-spacing: -.3px;
}
.auth-logo p { color: var(--text-muted-alt); font-size: 13.5px; margin-top: 4px; }
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-links {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted-alt);
}
.auth-links a { color: var(--primary-dark); font-weight: 600; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.layout-app { min-height: 100vh; }

/* â”€â”€ Sidebar â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-dark) 0%, #064E3B 100%);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(4,120,87,.25);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo span {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.2px;
}
.sidebar-logo span small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  opacity: .65;
  letter-spacing: 0;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: 14px 12px 4px;
}
.sidebar-link, .sidebar-link:visited {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.sidebar-link.active {
  background: rgba(255,255,255,.18);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 #34D399;
}
.sidebar-link svg { flex-shrink: 0; opacity: .85; }
.sidebar-link.active svg { opacity: 1; }
.sidebar-footer {
  padding: 18px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-user { display: flex; align-items: center; gap: 11px; }
.sidebar-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.25);
}
.sidebar-user-name { color: #fff; font-size: 13px; font-weight: 700; }
.sidebar-logout { color: rgba(255,255,255,.5); font-size: 12px; }
.sidebar-logout:hover { color: #fff; text-decoration: none; }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* â”€â”€ Main Area â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(4,120,87,.06);
}
.topbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 6px;
  border-radius: var(--radius-xs);
}
.topbar-toggle:hover { background: var(--primary-xlite); }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
.main-content {
  flex: 1;
  padding: 32px 32px 56px;
  max-width: 1280px;
  width: 100%;
}

/* ============================================================
   ALERTAS + TOASTS
   ============================================================ */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
  border-left: 4px solid;
  line-height: 1.5;
}
.alert-success { background: var(--success-lite); color: #065F46; border-color: var(--success); }
.alert-error   { background: var(--error-lite);   color: #991B1B; border-color: var(--error); }
.alert-info    { background: var(--info-lite);     color: #1E40AF; border-color: var(--info); }
.alert-warning { background: var(--warning-lite);  color: #92400E; border-color: var(--warning); }

/* Toasts Flutuantes */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 290px;
  max-width: 400px;
  background: var(--surface);
  color: var(--text);
  padding: 14px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  font-size: 13.5px;
  font-weight: 500;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 0.4s cubic-bezier(0.16,1,0.3,1) forwards;
}
.toast.toast-outro { animation: toastOut 0.4s cubic-bezier(0.16,1,0.3,1) forwards; }
.toast.alert-success { border-color: var(--success); }
.toast.alert-error   { border-color: var(--error); }
.toast.alert-info    { border-color: var(--info); }
.toast.alert-warning { border-color: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(28px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(.92); }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -.1px;
  line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: none; }

.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary { background: var(--primary-xlike, #F0FDF4); color: var(--text-mid); border-color: var(--border); }
.btn-secondary { background: #F0FDF4; }
.btn-secondary:hover { background: var(--primary-lite); border-color: var(--primary); color: var(--primary-dark); }

.btn-outline { background: transparent; color: var(--primary-dark); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-lite); }

.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover { background: #dc2626; }

.btn-ghost { background: transparent; color: var(--text-muted-alt); border-color: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--primary-xlike, #F0FDF4); }

/* BotÃ£o Voltar (Design EspecÃ­fico) */
.btn-back {
  background: #F2FCF7; /* fundo levemente esverdeado claro fiel Ã  imagem */
  color: #016B58; /* verde escuro (tealish) para o texto */
  border: 1.5px solid #91E2C4; /* borda suave verde/ciano */
  border-radius: 12px; /* cantos bem arredondados conforme a imagem */
  padding: 6px 18px;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-back:hover { background: #D1FAE5; border-color: var(--primary); }

.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 700; color: var(--text); }
.form-label.required::after { content: ' *'; color: var(--error); }
.form-label-sm { font-size: 12px; font-weight: 600; color: var(--text-muted-alt); }
.form-label-section {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--border-soft);
  padding-bottom: 6px;
  margin-bottom: 4px;
}
.form-control {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,.18);
}
.form-control:hover { border-color: var(--primary); }
.form-control.is-invalid { border-color: var(--error); }
.invalid-feedback { font-size: 12px; color: var(--error); font-weight: 600; }
.form-hint { font-size: 12px; color: var(--text-muted-alt); margin-top: 2px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 88px; }

.form-grid { display: grid; gap: 18px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-full { grid-column: 1/-1; }

.radio-group { display: flex; gap: 14px; align-items: center; padding-top: 4px; flex-wrap: wrap; }
.radio-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.radio-label input { accent-color: var(--primary); width: 15px; height: 15px; }

.input-password { position: relative; }
.input-password .form-control { padding-right: 44px; }
.btn-toggle-pw {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted-alt);
  display: flex; align-items: center;
  transition: color var(--transition);
}
.btn-toggle-pw:hover { color: var(--primary); }

.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.form-section { padding: 26px; border-bottom: 1px solid var(--border-soft); }
.form-section:last-child { border-bottom: none; }
.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-lite);
}
.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 26px;
  background: var(--primary-xlike, #F0FDF4);
  background: #F0FDF4;
  border-top: 1px solid var(--border-soft);
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 14px;
}
.page-header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.patient-subtitle { font-size: 13px; color: var(--text-muted-alt); margin-top: 2px; }
.badge-count {
  background: var(--primary-lite);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
}

/* ============================================================
   DASHBOARD â€” STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon--green  { background: var(--primary-lite); color: var(--primary-dark); }
.stat-icon--blue   { background: #EFF6FF; color: #1D4ED8; }
.stat-icon--amber  { background: #FEF3C7; color: #B45309; }
.stat-icon--rose   { background: #FEE2E2; color: #B91C1C; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted-alt); margin-top: 3px; font-weight: 500; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: #FAFFFE;
}
.card-header h3 { font-size: 14px; font-weight: 700; color: var(--text); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
.table th {
  text-align: left;
  padding: 12px 18px;
  background: var(--primary-xlike, #F0FDF4);
  background: #F0FDF4;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: .7px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--primary-xlike, #FAFFFE); }
.td-main { font-weight: 600; }
.td-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

/* ============================================================
   PATIENT CARDS (Grid)
   ============================================================ */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  align-items: center;
  flex-wrap: wrap;
}
.search-input-wrapper {
  flex: 1;
  position: relative;
  min-width: 200px;
  max-width: 480px;
}
.search-icon {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--primary);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 38px 10px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,.15);
}
.search-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 18px; color: var(--text-muted-alt); line-height: 1;
}
.patients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.patient-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.patient-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.patient-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 19px;
  flex-shrink: 0;
}
.patient-info { flex: 1; min-width: 0; }
.patient-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.patient-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 3px; }
.patient-meta span {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-muted-alt);
}
.patient-actions { display: flex; gap: 5px; flex-shrink: 0; }

.empty-state { text-align: center; padding: 80px 24px; color: var(--text-muted-alt); }
.empty-state p { margin: 16px 0 24px; font-size: 15px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; gap: 6px; margin-top: 28px; flex-wrap: wrap; }
.pagination-item {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted-alt);
  background: var(--surface);
  text-decoration: none;
  transition: all var(--transition);
}
.pagination-item:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-xlike, #F0FDF4); }
.pagination-item.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(4,78,59,.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
  animation: toastIn .3s cubic-bezier(0.16,1,0.3,1);
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 10px; color: var(--text); }
.modal-text { font-size: 13.5px; color: var(--text-muted-alt); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   TABS (ProntuÃ¡rio)
   ============================================================ */
.tabs-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 2px solid var(--border-soft);
  -ms-overflow-style: none;
  scrollbar-width: none;
  background: #FAFFFE;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 16px 20px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted-alt);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
}
.tab-btn:hover { color: var(--primary-dark); background: var(--primary-xlike, #F0FDF4); }
.tab-btn.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.tab-badge {
  background: var(--primary-lite);
  color: var(--primary-dark);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 700;
}
.tab-panel { display: none; padding: 28px; }
.tab-panel.active { display: block; }
.tab-footer {
  display: flex; justify-content: flex-end;
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
  margin-top: 22px;
}

/* ============================================================
   ANTECEDENTES
   ============================================================ */
.antecedentes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.antec-item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: border-color var(--transition);
}
.antec-item:hover { border-color: var(--primary); }
.antec-header { display: flex; align-items: center; justify-content: space-between; }
.antec-detail { margin-top: 12px; animation: slideDown .2s ease; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   EVA SLIDER
   ============================================================ */
.eva-slider-wrapper { display: flex; flex-direction: column; gap: 8px; }
.eva-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--primary) 0%, var(--border) 0%);
  outline: none;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition);
}
.eva-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,.45);
  cursor: pointer;
}
.eva-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,.45);
  cursor: pointer;
}
.eva-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted-alt); }
#eva-value { font-size: 24px; font-weight: 800; color: var(--primary-dark); text-align: center; }

/* ============================================================
   UPLOAD
   ============================================================ */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--text-muted-alt);
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-xlike, #F0FDF4);
  color: var(--primary-dark);
}
.upload-area svg { margin: 0 auto 12px; }
.upload-area p { font-size: 14px; margin-bottom: 4px; }
.upload-area small { font-size: 12px; }
.preview-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.preview-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--primary-lite);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--primary-dark);
}
.preview-item img { width: 36px; height: 36px; object-fit: cover; border-radius: var(--radius-xs); }

/* ============================================================
   IMAGE GALLERY
   ============================================================ */
.img-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.img-card {
  border-radius: var(--radius-sm);
  overflow: visible;
  cursor: grab;
  transition: transform var(--transition), box-shadow var(--transition);
}
.img-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.img-card:active { cursor: grabbing; }
.img-card.dragging { opacity: .5; transform: scale(.97); }
.img-card-inner {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--primary-xlike, #F0FDF4);
}
.img-card-inner img { width: 100%; height: 100%; object-fit: cover; }
.img-card-overlay {
  position: absolute; inset: 0;
  background: rgba(4,78,59,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity var(--transition);
}
.img-card:hover .img-card-overlay { opacity: 1; }
.btn-img-del, .btn-img-view {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: background var(--transition), transform var(--transition);
}
.btn-img-del  { background: var(--error); }
.btn-img-del:hover  { background: #dc2626; transform: scale(1.1); }
.btn-img-view { background: rgba(255,255,255,.25); }
.btn-img-view:hover { background: rgba(255,255,255,.4); transform: scale(1.1); }
.img-desc-input {
  width: 100%;
  border: 1.5px solid transparent;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 11px;
  padding: 5px 7px;
  color: var(--text-muted-alt);
  background: #F0FDF4;
  font-family: inherit;
  transition: border-color var(--transition);
  margin-top: 2px;
}
.img-desc-input:focus { outline: none; border-color: var(--primary); }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox-inner { position: relative; max-width: 90vw; max-height: 90vh; }
.lightbox-inner img { max-height: 88vh; border-radius: var(--radius); }
.lightbox-close {
  position: absolute; top: -18px; right: -18px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; line-height: 1;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-muted    { color: var(--text-muted-alt); }
.text-sm       { font-size: 12px; }
.text-success  { color: var(--primary-dark); }
.text-error    { color: var(--error); }
.mt-2  { margin-top: 8px; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-4  { margin-bottom: 16px; }
.m-0   { margin: 0; }
.p-0   { padding: 0; }
.gap-2 { gap: 8px; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* CSS spin para loading btn */
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVE â€” BREAKPOINTS
   ============================================================ */

/* â”€â”€ Tablet / Desktop MÃ©dio (< 1024px) â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .main-content { padding: 24px 24px 48px; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .col-span-3  { grid-column: span 2; }
  .antecedentes-grid { grid-template-columns: 1fr 1fr; }
}

/* â”€â”€ Tablet (< 768px) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 260px;
    --topbar-h: 60px;
  }

  /* Sidebar Mobile â€” hidden off-canvas */
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(4,120,87,.3);
  }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .topbar { padding: 0 18px; }
  .topbar-toggle { display: flex; }
  .main-content { padding: 20px 18px 48px; }

  /* Grids colapse */
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3, .col-span-full { grid-column: span 1; }
  .antecedentes-grid { grid-template-columns: 1fr; }
  .patients-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .img-gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  /* Page Header empilhado */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; justify-content: center; }

  /* Auth */
  .auth-card { padding: 32px 24px; }

  /* Tabs */
  .tab-btn { padding: 12px 14px; font-size: 12px; }

  /* Form footer */
  .form-footer { flex-direction: column-reverse; }
  .form-footer .btn { width: 100%; justify-content: center; }

  /* Modal */
  .modal { padding: 24px; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; justify-content: center; }

  /* Search bar */
  .search-bar { flex-direction: column; align-items: stretch; }
  .search-input-wrapper { max-width: 100%; }

  /* Table */
  .table { min-width: 420px; }
  .table th, .table td { padding: 10px 12px; }
}

/* â”€â”€ Mobile Pequeno (< 480px) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 480px) {
  body { font-size: 13.5px; }
  .stats-grid { grid-template-columns: 1fr; }
  .patient-card { flex-wrap: wrap; }
  .patient-actions { width: 100%; justify-content: flex-end; }
  .page-title { font-size: 18px; }
  .auth-card { padding: 28px 18px; }
  .toast { min-width: calc(100vw - 40px); max-width: calc(100vw - 40px); }
  .toast-container { left: 20px; right: 20px; bottom: 20px; }
  .modal { padding: 20px; }
  .tab-btn { padding: 11px 10px; font-size: 11px; }

  .btn-sm { padding: 5px 10px; font-size: 11.5px; }
  .table-wrapper { font-size: 12.5px; }
}

/* ============================================================
   Lightbox Premium â€” FisioSystem
============================================================ */
.fslb {
  position: fixed; inset: 0; z-index: 9999;
  display: none; flex-direction: column;
  background: rgba(5, 8, 18, 0.93);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .22s ease;
}
.fslb.open { opacity: 1; }

/* â”€â”€ Barra superior â”€â”€ */
.fslb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(255,255,255,.05);
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.fslb-counter {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.6);
  font-family: 'Inter', sans-serif;
  letter-spacing: .5px;
}
.fslb-actions { display: flex; align-items: center; gap: 6px; }

.fslb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none;
  background: rgba(255,255,255,.09);
  color: rgba(255,255,255,.85);
  border-radius: 9px;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.fslb-btn:hover { background: rgba(16,185,129,.35); color: #fff; }

.fslb-zoom-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  min-width: 42px;
  text-align: center;
  font-family: 'Inter', monospace;
}

/* â”€â”€ Stage (Ã¡rea da imagem) â”€â”€ */
.fslb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.fslb-img-wrap {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.fslb-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  transform-origin: center center;
  cursor: zoom-in;
  opacity: 0;
  transition: opacity .2s ease;
  user-select: none;
  -webkit-user-drag: none;
}

/* â”€â”€ BotÃµes de navegaÃ§Ã£o â”€â”€ */
.fslb-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  z-index: 10;
  width: 48px; height: 48px;
  border: none;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, transform .18s;
  backdrop-filter: blur(4px);
}
.fslb-nav:hover { background: rgba(16,185,129,.45); transform: translateY(-50%) scale(1.08); }
.fslb-prev { left: 16px; }
.fslb-next { right: 16px; }

/* â”€â”€ Legenda â”€â”€ */
.fslb-caption {
  text-align: center;
  padding: 8px 24px 4px;
  font-size: 13px;
  color: rgba(255,255,255,.55);
  font-family: 'Inter', sans-serif;
  min-height: 26px;
  flex-shrink: 0;
}

/* â”€â”€ Thumbnails â”€â”€ */
.fslb-thumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  overflow-x: auto;
  flex-shrink: 0;
  background: rgba(255,255,255,.04);
  border-top: 1px solid rgba(255,255,255,.07);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
}
.fslb-thumbs::-webkit-scrollbar { height: 4px; }
.fslb-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

.fslb-thumb {
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 7px;
  cursor: pointer;
  opacity: .45;
  border: 2px solid transparent;
  transition: opacity .18s, border-color .18s, transform .18s;
  flex-shrink: 0;
}
.fslb-thumb:hover { opacity: .75; transform: scale(1.05); }
.fslb-thumb.active {
  opacity: 1;
  border-color: #10B981;
  transform: scale(1.1);
  box-shadow: 0 0 0 2px rgba(16,185,129,.35);
}

/* Mobile */
@media (max-width: 600px) {
  .fslb-nav { width: 38px; height: 38px; }
  .fslb-prev { left: 8px; }
  .fslb-next { right: 8px; }
  .fslb-thumb { width: 44px; height: 44px; }
}


/* ----------------------------------------------
   Banner de Aviso de Vencimento de Licença
---------------------------------------------- */
.license-expiry-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-radius: 14px;
  margin-bottom: 20px;
  border: 1.5px solid;
  animation: licenseSlideDown .4s cubic-bezier(.21,1.02,.73,1) both;
}

/* Tom âmbar — aviso (2-5 dias) */
.license-expiry--warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #f59e0b;
  box-shadow: 0 4px 16px rgba(245,158,11,.15);
}

/* Tom vermelho — crítico (0-1 dias) */
.license-expiry--critical {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  border-color: #f43f5e;
  box-shadow: 0 4px 16px rgba(244,63,94,.18);
  animation: licenseSlideDown .4s cubic-bezier(.21,1.02,.73,1) both,
             licensePulse 2.5s ease-in-out infinite;
}

.license-expiry-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.license-expiry-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.license-expiry-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.license-expiry-msg strong {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
}
.license-expiry--critical .license-expiry-msg strong {
  color: #9f1239;
}

.license-expiry-msg span {
  font-size: 13px;
  color: #78350f;
  line-height: 1.45;
}
.license-expiry--critical .license-expiry-msg span {
  color: #881337;
}

.license-expiry-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform .18s, filter .18s, box-shadow .18s;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 4px 12px rgba(245,158,11,.35);
}
.license-expiry--critical .license-expiry-btn {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 4px 12px rgba(244,63,94,.35);
}
.license-expiry-btn:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
  box-shadow: 0 8px 20px rgba(245,158,11,.4);
}
.license-expiry--critical .license-expiry-btn:hover {
  box-shadow: 0 8px 20px rgba(244,63,94,.4);
}

@keyframes licenseSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes licensePulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(244,63,94,.18); }
  50%       { box-shadow: 0 4px 24px rgba(244,63,94,.38); }
}

/* Responsivo mobile */
@media (max-width: 600px) {
  .license-expiry-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .license-expiry-btn {
    width: 100%;
    justify-content: center;
  }
}
