.master-access-page {
  padding: 64px 0 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1040px;
  margin: 0 auto;
}

.master-access-header {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 0;
  right: 0;
  height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 8px 16px;
  z-index: 25;
  transition: opacity 180ms ease;
}

.master-access-title {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #1b1b1b;
}

.master-access-back,
.master-access-save {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.master-access-back {
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.master-access-save {
  background: #1b1b1b;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.master-access-save:disabled,
.master-access-save--busy {
  opacity: 0.5;
  cursor: default;
}

.master-access-save--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.master-access-back img,
.master-access-save img {
  width: 24px;
  height: 24px;
}

.master-access-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.master-access-loading,
.master-access-error {
  text-align: center;
  font-size: 14px;
  color: #6b7280;
}

.master-access-card {
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.master-access-card__heading {
  max-width: 320px;
  margin: 0 auto;
  text-align: center;
  margin-bottom: 8px;
}

.master-access-card__title {
  margin: 4px 0 8px;
  font-size: 24px;
  line-height: 1.08;
  font-weight: 600;
  color: #1b1b1b;
}

.master-access-card__subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 600;
  color: #1b1b1b;
}

.master-access-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.master-access-section__title {
  margin: 0;
  font-size: 14px;
  line-height: 1.1;
  font-weight: 600;
  color: #1b1b1b;
}

.master-access-section__rows {
  display: flex;
  flex-direction: column;
}

.master-access-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed #d8d8d8;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  height: 48px;
}

.master-access-row:last-child {
  border-bottom: none;
}

.master-access-row:active {
  background: transparent;
}

.master-access-row * {
  -webkit-tap-highlight-color: transparent;
}

.master-access-row__label {
  font-size: 14px;
  line-height: 1.25;
  color: #1b1b1b;
  -webkit-user-select: none;
  user-select: none;
}

.master-access-row__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(100%);
  white-space: nowrap;
  appearance: none;
  -webkit-appearance: none;
}

.master-access-switch {
  width: 48px;
  height: 24px;
  border-radius: 999px;
  background: #ef7f86;
  position: relative;
  flex: 0 0 44px;
  transition: background-color 0.18s ease;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  contain: paint;
}

.master-access-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 30px;
  height: 20px;
  border-radius: 10px;
  background: #fff;
  transition: transform 0.18s ease;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.master-access-row__input:checked + .master-access-switch {
  background: #97d98e;
}

.master-access-row__input:checked + .master-access-switch::after {
  transform: translateX(10px);
}

.master-access-row__input:focus-visible + .master-access-switch {
  box-shadow: 0 0 0 2px rgba(27, 27, 27, 0.12);
}

.master-access-leave-modal[hidden] {
  display: none !important;
}

.master-access-leave-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.master-access-leave-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 27, 27, 0.62);
}

.master-access-leave-modal__dialog {
  position: relative;
  width: min(100%, 360px);
  border-radius: 24px;
  background: #fff;
  padding: 22px 16px 14px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
}

.master-access-leave-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: #edf0f4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.master-access-leave-modal__close img {
  width: 16px;
  height: 16px;
}

.master-access-leave-modal__title {
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0 40px;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  color: #1b1b1b;
  text-align: center;
}

.master-access-leave-modal__save,
.master-access-leave-modal__exit {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
  cursor: pointer;
}

.master-access-leave-modal__save {
  border: 0;
  background: #1b1b1b;
  color: #fff;
}

.master-access-leave-modal__exit {
  border: 1px solid #f0cdcd;
  background: #fff;
  color: #d51616;
}

.master-access-leave-modal__close,
.master-access-leave-modal__save,
.master-access-leave-modal__exit {
  -webkit-tap-highlight-color: transparent;
}

.master-access-leave-modal__close:focus,
.master-access-leave-modal__close:focus-visible,
.master-access-leave-modal__save:focus,
.master-access-leave-modal__save:focus-visible,
.master-access-leave-modal__exit:focus,
.master-access-leave-modal__exit:focus-visible,
.master-access-leave-modal__save:active,
.master-access-leave-modal__exit:active {
  outline: none;
  box-shadow: none;
}
