/* ALISE content manager — active only when index.html?edit=1 is open. */
.cms-editor,
.cms-editor * {
  box-sizing: border-box;
  font-family: "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
}

.cms-upload-input {
  position: fixed;
  z-index: -1;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

body.cms-editing {
  padding-bottom: 96px;
}

.cms-text-editable {
  border-radius: 3px;
  outline: 1px dashed rgba(11, 120, 201, .48);
  outline-offset: 3px;
  cursor: text;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.cms-text-editable:hover {
  outline-color: #f18700;
  background: rgba(255, 245, 226, .62);
}

.cms-text-editable:focus {
  outline: 2px solid #0b78c9;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(11, 120, 201, .13);
}

.cms-image-editable {
  outline: 3px dashed rgba(241, 135, 0, .72);
  outline-offset: -5px;
  cursor: pointer !important;
}

.cms-image-editable:hover {
  filter: brightness(.94) saturate(.9);
}

.cms-bg-button {
  position: absolute;
  z-index: 50;
  top: 14px;
  right: 14px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 20px;
  color: #fff;
  background: rgba(3, 42, 88, .88);
  box-shadow: 0 8px 20px rgba(0, 20, 48, .18);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.cms-bg-button:hover,
.cms-bg-button:focus-visible {
  background: #f18700;
}

.cms-toolbar {
  position: fixed;
  z-index: 10000;
  right: 18px;
  bottom: 16px;
  left: 18px;
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 15px;
  color: #fff;
  background: rgba(3, 34, 74, .96);
  box-shadow: 0 18px 46px rgba(0, 23, 55, .33);
  backdrop-filter: blur(12px);
}

.cms-toolbar__title {
  display: grid;
  min-width: 180px;
  margin-right: auto;
  gap: 2px;
}

.cms-toolbar__title strong {
  font-size: 14px;
}

.cms-toolbar__title span {
  color: #bcd4eb;
  font-size: 10px;
}

.cms-toolbar button,
.cms-toolbar a,
.cms-import-label {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 22px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.cms-toolbar button:hover,
.cms-toolbar button:focus-visible,
.cms-toolbar a:hover,
.cms-toolbar a:focus-visible,
.cms-import-label:hover,
.cms-import-label:focus-within {
  border-color: #73b7e9;
  background: rgba(255, 255, 255, .16);
}

.cms-toolbar .cms-button--primary {
  border-color: #f18700;
  background: #e46e00;
}

.cms-toolbar .cms-button--danger {
  color: #ffd9d9;
}

.cms-import-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.cms-drawer {
  position: fixed;
  z-index: 10001;
  top: 14px;
  right: 14px;
  bottom: 98px;
  width: min(480px, calc(100vw - 28px));
  overflow: auto;
  border: 1px solid #dbe4ec;
  border-radius: 15px;
  color: #183657;
  background: #fff;
  box-shadow: 0 22px 60px rgba(0, 25, 58, .28);
}

.cms-drawer[hidden] {
  display: none;
}

.cms-drawer__header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #e1e8ef;
  background: rgba(255, 255, 255, .97);
}

.cms-drawer__header strong {
  color: #06275a;
  font-size: 16px;
}

.cms-drawer__header button {
  width: 36px;
  height: 36px;
  border: 1px solid #cedae5;
  border-radius: 50%;
  color: #06275a;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
}

.cms-drawer__intro {
  margin: 0;
  padding: 16px 20px 0;
  color: #5a6b80;
  font-size: 11px;
  line-height: 1.75;
}

.cms-drawer__search {
  position: sticky;
  z-index: 2;
  top: 73px;
  display: block;
  padding: 12px 20px;
  background: rgba(255, 255, 255, .97);
}

.cms-drawer__search input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #cedae5;
  border-radius: 8px;
  color: #163653;
  background: #f8fafc;
  font-size: 12px;
}

.cms-fields {
  display: grid;
  gap: 12px;
  padding: 4px 20px 24px;
}

.cms-field {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #e0e7ed;
  border-radius: 9px;
  background: #fbfcfe;
}

.cms-field[hidden] {
  display: none;
}

.cms-field__label {
  color: #6a7889;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
}

.cms-field textarea,
.cms-field input {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid #ccd9e4;
  border-radius: 6px;
  color: #193855;
  background: #fff;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}

.cms-field textarea:focus,
.cms-field input:focus {
  border-color: #0b78c9;
  outline: 3px solid rgba(11, 120, 201, .12);
}

.cms-toast {
  position: fixed;
  z-index: 10002;
  top: 18px;
  left: 50%;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 18px;
  transform: translate(-50%, -20px);
  border-radius: 24px;
  color: #fff;
  background: #0a6e4f;
  box-shadow: 0 10px 28px rgba(0, 35, 50, .24);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.cms-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.cms-toast.is-error {
  background: #b43a32;
}

@media (max-width: 860px) {
  body.cms-editing {
    padding-bottom: 200px;
  }

  .cms-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .cms-toolbar__title {
    grid-column: 1 / -1;
    min-width: 0;
    margin: 0;
  }

  .cms-toolbar button,
  .cms-toolbar a,
  .cms-import-label {
    min-height: 38px;
    padding-inline: 8px;
    font-size: 10px;
  }

  .cms-drawer {
    bottom: 188px;
  }

  .cms-bg-button {
    top: 8px;
    right: 8px;
  }
}
