* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cp-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--cp-bg);
  color: var(--cp-text);
  font-family: "Segoe UI", Aptos, Calibri, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
.button {
  min-height: 44px;
  border: 1px solid var(--cp-border-strong);
  border-radius: 0.625rem;
  padding: 9px 16px;
  background: var(--cp-surface);
  color: var(--cp-text);
  cursor: pointer;
  font-weight: 650;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

button:hover,
.button:hover {
  border-color: var(--cp-text-muted);
  background: var(--cp-surface-soft);
}

button:active,
.button:active {
  transform: translateY(1px);
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--cp-accent);
  outline-offset: 3px;
}

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

a {
  color: var(--cp-link);
}

svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

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

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

.button--danger {
  border-color: var(--cp-danger);
  background: var(--cp-danger);
  color: var(--cp-accent-fg);
}

.button--quiet {
  border-color: var(--cp-border);
  background: var(--cp-surface);
}

.button--wide {
  width: 100%;
}

.text-button {
  min-height: auto;
  border: 0;
  padding: 4px;
  background: var(--cp-surface);
  color: var(--cp-link);
}

.text-button:hover {
  border: 0;
  background: var(--cp-surface);
  color: var(--cp-accent);
}

.card {
  border: 1px solid var(--cp-border);
  border-radius: 16px;
  background: var(--cp-surface);
  box-shadow: 0 1px 2px var(--cp-border);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cp-accent);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cp-success);
  box-shadow: 0 0 0 4px var(--cp-accent-soft);
}

.auth-page {
  background: linear-gradient(145deg, var(--cp-accent-soft), var(--cp-bg) 42%);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 20px;
}

.workspace-card,
.login-card {
  width: min(100%, 540px);
  padding: 32px;
}

.brand-lockup,
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--cp-text);
  text-decoration: none;
}

.brand-lockup {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--cp-border);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--cp-accent);
  border-radius: 13px;
  background: var(--cp-accent);
  color: var(--cp-accent-fg);
  font-size: 1.25rem;
  font-weight: 800;
}

.brand-mark--small {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 1rem;
}

.brand-name,
.brand-caption {
  display: block;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.brand-caption {
  margin-top: 2px;
  color: var(--cp-text-muted);
  font-size: 0.78rem;
}

.workspace-copy {
  padding: 32px 0 24px;
}

.status-pill,
.sync-badge,
.timezone-chip,
.calendar-legend {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--cp-border);
  border-radius: 999px;
  background: var(--cp-surface-soft);
  color: var(--cp-text-muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.status-pill {
  margin-bottom: 18px;
  padding: 7px 11px;
}

.workspace-copy h1,
.login-copy h1,
.page-heading h1 {
  margin: 0;
  color: var(--cp-text);
  letter-spacing: -0.035em;
}

.workspace-copy h1 {
  font-size: clamp(2rem, 7vw, 2.65rem);
}

.workspace-copy p,
.login-copy p,
.page-heading > div > p:last-child {
  color: var(--cp-text-muted);
  line-height: 1.55;
}

.workspace-copy > p:last-child {
  max-width: 440px;
  margin: 12px 0 0;
}

.app-tile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--cp-border);
  border-radius: 16px;
  padding: 18px;
  background: linear-gradient(135deg, var(--cp-accent-soft), var(--cp-surface));
  color: var(--cp-text);
  text-decoration: none;
  transition:
    border-color 140ms ease,
    transform 140ms ease;
}

.app-tile:hover {
  border-color: var(--cp-accent);
  transform: translateY(-2px);
}

.app-tile__icon,
.login-icon,
.dialog-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  background: var(--cp-accent);
  color: var(--cp-accent-fg);
}

.app-tile__icon {
  width: 48px;
  height: 48px;
}

.app-tile__copy {
  min-width: 0;
}

.app-tile__copy strong,
.app-tile__copy span {
  display: block;
}

.app-tile__copy strong {
  margin-bottom: 4px;
  font-size: 1rem;
}

