:root {
  --ink: #172326;
  --muted: #5f6f73;
  --soft: #f5f1ea;
  --paper: #fffdf8;
  --line: #d8e0dd;
  --teal: #0f766e;
  --teal-dark: #0b4f4a;
  --teal-soft: #dff4ef;
  --red: #bf3f4a;
  --red-soft: #f7dee1;
  --gold: #c9953f;
  --blue: #2f6f9f;
  --graphite: #243033;
  --shadow: 0 18px 50px rgba(23, 35, 38, 0.14);
  --radius: 8px;
  --header-height: 74px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

body.staff-mode {
  background: #eef3f2;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid rgba(191, 63, 74, 0.45);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 30;
  transform: translateY(-150%);
  background: var(--paper);
  color: var(--ink);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid rgba(216, 224, 221, 0.8);
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

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

.brand strong {
  font-size: 1rem;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, var(--teal-soft));
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.14);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span::before,
.brand-mark span::after {
  content: "";
  position: absolute;
  background: var(--red);
  border-radius: 2px;
}

.brand-mark::before {
  left: 18px;
  top: 9px;
  width: 6px;
  height: 24px;
}

.brand-mark::after {
  left: 9px;
  top: 18px;
  width: 24px;
  height: 6px;
}

.brand-mark span::before {
  left: 6px;
  top: 6px;
  width: 5px;
  height: 5px;
  background: var(--teal);
}

.brand-mark span::after {
  right: 6px;
  bottom: 6px;
  width: 5px;
  height: 5px;
  background: var(--gold);
}

.main-nav {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.main-nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.85rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius);
}

.main-nav a:hover {
  color: var(--ink);
  background: rgba(15, 118, 110, 0.08);
}

.header-actions,
.hero-actions,
.form-footer,
.staff-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.button-primary:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.button-secondary {
  color: #ffffff;
  background: var(--red);
  border-color: var(--red);
}

.button-secondary:hover {
  background: #9f303a;
  border-color: #9f303a;
}

.button-light {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.button-light:hover {
  background: #f4f7f6;
}

.button-ghost {
  color: var(--teal-dark);
  background: transparent;
  border-color: rgba(15, 118, 110, 0.35);
}

.button-ghost:hover {
  background: var(--teal-soft);
}

.hero,
.section,
.staff-login,
.staff-app {
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.hero {
  position: relative;
  min-height: 76vh;
  display: grid;
  align-items: end;
  padding: 8rem clamp(1rem, 5vw, 5rem) 7.5rem;
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(14, 27, 29, 0.72) 0%, rgba(14, 27, 29, 0.46) 42%, rgba(14, 27, 29, 0.08) 100%),
    url("assets/clinic-hero.png") center / cover no-repeat;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.2)),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18), transparent 34rem);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 690px;
}

.hero h1,
.login-form h1,
.staff-topbar h1 {
  margin: 0;
  font-size: 4.25rem;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p {
  max-width: 620px;
  margin: 1.35rem 0 1.6rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.2rem;
}

.hero-status {
  position: absolute;
  z-index: 2;
  left: clamp(1rem, 5vw, 5rem);
  right: clamp(1rem, 5vw, 5rem);
  bottom: 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 253, 248, 0.9);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.hero-status div {
  padding: 1rem;
  background: rgba(255, 253, 248, 0.82);
}

.hero-status strong,
.hero-status span {
  display: block;
}

.hero-status span {
  color: var(--muted);
  font-size: 0.88rem;
}

.section {
  padding: 5rem clamp(1rem, 5vw, 5rem);
}

.section-heading {
  max-width: 760px;
  margin-bottom: 2rem;
}

.section-heading.compact {
  margin-bottom: 1.2rem;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.45rem;
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section h2,
.field-copy h2,
.operations-panel h2 {
  margin: 0;
  color: var(--ink);
  line-height: 1.08;
  letter-spacing: 0;
}

.section h2,
.field-copy h2 {
  font-size: 2.35rem;
}

.section-heading p,
.field-copy p {
  max-width: 660px;
  color: var(--muted);
  margin: 0.9rem 0 0;
  font-size: 1.02rem;
}

.service-section {
  background: var(--paper);
}

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

.service-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 1.15rem;
  box-shadow: 0 10px 30px rgba(36, 48, 51, 0.07);
}

.service-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.service-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  border-radius: var(--radius);
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.service-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.service-card h3,
.contact-grid h3,
.visit-summary h3,
.login-form h1,
.message-list strong {
  margin: 0;
  letter-spacing: 0;
}

.service-card p,
.contact-grid p,
.message-list p,
.login-form p {
  color: var(--muted);
}

.service-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.8rem 0 1rem;
}

