:root {
  color-scheme: light;
  --ink: #18231f;
  --muted: #69736f;
  --line: #e1e6df;
  --soft: #f7f4ee;
  --paper: #ffffff;
  --teal: #0d3540;
  --teal-strong: #082630;
  --sage: #dbe7e7;
  --gold: #a46f2a;
  --champagne: #d8c6a3;
  --champagne-soft: #e9ddc8;
  --rose: #9f5363;
  --shadow: 0 24px 70px rgba(28, 41, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Manrope, Arial, sans-serif;
  background:
    radial-gradient(circle at 85% 3%, rgba(216, 198, 163, 0.24), transparent 26%),
    linear-gradient(180deg, #faf7f1 0%, #f7f3ec 42%, #efe8dd 100%);
  color: var(--ink);
}

.public-page {
  min-height: 100vh;
}

.public-main {
  width: min(100% - 34px, 1180px);
  margin: 0 auto;
  padding: 22px 0 64px;
}

.public-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.public-hero {
  min-height: 420px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: rgba(250, 247, 241, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal-strong), var(--teal));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  box-shadow: inset 0 -10px 24px rgba(164, 111, 42, 0.28);
}

.brand-logo {
  width: 92px;
  height: auto;
  flex: 0 0 auto;
  display: block;
  border-radius: 8px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 500;
}

.brand small,
.sidebar-note small,
.eyebrow,
.metric span,
label,
.appointment-meta,
.route-pill,
.duration-pill {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #52615d;
  text-decoration: none;
  font-weight: 700;
}

.nav-link.active {
  background: rgba(216, 198, 163, 0.26);
  color: var(--teal-strong);
}

.icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(13, 53, 64, 0.11);
  color: var(--teal-strong);
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--soft);
  display: grid;
  gap: 6px;
}

.sidebar-note strong {
  font-size: 1.08rem;
}

.main {
  min-width: 0;
  padding: 28px;
}

.hero {
  position: relative;
  min-height: 300px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-end;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 78% 12%, rgba(216, 198, 163, 0.18), transparent 28%),
    linear-gradient(90deg, rgba(8, 38, 48, 0.88), rgba(47, 48, 46, 0.58), rgba(92, 62, 38, 0.18));
}

.hero-content {
  position: relative;
  max-width: 720px;
  padding: 42px;
  color: white;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.75rem;
  font-weight: 800;
}

.hero .eyebrow {
  color: #f1d8a8;
}

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

h1 {
  margin-top: 10px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0;
  font-weight: 500;
}

h2,
h3 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
}

.hero p {
  max-width: 610px;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.6;
}

.view {
  display: none;
  margin-top: 28px;
}

.view.active {
  display: block;
}

.section-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2 {
  margin-top: 6px;
  font-size: clamp(1.6rem, 3vw, 2.45rem);
}

.booking-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(320px, 1.2fr) minmax(280px, 0.94fr);
  gap: 16px;
  align-items: start;
}

.panel,
.metric,
.link-card,
.appointment,
.auth-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.24));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56), 0 18px 50px rgba(52, 44, 31, 0.055);
}

.panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title.compact {
  margin-bottom: 12px;
}

.panel-title h3 {
  margin-top: 4px;
  font-size: 1.25rem;
}

.agenda-list,
.date-strip,
.time-grid,
.patient-form,
.appointments,
.link-grid {
  display: grid;
  gap: 10px;
}

.agenda-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  padding: 14px;
  text-align: left;
  color: inherit;
  display: grid;
  gap: 8px;
}

.agenda-card:disabled {
  cursor: default;
}

.agenda-card.active {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--gold);
}

.agenda-card strong {
  font-size: 0.98rem;
}

.agenda-card span {
  color: var(--muted);
  line-height: 1.45;
}

.agenda-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag,
.status,
.route-pill,
.duration-pill {
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--soft);
  color: var(--teal-strong);
}

.access-banner {
  display: none;
  margin-bottom: 16px;
  border: 1px solid rgba(164, 111, 42, 0.34);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.86);
  padding: 14px 16px;
  color: #4f4638;
  line-height: 1.5;
}

.access-banner.active {
  display: block;
}

.access-banner strong {
  color: var(--teal-strong);
}

.access-banner.locked {
  border-color: #e7c8a0;
}

.date-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.date-button,
.time-button,
.ghost-button,
.secondary-button,
.primary-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-weight: 800;
}

.date-button {
  padding: 10px;
  display: grid;
  gap: 3px;
}

.date-button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.date-button.active,
.time-button.active,
.ghost-button.active {
  border-color: var(--gold);
  background: rgba(216, 198, 163, 0.28);
  color: var(--teal-strong);
}

.time-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.time-button {
  padding: 0 10px;
}

.time-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  text-decoration: line-through;
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  padding: 12px 13px;
  color: var(--ink);
  outline: none;
}

input:disabled,
textarea:disabled,
select:disabled,
button:disabled {
  cursor: not-allowed;
}

input:disabled,
textarea:disabled {
  color: #8a938f;
  background: #f2f1ed;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(13, 53, 64, 0.13);
}

.summary {
  min-height: 62px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px dashed #bad1cb;
  color: #53625e;
  padding: 12px;
  line-height: 1.45;
}

