/* Slotback – mobile-first base styles, no framework. */

/* Palettes. Light is the default; the server sets data-theme from the `theme` cookie.
   Every colour is a variable defined in BOTH palettes. */
:root,
:root[data-theme="light"] {
  --bg: #f6f9f8;
  --surface: #ffffff;
  --text: #13201b;
  --muted: #52605a;
  --border: #dfe6e2;
  --accent: #0b7a55;
  --accent-hover: #095f43;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --focus: #0b7a55;
  --radius: 10px;
  --space: 1rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121715;
  --surface: #1b2220;
  --text: #e8ede9;
  --muted: #a5b0aa;
  --border: #34403b;
  --accent: #5fcf9f;
  --accent-hover: #82dfb7;
  --accent-text: #06150e;
  --danger: #f4938b;
  --danger-bg: #3a1f1d;
  --focus: #82dfb7;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

h1,
h2 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 var(--space);
}

main.container {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* Header */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  min-height: 3.5rem;
}

.brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

/* The logo is an image, in two colour variants; data-theme decides which one shows. */
.brand-logo {
  display: block;
  height: 28px;
  width: auto;
}

.brand-logo-dark,
:root[data-theme="dark"] .brand-logo-light {
  display: none;
}

:root[data-theme="dark"] .brand-logo-dark {
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space);
  min-width: 0;
}

.theme-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--bg);
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Shows what a click switches to: the moon in the light theme, the sun in the dark one. */
.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space);
  min-width: 0;
}

.nav-business {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-form {
  margin: 0;
}

/* Cards and layout */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem var(--space);
}

.card.narrow {
  max-width: 28rem;
  margin: 0 auto;
}

.hero {
  max-width: 40rem;
  padding: 1rem 0;
}

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

.lead {
  font-size: 1.1rem;
  color: var(--muted);
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  font-size: 0.875rem;
  margin: 0.35rem 0 0;
}

.switch {
  margin: 1.25rem 0 0;
  text-align: center;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Forms */

.field {
  margin-bottom: 1.1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--danger);
}

.input-prefix {
  display: flex;
  align-items: stretch;
}

.input-prefix span {
  display: flex;
  align-items: center;
  padding: 0 0.6rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  white-space: nowrap;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.input-prefix input {
  border-radius: 0 var(--radius) var(--radius) 0;
  min-width: 0;
}

.field-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin: 0.35rem 0 0;
}

.alert {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius);
  padding: 0.75rem;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
}

.button.primary {
  color: var(--accent-text);
  background: var(--accent);
}

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

.button.block {
  width: 100%;
}

.link-button {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0.5rem 0;
  cursor: pointer;
  text-decoration: underline;
}

/* Admin tabs */

.admin-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.admin-tabs-inner {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
}

.admin-tabs a {
  padding: 0.7rem 0;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.admin-tabs a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  margin-bottom: 1rem;
}

.page-head h1 {
  margin: 0;
}

.card + .card {
  margin-top: 1rem;
}

.notice {
  color: var(--accent);
  font-weight: 600;
}

.checklist {
  margin: 0;
  padding-left: 1.25rem;
}

.checklist li + li {
  margin-top: 0.4rem;
}

.checklist li.done {
  color: var(--muted);
}

/* Lists (services) */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card .list {
  border: 0;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  padding: 0.85rem var(--space);
}

.card .list-item {
  padding-left: 0;
  padding-right: 0;
}

.list-item + .list-item {
  border-top: 1px solid var(--border);
}

.list-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.list-title {
  font-weight: 600;
  color: var(--text);
}

a.list-title {
  text-decoration: none;
}

.list-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.list-item.inactive .list-title {
  color: var(--muted);
}

.button.small {
  min-height: 2.25rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Forms: extras */

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}

/* Date and time inputs have a wide intrinsic size; let them shrink with their column. */
.field-row > .field,
input[type="date"],
input[type="time"] {
  min-width: 0;
}

fieldset.field {
  border: 0;
  padding: 0;
  min-width: 0;
}

fieldset.field legend {
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.35rem;
}

.field.checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.field.checkbox input {
  width: 1.25rem;
  min-height: 1.25rem;
  margin: 0;
}

.field.checkbox label {
  margin: 0;
  font-weight: 400;
}

.hours-day {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
  padding: 0.75rem 0;
}

.hours-day legend {
  font-weight: 600;
  padding: 0;
  float: left;
  width: 100%;
  margin-bottom: 0.4rem;
}

.hours-day > div {
  clear: both;
}

.interval-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.interval-row input {
  width: auto;
  flex: 1 1 0;
  min-width: 0;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  margin: 0;
}

.choice input {
  width: 1.15rem;
  min-height: 1.15rem;
  margin: 0;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.copy-url {
  word-break: break-all;
}

/* Public pages */

.business-head {
  margin-bottom: 1rem;
}

.hours {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
}

.hours dt {
  font-weight: 600;
}

.hours dd {
  margin: 0;
}

.day-strip {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 1rem calc(-1 * var(--space)) 0;
  padding: 0 var(--space) 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.75rem;
  padding: 0.5rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  scroll-snap-align: start;
}

.day-weekday {
  font-size: 0.8rem;
  color: var(--muted);
}

.day-date {
  font-weight: 600;
}

.day-full,
.day-closed {
  opacity: 0.55;
}

.day-closed .day-date {
  text-decoration: line-through;
}

.day[aria-current="date"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  opacity: 1;
}

.day[aria-current="date"] .day-weekday {
  color: inherit;
}

.picker-day {
  margin-top: 1.25rem;
}

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.slot {
  text-align: center;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 600;
}

.slot a {
  display: block;
  padding: 0.6rem 0;
  color: inherit;
  text-decoration: none;
}

.slot:hover,
.slot:focus-within {
  background: var(--accent);
  color: var(--accent-text);
}

.actions {
  margin-top: 1rem;
}

.empty-day {
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Wider screens */

@media (min-width: 40rem) {
  h1 {
    font-size: 1.75rem;
  }

  .hero {
    padding: 3rem 0;
  }

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

  .actions {
    flex-direction: row;
  }

  .card {
    padding: 1.75rem;
  }
}

/* Owner calendar */

.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
}

.day-nav h2 {
  margin: 0;
  text-align: center;
}

.list-item.time-off {
  border-radius: var(--radius);
  background: var(--bg);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  margin-bottom: 0.75rem;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  resize: vertical;
}

.list-meta.answer {
  color: var(--text);
}

/* Question form: the items field is only for a choice (no script needed). */

.question-form:not(:has(input[value="choice"]:checked)) .question-options {
  display: none;
}

/* Question rows of the new-service form: the items field is only for a choice. */

.question-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem var(--space);
  margin-bottom: 0.75rem;
}

.question-row:not(:has(option[value="choice"]:checked)) .question-options {
  display: none;
}

/* Overview */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0;
}

.stat {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.75rem var(--space);
}

.stat dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat dd {
  margin: 0.2rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-main dd {
  color: var(--accent);
}

.button.disabled {
  opacity: 0.4;
  cursor: default;
}

/* Time off form: show only the fields that fit the chosen kind (no script needed). */

.off-form:has(input[value="days"]:checked) .off-hours,
.off-form:has(input[value="hours"]:checked) .off-days {
  display: none;
}
