:root {
  --ink: #17313b;
  --muted: #60747d;
  --paper: #fffdf8;
  --panel: rgba(255, 255, 255, 0.82);
  --line: #dfe8e7;
  --teal: #006d77;
  --teal-dark: #004f56;
  --mint: #83c5be;
  --amber: #f6bd60;
  --rose: #e76f51;
  --blue: #3a86ff;
  --violet: #7b61ff;
  --shadow: 0 24px 80px rgba(25, 58, 68, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(131, 197, 190, 0.45), transparent 32rem),
    radial-gradient(circle at 86% 2%, rgba(246, 189, 96, 0.3), transparent 28rem),
    linear-gradient(135deg, #f7fbf9 0%, #fff7eb 100%);
  font-family: "Instrument Sans", sans-serif;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.hero {
  padding: 24px clamp(18px, 4vw, 64px) 34px;
}

.page-hero {
  padding-bottom: 24px;
}

.topbar,
.hero-grid,
.workspace {
  display: grid;
  gap: 24px;
}

.topbar {
  align-items: center;
  grid-template-columns: 1fr auto;
  margin-bottom: 28px;
}

.brand,
.topbar-actions,
.header-actions,
.hero-badges,
.section-heading.split,
.calendar-toolbar,
.daily-toolbar,
.appointment-actions,
.appointment-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--teal);
  color: white;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 0.9rem;
}

.brand-link {
  width: fit-content;
}

.simple-hero {
  max-width: 760px;
  padding: clamp(18px, 4vw, 42px) 0 10px;
}

.eyebrow,
.section-heading span {
  color: var(--teal);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

h1,
h2 {
  font-family: "Newsreader", serif;
  line-height: 0.95;
  margin: 10px 0;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  max-width: 720px;
}

h2 {
  font-size: clamp(2rem, 4vw, 4rem);
}

h3 {
  margin: 0 0 18px;
}

.simple-hero p,
.section-heading p {
  color: var(--muted);
  max-width: 680px;
  font-size: 1.05rem;
}

.hero-badges {
  flex-wrap: wrap;
  margin-top: 24px;
}

.hero-badges span,
.legend-item,
.status-badge,
.origin-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 700;
}

.status-card,
.card,
.mode-panel,
.login-card,
.dialog {
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 28px;
}

.status-card {
  padding: 26px;
}

.status-pulse {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 50%;
  background: #2fb344;
  box-shadow: 0 0 0 8px rgba(47, 179, 68, 0.12);
}

.status-card p {
  color: var(--muted);
  line-height: 1.7;
}

.ghost-button,
.solid-button,
.submit-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal-dark);
  border: 1px solid var(--line);
}

.solid-button,
.submit-button {
  background: var(--teal);
  color: white;
  box-shadow: 0 14px 34px rgba(0, 109, 119, 0.24);
}

.workspace {
  grid-template-columns: 320px minmax(0, 1fr);
  padding: 0 clamp(18px, 4vw, 64px) 64px;
  align-items: start;
}

.compact-workspace {
  display: block;
  max-width: 1120px;
  margin: 0 auto;
}

.choice-card {
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 32px;
  padding: clamp(22px, 5vw, 44px);
}

.choice-card h2 {
  margin-bottom: 8px;
}

.choice-card p {
  color: var(--muted);
  margin-bottom: 24px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.choice-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 26px;
  padding: clamp(18px, 4vw, 30px);
  text-align: left;
  min-height: 180px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: block;
}

.choice-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(25, 58, 68, 0.14);
  border-color: rgba(0, 109, 119, 0.3);
}

.choice-button span,
.choice-button strong,
.choice-button small {
  display: block;
}

.choice-button span {
  color: var(--teal);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.78rem;
}

