/* =========================================================
   ASPIAM UI - CSS 
   - Login
   - Layout do App (Topbar, Sidebar, Conteúdo)
   - Dashboard
   - Agenda
   - Tabela (Pacientes, etc.)
   - Tema Claro / Escuro
   ========================================================= */

/* ------------------ VARIÁVEIS GERAIS ------------------ */
:root {
  --aspiam-primary: #00a48a;
  --aspiam-primary-dark: #00826d;
  --aspiam-primary-soft: #e6f8f4;

  --aspiam-bg-main: #f5f7f8;
  --aspiam-bg-soft: #edf4f4;
  --aspiam-border-soft: #d8e3e2;

  --aspiam-text-main: #1f2a2a;
  --aspiam-text-muted: #7b8c8b;

  --aspiam-radius-sm: 6px;
  --aspiam-radius-md: 10px;
  --aspiam-radius-lg: 14px;

  --aspiam-shadow-soft: 0 10px 30px rgba(8, 30, 30, 0.08);
}

/* Transições suaves em elementos principais */
body,
.aspiam-topbar,
.aspiam-sidebar,
.card,
.agenda-column,
.agenda-side-card,
.table-wrapper,
.table,
.agenda-slot-card,
.patient-row,
.task-item,
.input,
.select,
.agenda-textarea {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

/* Fonte global */
html, body {
  margin: 0;
  padding: 0;
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

/* -------------------------------------------------------
   LOGIN PAGE
   ------------------------------------------------------- */
body.login-page {
  min-height: 100vh;
  background: radial-gradient(circle at top, #00a48a 0, #00221c 35%, #020807 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-card {
  background: rgba(6, 18, 18, 0.95);
  border-radius: 18px;
  padding: 26px 24px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.login-logo img {
  height: 32px;
}

.login-logo span {
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}

.login-title {
  font-size: 1.4rem;
  margin: 0 0 4px;
}

.login-subtitle {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-group label {
  font-size: 0.8rem;
}

.input {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 8px 10px;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  outline: none;
}

.input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.login-footer {
  margin-top: 14px;
  font-size: 0.8rem;
  text-align: center;
}

.login-footer a {
  color: var(--aspiam-primary);
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* Botões (login e app usam os mesmos estilos base) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #ffffff;
  color: #0f2726;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--aspiam-primary);
  border-color: var(--aspiam-primary);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(0, 164, 138, 0.4);
}

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

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

.btn-outline:hover {
  background: rgba(0, 164, 138, 0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--aspiam-text-main);
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* -------------------------------------------------------
   APP LAYOUT (body.aspiam-theme)
   ------------------------------------------------------- */
body.aspiam-theme {
  background: var(--aspiam-bg-main);
  color: var(--aspiam-text-main);
  min-height: 100vh;
}

/* Topbar */
.aspiam-topbar {
  height: 64px;
  background: #009177;
  border-bottom: 1px solid #007260;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  color: #ffffff;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  height: 28px;
}

.topbar-product {
  font-weight: 600;
  color: #ffffff;
}

.topbar-section {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

.topbar-divider {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* botão icônico e hambúrguer */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-burger {
  width: 18px;
  height: 14px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
}

.menu-burger span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  transition: transform 0.25s ease, opacity 0.2s ease, background 0.25s ease;
}

/* animação do hambúrguer */
body.sidebar-is-open .menu-burger span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
body.sidebar-is-open .menu-burger span:nth-child(2) {
  opacity: 0;
}
body.sidebar-is-open .menu-burger span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}
body.sidebar-is-open .menu-burger span {
  background: #ffffff;
}

/* botão de tema na topbar */
.theme-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

body.theme-dark #themeToggleBtn {
  background: rgba(0, 164, 138, 0.18);
}

/* botão "Ajuda" na topbar */
.aspiam-topbar .btn-outline {
  border-color: rgba(255, 255, 255, 0.7);
  color: #ffffff;
}
.aspiam-topbar .btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* usuário na topbar */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-initials {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #ffffff;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #ffffff;
}

.user-role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Shell principal */
.aspiam-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

/* Sidebar */
.aspiam-sidebar {
  width: 240px;
  background: #ffffff;
  border-right: 1px solid #e5eaea;
  padding: 16px 12px;
  box-shadow: 0 10px 30px rgba(15, 44, 35, 0.12);
  transition:
    transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.25s ease;
  transform: translateX(0);
}

/* estado fechada */
.aspiam-sidebar.sidebar-closed {
  transform: translateX(-260px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

/* Conteúdo principal */
.aspiam-content {
  padding: 18px 20px 24px;
}

/* Títulos das seções / páginas */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.page-title {
  margin: 0;
  font-size: 1.2rem;
}

.page-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--aspiam-text-muted);
}

.page-actions {
  display: flex;
  gap: 8px;
}

/* Páginas (navegação interna) */
.page {
  display: none;
}

.page.page-active {
  display: block;
}

/* Navegação da sidebar */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--aspiam-text-muted);
  margin: 0 0 4px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--aspiam-text-main);
  font-size: 0.9rem;
  cursor: pointer;
  transform-origin: left center;
  transition:
    background 0.2s ease,
    transform 0.18s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}

.nav-item:hover {
  background: var(--aspiam-bg-soft);
  transform: translateX(4px) scale(1.03);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
}

.nav-item-active {
  background: var(--aspiam-primary);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(0, 164, 138, 0.26);
}

.nav-item-active .nav-label {
  font-weight: 500;
}

.nav-icon {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d5e0e0;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-item:hover .nav-icon {
  transform: scale(1.3);
  background: var(--aspiam-primary);
}

.nav-item-active .nav-icon {
  background: #ffffff;
  transform: scale(1.4);
}

/* Grid básico / cards */
.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.card {
  background: #ffffff;
  border-radius: var(--aspiam-radius-lg);
  padding: 12px 12px 10px;
  box-shadow: var(--aspiam-shadow-soft);
  border: 1px solid #e3eeee;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 500;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--aspiam-text-muted);
}

/* KPI no dashboard */
.kpi-value {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 4px;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--aspiam-text-muted);
}

/* Pills genéricas */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Dashboard - pills de status */
.pill-status-checkin {
  background: #e8fff4;
  color: #0f654a;
}
.pill-status-waiting {
  background: #fff9ee;
  color: #805925;
}
.pill-status-inservice {
  background: #eef3ff;
  color: #21407e;
}
.pill-status-billing {
  background: #f2f0ff;
  color: #4b33aa;
}

/* Dashboard - layout */
.dashboard-kpis .card {
  position: relative;
  overflow: hidden;
}

.dashboard-kpis .card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(0, 164, 138, 0.16), transparent 60%);
}

