/* ==========================================================================
   VetDay — Sistema Veterinário SaaS
   Estilo principal: layout moderno, premium, inspirado em Stripe/Linear/Notion
   ========================================================================== */

:root {
  --color-primary: #2D7DFD;
  --color-primary-dark: #1E63D6;
  --color-primary-light: #E8F1FF;
  --color-secondary: #0EA5E9;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-info: #06B6D4;

  --color-bg: #F5F7FB;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F8FAFC;
  --color-border: #E5E9F0;
  --color-text: #0F172A;
  --color-text-muted: #64748B;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.08);

  --sidebar-width: 270px;
  --topbar-height: 64px;
  --shell-gap: 12px;

  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-bs-theme="dark"] {
  --color-bg: #0B1220;
  --color-surface: #111B2E;
  --color-surface-alt: #0F1A2D;
  --color-border: #1F2A3F;
  --color-text: #E2E8F0;
  --color-text-muted: #94A3B8;
  --color-primary-light: rgba(45, 125, 253, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
}

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  transition: all .18s ease;
}
.btn-lg { padding: 0.85rem 1.4rem; border-radius: var(--radius); }
.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 8px 24px rgba(45, 125, 253, 0.25);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1px);
}
.btn-outline-primary { color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline-primary:hover { background: var(--color-primary); }

.btn-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text);
}
.btn-icon:hover { background: var(--color-surface-alt); border-color: var(--color-border); }

.brand-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  border-radius: 12px;
  font-size: 1.1rem;
  box-shadow: 0 10px 25px rgba(45, 125, 253, 0.35);
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

/* Palavra-marca: Vet (preto) + Day (azul primário) */
.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-wordmark-vet {
  color: #0f172a;
}

.brand-wordmark-day {
  color: var(--color-primary, #2d7dfd);
}

[data-bs-theme="dark"] .brand-wordmark-vet {
  color: var(--color-text, #f1f5f9);
}

.brand-wordmark--inline {
  font-size: 1.15rem;
}

.brand-wordmark--lg {
  font-size: 1.35rem;
}

.public-navbar .brand-wordmark--inline {
  font-size: 1.2rem;
}

.site-footer .brand-wordmark--inline {
  font-size: 1.05rem;
}

.brand-logo {
  display: block;
  flex-shrink: 0;
}

.brand-logo--mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(45, 125, 253, 0.28);
  flex-shrink: 0;
}

.brand-logo--full {
  height: 36px;
  width: auto;
  max-width: min(180px, 42vw);
}

/* ---------- Public navbar / footer ---------- */
.public-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  padding: var(--shell-gap, 12px) 0 0;
  background: transparent;
  border-bottom: none;
  justify-content: center;
}
/* Bootstrap aplica space-between no .container interno — centralizar a pílula */
.navbar.public-navbar > .container.public-navbar-shell {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.public-navbar-shell {
  display: flex;
  justify-content: center;
  align-items: center;
}
.public-navbar-pill {
  max-width: 100%;
}
.public-navbar-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding-inline: 0.25rem 0.35rem;
}
.public-navbar .brand-logo--full {
  height: 30px;
}
.public-navbar .navbar-toggler {
  border-radius: 12px;
  border-color: var(--color-border);
  padding: 0.35rem 0.55rem;
  flex-shrink: 0;
}
.public-navbar-menu.navbar-collapse {
  flex-grow: 0;
}
.public-navbar .nav-link {
  color: var(--color-text);
  font-weight: 500;
}
.public-navbar .nav-link:hover { color: var(--color-primary); }

.public-footer {
  background: var(--color-surface);
  padding: 3rem 0 1.5rem;
  border-top: 1px solid var(--color-border);
  margin-top: 4rem;
}
.public-footer a { color: var(--color-text-muted); }
.public-footer a:hover { color: var(--color-primary); }

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

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  transition: transform .25s ease, width .2s ease, box-shadow .2s ease;
  min-height: 0;
  overflow: hidden;
}

@media (min-width: 992px) {
  .app-sidebar {
    overflow: visible;
  }
}

/* margin-left padrão — desktop flutuante sobrescreve em sidebar.css */
.app-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.app-main {
  margin-left: 0;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Sidebar brand / toggle: ver sidebar.css */

.sidebar-nav {
  padding: 0.75rem 0.85rem 0.5rem;
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.18) transparent;
}
.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
}
.nav-section-title {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  margin: 0.85rem 0.7rem 0.4rem;
}
.nav-section-title:first-child {
  margin-top: 0;
}
.sidebar-nav .nav-item span {
  flex: 1;
}

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  color: var(--color-text-muted);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 0.2rem;
  transition: all .15s ease;
}
.sidebar-nav .nav-item i {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  width: 22px;
  text-align: center;
}
.sidebar-nav .nav-item:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}
.sidebar-nav .nav-item.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.sidebar-nav .nav-item.active i { color: var(--color-primary); }