.service-meta span {
  border: 1px solid rgba(47, 111, 159, 0.22);
  border-radius: 999px;
  background: #eef6fb;
  color: #24567a;
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.appointment-section {
  background: #edf5f2;
}

.appointment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.75fr);
  gap: 1.25rem;
  align-items: start;
}

.booking-form,
.visit-summary,
.login-form,
.operations-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(36, 48, 51, 0.08);
}

.booking-form {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.form-row.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.42rem;
  color: var(--graphite);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cdd7d4;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  font-weight: 500;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.slot-panel {
  display: grid;
  gap: 0.8rem;
  border: 1px solid #d7e6e1;
  border-radius: var(--radius);
  background: #f8fbfa;
  padding: 1rem;
}

.slot-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
}

.slot-heading strong {
  color: var(--ink);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.slot-button {
  min-height: 42px;
  border: 1px solid #cdd7d4;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.slot-button:hover,
.slot-button.is-selected {
  border-color: var(--teal);
  color: #ffffff;
  background: var(--teal);
}

.visit-summary {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  padding: 1.15rem;
}

.visit-summary h3 {
  font-size: 1.2rem;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.summary-item span {
  color: var(--muted);
}

.care-steps {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0;
}

.care-steps span {
  position: relative;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding-left: 2rem;
  color: var(--muted);
}

.care-steps span::before {
  content: "";
  position: absolute;
  left: 0;
  width: 1rem;
  height: 1rem;
  border: 2px solid #b9c6c3;
  border-radius: 50%;
  background: #ffffff;
}

.care-steps .is-complete {
  color: var(--teal-dark);
  font-weight: 900;
}

.care-steps .is-complete::before {
  border-color: var(--teal);
  background: var(--teal);
  box-shadow: inset 0 0 0 3px #ffffff;
}

.booking-result {
  min-height: 64px;
  display: grid;
  align-content: center;
  border-radius: var(--radius);
  background: #f7f0e4;
  color: #6c4b17;
  padding: 0.9rem;
  font-weight: 800;
}

.booking-result:empty {
  display: none;
}

.contact-section {
  background: var(--paper);
}

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

.contact-grid article {
  min-height: 176px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 1rem;
}

.contact-grid a {
  color: var(--teal-dark);
  font-weight: 900;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.staff-login {
  min-height: 100vh;
  padding: 2rem;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(191, 63, 74, 0.08)),
    #eef3f2;
}

.login-shell {
  width: min(1080px, 100%);
  min-height: calc(100vh - 4rem);
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 520px);
  gap: 1.5rem;
  align-items: center;
  margin: 0 auto;
}

.login-brand {
  align-self: start;
}

.login-form {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.login-form h1 {
  color: var(--ink);
  font-size: 2.4rem;
}

.login-feedback {
  min-height: 24px;
  color: var(--teal-dark);
  font-weight: 800;
}

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

.staff-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem;
  border-right: 1px solid #d4dfdc;
  background: #ffffff;
}

.staff-brand {
  padding: 0.3rem 0.2rem;
}

.staff-nav {
  display: grid;
  gap: 0.35rem;
}

.staff-nav button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  text-align: left;
  padding: 0 0.85rem;
  font-weight: 900;
}

.staff-nav button:hover,
.staff-nav button.is-active {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.staff-sidebar > .button {
  margin-top: auto;
}

.staff-main {
  min-width: 0;
  padding: 1.25rem;
}

.staff-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.staff-topbar h1 {
  color: var(--ink);
  font-size: 2.2rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--teal-dark);
  background: #ffffff;
}

.icon-button:hover {
  background: var(--teal-soft);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.staff-tab {
  display: none;
}

.staff-tab.is-active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.metric-grid article {
  min-height: 144px;
  display: grid;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 1rem;
}

.metric-grid span,
.metric-grid small {
  color: var(--muted);
}

.metric-grid strong {
  color: var(--ink);
  font-size: 2.15rem;
  line-height: 1;
}

.staff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.operations-panel {
  padding: 1rem;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.operations-panel h2 {
  font-size: 1.25rem;
}

.queue-list,
.coverage-list,
.admin-service-list,
.message-list {
  display: grid;
  gap: 0.75rem;
}

.queue-item,
.coverage-list div,
.admin-service,
.message-list article {
  border: 1px solid #dce5e2;
  border-radius: var(--radius);
  background: #fbfdfc;
  padding: 0.85rem;
}

.queue-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
}

.queue-time,
.queue-status,
.appointment-status,
.admin-state {
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.queue-time {
  color: #24567a;
  background: #eef6fb;
}

.queue-status,
.appointment-status {
  color: #6c4b17;
  background: #f8eacb;
}

.appointment-status.is-ready,
.admin-state.is-active {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.appointment-status.is-late,
.admin-state.is-paused {
  color: #8e2630;
  background: var(--red-soft);
}

.coverage-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.coverage-list span {
  color: var(--muted);
}

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

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

td:last-child {
  width: 180px;
}

.admin-service {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.admin-service h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.admin-service p {
  margin: 0;
  color: var(--muted);
}

.admin-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.capacity-control {
  display: inline-grid;
  grid-template-columns: 36px 44px 36px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.capacity-control button {
  width: 36px;
  height: 36px;
  border: 0;
  background: #ffffff;
  font-weight: 900;
}

.capacity-control span {
  height: 36px;
  display: grid;
  place-items: center;
  border-inline: 1px solid var(--line);
  color: var(--ink);
  background: #f6f9f8;
  font-weight: 900;
}

.toggle-button {
  min-height: 36px;
  border: 1px solid rgba(15, 118, 110, 0.35);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--teal-dark);
  padding: 0 0.7rem;
  font-weight: 900;
}

.toggle-button.is-paused {
  border-color: rgba(191, 63, 74, 0.38);
  color: #8e2630;
  background: var(--red-soft);
}

.mini-form {
  display: grid;
  gap: 1rem;
}

.message-list article {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
}

.message-list span {
  color: var(--muted);
  font-weight: 900;
}

.message-list p {
  margin: 0.15rem 0 0;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  max-width: min(360px, calc(100vw - 2rem));
  min-height: 48px;
  display: grid;
  align-items: center;
  transform: translateY(calc(100% + 1.5rem));
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
  font-weight: 800;
  opacity: 0;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1100px) {
  .service-grid,
  .contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .staff-grid,
  .appointment-layout {
    grid-template-columns: 1fr;
  }

  .visit-summary {
    position: static;
  }
}

@media (max-width: 840px) {
  :root {
    --header-height: 112px;
  }

  .site-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  .header-actions {
    margin-left: auto;
  }

  .hero {
    min-height: min(700px, calc(100svh - var(--header-height) - 48px));
    padding-top: 4.5rem;
    padding-bottom: 8.5rem;
  }

  .hero h1 {
    font-size: 3.25rem;
  }

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

  .hero-status div {
    padding: 0.8rem;
  }

  .hero-status span {
    font-size: 0.78rem;
  }

  .form-row.two-col,
  .service-grid,
  .contact-grid,
  .slot-grid {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
    align-content: center;
  }

  .staff-app {
    grid-template-columns: 1fr;
  }

  .staff-sidebar {
    position: static;
    height: auto;
  }

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

  .staff-sidebar > .button {
    margin-top: 0;
  }

  .staff-topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .site-header,
  .section,
  .staff-login,
  .staff-main {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .section {
    padding-top: 3rem;
    padding-bottom: 3.5rem;
  }

  .brand small {
    display: none;
  }

  .hero {
    min-height: min(640px, calc(100svh - var(--header-height) - 48px));
    padding: 4rem 1rem 7.5rem;
  }

  .hero h1 {
    font-size: 2.65rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .hero-actions,
  .form-footer,
  .staff-actions,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .section h2,
  .field-copy h2 {
    font-size: 1.85rem;
  }

  .queue-item,
  .admin-service,
  .message-list article {
    grid-template-columns: 1fr;
  }

  .admin-controls {
    justify-content: flex-start;
  }

  .staff-nav {
    grid-template-columns: 1fr;
  }
}