.dashboard-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.patient-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.patient-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--aspiam-radius-md);
  border: 1px solid #edf2f2;
  background: #f9fbfb;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.patient-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.03);
  background: #ffffff;
}

.patient-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--aspiam-bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--aspiam-primary-dark);
}

.patient-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.patient-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.patient-info {
  font-size: 0.78rem;
  color: var(--aspiam-text-muted);
}

.patient-status {
  display: flex;
  align-items: center;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.task-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--aspiam-radius-md);
  border: 1px solid #edf2f2;
  background: #f9fbfb;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.task-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.03);
  background: #ffffff;
  border-color: #dde8e8;
}

.task-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.task-title {
  font-size: 0.88rem;
}

.task-title strong {
  font-weight: 600;
}

.task-meta {
  font-size: 0.78rem;
  color: var(--aspiam-text-muted);
}

.task-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.task-priority {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.task-priority-high {
  background: #ffe4e4;
  border-color: #ffc2c2;
  color: #9b1c1c;
}

.task-priority-medium {
  background: #fff4dd;
  border-color: #ffe0a9;
  color: #7b4c11;
}

.task-priority-low {
  background: #edf5ff;
  border-color: #d3e4ff;
  color: #24457b;
}

/* -------------------------------------------------------
   AGENDA
   ------------------------------------------------------- */
.agenda-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.agenda-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
}

