body.drawer-open {
  overflow: hidden;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 100%;
  height: 100vh;
  background: var(--color-surface);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.drawer-overlay.is-open .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.drawer-header h2 {
  font-family: var(--font-en);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 24px;
  line-height: 1;
  color: var(--color-text-secondary);
  transition: background 0.2s ease;
}

.drawer-close:hover {
  background: var(--color-hover);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.drawer-footer .btn-outline,
.drawer-footer .btn-dark {
  flex: 1;
  justify-content: center;
}

/* ── Form ── */
.form-section-title {
  font-family: var(--font-bn);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-deep);
  margin-bottom: var(--space-md);
}

.form-section-title:not(:first-child) {
  margin-top: var(--space-lg);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-deep);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-bn);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: var(--color-surface);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input,
.form-select {
  height: 42px;
  padding: 0 12px;
}

.form-select {
  appearance: none;
  background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 32px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-active-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.form-textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Upload Zone ── */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  margin-bottom: var(--space-lg);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: #fafafa;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-zone:hover {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
}

.upload-zone svg {
  width: 32px;
  height: 32px;
  color: var(--color-text-muted);
}

.upload-zone-text {
  font-family: var(--font-en);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.upload-zone-subtext {
  font-family: var(--font-en);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── Rich Text Toolbar ── */
.editor-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  background: #f9fafb;
  border-bottom: 1px solid var(--color-border);
}

.editor-toolbar-btn,
.editor-toolbar-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: var(--font-en);
  font-size: 12px;
  color: var(--color-text-secondary);
  background: transparent;
}

.editor-toolbar-btn:hover {
  background: var(--color-hover);
  border-color: var(--color-border);
}

.editor-toolbar-select {
  padding-right: 20px;
  appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 4px center;
}

.editor-wrap .form-textarea {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.editor-wrap .form-textarea:focus {
  box-shadow: none;
}

/* ── Toggle Switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-family: var(--font-bn);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text-deep);
  cursor: pointer;
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: #d1d5db;
  border-radius: 12px;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.toggle-input:checked + .toggle-switch {
  background: var(--color-brand);
}

.toggle-input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

@media (max-width: 768px) {
  .drawer-panel {
    width: 100%;
  }

  .drawer-close {
    width: var(--touch-min);
    height: var(--touch-min);
  }

  .drawer-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }

  .editor-toolbar-btn,
  .editor-toolbar-select {
    min-width: 36px;
    height: 36px;
  }
}