.choice-button strong {
  margin: 14px 0 8px;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.choice-button small {
  color: var(--muted);
  font-size: 0.95rem;
}

.patient-choice {
  background: linear-gradient(135deg, #ffffff 0%, #eaf7f5 100%);
}

.city-choice {
  background: linear-gradient(135deg, #ffffff 0%, #fff3d9 100%);
}

.mode-panel {
  position: sticky;
  top: 20px;
  padding: 16px;
}

.mode-card {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 22px;
  padding: 18px;
  color: var(--muted);
  transition: 0.2s ease;
}

.mode-card:hover,
.mode-card.active {
  color: var(--ink);
  background: white;
  border-color: var(--line);
  transform: translateY(-1px);
}

.mode-card span {
  color: var(--teal);
  font-weight: 900;
}

.mode-card strong,
.mode-card small {
  display: block;
  margin-top: 6px;
}

.legend {
  margin-top: 18px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.legend-item {
  display: block;
  margin: 8px 0;
}

.content-panel {
  min-width: 0;
}

.view {
  display: none;
  animation: reveal 0.22s ease both;
}

.view.active {
  display: block;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.booking-grid,
.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 22px;
}

.card,
.login-card {
  padding: clamp(18px, 3vw, 28px);
}

.field-label,
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.9rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 109, 119, 0.12);
}

.date-input {
  margin-bottom: 18px;
}

.emergency-notice {
  border: 1px solid rgba(231, 111, 81, 0.28);
  background: rgba(231, 111, 81, 0.1);
  color: #7a2e22;
  border-radius: 16px;
  padding: 12px 14px;
  margin: -4px 0 18px;
  font-weight: 700;
  line-height: 1.4;
}

.price-preview {
  margin-top: 16px;
  border: 1px solid rgba(0, 109, 119, 0.22);
  background: rgba(0, 109, 119, 0.08);
  color: var(--teal-dark);
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 800;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}

.slot-grid::before {
  content: "Manha";
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 4px;
}

.slot-period {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 14px;
}

.slot-button {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  color: var(--ink);
  font-weight: 900;
  transition: 0.18s ease;
}

.slot-button small {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

.slot-button:hover:not(:disabled),
.slot-button.selected {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
  transform: translateY(-1px);
}

.slot-button:hover small,
.slot-button.selected small {
  color: rgba(255, 255, 255, 0.85);
}

.slot-button:disabled {
  color: #93a4aa;
  background: #edf3f2;
  cursor: not-allowed;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.submit-button {
  width: 100%;
  margin-top: 18px;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.blocked {
  opacity: 0.82;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(440px, calc(100% - 48px));
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-heading.split {
  justify-content: space-between;
  align-items: flex-start;
}

.login-card {
  max-width: 680px;
}

.table-card {
  margin-top: 22px;
}

.admin-day-card {
  margin-top: 0;
}

.admin-day-toolbar {
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-day-toolbar label {
  min-width: min(100%, 180px);
}

.admin-day-toolbar button {
  width: auto;
}

.appointment-list {
  display: grid;
  gap: 12px;
}

.appointment-row {
  border: 1px solid var(--line);
  background: white;
  border-radius: 20px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.appointment-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.appointment-main strong {
  display: block;
}

.appointment-main small,
.appointment-meta {
  color: var(--muted);
}

.appointment-actions {
  flex-wrap: wrap;
}

.appointment-actions button,
.appointment-actions select {
  width: auto;
  padding: 9px 10px;
  border-radius: 12px;
}

.month-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.day-name,
.day-cell {
  border-radius: 16px;
  padding: 10px;
}

.day-name {
  color: var(--muted);
  text-align: center;
  font-weight: 900;
  font-size: 0.8rem;
}

.day-cell {
  min-height: 94px;
  border: 1px solid var(--line);
  background: white;
  text-align: left;
}

.day-cell.outside {
  opacity: 0.35;
}

.day-cell.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 109, 119, 0.1);
}

.day-cell strong,
.day-cell small {
  display: block;
}

.day-cell small {
  color: var(--muted);
  margin-top: 6px;
}

.private {
  border-color: rgba(0, 109, 119, 0.35);
  background: rgba(0, 109, 119, 0.08);
}

.insurance {
  border-color: rgba(58, 134, 255, 0.34);
  background: rgba(58, 134, 255, 0.08);
}

.cajuri {
  border-color: rgba(246, 189, 96, 0.5);
  background: rgba(246, 189, 96, 0.18);
}

.sao-miguel {
  border-color: rgba(123, 97, 255, 0.34);
  background: rgba(123, 97, 255, 0.1);
}

.missed {
  border-color: rgba(231, 111, 81, 0.45);
  background: rgba(231, 111, 81, 0.12);
}

.canceled {
  color: #8d99ae;
  border-color: #d7dde4;
  background: #f1f3f5;
}

.dialog {
  width: min(460px, calc(100% - 32px));
  border: 0;
  padding: 24px;
}

.dialog::backdrop {
  background: rgba(23, 49, 59, 0.35);
  backdrop-filter: blur(4px);
}

.dialog form,
.dialog menu {
  display: grid;
  gap: 14px;
}

.dialog menu {
  grid-template-columns: 1fr 1fr;
  padding: 0;
}

@media (max-width: 980px) {
  .topbar,
  .hero-grid,
  .workspace,
  .booking-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .mode-panel {
    position: static;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1;
  }
}

@media (max-width: 620px) {
  .hero {
    padding-top: 16px;
  }

  .topbar-actions,
  .section-heading.split,
  .appointment-main,
  .daily-toolbar,
  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .choice-grid,
  .month-calendar {
    grid-template-columns: 1fr;
  }

  .month-calendar .day-name {
    display: none;
  }

  .day-cell {
    min-height: auto;
  }

  .admin-day-toolbar button {
    width: 100%;
  }
}