/* variações de status da agenda */
.pill-status-confirmed {
  background: #e8fff4;
  color: #0f654a;
}
.pill-status-pending {
  background: #fff9ee;
  color: #805925;
}
.pill-status-inservice {
  background: #eef3ff;
  color: #21407e;
}
.pill-status-done {
  background: #e9f7ff;
  color: #1a567a;
}
.pill-status-no-show {
  background: #ffe4e4;
  color: #9b1c1c;
}

/* layout principal da agenda */
.agenda-board {
  display: grid;
  grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 4px;
}

.agenda-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.agenda-column {
  background: #ffffff;
  border-radius: var(--aspiam-radius-lg);
  padding: 14px;
  box-shadow: var(--aspiam-shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agenda-column-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.agenda-prof-name {
  font-size: 0.95rem;
  font-weight: 500;
}

.agenda-prof-meta {
  font-size: 0.78rem;
  color: var(--aspiam-text-muted);
}

.agenda-prof-counter {
  font-size: 0.78rem;
  color: var(--aspiam-text-muted);
}

/* cards de horário (slots) */
.agenda-slot-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--aspiam-radius-md);
  border: 1px solid #edf2f2;
  background: #f9fbfb;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.agenda-slot-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.03);
  background: #ffffff;
  border-color: #dbe7e7;
}

.agenda-slot-time {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--aspiam-text-muted);
  margin-top: 2px;
}

.agenda-slot-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agenda-slot-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.agenda-patient-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.agenda-patient-free {
  color: var(--aspiam-text-muted);
  font-weight: 400;
  font-style: italic;
}

.agenda-slot-info {
  font-size: 0.78rem;
  color: var(--aspiam-text-muted);
}

.agenda-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

/* cores por tipo de slot (borda esquerda) */
.slot-confirmed {
  border-left: 3px solid #22c18d;
}
.slot-pending {
  border-left: 3px solid #f2a93b;
}
.slot-inservice {
  border-left: 3px solid #4b6bde;
}
.slot-done {
  border-left: 3px solid #4bb36b;
}
.slot-no-show {
  border-left: 3px solid #e86a6a;
}
.slot-free {
  border-left: 3px solid #c9d6d6;
}

/* painel lateral da agenda */
.agenda-sidepanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agenda-side-card {
  padding: 12px 12px 10px;
}

.agenda-free-list,
.agenda-delay-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agenda-free-list li,
.agenda-delay-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: var(--aspiam-radius-sm);
  background: #f8fbfb;
}

.agenda-free-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3ff;
  color: #21407e;
}

.delay-main {
  display: flex;
  flex-direction: column;
}

.delay-name {
  font-size: 0.82rem;
  font-weight: 500;
}

.delay-meta {
  font-size: 0.75rem;
  color: var(--aspiam-text-muted);
}

.delay-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ffe4e4;
  color: #9b1c1c;
}

/* modal da agenda */
.agenda-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 20, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.agenda-modal {
  width: 100%;
  max-width: 620px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
  padding: 16px 18px 14px;
  animation: agendaModalIn 0.18s ease-out;
}

.agenda-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.agenda-modal-header h2 {
  font-size: 1.1rem;
}

.agenda-modal-close {
  border: none;
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--aspiam-text-muted);
}

.agenda-modal-body {
  margin-top: 4px;
}

.agenda-textarea {
  border-radius: 12px;
  resize: vertical;
}

