:root {
  --bg: #f4f6f7;
  --panel: #ffffff;
  --text: #16212a;
  --muted: #66737d;
  --line: #d5dde2;
  --accent: #14556b;
  --accent-soft: #dbeef4;
  --ok: #1f6b45;
  --ok-soft: #e0f2e8;
  --danger: #8c2330;
  --danger-soft: #ffe2e5;
  --warn: #8b5d00;
  --warn-soft: #fff1cc;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.embed-body {
  background: transparent;
}

a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(16px, 4vw, 56px) 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--accent);
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1;
}

h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

main {
  display: grid;
  gap: 18px;
  padding: 20px clamp(14px, 4vw, 56px) 48px;
}

.embed-main {
  padding: 0;
}

.embed-main .auth-card {
  max-width: none;
  border-radius: 0;
}

.embed-main .auth-card.wide {
  max-width: none;
}

.embed-main .auth-card > h2 {
  margin-bottom: 8px;
}

nav,
.inline,
.section-title,
.user-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

nav {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-title,
.user-main {
  justify-content: space-between;
}

.time-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.time-select-row span {
  color: var(--muted);
  font-weight: 900;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.panel,
.auth-card,
.message {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel details {
  border-top: 1px solid var(--line);
  padding: 11px 0;
}

.panel details:first-of-type {
  border-top: 0;
}

.panel summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 900;
}

.panel details p,
.panel details ul {
  margin-bottom: 0;
}

.faq-panel details > p,
.faq-panel details > ul {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.faq-panel details > ul {
  display: grid;
  gap: 4px;
  padding-left: 24px;
}

.faq-panel details > ul li {
  padding-left: 0;
}

.faq-panel details > ul li::marker {
  color: var(--accent);
}

.auth-card {
  max-width: 480px;
}

.auth-card.wide {
  max-width: 720px;
}

.stack {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
}

textarea {
  resize: vertical;
}

textarea.code-copy {
  min-height: 92px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.booking-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
}

.full {
  grid-column: 1 / -1;
}

.check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check input {
  min-height: auto;
  width: auto;
}

.primary,
.ghost {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.ghost {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 8px 12px;
}

.danger-action {
  background: var(--danger-soft);
  color: var(--danger);
}

.muted,
.booking-line span,
.user-card span {
  color: var(--muted);
  font-size: 14px;
}

.small-note,
.login-extra {
  margin-bottom: 0;
}

.public-intro {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  border-left: 3px solid var(--accent-soft);
  padding-left: 14px;
  color: var(--muted);
}

.public-intro p,
.public-intro ul {
  margin: 0;
}

.public-intro ul {
  display: grid;
  gap: 4px;
  padding-left: 18px;
}

.public-intro li {
  padding-left: 2px;
}

.public-fields label {
  flex: 1;
}

.trial-slots,
.slot-group,
.adjustment-log {
  display: grid;
  gap: 10px;
}

.slot-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #f8faf9;
}

.slot-group h3 {
  margin: 0;
  font-size: 16px;
}

.loading-box {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--accent);
  padding: 12px;
  font-weight: 900;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.date-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.date-option {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--accent);
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 900;
}

.date-option.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.trial-details {
  display: grid;
  gap: 13px;
}

.slot-option {
  position: relative;
}

.slot-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.slot-option span {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--accent);
  padding: 10px;
  text-align: center;
}

.slot-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.slot-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  font-weight: 900;
}

.slot-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.adjustment-log {
  border-left: 3px solid var(--accent-soft);
  padding-left: 10px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.check-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 8px;
  font-weight: 800;
}

.check-pill input {
  min-height: auto;
  width: auto;
}

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

.message {
  margin: 0;
  font-weight: 800;
}

.message.ok,
.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.message.warn,
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.message.danger,
.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.credit-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.credit-row strong {
  font-size: 34px;
  color: var(--accent);
}

.credit-row.secondary strong {
  font-size: 22px;
}

.meter {
  height: 8px;
  margin: 10px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf0;
}

.meter span {
  display: block;
  height: 100%;
  max-width: 100%;
  background: var(--accent);
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 900;
}

.pill.confirmed {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill.option {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill.locked {
  background: #28313c;
  color: #fff;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.service-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf9;
}

.service-card span {
  color: var(--accent);
  font-weight: 900;
}

.service-card small,
.service-admin h3 {
  color: var(--muted);
}

.service-admin {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.service-admin h3 {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.service-edit {
  align-items: end;
}

.teacher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.teacher-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf9;
}

.teacher-create {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

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

.embed-calendar {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.embed-calendar iframe {
  display: block;
  width: 100%;
  min-height: 640px;
  border: 0;
}

.calendar {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.calendar th,
.calendar td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.calendar th {
  background: #eff3f5;
}

.calendar th span {
  color: var(--muted);
  font-size: 12px;
}

.list,
.admin-users {
  display: grid;
  gap: 10px;
}

.compact {
  max-height: 420px;
  overflow: auto;
}

.booking-line,
.user-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.booking-line {
  grid-template-columns: 1fr auto;
  align-items: center;
}

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

.booking-edit {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.booking-edit summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent);
  font-weight: 900;
}

.booking-edit-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.booking-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
}

.booking-contact span,
.booking-note {
  color: var(--muted);
  font-size: 13px;
}

.booking-note {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font-family: inherit;
}

.user-card.inactive {
  opacity: 0.55;
}

.actions {
  flex-wrap: wrap;
  align-items: end;
}

.actions label {
  width: 160px;
}

.actions label:has(.check-grid) {
  width: 360px;
}

.date-form {
  display: flex;
  align-items: end;
  gap: 10px;
}

@media (max-width: 920px) {
  .topbar,
  .section-title,
  .user-main,
  .booking-line,
  .booking-actions,
  .date-form {
    align-items: stretch;
    flex-direction: column;
  }

  .grid.two,
  .booking-form,
  .booking-edit-form {
    grid-template-columns: 1fr;
  }
}
