* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --sidebar: #14213d;
  --sidebar-soft: #1f3158;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --text: #172033;
  --muted: #697386;
  --border: #e4e9f2;
  --success: #14804a;
  --radius: 16px;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  text-decoration: none;
}

.app-layout {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;

  width: 250px;

  padding: 24px 18px;

  background: var(--sidebar);
  color: white;

  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 0 8px 24px;
}

.brand-icon {
  width: 44px;
  height: 44px;

  border-radius: 12px;

  background: #ffffff;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--sidebar);
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 17px;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: #aebbd2;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.menu a {
  min-height: 45px;

  padding: 11px 12px;

  border-radius: 10px;

  display: flex;
  align-items: center;
  gap: 11px;

  color: #d8e1ef;

  transition: .18s ease;
}

.menu a:hover {
  background: var(--sidebar-soft);
  color: white;
}

.menu a.active {
  background: #ffffff;
  color: var(--sidebar);
  font-weight: 700;
}

.menu a.disabled {
  cursor: default;
  opacity: .55;
}

.menu a.disabled:hover {
  background: transparent;
}

.menu a small {
  margin-left: auto;
  font-size: 10px;
}

.menu-icon {
  width: 22px;
  text-align: center;
}

.menu-divider {
  height: 1px;

  margin: 12px 8px;

  background: rgba(255,255,255,.12);
}

.sidebar-footer {
  margin-top: auto;

  padding: 15px 8px 0;

  border-top: 1px solid rgba(255,255,255,.12);

  color: #bac6d8;
  font-size: 13px;
}

.sidebar-footer small {
  display: block;
  margin-top: 4px;
}

.main-content {
  margin-left: 250px;
  padding: 34px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 6px;

  color: var(--primary);

  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: 30px;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
}

.clinic-badge {
  min-width: 185px;

  padding: 12px 16px;

  border: 1px solid var(--border);
  border-radius: 12px;

  background: white;

  display: flex;
  align-items: center;
  gap: 11px;
}

.clinic-badge small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.clinic-badge strong {
  display: block;
  margin-top: 2px;
}

.clinic-dot {
  width: 10px;
  height: 10px;

  border-radius: 50%;

  background: #22c55e;

  box-shadow: 0 0 0 4px #dcfce7;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));

  gap: 18px;

  margin-bottom: 22px;
}

.stat-card {
  min-height: 150px;

  padding: 20px;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  background: var(--panel);

  color: var(--text);

  box-shadow: 0 4px 16px rgba(28,39,60,.04);

  transition: .18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(28,39,60,.08);
}

.stat-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-bottom: 25px;

  font-size: 13px;
  font-weight: 600;
}

.stat-icon {
  font-size: 20px;
}

.stat-number {
  display: block;

  margin-bottom: 7px;

  font-size: 34px;
}

.stat-label {
  display: block;

  margin-bottom: 8px;

  font-size: 21px;
}

.stat-card small {
  color: var(--muted);
}

.stat-primary small {
  color: #dbeafe;
}

.dashboard-grid {
  display: grid;

  grid-template-columns:
    minmax(0, 2.1fr)
    minmax(280px, .9fr);

  gap: 22px;
}

.panel {
  padding: 22px;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  background: var(--panel);

  box-shadow: 0 4px 16px rgba(28,39,60,.04);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 16px;

  margin-bottom: 22px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 38px;

  padding: 9px 14px;

  border-radius: 9px;

  font-size: 13px;
  font-weight: 700;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-secondary {
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
}

.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 12px;

  border-bottom: 1px solid var(--border);

  color: var(--muted);

  text-align: left;
  font-size: 12px;
}

td {
  padding: 14px 12px;

  border-bottom: 1px solid #eef1f6;

  font-size: 14px;
}

.time-cell {
  font-weight: 700;
}

.status-badge {
  display: inline-block;

  padding: 5px 9px;

  border-radius: 999px;

  background: #ecfdf3;
  color: var(--success);

  font-size: 11px;
  font-weight: 800;
}

.empty-state {
  padding: 42px 20px;

  text-align: center;
}

.empty-icon {
  width: 54px;
  height: 54px;

  margin: 0 auto 14px;

  border-radius: 14px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--primary-soft);
  color: var(--primary);

  font-size: 24px;
}

.empty-state h3 {
  margin-bottom: 7px;
}

.empty-state p {
  max-width: 410px;

  margin: 0 auto 18px;

  color: var(--muted);
}

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

.quick-action {
  padding: 14px;

  border: 1px solid var(--border);
  border-radius: 12px;

  display: flex;
  align-items: center;
  gap: 12px;

  color: var(--text);

  transition: .18s ease;
}

.quick-action:hover {
  border-color: #c8d4e8;
  background: #f8faff;
}

.quick-action > span {
  width: 38px;
  height: 38px;

  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--primary-soft);
  color: var(--primary);

  font-weight: 800;
}

.quick-action strong {
  display: block;
  font-size: 14px;
}

.quick-action small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

@media (max-width: 1100px) {

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

}

@media (max-width: 760px) {

  .sidebar {
    position: static;
    width: 100%;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .clinic-badge {
    width: 100%;
  }

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

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

}


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

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

.agenda-form-panel {
  position: sticky;
  top: 25px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-full {
  grid-column: 1 / -1;
}

.form-group label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.form-group small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;

  padding: 11px 12px;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: white;

  color: var(--text);

  font: inherit;

  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #80a9ef;
  box-shadow: 0 0 0 3px #eff6ff;
}

.form-group textarea {
  resize: vertical;
}

.btn-large {
  width: 100%;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.count-badge {
  min-width: 34px;
  height: 34px;

  padding: 0 10px;

  border-radius: 999px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--primary-soft);
  color: var(--primary);

  font-weight: 800;
}

.time-end {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 11px;
  font-weight: 400;
}

.status-confirmada {
  background: #ecfdf3;
  color: #14804a;
}

.status-agendada {
  background: #eff6ff;
  color: #2563eb;
}

.status-em_atendimento {
  background: #fff7ed;
  color: #c2410c;
}

.status-concluida {
  background: #f0fdf4;
  color: #166534;
}

.status-cancelada {
  background: #fef2f2;
  color: #b91c1c;
}

.status-faltou {
  background: #fff1f2;
  color: #be123c;
}

@media (max-width: 1050px) {

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

  .agenda-form-panel {
    position: static;
  }

}

@media (max-width: 600px) {

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

}