.agenda-modal-footer {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes agendaModalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* -------------------------------------------------------
   TABELA (Pacientes, Profissionais, Financeiro)
   ------------------------------------------------------- */
.table-wrapper {
  border-radius: var(--aspiam-radius-lg);
  border: 1px solid #e3eeee;
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--aspiam-shadow-soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.table thead {
  background: #f3f7f7;
}

.table th,
.table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #edf2f2;
}

.table th {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--aspiam-text-muted);
}

.table tbody tr:hover {
  background: #f8fbfb;
}

/* -------------------------------------------------------
   RESPONSIVO
   ------------------------------------------------------- */
@media (max-width: 1100px) {
  .agenda-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .aspiam-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    z-index: 20;
  }

  .aspiam-content {
    padding: 16px 14px 24px;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .agenda-board {
    grid-template-columns: minmax(0, 1fr);
  }

  .agenda-columns {
    grid-template-columns: 1fr;
  }

  .form-2col {
    grid-template-columns: 1fr !important;
  }

  .task-item {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .task-side {
    flex-direction: row;
    justify-content: flex-start;
  }
}

/* -------------------------------------------------------
   TEMA ESCURO
   ------------------------------------------------------- */
body.theme-dark {
  --aspiam-bg-soft: #081414;
  --aspiam-border-soft: #1f3332;
  --aspiam-text-main: #e7f5f3;
  --aspiam-text-muted: #8ca3a1;
  --aspiam-shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.75);
  background: #020605;
  color: var(--aspiam-text-main);
}

body.theme-dark .aspiam-topbar {
  background: #006b57;
  border-bottom-color: #004133;
  color: #ffffff;
}

body.theme-dark .topbar-section,
body.theme-dark .topbar-product,
body.theme-dark .topbar-divider,
body.theme-dark .user-name,
body.theme-dark .user-role {
  color: rgba(255, 255, 255, 0.9);
}

/* sidebar e conteúdo */
body.theme-dark .aspiam-sidebar {
  background: #050b0a;
  border-right-color: #162524;
}

body.theme-dark .aspiam-content {
  background: radial-gradient(circle at top left, #071716 0, #020605 45%);
}

/* cards / colunas / paineis */
body.theme-dark .card,
body.theme-dark .agenda-column,
body.theme-dark .agenda-side-card,
body.theme-dark .table-wrapper {
  background: #050b0a;
  border-color: #1f3332;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.8);
}

/* listas de linhas */
body.theme-dark .patient-row,
body.theme-dark .task-item,
body.theme-dark .agenda-slot-card,
body.theme-dark .agenda-free-list li,
body.theme-dark .agenda-delay-list li {
  background: #050b0a;
  border-color: #253837;
}

/* tabela */
body.theme-dark .table thead {
  background: #071716;
}

body.theme-dark .table tbody tr:hover {
  background: #081313;
}

/* inputs / selects / textarea */
body.theme-dark .input,
body.theme-dark .select,
body.theme-dark .agenda-textarea {
  background: #050b0a;
  border-color: #2a3f3e;
  color: var(--aspiam-text-main);
}

body.theme-dark .input::placeholder,
body.theme-dark .agenda-textarea::placeholder {
  color: #6f8583;
}

/* botões ghost no escuro */
body.theme-dark .btn-ghost {
  color: var(--aspiam-text-muted);
}

body.theme-dark .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* nav lateral no escuro */
body.theme-dark .nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
}

body.theme-dark .nav-item-active {
  background: var(--aspiam-primary-dark);
}

body.theme-dark .nav-icon {
  background: #2d4947;
}

