:root {
  --editor-primary: #245bd8;
  --editor-dark: #1845b7;
  --editor-soft: #eaf0ff;
  --editor-border: #d9e2f2;
  --editor-bg: #f3f6fd;
  --editor-card: #ffffff;
  --editor-danger: #b9342a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--editor-bg); }
body { margin: 0; min-width: 320px; color: #182238; background: linear-gradient(180deg, #fafcff, var(--editor-bg)); line-height: 1.6; }
a { color: var(--editor-dark); }
button, input, textarea { font: inherit; }
[hidden] { display: none !important; }
.editor-shell { width: min(100% - 28px, 1180px); margin: 0 auto; padding: 24px 0 60px; }
.editor-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; }
.editor-header h1 { margin: 0; font-size: clamp(24px, 5vw, 34px); }
.editor-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-nav form { margin: 0; }
.editor-nav a,
.editor-nav button { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 13px; border: 1px solid var(--editor-border); border-radius: 12px; color: var(--editor-dark); background: var(--editor-card); text-decoration: none; font-weight: 800; cursor: pointer; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); gap: 18px; align-items: start; }
.editor-card { border: 1px solid var(--editor-border); border-radius: 20px; background: var(--editor-card); box-shadow: 0 12px 34px rgba(31, 60, 116, .09); overflow: hidden; }
.editor-card__header { padding: 20px 22px 14px; border-bottom: 1px solid var(--editor-border); }
.editor-card__header h2 { margin: 0; font-size: 20px; }
.editor-card__header p { margin: 5px 0 0; color: #64708a; font-size: 13px; }
.editor-card__body { padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label { font-weight: 850; font-size: 14px; }
.field small { color: #64708a; }
.field input, .field textarea { width: 100%; border: 1px solid #c7d3e6; border-radius: 12px; padding: 11px 12px; color: #182238; background: #fff; }
.field textarea { min-height: 112px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--editor-primary); box-shadow: 0 0 0 4px rgba(36, 91, 216, .12); }
.field-error { min-height: 1.3em; margin: 0; color: var(--editor-danger); font-size: 13px; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 10px 18px; border: 1px solid transparent; border-radius: 13px; cursor: pointer; font-weight: 900; text-decoration: none; }
.button--primary { color: #fff; background: linear-gradient(145deg, var(--editor-primary), var(--editor-dark)); }
.button--secondary { color: var(--editor-dark); border-color: var(--editor-border); background: #fff; }
.button--danger { color: #fff; background: var(--editor-danger); }
.button:disabled { opacity: .6; cursor: wait; }
.status-message { margin: 0 0 16px; padding: 12px 14px; border: 1px solid #b8dfce; border-radius: 12px; color: #165f44; background: #eefaf5; font-weight: 800; }
.status-message--error { border-color: #efc5c1; color: #922a22; background: #fff2f1; }
.preview-pane { position: sticky; top: 14px; }
.crop-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; align-items: start; }
.crop-stage { width: 100%; aspect-ratio: 1 / 1; border: 1px dashed #9eb1ce; border-radius: 16px; overflow: hidden; background: #edf2f9; }
.crop-stage canvas { display: block; width: 100%; height: 100%; }
.crop-controls { display: grid; gap: 12px; }
.crop-controls label { display: grid; gap: 5px; font-weight: 800; font-size: 13px; }
.crop-controls input[type="range"] { width: 100%; }
.crop-file { display: grid; gap: 7px; margin-bottom: 14px; }
.login-card { width: min(100% - 28px, 470px); margin: 8vh auto 0; padding: 26px; border: 1px solid var(--editor-border); border-radius: 22px; background: #fff; box-shadow: 0 18px 55px rgba(31, 60, 116, .14); }
.login-card h1 { margin: 0; }
.login-card > p { color: #64708a; }
.login-card .field { margin-top: 14px; }
.login-card .button { width: 100%; margin-top: 18px; }
.login-footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; margin-top: 18px; text-align: center; font-size: 13px; }
.login-footer form { margin: 0; }
.link-button { padding: 0; border: 0; color: var(--editor-dark); background: transparent; text-decoration: underline; cursor: pointer; }

@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
  .preview-pane { position: static; order: -1; }
  .crop-layout { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .editor-shell { width: min(100% - 18px, 1180px); padding-top: 14px; }
  .editor-header { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }
  .editor-card__body, .editor-card__header { padding-left: 16px; padding-right: 16px; }
  .actions { display: grid; }
  .button { width: 100%; }
}

/* V3.0.2: the preview loads the real public profile page in a same-origin frame. */
.login-kicker,
.editor-kicker {
  margin: 0 0 4px;
  color: var(--editor-primary, #245bd8);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}
.editor-card--preview { overflow: hidden; }
.public-profile-preview {
  overflow: hidden;
  margin: 16px;
  border: 1px solid #cfd8e7;
  border-radius: 18px;
  background: #e8edf5;
  box-shadow: 0 16px 38px rgba(31, 60, 116, .13);
}
.public-profile-preview__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  border-bottom: 1px solid #cfd8e7;
  background: linear-gradient(180deg, #f8fafc, #edf1f6);
}
.public-profile-preview__bar > span {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b8c2d1;
}
.public-profile-preview__bar > span:nth-child(1) { background: #e26a66; }
.public-profile-preview__bar > span:nth-child(2) { background: #e7b84f; }
.public-profile-preview__bar > span:nth-child(3) { background: #67b77d; }
.public-profile-preview__bar strong {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #5a667a;
  font-size: 11px;
  white-space: nowrap;
}
.public-profile-preview__frame {
  display: block;
  width: 100%;
  height: min(72vh, 760px);
  min-height: 620px;
  border: 0;
  background: #fff;
}
.public-profile-preview__note {
  margin: 0;
  padding: 0 18px 18px;
  color: #64708a;
  font-size: 11px;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .public-profile-preview__frame {
    height: min(68vh, 680px);
    min-height: 560px;
  }
}

@media (max-width: 620px) {
  .editor-card--preview { margin-inline: -9px; border-radius: 0; }
  .public-profile-preview { margin: 0; border-right: 0; border-left: 0; border-radius: 0; }
  .public-profile-preview__frame {
    height: 580px;
    min-height: 520px;
  }
  .public-profile-preview__note { padding: 12px 16px 16px; }
}

/* V3.0.8: authenticated staff can display and save only their own assigned QR code. */
.staff-self-qr-card {
  margin-top: 18px;
  scroll-margin-top: 14px;
}
.staff-self-qr__toggle {
  width: 100%;
}
.staff-self-qr__panel {
  display: grid;
  grid-template-columns: minmax(220px, 310px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--editor-border);
}
.staff-self-qr__visual {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 0;
}
.staff-self-qr__visual canvas {
  display: block;
  width: min(100%, 300px);
  height: auto;
  aspect-ratio: 1 / 1;
  padding: 10px;
  border: 1px solid #c9d5e7;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 60, 116, .11);
}
.staff-self-qr__status {
  margin: 0;
  color: #53617a;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}
.staff-self-qr__status--error {
  color: var(--editor-danger);
}
.staff-self-qr__details {
  min-width: 0;
}
.staff-self-qr__lead {
  margin: 0 0 14px;
  color: #27334b;
  font-size: 16px;
  line-height: 1.75;
}
.staff-self-qr__url-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 850;
}
.staff-self-qr__url {
  width: 100%;
  min-height: 82px;
  padding: 11px 12px;
  border: 1px solid #c7d3e6;
  border-radius: 12px;
  color: #26324a;
  background: #f8faff;
  resize: none;
  overflow-wrap: anywhere;
}
.staff-self-qr__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.staff-self-qr__actions .button {
  flex: 1 1 150px;
}
.staff-self-qr__note {
  margin: 14px 0 0;
  color: #64708a;
  font-size: 12px;
  line-height: 1.7;
}

@media (max-width: 720px) {
  .staff-self-qr__panel {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .staff-self-qr__visual canvas {
    width: min(100%, 280px);
  }
}

@media (max-width: 620px) {
  .staff-self-qr__actions {
    display: grid;
  }
  .staff-self-qr__actions .button {
    width: 100%;
  }
}
.staff-self-qr__unavailable {
  margin: 0;
  padding: 13px 14px;
  border: 1px solid #efc5c1;
  border-radius: 12px;
  color: #922a22;
  background: #fff2f1;
  font-weight: 800;
}
