/* Booking configuration follows the Toolbox panel, field, and action rhythm. */
.booking-type-tabs {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 14px 0 18px;
  padding: 2px 1px 4px;
}

.booking-type-tabs > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 150px;
  flex: 1 1 180px;
  max-width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--booking-accent, var(--line));
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.booking-type-tabs > button > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.booking-type-tabs > button > .booking-status {
  display: inline-flex;
  flex: 0 0 auto;
  white-space: nowrap;
}

.booking-type-tabs > button.active {
  border-color: var(--booking-accent, var(--brand));
  background: var(--booking-soft);
  box-shadow: inset 0 0 0 1px var(--booking-accent, var(--brand));
}

.booking-type-tabs strong {
  overflow-wrap: anywhere;
}

.booking-type-tabs small {
  color: var(--muted);
  font-size: .67rem;
}

.booking-type-entry {
  --booking-accent: #2ab873;
  --booking-soft: color-mix(in srgb, #2ab873 13%, var(--surface));
}

.booking-type-birthday {
  --booking-accent: #c357a2;
  --booking-soft: color-mix(in srgb, #c357a2 12%, var(--surface));
}

.booking-type-course {
  --booking-accent: #3c82d4;
  --booking-soft: color-mix(in srgb, #3c82d4 12%, var(--surface));
}

.booking-type-event {
  --booking-accent: #d28a24;
  --booking-soft: color-mix(in srgb, #d28a24 12%, var(--surface));
}

.booking-type-overview,
.booking-type-editor,
.booking-schedule {
  grid-column: 1 / -1;
  border-top: 4px solid var(--booking-accent, var(--brand));
}

.booking-type-overview .panel-title,
.booking-type-editor .panel-title,
.booking-schedule .panel-title {
  align-items: flex-start;
}

.booking-type-overview .panel-title h2,
.booking-type-editor .panel-title h2,
.booking-schedule .panel-title h2 {
  margin: 0 0 4px;
}

.booking-type-overview .panel-title p,
.booking-type-editor .panel-title p,
.booking-schedule .panel-title p {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
}

.booking-editor-heading,
.booking-editor-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.booking-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 850;
}

.booking-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.booking-status.active {
  background: color-mix(in srgb, #2ab873 16%, var(--surface));
  color: #168657;
}

.booking-status.inactive {
  background: color-mix(in srgb, var(--muted) 14%, var(--surface));
  color: var(--muted);
}

.booking-current-context,
.booking-new-context {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--booking-soft, var(--surface-2));
  color: var(--text);
}

.booking-current-context span {
  color: var(--booking-accent, var(--brand));
  font-size: .7rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.booking-new-context {
  color: var(--muted);
  font-size: .77rem;
}

.booking-type-editor .booking-settings-grid {
  margin-top: 0;
}

.booking-type-overview .booking-type-tabs {
  margin-bottom: 0;
}

.booking-setting-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 750;
}

.booking-setting-field > .booking-field-label {
  align-self: end;
}

.booking-type-editor input,
.booking-type-editor select,
.booking-attendance select,
.booking-type-editor textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
}

.booking-duration-control {
  display: grid;
  grid-template-columns: minmax(90px, .75fr) minmax(130px, 1.25fr);
  gap: 8px;
}

.booking-duration-control input,
.booking-duration-control select {
  min-width: 0;
}

.booking-type-editor textarea {
  resize: vertical;
  line-height: 1.45;
}

.booking-type-editor input:invalid,
.booking-type-editor select:invalid {
  border-color: color-mix(in srgb, var(--danger) 65%, var(--line));
}

.booking-type-editor [hidden] {
  display: none !important;
}

.booking-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.booking-help {
  display: inline-grid;
  place-items: center;
  width: 18px;
  flex: 0 0 18px;
  height: 18px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--brand) 45%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  color: var(--brand);
  font-size: .68rem;
  font-weight: 900;
  line-height: 1;
  cursor: help;
}

.booking-message-field,
.booking-validation,
.booking-settings-actions {
  grid-column: 1 / -1;
}

.booking-validation {
  margin: 0;
  color: var(--danger);
  font-size: .75rem;
}

.booking-settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 3px;
}

.booking-settings-actions span {
  margin-right: auto;
  color: var(--muted);
  font-size: .72rem;
}