/* modal da agenda no escuro */
body.theme-dark .agenda-modal {
  background: #050b0a;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

/* =========================================================
   PACIENTES - LISTAGEM
   ========================================================= */

.patients-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.patients-toolbar-left {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.patients-toolbar-right {
  display: flex;
  gap: 8px;
}

.patients-search {
  min-width: 280px;
}

.patients-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(280px, 0.9fr);
  gap: 12px;
}

.patients-main,
.patients-side {
  min-width: 0;
}

.patients-table-wrapper {
  overflow-x: auto;
}

.patient-table-person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.patient-mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--aspiam-primary-soft);
  color: var(--aspiam-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.patient-table-name {
  font-size: 0.88rem;
  font-weight: 600;
}

.patient-table-meta {
  font-size: 0.76rem;
  color: var(--aspiam-text-muted);
}

.patient-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.patient-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: #edf7f6;
  color: #11685b;
  border: 1px solid #d3ece8;
}

.patient-chip-soft {
  background: #f3f6fb;
  color: #4b5c84;
  border-color: #dde6f7;
}

.patient-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
}

.patient-badge-active {
  background: #e8fff4;
  color: #0f654a;
}

.patient-badge-pending {
  background: #fff4dd;
  color: #7b4c11;
}

.patient-badge-warning {
  background: #ffe4e4;
  color: #9b1c1c;
}

.patient-actions-inline {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.patients-alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.patients-alert-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: var(--aspiam-radius-md);
  background: #f8fbfb;
  border: 1px solid #edf2f2;
}

.patients-alert-title {
  font-size: 0.86rem;
  font-weight: 600;
}

.patients-alert-meta {
  font-size: 0.76rem;
  color: var(--aspiam-text-muted);
}

.patients-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* =========================================================
   PACIENTE - CADASTRO
   ========================================================= */

.patient-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(260px, 0.9fr);
  gap: 12px;
}

.patient-form-main,
.patient-form-side {
  min-width: 0;
}

.patient-form-grid {
  margin-top: 6px;
}

.form-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.patient-form-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.patient-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
}

.patient-check-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--aspiam-primary);
  flex-shrink: 0;
}

/* =========================================================
   PACIENTES / CADASTRO RESPONSIVO
   ========================================================= */

@media (max-width: 1100px) {
  .patients-layout,
  .patient-form-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .patients-search {
    min-width: 100%;
  }

  .form-2col {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   PACIENTES / CADASTRO - TEMA ESCURO
   ========================================================= */

body.theme-dark .patient-mini-avatar {
  background: rgba(0, 164, 138, 0.14);
  color: #8ef0dd;
}

body.theme-dark .patient-chip {
  background: #0a1b19;
  color: #9cefe1;
  border-color: #1f3332;
}

body.theme-dark .patient-chip-soft {
  background: #101821;
  color: #b7c7e9;
  border-color: #263345;
}

body.theme-dark .patients-alert-item {
  background: #050b0a;
  border-color: #253837;
}

/* ========================================================= */
/* ===================== AGENDA V2 ========================== */
/* ========================================================= */

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

.agenda-strip-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.agenda-day-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: #edf7f6;
  color: #11685b;
  border: 1px solid #d3ece8;
  font-size: 0.78rem;
  font-weight: 500;
}

.agenda-day-meta {
  font-size: 0.78rem;
  color: var(--aspiam-text-muted);
}

.agenda-strip-right {
  display: flex;
  gap: 6px;
}

.agenda-new-layout {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 280px;
  gap: 12px;
  align-items: start;
}

.agenda-time-column {
  display: grid;
  grid-template-rows: 64px repeat(8, 72px);
}

.agenda-time-head {
  border-bottom: 1px solid transparent;
}

.agenda-time {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--aspiam-text-muted);
  border-bottom: 1px solid #edf2f2;
}

.agenda-main-board {
  min-width: 0;
}

.agenda-grid-scroller {
  overflow-x: auto;
  padding-bottom: 4px;
}

.agenda-grid-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 10px;
  min-width: max-content;
}

.agenda-col {
  display: grid;
  grid-template-rows: 64px repeat(8, 72px);
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e3eeee;
  box-shadow: var(--aspiam-shadow-soft);
  overflow: hidden;
  min-width: 280px;
}

