:root {
  color-scheme: dark;
  --bg: #080811;
  --surface: #11101c;
  --surface-alt: #171526;
  --empty: #363640;
  --empty-line: #50505b;
  --ink: #f8f3e7;
  --muted: #a39aa9;
  --line: rgba(255, 255, 255, 0.1);
  --brand-accent: #f3bf4f;
  --brand-accent-dark: #d99c2b;
  --client-accent: #f3bf4f;
  --focus: #f3bf4f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.auth-loading .app-shell {
  visibility: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 78% 0%, rgba(84, 55, 132, 0.28), transparent 30rem),
    radial-gradient(circle at 16% 6%, rgba(243, 191, 79, 0.08), transparent 24rem),
    radial-gradient(circle at 44% 100%, rgba(77, 199, 161, 0.08), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

.test-body {
  min-height: 100vh;
  background: #f6f7fb;
  color: #080811;
}

.test-body[data-background="dark"] {
  background: #080811;
  color: #f8f3e7;
}

.test-toolbar {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 2;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: #080811;
  color: var(--ink);
}

.test-toolbar h1 {
  font-size: 26px;
}

.test-toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.test-page-shell {
  padding: 42px 24px;
}

.test-page-content {
  width: min(1180px, 100%);
  margin: 0 auto;
}

#testEmbedFrame {
  width: 100%;
  min-height: 620px;
  border: 0;
  background: transparent;
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-accent);
  color: #100d17;
  cursor: pointer;
  font-weight: 900;
  padding: 0 16px;
  box-shadow: 0 10px 24px rgba(243, 191, 79, 0.12);
}