.sidebar-footer {
  padding: 0 1rem 1.25rem;
  flex-shrink: 0;
}

.sidebar-footer .card-soft {
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

/* Sidebar recolhida: ver sidebar.css */

/* Overlay mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1035;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  border: none;
  padding: 0;
  cursor: pointer;
}
.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: var(--shell-gap, 12px) var(--shell-gap, 12px) 0;
  background: transparent;
  border-bottom: none;
  height: auto;
  min-height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
  padding: 0.35rem 0.5rem 0.35rem 0.35rem;
  margin-inline: auto;
  max-width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.topbar-pill .btn-topbar-menu {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.topbar-pill .btn-topbar-menu:hover,
.topbar-pill .btn-topbar-menu:focus-visible {
  background: var(--color-primary-light);
  border-color: rgba(45, 125, 253, 0.35);
  color: var(--color-primary);
}

.topbar-pill-sep--menu {
  margin-inline: 0.1rem 0.15rem;
}

.topbar-pill-sep {
  width: 1px;
  height: 28px;
  background: var(--color-border);
  margin-inline: 0.25rem;
  flex-shrink: 0;
}

.topbar-pill .btn-user {
  border-radius: 999px;
  padding: 0.2rem 0.45rem 0.2rem 0.2rem;
}
.topbar-pill .btn-user:hover {
  background: var(--glass-nav-hover, var(--color-surface-alt));
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 1;
  min-width: 0;
  overflow: visible;
}

.topbar-actions .btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
}

.topbar-actions .clinic-switcher,
.topbar-actions .user-menu {
  flex-shrink: 0;
}

.topbar-pill .btn-outline-secondary {
  border-radius: 999px;
  border-color: transparent;
  background: transparent;
  color: var(--color-text);
}
.topbar-pill .btn-outline-secondary:hover,
.topbar-pill .btn-outline-secondary:focus,
.topbar-pill .btn-outline-secondary.show,
.topbar-pill .btn-outline-secondary:active,
.topbar-pill .btn-outline-secondary[aria-expanded="true"] {
  background: var(--glass-nav-hover, var(--color-surface-alt));
  border-color: transparent;
  color: var(--color-text);
  box-shadow: none;
}
.topbar-pill .clinic-switcher .dropdown-toggle.show,
.topbar-pill .clinic-switcher .dropdown-toggle[aria-expanded="true"] {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.topbar-pill .clinic-switcher .dropdown-toggle i {
  color: inherit;
}

.topbar-actions .btn-primary.btn-sm {
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  font-weight: 600;
}
.btn-user {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.3rem 0.5rem;
}
.btn-user:hover { background: var(--color-surface-alt); border-color: var(--color-border); }
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.notification-dot {
  position: absolute; top: 8px; right: 8px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-danger); border: 2px solid var(--color-surface);
}
.notification-menu { width: 320px; }
.notification-item {
  display: flex; gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
.notification-item:last-child { border-bottom: none; }
.notification-item i { font-size: 1.4rem; }

/* padding e max-width: ver responsive.css */

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.page-title { font-weight: 700; font-size: 1.6rem; margin: 0; color: var(--color-text); }
.page-subtitle { color: var(--color-text-muted); margin: 0; }

/* ---------- KPI Cards ---------- */
.kpi-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, var(--color-primary-light) 0%, transparent 65%);
  opacity: 0.6;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-card .kpi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 1.3rem;
  margin-bottom: 0.6rem;
}
.kpi-card.success .kpi-icon { background: rgba(16,185,129,.12); color: var(--color-success); }
.kpi-card.warning .kpi-icon { background: rgba(245,158,11,.14); color: var(--color-warning); }
.kpi-card.danger  .kpi-icon { background: rgba(239,68,68,.14); color: var(--color-danger); }
.kpi-card.info    .kpi-icon { background: rgba(6,182,212,.14); color: var(--color-info); }
.kpi-card .kpi-label { color: var(--color-text-muted); font-size: 0.85rem; font-weight: 500; }
.kpi-card .kpi-value { font-size: 1.65rem; font-weight: 700; line-height: 1.2; margin-top: 0.25rem; }
.kpi-card .kpi-extra { color: var(--color-text-muted); font-size: 0.78rem; margin-top: 0.45rem; }

