.editor-panel {
  --editor-ink: #193326;
  --editor-muted: #55635a;
  --editor-paper: #f6f2e8;
  --editor-border: #d9d6c8;
  position: fixed;
  z-index: 65;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  width: min(30rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  background: var(--editor-paper);
  color: var(--editor-ink);
  border: 1px solid #d5d9c5;
  border-radius: 1.125rem;
  box-shadow: 0 1.25rem 3rem #07100e66;
  font-size: .9375rem;
  text-align: left;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-panel, .editor-panel * { box-sizing: border-box; }

.editor-panel #editor-content { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.editor-panel #editor-content[hidden] { display: none; }
.editor-panel :is(p, h2, h3, h4) { margin: 0; }
.editor-panel [tabindex="-1"]:focus { outline: none; }
.editor-panel :is(button, input, select, textarea, a):focus-visible { outline: 2px solid #ad6b16; outline-offset: 2px; }

.editor-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  padding: .95rem 1.05rem;
  background: #1c382a;
  color: #fffdf1;
}

.editor-header .editor-kicker {
  color: #edc480;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: .2rem;
}

.editor-header h2 { font-family: Georgia, serif; font-size: clamp(1.4rem, 5vw, 1.72rem); font-weight: 500; line-height: 1; }
.editor-header__actions { display: flex; align-items: center; gap: .35rem; }
.editor-header .editor-button { border-color: #ffffff37; background: transparent; color: #fffdf1; }
.editor-header .editor-button:hover { background: #ffffff16; }

.editor-tabs {
  flex: none;
  display: flex;
  gap: .2rem;
  padding: .55rem .8rem;
  border-bottom: 1px solid var(--editor-border);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.editor-tabs button {
  flex: none;
  min-height: 2.25rem;
  padding: .4rem .6rem;
  border: 0;
  border-radius: .38rem;
  background: transparent;
  color: var(--editor-muted);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
}

.editor-tabs button:hover { background: #ece8dc; }
.editor-tabs button[aria-pressed="true"] { background: #dce5d8; color: var(--editor-ink); }
.editor-body { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding: 1.1rem; }
.editor-section { display: grid; gap: .75rem; }
.editor-panel h3 { color: var(--editor-ink); font-size: 1.2rem; line-height: 1.3; }
.editor-panel h4 { color: var(--editor-ink); font-size: .94rem; line-height: 1.35; }
.editor-help, .editor-empty { color: var(--editor-muted); line-height: 1.48; }
.editor-empty { padding: .7rem; border: 1px dashed var(--editor-border); border-radius: .5rem; }
.editor-heading-row { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }

.editor-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: .42rem .66rem;
  border: 1px solid #ccd2c3;
  border-radius: .4rem;
  background: #fffcf5;
  color: var(--editor-ink);
  font: inherit;
  font-size: .8125rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.editor-button:hover { background: #e4e9dd; }
.editor-button--outline { border-color: #aebaab; }
.editor-button--quiet { color: #6a4540; background: transparent; border-color: transparent; }
.editor-button--quiet:hover { background: #f3e6dc; }
.editor-button--primary { background: #234a35; border-color: #234a35; color: #fffdf5; }
.editor-button--primary:hover { background: #2c5c42; }
.editor-button:disabled { cursor: default; opacity: .55; }

.editor-form, .editor-object, .editor-invite, .editor-memory {
  border: 1px solid var(--editor-border);
  border-radius: .65rem;
  padding: .9rem;
  background: #fffcf3;
  display: grid;
  gap: .7rem;
}

.editor-form header { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.editor-form header h3 { font-size: 1rem; }
.editor-form__footer { display: flex; justify-content: flex-start; }
.editor-fields, .editor-transform { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.editor-transform { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.editor-panel label { display: grid; gap: .3rem; color: var(--editor-ink); font-size: .85rem; font-weight: 650; }
.editor-panel label.editor-check, .editor-existing label { display: flex; gap: .5rem; align-items: center; }
.editor-panel :is(input, select, textarea) {
  width: 100%;
  min-width: 0;
  min-height: 2.5rem;
  margin: 0;
  padding: .45rem .5rem;
  border: 1px solid #c9cdbf;
  border-radius: .4rem;
  background: #fffdf9;
  color: var(--editor-ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.2;
}

.editor-panel textarea { resize: vertical; line-height: 1.42; }
.editor-panel input[type="file"] { line-height: 1.45; }
.editor-panel input[type="color"] { padding: .25rem; }
.editor-panel input[type="checkbox"] { height: 1.0625rem; width: 1.0625rem; min-height: 0; accent-color: #234a35; }
.editor-panel a { color: #23543b; text-decoration-thickness: 1px; text-underline-offset: .14em; }
.editor-existing { display: flex; align-items: center; gap: .5rem; justify-content: space-between; overflow-wrap: anywhere; }
.editor-existing label { flex: none; }
.editor-inline-actions, .editor-nudge, .editor-tray { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.editor-tray .editor-button { background: #e9ede0; }
.editor-tray .editor-button:hover { background: #dce6d5; }
.editor-room-publish { justify-content: space-between; margin-top: .25rem; padding-top: .7rem; border-top: 1px solid var(--editor-border); }

.editor-row {
  display: flex;
  gap: .6rem;
  justify-content: space-between;
  align-items: center;
  padding: .52rem .05rem;
  border-bottom: 1px solid var(--editor-border);
}

.editor-row__copy { min-width: 0; overflow-wrap: anywhere; }
.editor-row__copy p, .editor-memory .editor-memory__meta { color: var(--editor-muted); font-size: .82rem; line-height: 1.4; }
.editor-row__actions { display: flex; flex-wrap: wrap; gap: .2rem; justify-content: flex-end; }
.editor-row__actions .editor-button { min-height: 1.95rem; padding-inline: .48rem; }
.editor-change-preview { padding: .7rem; border-radius: .48rem; border: 1px solid #d0daca; background: #e7eee2; line-height: 1.45; }
.editor-change-preview[hidden] { display: none; }
.editor-change-preview p { margin-top: .2rem; }
.editor-memory p { white-space: pre-wrap; overflow-wrap: anywhere; }
.editor-memory img { display: block; width: 100%; max-height: 11rem; object-fit: cover; border-radius: .38rem; }
.editor-tag { border-radius: 1rem; flex: none; padding: .2rem .47rem; background: #eee8d9; color: #634918; font-size: .75rem; font-weight: 700; }

.editor-status:not(:empty), .editor-confirm {
  border-top: 1px solid var(--editor-border);
  padding: .55rem 1.1rem;
  background: #e7ebe0;
  color: var(--editor-ink);
  line-height: 1.45;
}

.editor-status { flex: none; }
.editor-status.editor-status--error:not(:empty) { background: #fae8dc; color: #7d2c24; }
.editor-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.editor-confirm p { width: 100%; margin-bottom: .15rem; }

@media (max-width: 720px) {
  .editor-panel { right: .5rem; bottom: max(.5rem, env(safe-area-inset-bottom)); width: calc(100% - 1rem); max-height: 58dvh; }
  .editor-body { padding: .85rem; }
  .editor-tabs { padding-inline: .55rem; }
  .editor-tabs button { min-height: 2.6rem; }
  .editor-button { min-height: 2.45rem; }
  .editor-row__actions .editor-button { min-height: 2.25rem; }
}