button:hover {
  background: var(--brand-accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

button.is-idle {
  opacity: 0.48;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

body:not(.signed-out) .app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.signed-out .app-shell {
  grid-template-columns: minmax(300px, 420px);
  align-content: center;
  justify-content: center;
}

.signed-out .access-pane {
  display: grid;
  width: 100%;
}

.editor-pane,
.access-pane {
  min-width: 0;
}

.access-pane {
  display: none;
  align-content: start;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom:100px;
}

.topbar > div:first-child {
  margin-right: auto;
}

.identity-pill {
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
}

h2 {
  font-family: var(--serif);
  font-size: 18px;
}

.eyebrow {
  color: var(--brand-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 42%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(100px, auto) minmax(0, 1fr);
  align-items: end;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.settings-grid label {
  width: 110px;
}

.settings-grid .theme-control {
  width: 92px;
}

.settings-grid .color-control {
  width: 92px;
}

.color-control input {
  min-height: 40px;
  padding: 4px;
  cursor: pointer;
}

.schedule-control-group {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 14px;
  justify-self: end;
}

.delete-control-slot {
  justify-self: start;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0d17;
  color: var(--ink);
}

input,
select {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  min-height: 154px;
  resize: vertical;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.calendar-editor,
.embed-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  gap: 16px;
  padding: 22px;
  overflow-x: auto;
}

.calendar-editor {
  background: #0b0b14;
}

.embed-calendar {
  background: transparent;
}

.day-column,
.embed-day {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 132px;
}

.day-column h3,
.embed-day h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1;
  text-align: center;
}

.day-column h3 {
  color: var(--ink);
}

.embed-day h2 {
  color: var(--embed-heading-color, inherit);
}

.editor-slot,
.embed-slot {
  display: grid;
  align-content: center;
  min-height: 96px;
  border: 1px solid var(--empty-line);
  border-radius: 8px;
  background: var(--empty);
}

.editor-slot {
  gap: 6px;
}

.editor-slot:focus-within {
  border-color: var(--client-accent);
  background: var(--surface-alt);
}

.filled-slot.editor-slot:focus-within {
  background: var(--surface-alt);
}

.slot-title-input,
.slot-time-input {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
}

.slot-title-input {
  padding: 0 10px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
}

.slot-time-input {
  padding: 8px 10px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.slot-automation-select {
  width: calc(100% - 20px);
  min-height: 32px;
  margin: 0 10px;
  padding: 4px 8px;
  font-size: 12px;
}

.slot-title-input::placeholder,
.slot-time-input::placeholder {
  color: #85838d;
  opacity: 1;
}

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

.ghost-button,
.secondary-button,
.danger-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: none;
}

.ghost-button:hover,
.secondary-button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.danger-button {
  border-color: rgba(240, 104, 87, 0.42);
  color: #ff9c8d;
}

.danger-button:hover {
  background: rgba(240, 104, 87, 0.12);
}

.auth-panel,
.schedule-list-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.embed-inline-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, max-content));
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.embed-inline-panel textarea {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.embed-inline-panel .status-line {
  grid-column: 1 / -1;
  text-align: center;
}

.embed-inline-panel .status-line:empty {
  display: none;
}

[data-copy-target="staticEmbedCode"] {
  border: 1px solid rgba(77, 199, 161, 0.58);
  background: rgba(77, 199, 161, 0.18);
  color: #dffcf2;
  box-shadow: 0 10px 24px rgba(77, 199, 161, 0.08);
}

[data-copy-target="staticEmbedCode"]:hover {
  background: rgba(77, 199, 161, 0.28);
}

.schedule-list-panel {
  margin-bottom: 16px;
  display: grid;
  gap: 12px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.schedule-rows {
  display: grid;
  gap: 40px;
}

.schedule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border: 1px solid var(--line);
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
}

.schedule-row.expanded {
  padding: 12px 0 0;
  border-bottom-color: transparent;
  background: transparent;
}

.schedule-row-main {
  display: grid;
  justify-items: start;
  gap: 3px;
  min-height: 42px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.schedule-row-main span {
  font-weight: 900;
}

.schedule-name-input {
  min-height: 48px;
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  box-shadow: none;
}

.schedule-name-input:focus-visible {
  outline: 0;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(243, 191, 79, 0.16);
}

.expanded-schedule-mount {
  grid-column: 1 / -1;
}

.expanded-schedule-mount .panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}

#newScheduleMount {
  margin-top: 16px;
}

.schedule-toggle-button,
.schedule-edit-button {
  min-width: 84px;
  border-radius: 999px;
}

.pending-request-pill {
  align-self: center;
  padding: 7px 10px;
  border: 1px solid rgba(243, 191, 79, 0.58);
  border-radius: 999px;
  background: rgba(243, 191, 79, 0.1);
  color: var(--brand-accent);
  font-size: 12px;
  font-weight: 900;
}

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

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented-control button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.segmented-control button:hover,
.segmented-control button.is-selected {
  border-color: var(--brand-accent);
  background: rgba(243, 191, 79, 0.12);
}

.status-line {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.status-error {
  color: #ff9c8d;
}

[data-request-action="reject"] {
  border-color: rgba(143, 103, 210, 0.62);
  background: rgba(143, 103, 210, 0.1);
  color: #d8c4ff;
}

[data-request-action="reject"]:hover {
  background: rgba(143, 103, 210, 0.18);
}

.editor-list {
  display: grid;
  gap: 8px;
}

.inline-editor-list {
  padding: 0 18px 14px;
}

.modal-dialog {
  width: min(420px, calc(100vw - 28px));
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow);
}

.automation-dialog {
  width: min(620px, calc(100vw - 28px));
}

.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.modal-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.automation-list {
  display: grid;
  gap: 8px;
}

.automation-item {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f0e19;
}

.automation-item label {
  min-width: 0;
}

.editor-pill {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.change-request-list {
  display: grid;
  gap: 10px;
  padding: 0 18px 14px;
}

.change-request-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f0e19;
}

.change-request-card h3 {
  margin: 0;
  font-size: 15px;
}

.change-request-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.diff-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.diff-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.diff-legend i {
  width: 10px;
  height: 10px;
  border: 1px solid transparent;
  border-radius: 50%;
}

.diff-legend .diff-added {
  border-color: rgba(77, 199, 161, 0.78);
  background: rgba(77, 199, 161, 0.28);
}

.diff-legend .diff-changed {
  border-color: rgba(243, 191, 79, 0.82);
  background: rgba(243, 191, 79, 0.28);
}

.diff-legend .diff-removed {
  border-color: rgba(143, 103, 210, 0.82);
  background: rgba(143, 103, 210, 0.28);
}

.schedule-diff-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 10px;
  overflow-x: auto;
}

.diff-day {
  display: grid;
  gap: 8px;
  min-width: 112px;
}

.diff-day h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
}

