/* =========================================================
   Acolhe Demo — Dashboard Design System
   Paleta: azul corporativo · cinza neutro · branco
   Tipografia: DM Sans (sem serifa)
   ========================================================= */

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul, ol { list-style: none; }

/* ─── Design Tokens ─────────────────────────────────────── */
:root {
  /* Cores primárias */
  --d-blue:       #2563EB;
  --d-blue-dk:    #1D4ED8;
  --d-blue-lt:    #EFF6FF;
  --d-navy:       #1E3A5F;
  --d-navy-soft:  #2A4F7A;

  /* Tons neutros */
  --d-bg:         #F3F4F6;
  --d-surface:    #FFFFFF;
  --d-border:     #E5E7EB;
  --d-border-dk:  #D1D5DB;

  /* Texto */
  --d-text:       #111827;
  --d-text-2:     #374151;
  --d-text-muted: #6B7280;
  --d-text-faint: #9CA3AF;

  /* Status */
  --d-green:      #059669;
  --d-green-lt:   #D1FAE5;
  --d-amber:      #D97706;
  --d-amber-lt:   #FEF3C7;
  --d-red:        #DC2626;
  --d-red-lt:     #FEE2E2;
  --d-purple:     #7C3AED;
  --d-purple-lt:  #EDE9FE;

  /* Acento terracota (consistência com landing) */
  --d-accent:     #C1604A;
  --d-accent-lt:  #FEF0ED;

  /* Tipografia */
  --d-font: 'DM Sans', system-ui, -apple-system, sans-serif;

  /* Escala de texto */
  --d-xs:   0.75rem;
  --d-sm:   0.875rem;
  --d-base: 1rem;
  --d-lg:   1.125rem;
  --d-xl:   1.25rem;
  --d-2xl:  1.5rem;
  --d-3xl:  1.875rem;

  /* Espaços */
  --d-1: 0.25rem;
  --d-2: 0.5rem;
  --d-3: 0.75rem;
  --d-4: 1rem;
  --d-5: 1.25rem;
  --d-6: 1.5rem;
  --d-8: 2rem;
  --d-10: 2.5rem;
  --d-12: 3rem;

  /* Layout */
  --sidebar-w:  240px;
  --topbar-h:   64px;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  18px;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.08);
  --shadow-md: 0 8px 24px rgba(0,0,0,.1);

  /* Transição */
  --t: 0.2s ease;
}

/* ─── Base ───────────────────────────────────────────────── */
body {
  font-family: var(--d-font);
  font-size: var(--d-base);
  color: var(--d-text);
  background: var(--d-bg);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ─── Shell (sidebar + conteúdo) ─────────────────────────── */
.dash-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--d-navy);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform var(--t);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--d-3);
  padding: var(--d-6) var(--d-5);
  font-size: var(--d-lg);
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-logo svg { flex-shrink: 0; }

.sidebar-section {
  padding: var(--d-5) var(--d-3);
  flex: 1;
}
.sidebar-section-label {
  font-size: var(--d-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: var(--d-2) var(--d-3);
  margin-bottom: var(--d-1);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--d-3);
  padding: var(--d-3) var(--d-4);
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  font-size: var(--d-sm);
  font-weight: 500;
  transition: all var(--t);
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.nav-item.active {
  background: var(--d-blue);
  color: #fff;
}
.nav-item svg { flex-shrink: 0; opacity: .85; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--d-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  line-height: 1.5;
}

/* Sidebar footer (perfil do usuário) */
.sidebar-footer {
  padding: var(--d-4) var(--d-5);
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--d-3);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--d-blue);
  color: #fff;
  font-size: var(--d-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: var(--d-sm);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: var(--d-xs);
  color: rgba(255,255,255,.45);
}
.btn-logout {
  color: rgba(255,255,255,.45);
  transition: color var(--t);
  padding: var(--d-1);
}
.btn-logout:hover { color: #fff; }

/* ─── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  position: fixed;
  left: var(--sidebar-w);
  top: 0; right: 0;
  height: var(--topbar-h);
  background: var(--d-surface);
  border-bottom: 1px solid var(--d-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--d-8);
  z-index: 40;
  gap: var(--d-6);
}
.topbar-title {
  font-size: var(--d-xl);
  font-weight: 700;
  color: var(--d-text);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--d-4);
}
.topbar-date {
  font-size: var(--d-sm);
  color: var(--d-text-muted);
}

/* Botão hamburger mobile */
.topbar-hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: var(--d-2);
  color: var(--d-text-muted);
}
.topbar-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all var(--t);
}

