dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(20,20,16,.2);
}

dialog::backdrop {
  background: rgba(18,18,15,.36);
  backdrop-filter: blur(5px);
}

.dialog-card { padding: 24px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.dialog-header h2 { margin-top: 4px; }
.dialog-close { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 24px; line-height: 1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.dialog-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dialog-form-grid .full-span { grid-column: 1 / -1; }

.book-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.book-actions .button { white-space: nowrap; }

.review-body {
  min-height: 90px;
  line-height: 1.8;
  white-space: normal;
}
.review-updated { margin-top: 16px; color: var(--muted); font-size: 12px; }

.note-actions-row { display: flex; gap: 14px; margin-top: 12px; }
.text-action { padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.text-action:hover { color: var(--text); }
.danger-text:hover { color: #a33a3a; }

.backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.backup-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}
.backup-card h3 { margin-bottom: 6px; }
.backup-card .button { margin-top: 16px; }
.file-button input { position: absolute; opacity: 0; pointer-events: none; }
.file-button { position: relative; }
.backup-state { min-height: 20px; color: var(--muted); font-size: 12px; }

.floating-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  transform: translate(-50%, 20px);
  padding: 10px 15px;
  border-radius: 999px;
  background: #20211d;
  color: white;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  box-shadow: 0 12px 30px rgba(0,0,0,.16);
}
.floating-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 700px) {
  .dialog-form-grid, .backup-grid { grid-template-columns: 1fr; }
  .dialog-form-grid .full-span { grid-column: auto; }
  .book-actions { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .book-actions .button { flex: 1 1 140px; }
}