.diff-slot {
  position: relative;
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 72px;
  padding: 16px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
}

.diff-slot strong {
  font-size: 12px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.diff-slot small,
.diff-slot em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.diff-automation-note {
  color: var(--ink);
  font-weight: 800;
}

.diff-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.diff-same {
  opacity: 0.38;
}

.diff-same .diff-badge {
  display: none;
}

.diff-slot.diff-added {
  border-color: rgba(77, 199, 161, 0.78);
  background: rgba(77, 199, 161, 0.12);
}

.diff-slot.diff-changed {
  border-color: rgba(243, 191, 79, 0.82);
  background: rgba(243, 191, 79, 0.12);
}

.diff-slot.diff-removed {
  border-color: rgba(143, 103, 210, 0.82);
  background: rgba(143, 103, 210, 0.12);
}

iframe {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #080811;
}

.embed-body {
  background: transparent;
  color: #080811;
}

.embed-body[data-page="dark"] {
  color: #f8f3e7;
}

.embed-root {
  padding: 0;
}

.embed-card {
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  overflow: visible;
}

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

.embed-time {
  margin-top: 12px;
  color: var(--slot-time-color, #52627a);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.embed-title {
  color: var(--slot-title-color, var(--ink));
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.automated-slot {
  width: 100%;
  padding: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.automated-slot:hover {
  background: var(--slot-hover-bg, #e9f5ee);
}

.automation-public-dialog {
  width: min(720px, calc(100vw - 28px));
  color: #f4f4f5;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.automation-public-panel {
  gap: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: #111318;
  color: #f4f4f5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

.automation-public-panel h2 {
  color: #f4f4f5;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.automation-public-panel .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.12);
  background: #151820;
}

.automation-public-panel .secondary-button {
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #e4e4e7;
  box-shadow: none;
}

.automation-public-panel .secondary-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.automation-public-panel iframe {
  min-height: 620px;
  border: 0;
  border-radius: 0;
}

.empty-slot {
  color: transparent;
}

.embed-slot.empty-slot {
  opacity: 0.7;
}

.filled-slot.editor-slot {
  border-width: 2px;
  border-color: var(--client-accent);
  background: var(--surface-alt);
}

.filled-slot.embed-slot {
  border-width: 2px;
  border-color: var(--client-accent);
  background: var(--slot-bg);
}

[data-mode="booking"] .automated-slot {
  position: relative;
  border-width: 3px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--client-accent) 38%, transparent);
  transform: translateY(0);
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

[data-mode="booking"] .automated-slot::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--client-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--client-accent) 18%, transparent);
}

[data-mode="booking"] .automated-slot:hover {
  background: var(--slot-hover-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--client-accent) 56%, transparent), 0 10px 24px rgba(2, 19, 41, 0.14);
  transform: translateY(-2px);
}

[data-theme="light"] {
  --slot-bg: #f1edf7;
  --embed-heading-color: #080811;
  --slot-hover-bg: color-mix(in srgb, var(--client-accent) 12%, #ffffff);
  --slot-title-color: #080811;
  --slot-time-color: #4f5060;
}

[data-theme="dark"] {
  --slot-bg: #11101c;
  --embed-heading-color: #f8f3e7;
  --slot-hover-bg: color-mix(in srgb, var(--client-accent) 18%, #11101c);
  --slot-title-color: #f8fafc;
  --slot-time-color: #c9c1d2;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  background: #0f0e19;
  border: 1px solid var(--line);
  border-radius: 10px;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .settings-grid,
  .button-row,
  .automation-item {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 25px;
  }

  .calendar-editor,
  .embed-calendar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 12px;
    overflow-x: visible;
  }

  .day-column,
  .embed-day {
    gap: 16px;
  }

  .day-column h3,
  .embed-day h2 {
    font-size: 18px;
  }

  .editor-slot,
  .embed-slot {
    min-height: 96px;
  }

  .embed-day.empty-day,
  .embed-day .empty-slot {
    display: none;
  }
}