.booking-type-context {
  display: flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  max-width: 100%;
  flex-wrap: wrap;
  margin-top: 9px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--booking-soft);
  font-size: .69rem;
}

.booking-type-context i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--booking-accent);
}

.booking-type-context span,
.booking-import-help,
.booking-grid-exceptions > small {
  color: var(--muted);
}

.booking-import-help {
  margin: 0 0 12px;
  padding-left: 11px;
  border-left: 3px solid var(--booking-accent);
  font-size: .76rem;
  line-height: 1.5;
}

/* The contained table covers a complete 24-hour day. */
.booking-schedule .booking-painter {
  max-height: 510px;
  overflow: auto;
  grid-template-columns: 27px minmax(0, 1fr);
  touch-action: pan-y;
}

.booking-schedule .booking-painter-main { min-width: 0; }
.booking-schedule .booking-painter-days,
.booking-schedule .booking-painter-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.booking-schedule .booking-painter-column button { padding: 0; }

.booking-schedule .booking-painter-times {
  grid-template-rows: 24px repeat(24, 28px);
}

.booking-schedule .booking-painter-grid {
  height: 672px;
}

.booking-schedule .booking-painter-column {
  grid-template-rows: repeat(24, 28px);
}

.booking-schedule .booking-painter-column button.selected {
  background: var(--booking-accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--booking-accent) 75%, #000);
}

.booking-grid-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.booking-grid-actions .primary {
  background: var(--booking-accent);
}

.booking-grid-exceptions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px dashed color-mix(in srgb, var(--booking-accent) 45%, var(--line));
  border-radius: 10px;
  background: var(--booking-soft);
}

.booking-grid-exceptions > strong {
  font-size: .72rem;
}

.booking-grid-exceptions > div {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.booking-grid-exceptions > div > span {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface);
  font-size: .7rem;
}

.booking-grid-exceptions b {
  color: var(--booking-accent);
}

.booking-grid-exceptions button {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  cursor: pointer;
}

.booking-precise {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.booking-precise > summary {
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.booking-exception-form {
  display: grid;
  grid-template-columns: minmax(190px, .55fr) minmax(0, 1.45fr);
  align-items: end;
  gap: 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.booking-exception-form h3 {
  margin: 0 0 4px;
}

.booking-exception-form p {
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.45;
}

.booking-exception-form .booking-rule-form {
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.5fr) auto;
}

.booking-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.booking-dialog::backdrop {
  background: rgba(4, 13, 9, .62);
  backdrop-filter: blur(2px);
}

.booking-resource-dialog {
  width: min(850px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.booking-resource-dialog > p {
  margin-bottom: 18px;
}

.booking-resource-dialog .booking-current-context {
  flex-wrap: wrap;
}

.booking-resource-dialog .booking-current-context strong {
  overflow-wrap: anywhere;
  min-width: 0;
}

.booking-editor-remove {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.booking-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.booking-dialog-head h2 {
  margin: 0;
}

.booking-dialog > p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.booking-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

.booking-import-list {
  display: grid;
  gap: 7px;
  max-height: 300px;
  overflow: auto;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.booking-import-list li {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface-2);
}

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

@media (max-width: 900px) {
  .booking-exception-form {
    grid-template-columns: 1fr;
  }

  .booking-exception-form .booking-rule-form {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }

  .booking-exception-form .booking-rule-form button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .booking-duration-control { grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); }
  .booking-grid-actions, .booking-settings-actions { flex-wrap: wrap; }
  .booking-dialog { padding: 16px; }

  .booking-type-overview .panel-title,
  .booking-type-editor .panel-title,
  .booking-schedule .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .booking-editor-actions {
    width: 100%;
  }

  .booking-editor-actions button {
    flex: 1;
  }

  .booking-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .booking-settings-actions span {
    margin: 0;
  }

  .booking-settings-actions button {
    width: 100%;
  }

  .booking-grid-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .booking-exception-form .booking-rule-form {
    grid-template-columns: 1fr;
  }

  .booking-type-tabs > button {
    min-width: 210px;
  }

  .booking-dialog-actions {
    flex-direction: column-reverse;
  }

  .booking-dialog-actions button {
    width: 100%;
  }
}