.primary-button {
  background: linear-gradient(145deg, rgba(31, 36, 35, 0.94), rgba(31, 36, 35, 0.68) 58%, rgba(169, 135, 78, 0.54));
  color: #f8f3ea;
  border-color: rgba(248, 243, 234, 0.18);
  padding: 0 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 16px 46px rgba(31, 36, 35, 0.18);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.agenda-card:hover,
.date-button:hover,
.time-button:not(:disabled):hover {
  transform: translateY(-1px);
}

a.primary-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.secondary-button {
  padding: 0 14px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-button {
  padding: 0 12px;
}

.doctor-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.doctor-section {
  margin-top: 28px;
}

.metrics {
  display: grid;
  gap: 10px;
}

.metric {
  padding: 18px;
  display: grid;
  gap: 6px;
}

.metric strong {
  font-size: 2.2rem;
}

.appointment {
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  border-left: 4px solid var(--agenda-color, var(--gold));
}

.appointment.archived {
  border-left-color: #8d9291;
  background: linear-gradient(145deg, rgba(247, 244, 238, 0.72), rgba(255, 255, 255, 0.28));
}

.appointment.archived .appointment-title,
.appointment.archived .appointment-meta {
  opacity: 0.72;
}

.appointment h3 {
  font-size: 1.08rem;
}

.appointment-title,
.agenda-card-head,
.agenda-stat {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agenda-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--agenda-color);
  color: #fffaf1;
  font-family: Manrope, Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 10px 24px rgba(31, 36, 35, 0.14);
}

.appointment-meta {
  margin-top: 7px;
  line-height: 1.5;
}

.appointment-actions {
  display: flex;
  gap: 8px;
  align-items: start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status.pendente {
  color: #8b5e0f;
  background: #fff4d8;
}

.status.confirmado {
  color: var(--teal-strong);
  background: var(--sage);
}

.status.cancelado {
  color: var(--rose);
  background: #f7e2e7;
}

.status.no-show {
  color: #4f5557;
  background: #e7e8e6;
}

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

.link-card {
  padding: 18px;
  display: grid;
  gap: 12px;
  border-left: 4px solid var(--agenda-color, var(--gold));
}

.link-card code {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: #f6faf9;
  border: 1px solid var(--line);
  padding: 12px;
  color: #34504b;
}

.link-card p {
  color: var(--muted);
  line-height: 1.5;
}

.auth-card {
  max-width: 560px;
  padding: 28px;
}

.auth-card h2 {
  margin-top: 8px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.auth-card p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.manager-grid,
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.dashboard-wide {
  grid-column: 1 / -1;
}

.period-panel {
  display: grid;
  gap: 14px;
}

.period-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.period-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.48);
  display: grid;
  gap: 6px;
}

.period-card span {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.78rem;
}

.period-card strong {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 500;
}

.availability-form {
  display: grid;
  gap: 12px;
}

.availability-list,
.agenda-dashboard,
.chart-legend,
.waitlist-list,
.waitlist-form {
  display: grid;
  gap: 10px;
}

.availability-group {
  border: 1px solid var(--line);
  border-left: 4px solid var(--agenda-color, var(--gold));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.availability-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid rgba(47, 48, 46, 0.08);
  padding-top: 10px;
}

.availability-row strong,
.availability-row span {
  display: block;
}

.availability-row span,
.agenda-stat span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.mini-empty {
  padding: 12px;
  text-align: left;
}

.chart-panel {
  min-height: 280px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.pie-chart {
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--champagne-soft) 0 360deg);
  box-shadow: inset 0 0 0 18px rgba(255, 255, 255, 0.5), 0 18px 45px rgba(52, 44, 31, 0.1);
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.chart-legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.agenda-stat {
  border: 1px solid var(--line);
  border-left: 4px solid var(--agenda-color, var(--gold));
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.48);
}

.waitlist-public {
  margin-top: 16px;
}

.waitlist-public p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.waitlist-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--agenda-color, var(--gold));
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.52);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.waitlist-card p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.5;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 38, 48, 0.42);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(100%, 560px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: #faf7f1;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 12px;
}

.modal-copy {
  color: var(--muted);
  line-height: 1.6;
}

.modal.hidden {
  display: none;
}

.doctor-private.hidden,
.auth-card.hidden,
.hidden {
  display: none;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100vw - 44px));
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  padding: 14px 16px;
  background: #112522;
  color: white;
  box-shadow: var(--shadow);
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.empty {
  border: 1px dashed #b8cdc8;
  border-radius: 8px;
  padding: 26px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .sidebar-note {
    margin-top: 0;
    margin-left: auto;
  }

  .booking-grid,
  .doctor-layout,
  .manager-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .hero {
    min-height: 360px;
  }

  .hero-content {
    padding: 24px;
  }

  .section-heading,
  .appointment,
  .waitlist-card {
    display: grid;
  }

  .date-strip,
  .time-grid,
  .link-grid,
  .chart-panel,
  .period-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sidebar-note {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .date-strip,
  .time-grid,
  .link-grid,
  .chart-panel,
  .period-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    grid-auto-flow: row;
    width: 100%;
  }
}