/* KPI Card v2 (com sparkline + delta) */
.kpi-card .kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 0.5rem; position: relative; z-index: 1; }
.kpi-card .kpi-head .kpi-icon { margin-bottom: 0; }
.kpi-card .kpi-delta {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(100,116,139,.12);
  color: var(--color-text-muted);
}
.kpi-card .kpi-delta-up { background: rgba(16,185,129,.14); color: var(--color-success); }
.kpi-card .kpi-delta-down { background: rgba(239,68,68,.14); color: var(--color-danger); }
.kpi-card .kpi-sparkline {
  margin-top: 0.6rem;
  height: 42px;
  position: relative;
  z-index: 1;
}
.kpi-primary .kpi-icon { background: var(--color-primary-light); color: var(--color-primary); }
.kpi-success .kpi-icon { background: rgba(16,185,129,.14); color: var(--color-success); }
.kpi-warning .kpi-icon { background: rgba(245,158,11,.18); color: var(--color-warning); }
.kpi-danger  .kpi-icon { background: rgba(239,68,68,.16);  color: var(--color-danger); }
.kpi-info    .kpi-icon { background: rgba(6,182,212,.16);  color: var(--color-info); }
.kpi-secondary .kpi-icon { background: rgba(100,116,139,.14); color: var(--color-text-muted); }

/* ---------- Dashboard sub-nav ---------- */
.dash-tabs {
  display: flex; flex-wrap: wrap; gap: .5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .35rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}
.dash-tabs a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .55rem .95rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: all .15s ease;
}
.dash-tabs a:hover { background: var(--color-surface-alt); color: var(--color-text); }
.dash-tabs a.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  box-shadow: 0 8px 20px rgba(45,125,253,.25);
}

/* ---------- Alert items ---------- */
.alert-card {
  display: flex; align-items: center; gap: 12px;
  padding: .9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  text-decoration: none; color: inherit;
  transition: all .18s ease;
}
.alert-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.alert-card .alert-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  background: var(--color-primary-light);
  color: var(--color-primary);
  flex-shrink: 0;
}
.alert-card .alert-title { font-weight: 600; line-height: 1.2; }
.alert-card .alert-value { font-size: 1.25rem; font-weight: 700; color: var(--color-primary); margin-left: auto; }
.alert-card.priority-high .alert-icon { background: rgba(239,68,68,.14); color: var(--color-danger); }
.alert-card.priority-high { border-color: rgba(239,68,68,.4); }
.alert-card.priority-medium .alert-icon { background: rgba(245,158,11,.18); color: var(--color-warning); }
.alert-card.priority-low .alert-icon { background: rgba(6,182,212,.18); color: var(--color-info); }

/* ---------- Mini stat row (avg/total rows) ---------- */
.mini-stat {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
.mini-stat:last-child { border-bottom: none; }
.mini-stat .label { color: var(--color-text-muted); font-size: .85rem; }
.mini-stat .value { font-weight: 700; font-size: 1.05rem; }

/* ---------- Skeleton loaders ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-alt) 0%, var(--color-border) 50%, var(--color-surface-alt) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 8px;
}
.skeleton-line { height: 12px; margin: 6px 0; }
.skeleton-block { height: 240px; }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* DataTables: ver tables.css */

/* ---------- Report card on index ---------- */
.report-card {
  display: block;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  transition: all .2s ease;
  height: 100%;
}
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--color-primary); }
.report-card .report-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  background: var(--color-primary-light);
  color: var(--color-primary);
  margin-bottom: .7rem;
}
.report-card .report-title { font-weight: 700; font-size: 1.02rem; }
.report-card .report-desc { color: var(--color-text-muted); font-size: .86rem; margin-top: .2rem; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}
.filter-bar label { font-weight: 600; font-size: .78rem; color: var(--color-text-muted); margin-bottom: .25rem; display: block; text-transform: uppercase; letter-spacing: .06em; }
.filter-bar .filter-actions { display: flex; gap: .5rem; align-items: end; }

/* ---------- Empty state ---------- */
.empty-state { padding: 2rem 1rem; text-align: center; color: var(--color-text-muted); }
.empty-state i { font-size: 2rem; opacity: 0.6; display: block; margin-bottom: .5rem; }

/* ---------- Chart wrap ---------- */
.chart-card .card-body { padding: 1rem 1.25rem 1.5rem; }
.chart-card .chart-host { min-height: 280px; }
.chart-card-mini { min-height: 140px; }