.app-tile__copy span {
  color: var(--cp-text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.app-tile__arrow {
  width: 18px;
  color: var(--cp-text-muted);
}

.workspace-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  color: var(--cp-text-muted);
  font-size: 0.82rem;
}

.login-copy {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  padding: 32px 0 8px;
}

.login-icon {
  width: 48px;
  height: 48px;
  background: var(--cp-accent-soft);
  color: var(--cp-accent);
}

.login-copy h1 {
  font-size: 1.75rem;
}

.login-copy p:last-child {
  margin: 8px 0 0;
}

.form-field {
  display: grid;
  gap: 9px;
  margin: 20px 0 8px;
}

.form-field label {
  color: var(--cp-text);
  font-size: 0.86rem;
  font-weight: 700;
}

.input-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  border: 1px solid var(--cp-border-strong);
  border-radius: 0.625rem;
  padding: 0 13px;
  background: var(--cp-surface);
  color: var(--cp-text-muted);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.input-shell:focus-within {
  border-color: var(--cp-accent);
  box-shadow: 0 0 0 3px var(--cp-accent-soft);
}

.input-shell svg {
  width: 18px;
}

.input-shell input {
  width: 100%;
  min-height: 48px;
  border: 0;
  padding: 0;
  background: var(--cp-surface);
  color: var(--cp-text);
}

.input-shell input:focus {
  outline: 0;
}

.input-shell input::placeholder {
  color: var(--cp-text-soft);
}

.form-status {
  min-height: 22px;
  margin: 8px 0;
  color: var(--cp-danger);
  font-size: 0.85rem;
}

.security-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  margin: 22px 0 0;
  border-top: 1px solid var(--cp-border);
  padding-top: 18px;
  color: var(--cp-text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.security-note svg {
  width: 18px;
  color: var(--cp-success);
}

.app-page {
  background: var(--cp-bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  border-bottom: 1px solid var(--cp-border);
  padding: 12px max(20px, calc((100vw - 1440px) / 2 + 20px));
  background: var(--cp-panel-strong);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timezone-chip,
.sync-badge {
  padding: 8px 12px;
}

.timezone-chip svg {
  width: 16px;
}

.page-shell {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 36px 20px 48px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-heading h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.page-heading > div > p:last-child {
  max-width: 650px;
  margin: 10px 0 0;
}

.calendar-card {
  padding: 24px;
  overflow: hidden;
}

.calendar-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--cp-border);
  padding-bottom: 18px;
}

.calendar-card__header h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.calendar-card__header p {
  margin: 5px 0 0;
  color: var(--cp-text-muted);
  font-size: 0.84rem;
}

.calendar-legend {
  flex: 0 0 auto;
  border: 0;
  padding: 7px 0;
  background: var(--cp-surface);
}

.calendar-legend > span {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--cp-accent);
}

.calendar-status {
  margin: 0 0 14px;
  border-radius: 0.625rem;
  color: var(--cp-text-muted);
  font-size: 0.86rem;
}

.calendar-status:empty {
  display: none;
}

.calendar-status[data-kind="error"] {
  border: 1px solid var(--cp-danger);
  padding: 12px;
  color: var(--cp-danger);
}

.fc {
  --fc-border-color: var(--cp-border);
  --fc-button-bg-color: var(--cp-surface);
  --fc-button-border-color: var(--cp-border);
  --fc-button-hover-bg-color: var(--cp-surface-soft);
  --fc-button-hover-border-color: var(--cp-border-strong);
  --fc-button-active-bg-color: var(--cp-accent);
  --fc-button-active-border-color: var(--cp-accent);
  --fc-event-bg-color: var(--cp-accent);
  --fc-event-border-color: var(--cp-accent);
  --fc-event-text-color: var(--cp-accent-fg);
  --fc-list-event-hover-bg-color: var(--cp-accent-soft);
  --fc-neutral-bg-color: var(--cp-surface-soft);
  --fc-page-bg-color: var(--cp-surface);
  --fc-today-bg-color: var(--cp-highlight);
  color: var(--cp-text);
  font-size: 0.9rem;
}

.fc .fc-toolbar {
  gap: 16px;
}

.fc .fc-toolbar.fc-header-toolbar {
  margin-bottom: 20px;
}

.fc .fc-toolbar-title {
  color: var(--cp-text);
  font-size: clamp(1.05rem, 3vw, 1.4rem);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.fc .fc-button {
  min-height: 38px;
  border-radius: 0.625rem;
  box-shadow: none;
  padding: 7px 12px;
  text-transform: capitalize;
}

.fc .fc-button-primary {
  background: var(--cp-surface);
  border-color: var(--cp-border);
  color: var(--cp-text);
}

.fc .fc-button-primary:hover {
  background: var(--cp-surface-soft);
  border-color: var(--cp-border-strong);
  color: var(--cp-text);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--cp-accent);
  border-color: var(--cp-accent);
  color: var(--cp-accent-fg);
}

.fc .fc-button-primary:disabled {
  background: var(--cp-surface-soft);
  border-color: var(--cp-border);
  color: var(--cp-text-muted);
}

.fc-theme-standard .fc-scrollgrid,
.fc-theme-standard .fc-list {
  border-color: var(--cp-border);
  border-radius: 12px;
  overflow: hidden;
}

.fc-theme-standard td,
.fc-theme-standard th {
  border-color: var(--cp-border);
}

.fc .fc-col-header-cell {
  background: var(--cp-surface-soft);
}

.fc .fc-col-header-cell-cushion {
  padding: 10px 4px;
  color: var(--cp-text);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.fc .fc-daygrid-day-number,
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
  color: var(--cp-text);
  text-decoration: none;
}

.fc .fc-timegrid-axis-cushion,
.fc .fc-timegrid-slot-label-cushion,
.fc .fc-list-event-time {
  color: var(--cp-text-muted);
  font-size: 0.75rem;
}

.fc .fc-timegrid-slot {
  height: 3.1em;
}

.fc .fc-timegrid-slot-minor {
  border-top-style: none;
}

.fc .fc-timegrid-now-indicator-line {
  border-color: var(--cp-danger);
}

.fc-event {
  cursor: pointer;
}

.fc .fc-timegrid-event,
.fc .fc-daygrid-event {
  border: 0;
  border-radius: 7px;
  box-shadow: 0 1px 2px var(--cp-border);
}

.fc .fc-timegrid-event .fc-event-main,
.fc .fc-daygrid-event .fc-event-main {
  padding: 4px 6px;
}

.fc .fc-event-time {
  font-weight: 650;
}

.fc .fc-event-title {
  font-weight: 700;
}

.fc-event:focus-visible {
  outline: 3px solid var(--cp-warning);
  outline-offset: 2px;
}

.fc-event.is-cancelling {
  border: 2px dashed var(--cp-warning);
  opacity: 0.72;
}

.fc .fc-list-day-cushion {
  padding: 10px 12px;
  background: var(--cp-surface-soft);
}

.fc .fc-list-event > td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.fc .fc-list-event-dot {
  border-color: var(--cp-accent);
}

.fc .fc-list-empty {
  background: var(--cp-surface);
  color: var(--cp-text-muted);
}

dialog {
  width: min(calc(100% - 32px), 580px);
  max-height: calc(100vh - 32px);
  border: 1px solid var(--cp-border);
  border-radius: 16px;
  padding: 0;
  background: var(--cp-surface);
  color: var(--cp-text);
  box-shadow: var(--cp-shadow);
}

dialog:focus {
  outline: 0;
}

dialog::backdrop {
  background: var(--cp-overlay);
}

.dialog-content {
  padding: 28px;
}

.dialog-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}

.dialog-icon {
  width: 46px;
  height: 46px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.dialog-heading .eyebrow {
  margin-bottom: 3px;
}

.dialog-close {
  min-width: 40px;
  min-height: 40px;
  padding: 4px;
  font-size: 1.45rem;
  line-height: 1;
}

.booking-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 16px;
  border: 1px solid var(--cp-border);
  border-radius: 12px;
  padding: 15px 16px;
  background: var(--cp-surface-soft);
}

.booking-time span {
  color: var(--cp-text-muted);
}

.booking-time strong {
  color: var(--cp-accent);
  font-size: 1.05rem;
}

.booking-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}

