/* ============================================================
   Shared edit dialog. Bottom-sheet style on mobile, centered
   on desktop. Uses native <dialog> for focus trap + Esc + backdrop.
   ============================================================ */

.edit-dialog {
  border: 0;
  padding: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  border-radius: 16px 16px 0 0;
  background: var(--paper, #f6f1e7);
  color: var(--ink, #1a1814);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  /* Pin to bottom for the bottom-sheet feel */
  position: fixed;
  inset: auto 0 0 0;
  margin-bottom: 0;
}

@media (min-width: 600px) {
  .edit-dialog {
    inset: auto auto auto auto;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 16px;
  }
}

.edit-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.edit-dialog[hidden] { display: none; }

/* Header */
.edit-head {
  padding: 16px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--rule, #d8cfb9);
}
.edit-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.edit-close {
  background: transparent;
  border: 0;
  color: var(--mute, #7a7167);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  -webkit-tap-highlight-color: transparent;
}
.edit-close:active { transform: scale(0.92); }

/* Body — scrollable form */
.edit-body {
  padding: 16px 20px 8px;
  overflow-y: auto;
  max-height: calc(92dvh - 140px);
}
@media (min-width: 600px) {
  .edit-body { max-height: 60vh; }
}

.edit-row {
  display: block;
  margin-bottom: 14px;
}
.edit-row label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute, #7a7167);
  margin-bottom: 6px;
}

.edit-input,
.edit-textarea,
.edit-select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;     /* prevents iOS zoom-on-focus */
  background: var(--paper-2, #efe8d8);
  border: 1px solid var(--rule, #d8cfb9);
  border-radius: 8px;
  color: inherit;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.edit-textarea { resize: vertical; min-height: 80px; line-height: 1.4; }
.edit-input:focus,
.edit-textarea:focus,
.edit-select:focus { border-color: var(--ink, #1a1814); }

/* Type chips inside the dialog */
.edit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.edit-chips button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--ink, #1a1814);
  border: 1px solid var(--rule, #d8cfb9);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.edit-chips button.active {
  background: var(--ink, #1a1814);
  color: var(--paper, #f6f1e7);
  border-color: var(--ink, #1a1814);
}

/* Footer actions */
.edit-foot {
  display: flex;
  gap: 8px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule, #d8cfb9);
  background: var(--paper, #f6f1e7);
}
.edit-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--rule, #d8cfb9);
  background: transparent;
  color: var(--ink, #1a1814);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.edit-btn.primary {
  background: var(--ink, #1a1814);
  color: var(--paper, #f6f1e7);
  border-color: var(--ink, #1a1814);
  flex: 1;
}
.edit-btn.danger {
  color: #b3331a;
  border-color: rgba(179, 51, 26, 0.4);
}
.edit-btn:active { transform: scale(0.97); }

/* Kebab (⋯) trigger button used on cards. Subtle by default. */
.edit-trigger {
  background: transparent;
  border: 0;
  color: var(--mute, #7a7167);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.edit-trigger:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink, #1a1814); }
.edit-trigger:active { transform: scale(0.92); }
