:root {
  color-scheme: light;
  --ink: #141518;
  --muted: #626872;
  --paper: #f5f4ef;
  --surface: #ffffff;
  --line: #dcd9cf;
  --carbon: #111317;
  --carbon-2: #22262c;
  --red: #d92332;
  --red-dark: #a91324;
  --amber: #f3b21a;
  --green: #17865f;
  --steel: #31536b;
  --shadow: 0 18px 48px rgba(20, 21, 24, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(20, 21, 24, 0.035) 25%, transparent 25%) 0 0 / 48px 48px,
    linear-gradient(315deg, rgba(217, 35, 50, 0.035) 25%, transparent 25%) 0 0 / 48px 48px,
    var(--paper);
}

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

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 42px);
  color: #f8f8f5;
  background:
    linear-gradient(90deg, rgba(243, 178, 26, 0.12), transparent 38%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 8px, transparent 8px 16px),
    var(--carbon);
  border-bottom: 4px solid var(--red);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

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

.brand img {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.32);
}

.brand-copy {
  display: grid;
  gap: 0;
  line-height: 1;
}

.brand-copy strong {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-weight: 900;
}

.brand-copy span {
  color: #f3b21a;
  font-size: 0.86rem;
  font-weight: 750;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.session-badge {
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f9faf7;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-size: 0.9rem;
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 18px;
  width: min(1560px, calc(100% - 32px));
  margin: 18px auto 36px;
  align-items: start;
}

.calendar-area,
.panel {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.calendar-area {
  min-width: 0;
  overflow: hidden;
}

.calendar-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(17, 19, 23, 0.045), transparent 55%),
    #fff;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--red-dark);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  line-height: 1.02;
}

h2 {
  font-size: 1.08rem;
}

.week-range {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.calendar-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.text-button,
.primary-button,
.secondary-button,
.ghost-button {
  border: 0;
  border-radius: var(--radius);
  min-height: 42px;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  color: var(--ink);
  background: #f0eee7;
  border: 1px solid var(--line);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

.text-button {
  padding: 0 16px;
  color: #fff;
  background: var(--carbon);
}

.primary-button,
.secondary-button,
.ghost-button {
  width: 100%;
  padding: 0 16px;
}

.primary-button {
  color: #fff;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
  box-shadow: 0 12px 24px rgba(217, 35, 50, 0.22);
}

.secondary-button {
  color: var(--ink);
  background: var(--amber);
}

.ghost-button {
  color: var(--ink);
  background: #f1efe8;
  border: 1px solid var(--line);
}

.topbar .ghost-button {
  width: auto;
  color: #f8f8f5;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 20px 0;
}

.stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfaf6;
}

.stat strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.service-legend {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 9px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 750;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--chip-color);
}

.turnstile-box {
  display: grid;
  min-height: 68px;
  align-items: center;
  justify-items: start;
  overflow: hidden;
}

.calendar-scroll {
  max-height: calc(100vh - 258px);
  min-height: 560px;
  overflow: auto;
  padding: 16px;
  scrollbar-gutter: stable both-edges;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(154px, 1fr));
  gap: 10px;
  min-width: 1080px;
  align-items: start;
}

.day-column {
  display: grid;
  grid-template-rows: auto auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.day-column.today {
  border-color: var(--red);
  box-shadow: inset 0 0 0 2px rgba(217, 35, 50, 0.11);
}

.day-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 11px;
  background: #f7f5ef;
  border-bottom: 1px solid var(--line);
}

.day-header strong {
  display: block;
  font-size: 0.96rem;
}

.day-header span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.day-pick {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  background: var(--steel);
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.day-pick:disabled {
  cursor: not-allowed;
  color: #8a8790;
  background: #ded9ce;
}

.day-schedule {
  position: relative;
  height: var(--schedule-height, 720px);
  min-height: 560px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 49px, rgba(20, 21, 24, 0.08) 49px 50px),
    linear-gradient(180deg, #fff, #fbfaf6);
}

.time-label {
  position: absolute;
  left: 8px;
  transform: translateY(-50%);
  color: #8a8790;
  font-size: 0.68rem;
  font-weight: 800;
}

.current-time-line {
  position: absolute;
  left: 28px;
  right: 6px;
  z-index: 3;
  border-top: 2px solid var(--red);
  pointer-events: none;
}

.current-time-line i {
  position: absolute;
  right: 0;
  top: -10px;
  border-radius: 999px;
  padding: 2px 7px;
  color: #fff;
  background: var(--red);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 900;
}

.appointment-block {
  position: absolute;
  left: 34px;
  right: 7px;
  min-height: 42px;
  overflow: hidden;
  border: 1px solid rgba(20, 21, 24, 0.09);
  border-left: 5px solid var(--event-color, var(--red));
  border-radius: var(--radius);
  padding: 7px 8px;
  color: var(--ink);
  background: var(--event-bg, #fff4f5);
  box-shadow: 0 8px 18px rgba(20, 21, 24, 0.08);
  text-align: left;
}

button.appointment-block {
  cursor: pointer;
}

button.appointment-block:hover,
button.appointment-block:focus-visible {
  outline: 3px solid rgba(243, 178, 26, 0.35);
  transform: translateY(-1px);
}

.appointment-block strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.appointment-block span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 3px;
  color: #34373c;
  font-size: 0.72rem;
  font-weight: 760;
}

.closed-day {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 18px;
  color: var(--muted);
  font-weight: 850;
  text-align: center;
}

.control-rail {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 16px;
}

.panel-heading {
  margin-bottom: 13px;
}

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

.compact-form {
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: #35383d;
  font-size: 0.84rem;
  font-weight: 850;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cfcac0;
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 35, 50, 0.12);
}

textarea {
  resize: vertical;
}

.two-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
}

.form-message.success {
  color: var(--green);
}

.form-message.error {
  color: var(--red-dark);
}

.service-list,
.admin-appointments,
.hours-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.service-row,
.admin-row {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fbfaf6;
}

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

.service-swatch {
  width: 14px;
  height: 36px;
  border-radius: 6px;
  background: var(--swatch);
}

.service-row strong,
.admin-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.service-row span,
.admin-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.row-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--red-dark);
  background: #fff;
  font-weight: 850;
}

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

.admin-row.is-clickable {
  cursor: pointer;
}

.admin-row.is-clickable:hover {
  border-color: rgba(217, 35, 50, 0.35);
  background: #fff;
}

.full-width {
  margin-top: 12px;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 19, 23, 0.56);
}

.detail-modal {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(243, 178, 26, 0.16), transparent 48%),
    #fbfaf6;
}

.detail-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.detail-grid {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fbfaf6;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-grid dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.detail-note {
  min-height: 96px;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 18px 18px;
}

.detail-actions .ghost-button {
  width: auto;
  color: var(--red-dark);
}

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

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

  #appointmentsPanel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .session-badge {
    max-width: none;
    flex: 1;
  }

  .main-layout {
    width: min(100% - 20px, 1560px);
    margin-top: 10px;
  }

  .calendar-toolbar {
    flex-direction: column;
  }

  .calendar-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .stats-strip,
  .control-rail {
    grid-template-columns: 1fr;
  }

  .calendar-scroll {
    max-height: calc(100vh - 300px);
    min-height: 520px;
  }

  .two-fields {
    grid-template-columns: 1fr;
  }
}