/* ─── CONTEÚDO PRINCIPAL ─────────────────────────────────── */
.dash-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  flex: 1;
}
.dash-inner {
  padding: var(--d-8);
  max-width: 1200px;
}

/* ─── STAT CARDS ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--d-5);
  margin-bottom: var(--d-8);
}
.stat-card {
  background: var(--d-surface);
  border: 1px solid var(--d-border);
  border-radius: var(--radius-lg);
  padding: var(--d-6);
  display: flex;
  flex-direction: column;
  gap: var(--d-3);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-blue   { background: var(--d-blue-lt);   color: var(--d-blue); }
.stat-icon-green  { background: var(--d-green-lt);  color: var(--d-green); }
.stat-icon-amber  { background: var(--d-amber-lt);  color: var(--d-amber); }
.stat-icon-purple { background: var(--d-purple-lt); color: var(--d-purple); }
.stat-icon-accent { background: var(--d-accent-lt); color: var(--d-accent); }
.stat-label {
  font-size: var(--d-sm);
  color: var(--d-text-muted);
  font-weight: 500;
}
.stat-value {
  font-size: var(--d-3xl);
  font-weight: 700;
  color: var(--d-text);
  line-height: 1;
  letter-spacing: -.02em;
}
.stat-sub {
  font-size: var(--d-xs);
  color: var(--d-text-faint);
}
.stat-delta {
  font-size: var(--d-xs);
  font-weight: 600;
}
.stat-delta.up   { color: var(--d-green); }
.stat-delta.down { color: var(--d-red); }

/* ─── CARDS / PAINÉIS ────────────────────────────────────── */
.card {
  background: var(--d-surface);
  border: 1px solid var(--d-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--d-5) var(--d-6);
  border-bottom: 1px solid var(--d-border);
  gap: var(--d-4);
}
.card-title {
  font-size: var(--d-base);
  font-weight: 700;
  color: var(--d-text);
}
.card-body { padding: var(--d-6); }
.card-footer {
  padding: var(--d-4) var(--d-6);
  border-top: 1px solid var(--d-border);
  background: var(--d-bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ─── TABELAS ────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--d-sm);
}
thead th {
  text-align: left;
  padding: var(--d-3) var(--d-4);
  font-size: var(--d-xs);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--d-text-muted);
  border-bottom: 1px solid var(--d-border);
  white-space: nowrap;
}
tbody tr { transition: background var(--t); }
tbody tr:hover { background: var(--d-bg); }
tbody td {
  padding: var(--d-4);
  border-bottom: 1px solid var(--d-border);
  color: var(--d-text-2);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }

/* ─── BADGES DE STATUS ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--d-1);
  padding: 2px var(--d-3);
  border-radius: var(--radius-full);
  font-size: var(--d-xs);
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-pending  { background: var(--d-amber-lt);  color: var(--d-amber); }
.badge-confirmed{ background: var(--d-blue-lt);   color: var(--d-blue); }
.badge-done     { background: var(--d-green-lt);  color: var(--d-green); }
.badge-cancelled{ background: var(--d-red-lt);    color: var(--d-red); }

/* ─── BOTÕES ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--d-2);
  padding: .55rem 1.1rem;
  border-radius: var(--radius);
  font-family: var(--d-font);
  font-size: var(--d-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--t);
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--d-blue);
  color: #fff;
  border-color: var(--d-blue);
}
.btn-primary:hover { background: var(--d-blue-dk); border-color: var(--d-blue-dk); }
.btn-outline {
  background: transparent;
  color: var(--d-text-2);
  border-color: var(--d-border-dk);
}
.btn-outline:hover { background: var(--d-bg); }
.btn-ghost {
  background: transparent;
  color: var(--d-text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--d-bg); color: var(--d-text); }
.btn-danger {
  background: var(--d-red-lt);
  color: var(--d-red);
  border-color: transparent;
}
.btn-danger:hover { background: #FECACA; }
.btn-success {
  background: var(--d-green-lt);
  color: var(--d-green);
  border-color: transparent;
}
.btn-success:hover { background: #A7F3D0; }
.btn-sm { padding: .35rem .8rem; font-size: var(--d-xs); }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ─── INPUTS ─────────────────────────────────────────────── */
.input, select.input, textarea.input {
  width: 100%;
  padding: .6rem .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--d-border-dk);
  background: var(--d-surface);
  font-family: var(--d-font);
  font-size: var(--d-sm);
  color: var(--d-text);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--d-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.input-label {
  display: block;
  font-size: var(--d-sm);
  font-weight: 600;
  color: var(--d-text-2);
  margin-bottom: var(--d-2);
}
.input-group { margin-bottom: var(--d-5); }
.input-error {
  font-size: var(--d-xs);
  color: var(--d-red);
  margin-top: var(--d-1);
  font-weight: 500;
}

/* ─── AVATAR ─────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--d-blue-lt);
  color: var(--d-blue);
  font-size: var(--d-sm);
}
.avatar-sm  { width: 28px; height: 28px; font-size: var(--d-xs); }
.avatar-md  { width: 36px; height: 36px; }
.avatar-lg  { width: 48px; height: 48px; font-size: var(--d-lg); }
.avatar-xl  { width: 64px; height: 64px; font-size: var(--d-xl); }

/* ─── TAGS DE ESPECIALIDADE ──────────────────────────────── */
.spec-tag {
  display: inline-block;
  padding: 2px var(--d-3);
  border-radius: var(--radius-full);
  font-size: var(--d-xs);
  font-weight: 500;
  background: var(--d-blue-lt);
  color: var(--d-blue);
}

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--d-12) var(--d-8);
  gap: var(--d-4);
  color: var(--d-text-muted);
  text-align: center;
}
.empty-state-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--d-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--d-text-faint);
}
.empty-state p { font-size: var(--d-sm); max-width: 36ch; }

/* ─── LOADING ────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--d-border-dk);
  border-top-color: var(--d-blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { display: flex; align-items: center; gap: var(--d-4); padding: var(--d-6); color: var(--d-text-muted); font-size: var(--d-sm); }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--d-6);
  animation: dFadeIn .15s ease;
}
@keyframes dFadeIn { from { opacity: 0; } }
.modal-box {
  background: var(--d-surface);
  border-radius: var(--radius-xl);
  padding: var(--d-8);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-md);
  position: relative;
  animation: dSlideUp .2s ease;
}
@keyframes dSlideUp { from { transform: translateY(16px); opacity: 0; } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--d-6);
}
.modal-title { font-size: var(--d-xl); font-weight: 700; color: var(--d-text); }
.modal-close { color: var(--d-text-muted); font-size: 1.2rem; transition: color var(--t); }
.modal-close:hover { color: var(--d-text); }

/* ─── ALERTAS ────────────────────────────────────────────── */
.alert {
  padding: var(--d-4) var(--d-5);
  border-radius: var(--radius);
  font-size: var(--d-sm);
  font-weight: 500;
  border-left: 3px solid currentColor;
}
.alert-error   { background: var(--d-red-lt);   color: var(--d-red); }
.alert-success { background: var(--d-green-lt);  color: var(--d-green); }
.alert-info    { background: var(--d-blue-lt);   color: var(--d-blue); }

/* ─── OVERLAY mobile da sidebar ──────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0,0,0,.4);
}
.sidebar-overlay.active { display: block; }

/* ─── RESPONSIVO ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .topbar {
    left: 0;
  }
  .topbar-hamburger {
    display: flex;
  }
  .dash-content {
    margin-left: 0;
  }
  .dash-inner {
    padding: var(--d-5);
  }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding-inline: var(--d-4); }
}
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
}
