/* Componentes: cards, botões, tabelas, badges, toasts, modal.
   (Topnav/sidebar ficam em layout.css.) */

/* Botões — alinhados ao super admin (peso 800, shadow glow) */
.btn {
  display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px;
  padding: 0 15px; border-radius: 9px; border: 1px solid transparent;
  font-weight: 800; font-size: 12.5px; background: var(--surface); color: var(--text);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--primary); color: var(--primary-contrast);
  box-shadow: none;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-ghost { background: #fff; border-color: var(--line); color: #6b6979; }
.btn-ghost:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn-danger:hover { filter: brightness(0.93); transform: translateY(-1px); }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: 11.5px; }
.btn-icon { padding: 0; width: 41px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }

/* Cards */
.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: none;
}
.card-pad { padding: clamp(16px, 1.3vw, 22px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.card-head h3 svg { width: 17px; height: 17px; color: var(--primary); }
.card-body { padding: clamp(16px, 1.3vw, 22px); }

.metric {
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: clamp(14px, 1.1vw, 18px); box-shadow: none;
  display: flex; flex-direction: column; gap: 6px;
}
.metric-label { font-size: 12px; color: var(--text-soft); font-weight: 800; letter-spacing: 0; display: flex; align-items: center; gap: 6px; }
.metric-label svg { width: 15px; height: 15px; }
.metric-value { font-size: clamp(22px, 1.8vw, 28px); font-weight: 900; letter-spacing: -0.02em; }
.metric-foot { font-size: 12px; color: var(--text-muted); }
.metric.accent { border-color: color-mix(in srgb, var(--primary) 38%, var(--line)); background: color-mix(in srgb, var(--primary) 4%, #fff); }
.metric.ok { border-color: color-mix(in srgb, var(--ok) 38%, var(--line)); background: color-mix(in srgb, var(--ok) 4%, #fff); }
.metric.warn { border-color: color-mix(in srgb, var(--warn) 38%, var(--line)); background: color-mix(in srgb, var(--warn) 4%, #fff); }
.metric.danger { border-color: color-mix(in srgb, var(--danger) 38%, var(--line)); background: color-mix(in srgb, var(--danger) 4%, #fff); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.muted { background: var(--surface-2); color: var(--text-soft); }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 11px 14px; text-align: left; }
table.tbl thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-soft); font-weight: 600;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
table.tbl tbody tr { border-bottom: 1px solid var(--border); }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--text-muted); }
.cell-mono { font-family: var(--mono); font-size: 12px; }

/* Toolbar / filtros */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.search-input {
  position: relative; display: flex; align-items: center;
}
.search-input svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--text-soft); pointer-events: none; }
.search-input input { padding: 8px 12px 8px 32px; }

/* Empty state */
.empty { text-align: center; padding: clamp(28px, 4vw, 48px) 20px; color: var(--text-muted); }
.empty svg { width: 40px; height: 40px; color: var(--border-strong); margin-bottom: 10px; }
.empty h4 { margin: 0 0 4px; color: var(--text); font-size: 15px; font-weight: 800; }
.empty p { margin: 0; font-size: 13px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 1000; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

/* Modal */
.modal-root { position: fixed; inset: 0; z-index: 900; pointer-events: none; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 16, 24, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; overflow-y: auto; pointer-events: auto;
  animation: fade 0.15s var(--ease);
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; margin: auto; pointer-events: auto;
  animation: pop 0.18s var(--ease);
}
.modal.lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.modal-head h3 { margin: 0; font-size: clamp(16px, 1.2vw, 18px); font-weight: 900; }
.modal-body { padding: clamp(18px, 1.6vw, 24px); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
.modal-close { border: none; background: transparent; color: var(--text-soft); padding: 6px; border-radius: 6px; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Listas compactas */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; }
.list-item .li-sub { font-size: 12px; color: var(--text-muted); }
.list-item .li-time { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--primary); }

.divider { height: 1px; background: var(--border); margin: 16px 0; }
.muted { color: var(--text-muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Hero do dashboard */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg); padding: clamp(20px, 2.4vw, 30px) clamp(22px, 2.6vw, 34px); color: var(--primary-contrast);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  flex-wrap: wrap; margin-bottom: clamp(16px, 1.4vw, 22px); box-shadow: var(--shadow);
}
.hero-text h1 { margin: 0 0 4px; font-size: clamp(20px, 2.2vw, 26px); font-weight: 900; letter-spacing: -0.02em; }
.hero-text p { margin: 0; opacity: 0.9; font-size: clamp(13px, 0.6vw, 14px); }
.hero-stats { display: flex; gap: clamp(18px, 2vw, 30px); flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat .hs-value { font-size: clamp(22px, 2.4vw, 30px); font-weight: 900; letter-spacing: -0.02em; }
.hero-stat .hs-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.8; font-weight: 700; }
.hero .btn-primary { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); box-shadow: none; }
.hero .btn-primary:hover { background: rgba(255,255,255,0.3); }
@media (max-width: 620px) { .hero-stats { gap: 16px; } }

/* Timeline do dia */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}
.tl-item { position: relative; padding: 0 0 16px 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -19px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--info);
}
.tl-item.s-completed .tl-dot { border-color: var(--ok); }
.tl-item.s-pending .tl-dot { border-color: var(--warn); }
.tl-item.s-no_show .tl-dot { border-color: var(--danger); }
.tl-time { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-muted); }
.tl-title { font-weight: 600; font-size: 14px; margin: 2px 0 0; }
.tl-sub { font-size: 12px; color: var(--text-soft); }

/* Alerta compacto */
.alert-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px;
}
.alert-row svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-row.warn { background: var(--warn-soft); color: var(--warn); }
.alert-row.danger { background: var(--danger-soft); color: var(--danger); }
.alert-row.info { background: var(--info-soft); color: var(--info); }
.alert-row .ar-main { flex: 1; }
.alert-row .ar-title { font-weight: 600; }
.alert-row .ar-sub { font-size: 11.5px; opacity: 0.8; }

/* Barra de progresso */
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; }

/* Sparkline / barras mini */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 40px; }
.bars .bar { flex: 1; background: var(--primary-soft); border-radius: 3px 3px 0 0; min-height: 4px; }
.bars .bar.today { background: var(--primary); }

/* Theme picker cards */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 880px) { .theme-grid { grid-template-columns: 1fr; } }

.theme-card {
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; overflow: hidden; padding: 0; text-align: left;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
}
.theme-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.theme-card-selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.theme-card-preview { padding: 14px; min-height: 180px; display: flex; flex-direction: column; gap: 12px; }
.tp-hero { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.06); }
.tp-eyebrow { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.tp-title { font-size: 16px; font-weight: 700; line-height: 1.2; }
.tp-btn { display: inline-block; width: fit-content; padding: 5px 14px; border-radius: 8px; font-size: 11px; font-weight: 600; margin-top: 4px; }
.tp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-card { padding: 10px; border-radius: 10px; border: 1px solid; display: flex; flex-direction: column; gap: 5px; }
.tp-card-line { height: 4px; border-radius: 2px; }

.theme-card-info { padding: 12px 14px; position: relative; }
.theme-card-name { font-weight: 700; font-size: 14px; }
.theme-card-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.theme-card-font { font-size: 11px; color: var(--text-soft); margin-top: 4px; font-family: var(--mono); }
.theme-card-badge {
  position: absolute; top: 10px; right: 12px;
  background: var(--primary); color: var(--primary-contrast);
  padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