.agenda-col-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f2;
  background: linear-gradient(180deg, rgba(0,164,138,0.08), rgba(0,164,138,0.02));
}

.agenda-col-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.agenda-col-subtitle {
  font-size: 0.76rem;
  color: var(--aspiam-text-muted);
}

.agenda-slot {
  position: relative;
  border-bottom: 1px solid #edf2f2;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.01), rgba(0,0,0,0.00));
}

.agenda-slot:last-child {
  border-bottom: none;
}

.agenda-slot:empty:hover {
  background: rgba(0, 164, 138, 0.04);
  cursor: pointer;
}

.agenda-slot:empty::after {
  content: "+ Novo agendamento";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  color: rgba(0, 164, 138, 0);
  transition: color 0.18s ease;
  pointer-events: none;
}

.agenda-slot:empty:hover::after {
  color: rgba(0, 164, 138, 0.85);
}

.agenda-card {
  position: absolute;
  inset: 6px;
  border-radius: 10px;
  padding: 8px 9px;
  font-size: 0.76rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: grab;
  border: 1px solid transparent;
  box-shadow: 0 8px 18px rgba(0,0,0,0.04);
}

.agenda-card:active {
  cursor: grabbing;
}

.agenda-card strong {
  font-size: 0.82rem;
  line-height: 1.1;
}

.agenda-card span {
  color: #38504d;
  line-height: 1.15;
}

.agenda-card small {
  color: #5c716f;
  font-size: 0.7rem;
}

.agenda-card.confirmed {
  background: #e8fff4;
  border-color: #bfead8;
}

.agenda-card.waiting {
  background: #fff4dd;
  border-color: #f4d394;
}

.agenda-card.late {
  background: #ffe4e4;
  border-color: #f1b2b2;
}

.agenda-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agenda-queue {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fbfb;
  border: 1px solid #edf2f2;
  font-size: 0.78rem;
}

.queue-item strong {
  font-size: 0.82rem;
}

.queue-item span {
  color: var(--aspiam-text-muted);
}

.queue-item-alert {
  background: #fff1f1;
  border-color: #ffd0d0;
}

.queue-item-alert span,
.queue-item-alert strong {
  color: #a52c2c;
}

.agenda-priority-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(0,164,138,0.08), rgba(0,164,138,0.02));
  border: 1px solid #d7eeea;
}

.agenda-priority-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.agenda-priority-meta {
  font-size: 0.76rem;
  color: var(--aspiam-text-muted);
}

/* Dark mode da agenda v2 */
body.theme-dark .agenda-day-chip {
  background: #0a1b19;
  color: #9cefe1;
  border-color: #1f3332;
}

body.theme-dark .agenda-col {
  background: #050b0a;
  border-color: #1f3332;
}

body.theme-dark .agenda-col-header {
  background: linear-gradient(180deg, rgba(0,164,138,0.12), rgba(0,164,138,0.03));
  border-bottom-color: #1f3332;
}

body.theme-dark .agenda-time {
  border-bottom-color: #1f3332;
}

body.theme-dark .agenda-slot {
  border-bottom-color: #1f3332;
}

body.theme-dark .agenda-slot:empty:hover {
  background: rgba(0, 164, 138, 0.08);
}

body.theme-dark .agenda-card span,
body.theme-dark .agenda-card small {
  color: #b7c7c5;
}

body.theme-dark .queue-item {
  background: #050b0a;
  border-color: #253837;
}

body.theme-dark .agenda-priority-box {
  background: linear-gradient(180deg, rgba(0,164,138,0.12), rgba(0,164,138,0.03));
  border-color: #1f3332;
}