/* ---------- Cards ---------- */
.card-soft {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-soft .card-header {
  background: transparent;
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
}
.card-soft .card-header h2,
.card-soft .card-header h3,
.card-soft .card-header h5 { font-size: 1.02rem; margin: 0; font-weight: 600; }
.card-soft .card-body { padding: 1.25rem; }

/* Tabelas: ver tables.css */

.badge-soft {
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.78rem;
}
.badge-soft-success { background: rgba(16,185,129,.14); color: var(--color-success); }
.badge-soft-warning { background: rgba(245,158,11,.14); color: var(--color-warning); }
.badge-soft-danger  { background: rgba(239,68,68,.14); color: var(--color-danger); }
.badge-soft-info    { background: rgba(6,182,212,.14); color: var(--color-info); }
.badge-soft-secondary { background: rgba(100,116,139,.16); color: var(--color-text-muted); }
.badge-soft-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-soft-dark    { background: rgba(15,23,42,.12); color: var(--color-text); }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  padding: 0.6rem 0.85rem;
  background: var(--color-surface);
  color: var(--color-text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(45,125,253,.15);
}
.form-label { font-weight: 500; color: var(--color-text); margin-bottom: 0.4rem; }

/* ---------- Landing page ---------- */
.hero {
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 920px; height: 920px;
  background: radial-gradient(circle, var(--color-primary-light) 0%, transparent 60%);
  z-index: -1;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}
.hero h1 {
  font-size: clamp(2.2rem, 4.2vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
}
.hero-lead { font-size: 1.15rem; color: var(--color-text-muted); }
.feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  height: 100%;
  transition: all .2s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-card .feature-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.plan-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  transition: all .25s ease;
  height: 100%;
}
.plan-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.plan-card.featured {
  border-color: var(--color-primary);
  background: linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-surface) 35%);
  box-shadow: 0 24px 60px rgba(45,125,253,.18);
}
.plan-card .plan-price {
  font-size: 2.5rem; font-weight: 800;
  display: flex; align-items: baseline; gap: 0.3rem;
}
.plan-card .plan-price .currency { font-size: 1rem; color: var(--color-text-muted); }
.plan-card .plan-price small { font-size: 0.95rem; color: var(--color-text-muted); font-weight: 500; }
.plan-card ul { list-style: none; padding: 0; }
.plan-card ul li {
  display: flex; gap: 0.5rem; align-items: flex-start;
  margin-bottom: 0.6rem; color: var(--color-text);
}
.plan-card ul li i { color: var(--color-success); margin-top: 3px; }
.plan-card .plan-badge {
  position: absolute; top: -14px; right: 20px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  font-size: 0.78rem; font-weight: 700;
  padding: 0.4rem 0.85rem; border-radius: 999px;
}

/* Seletor mensal / anual (planos) */
.billing-cycle-picker-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.billing-cycle-picker {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 4px;
  gap: 4px;
  max-width: 100%;
  border-radius: 999px;
  background: var(--glass-field-bg, rgba(116, 130, 162, 0.14));
  border: 1px solid var(--glass-field-border, rgba(15, 23, 42, 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.billing-cycle-picker__btn {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}

.billing-cycle-picker__btn:hover {
  color: var(--color-text);
}

.billing-cycle-picker__btn.is-active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.billing-cycle-picker__badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-success);
  background: rgba(16, 185, 129, 0.14);
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

@media (max-width: 575.98px) {
  .billing-cycle-picker {
    border-radius: 16px;
    width: 100%;
    padding: 5px;
  }

  .billing-cycle-picker__btn {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
    white-space: normal;
    text-align: center;
    font-size: 0.8rem;
    padding: 0.5rem 0.65rem;
  }
}

@supports ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
  .billing-cycle-picker {
    background: var(--glass-bar-bg, rgba(255, 255, 255, 0.62));
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    backdrop-filter: blur(12px) saturate(160%);
  }

  .billing-cycle-picker__btn.is-active {
    background: var(--glass-bg-strong, rgba(255, 255, 255, 0.88));
  }
}

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0.7rem;
  width: 2px;
  background: var(--color-border);
}
.timeline-item {
  position: relative;
  padding: 0 0 1.4rem 1.2rem;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -0.35rem; top: 0.25rem;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

/* ---------- Misc ---------- */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--color-text-muted);
}
.empty-state i {
  font-size: 3rem;
  color: var(--color-primary);
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--color-surface-alt) 0%, #eef2f7 50%, var(--color-surface-alt) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% {background-position: 200% 0;} 100% {background-position: -200% 0;} }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-110%);
    width: min(280px, calc(100vw - var(--shell-gap) * 2));
    box-shadow: none;
    border-radius: var(--sidebar-float-radius, 20px);
  }
  .app-sidebar.show {
    transform: translateX(0);
    top: var(--shell-gap);
    left: var(--shell-gap);
    bottom: var(--shell-gap);
    height: auto;
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.is-collapsed {
    width: min(280px, calc(100vw - var(--shell-gap) * 2));
  }
  .app-main { margin-left: 0 !important; }
  .app-column { margin-left: 0 !important; }
  /* padding: responsive.css */
  .sidebar-rail-toggle { display: none !important; }
  .sidebar-brand {
    padding: 1rem 1.25rem;
  }

  .topbar {
    padding: 0.5rem var(--shell-gap) 0;
  }

  .topbar-pill {
    border-radius: 999px;
    max-width: calc(100vw - var(--shell-gap) * 2);
    padding: 0.3rem 0.4rem 0.3rem 0.3rem;
  }

  .topbar-pill-label--clinic {
    max-width: 5.5rem;
  }
}