.booking-details > div {
  border: 1px solid var(--cp-border);
  border-radius: 12px;
  padding: 13px 14px;
}

.booking-details > div:last-child {
  grid-column: 1 / -1;
}

.booking-details dt {
  margin-bottom: 4px;
  color: var(--cp-text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.booking-details dd {
  margin: 0;
  font-weight: 650;
  line-height: 1.4;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.confirmation {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  border: 1px solid var(--cp-warning);
  border-radius: 12px;
  padding: 16px;
  background: var(--cp-surface-soft);
}

.confirmation__copy strong {
  display: block;
  margin-bottom: 4px;
}

.confirmation__copy p {
  margin: 0;
  color: var(--cp-text-muted);
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: min(420px, calc(100% - 40px));
  border: 1px solid var(--cp-border);
  border-radius: 0.625rem;
  padding: 13px 16px;
  background: var(--cp-panel-strong);
  color: var(--cp-text);
  box-shadow: var(--cp-shadow);
  font-weight: 600;
}

.toast[data-kind="error"] {
  border-color: var(--cp-danger);
}

.toast[data-kind="success"] {
  border-color: var(--cp-success);
}

@media (max-width: 700px) {
  .auth-shell {
    align-items: start;
    padding: 20px 12px;
  }

  .workspace-card,
  .login-card {
    margin-top: 24px;
    padding: 24px;
  }

  .workspace-copy {
    padding-top: 26px;
  }

  .app-tile {
    gap: 12px;
    padding: 15px;
  }

  .app-tile__copy span {
    font-size: 0.8rem;
  }

  .workspace-footer {
    align-items: flex-start;
  }

  .login-copy {
    grid-template-columns: 1fr;
  }

  .topbar {
    min-height: 62px;
    padding: 10px 12px;
  }

  .topbar__actions {
    gap: 8px;
  }

  .topbar .brand-caption,
  .timezone-chip {
    display: none;
  }

  .topbar__actions .button--quiet {
    min-height: 40px;
    padding: 7px 12px;
  }

  .page-shell {
    padding: 24px 12px 36px;
  }

  .page-heading {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  .page-heading > div > p:last-child {
    margin-top: 8px;
    font-size: 0.9rem;
  }

  .sync-badge {
    display: none;
  }

  .calendar-card {
    padding: 14px;
  }

  .calendar-card__header {
    margin-bottom: 16px;
    padding-bottom: 14px;
  }

  .calendar-legend {
    display: none;
  }

  .fc {
    font-size: 0.84rem;
  }

  .fc .fc-toolbar {
    align-items: center;
    gap: 8px;
  }

  .fc .fc-toolbar.fc-header-toolbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    margin-bottom: 16px;
  }

  .fc .fc-toolbar.fc-footer-toolbar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-top: 14px;
    border-top: 1px solid var(--cp-border);
    padding-top: 12px;
    background: var(--cp-surface);
  }

  .fc .fc-toolbar-title {
    text-align: center;
    font-size: 1rem;
  }

  .fc .fc-button {
    min-height: 38px;
    padding: 7px 10px;
  }

  .fc .fc-list-day-cushion {
    padding: 9px 10px;
  }

  .fc .fc-list-event > td {
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .fc .fc-list-event-time {
    width: 74px;
    white-space: nowrap;
  }

  dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100vh - 24px);
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
  }

  .dialog-content {
    padding: 22px 18px 20px;
  }

  .booking-time {
    display: grid;
    gap: 5px;
  }

  .booking-details {
    gap: 9px;
  }

  .booking-details > div {
    padding: 11px 12px;
  }

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

  .toast {
    right: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