@media (max-width: 1200px) {
  .agenda-new-layout {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .agenda-side {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .agenda-header-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .agenda-new-layout {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .agenda-grid-track {
    grid-auto-columns: minmax(240px, 1fr);
  }

  .agenda-col {
    min-width: 240px;
  }
}

.queue-item.alert {
  color: red;
}


/* =========================================================
   ASPIAM — Base responsiva (desktop, notebook, tablet, celular)
   A largura útil acompanha a janela, não a resolução física.
   ========================================================= */
*,*::before,*::after {box-sizing:border-box;}
html,body {max-width:100%;}
body.aspiam-theme {min-width:0;}
.aspiam-topbar {width:100%;max-width:100%;gap:12px;}
.topbar-left,.topbar-right,.topbar-user {min-width:0;}
.user-info {min-width:0;}
.user-name,.user-role,.topbar-section {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.user-name {max-width:clamp(120px,14vw,280px);}
.topbar-context{min-width:0;max-width:480px;flex:1 1 240px;display:grid;gap:2px;padding:4px 12px;border-left:1px solid rgba(255,255,255,.25);font-size:.75rem;line-height:1.4;}
.topbar-context-row{display:flex;align-items:baseline;gap:8px;min-width:0;}
.topbar-context-label{flex:0 0 54px;font-size:.65rem;color:rgba(255,255,255,.8);}
.topbar-context-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#fff;font-weight:500;}
.aspiam-shell {width:100%;min-width:0;grid-template-columns:240px minmax(0,1fr);}
body:not(.sidebar-is-open) .aspiam-shell {grid-template-columns:0 minmax(0,1fr);}
.aspiam-sidebar {box-sizing:border-box;width:240px;min-width:240px;}
.aspiam-content {width:100%;max-width:100%;min-width:0;padding:clamp(12px,1.5vw,32px);}
.aspiam-content>section,.aspiam-content>.page {min-width:0;max-width:2200px;width:100%;margin-inline:auto;}
.page-header {flex-wrap:wrap;}
.page-header>div,.page-actions {min-width:0;}
.page-actions {flex-wrap:wrap;}
.grid-2,.grid-3,.patient-form-layout,.patients-layout {min-width:0;}
.card,.table-wrapper,.page-body {min-width:0;max-width:100%;}
.table-wrapper {overflow-x:auto;}
input,select,textarea {max-width:100%;}
@media(max-width:1100px){
 .topbar-right{gap:7px;}
 .aspiam-topbar{padding-inline:14px;}
}
@media(max-width:900px){
 .aspiam-shell,body.sidebar-is-open .aspiam-shell,body:not(.sidebar-is-open) .aspiam-shell {grid-template-columns:minmax(0,1fr);}
 .aspiam-sidebar{position:fixed;top:64px;bottom:0;left:0;z-index:40;max-height:calc(100dvh - 64px);overflow-y:auto;}
 .aspiam-content{padding:clamp(10px,2.2vw,18px);}
 .topbar-user .user-info{display:none;}
 .topbar-section{max-width:28vw;}
 .aspiam-topbar{height:108px;flex-wrap:wrap;align-content:center;row-gap:4px;}
 .topbar-context{order:3;flex:0 0 100%;max-width:100%;height:40px;padding:2px 0 0;border-left:0;border-top:1px solid rgba(255,255,255,.2);font-size:.72rem;}
 .aspiam-sidebar{top:108px;max-height:calc(100dvh - 108px);}
 .aspiam-shell{min-height:calc(100dvh - 108px);}
}
@media(max-width:600px){
 .aspiam-topbar{padding-inline:9px;gap:5px;}
 .topbar-left,.topbar-right{gap:5px;}
 .topbar-logo{height:24px;}
 .topbar-product,.topbar-divider{display:none;}
 .topbar-section{max-width:27vw;font-size:.78rem;}
 .topbar-user .avatar-initials{width:28px;height:28px;font-size:.72rem;}
 .aspiam-content{padding:10px 8px 16px;}
 .page-header{align-items:stretch;}
 .page-actions{width:100%;}
 .page-title{font-size:1.1rem;}
 .aspiam-shell{min-height:calc(100dvh - 108px);}
}