@media (max-width: 575.98px) {
  .topbar-pill-label--clinic {
    max-width: 4.25rem;
  }

  .clinic-switcher-btn {
    padding-inline: 0.45rem !important;
  }
}

@media (min-width: 992px) {
  .sidebar-overlay { display: none !important; }

  .topbar-pill .dropdown-menu,
  .topbar-dropdown-menu {
    width: auto !important;
    min-width: 260px;
    max-width: none;
    margin-inline: 0;
  }
}

.clinic-switcher .dropdown-toggle { max-width: 220px; }
.clinic-switcher .dropdown-menu,
.topbar-dropdown-menu {
  min-width: 260px;
  z-index: 1080;
}

@media (max-width: 991.98px) {
  .topbar-pill .dropdown-menu,
  .topbar-dropdown-menu {
    width: min(320px, calc(100vw - 1.5rem)) !important;
    min-width: min(280px, calc(100vw - 1.5rem)) !important;
    max-width: min(320px, calc(100vw - 1.5rem)) !important;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    margin-inline: auto;
  }

  .topbar-pill .clinic-switcher .dropdown-menu {
    min-width: min(280px, calc(100vw - 1.5rem)) !important;
  }

  /* Reforço quando o JS centraliza via Popper */
  .topbar-dropdown-menu.is-mobile-centered {
    transform: none !important;
    inset: auto !important;
  }
}

.dropdown-menu { border-radius: 12px; border-color: var(--color-border); box-shadow: var(--shadow-lg); }
.dropdown-item { padding: 0.55rem 1rem; font-weight: 500; color: var(--color-text); }
.dropdown-item:hover { background: var(--color-surface-alt); color: var(--color-text); }
.dropdown-item.active { background: var(--color-primary); color: #fff; }

/* Pagination */
.pagination .page-link {
  border-radius: 8px;
  margin: 0 2px;
  border-color: var(--color-border);
  color: var(--color-text-muted);
  font-weight: 500;
}
.pagination .page-item.active .page-link {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

/* Toasts and alerts polish */
.alert { border-radius: var(--radius); border: 1px solid transparent; }

/* Tooltips */
.cell-actions { display: inline-flex; gap: 0.25rem; }
.cell-actions .btn-sm { padding: 0.3rem 0.55rem; }

/* Animations utility */
.fade-in { animation: fadeIn .3s ease both; }
@keyframes fadeIn { from {opacity: 0; transform: translateY(6px);} to {opacity: 1; transform: none;} }

/* Command palette — estilos globais (não depender de workspace.css por página) */
.command-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(6px);
  z-index: 1060;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 1rem 1rem;
}
.command-palette-backdrop[hidden] {
  display: none !important;
}
.command-palette-backdrop.show {
  display: flex;
}

.command-palette {
  width: min(560px, 100%);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.command-palette-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  font-size: 1rem;
  background: transparent;
  color: var(--color-text);
  outline: none;
}
.command-palette-results { max-height: 320px; overflow-y: auto; }
.command-palette-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  text-decoration: none;
  color: var(--color-text);
  transition: background .1s ease;
}
.command-palette-item:hover,
.command-palette-item.active { background: var(--color-primary-light); }
.command-palette-item i {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--color-surface-alt);
  color: var(--color-primary);
}

/* Drawer global — estilos base (não depender de workspace.css por página) */
.app-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .4);
  backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.app-drawer-backdrop[hidden] {
  display: none !important;
}
.app-drawer-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.app-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(480px, 100vw);
  height: 100vh;
  background: var(--color-surface);
  box-shadow: -8px 0 40px rgba(15, 23, 42, .15);
  z-index: 1050;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
}
.app-drawer[hidden] {
  display: none !important;
}
.app-drawer.show {
  transform: translateX(0);
}

.app-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}
.app-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}
.drawer-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-border);
}
.drawer-section:last-child { border-bottom: none; }
