
.mem-add-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--paper-1);
  color: var(--ink-0);
  width: min(440px, 92vw);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  /* Explicit centring — some browsers position <dialog> with absolute
     top:0, left:0 and rely on user-agent CSS for centring, which on
     long pages drops the modal at the top of the document rather than
     the middle of the viewport. The fixed + transform pair anchors
     it to the viewport centre regardless of scroll position. */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  max-height: 90vh;
  overflow-y: auto;
}
.mem-add-dialog::backdrop {
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Meeting prep modal: wider, taller, calmer read pace.
   The dialog itself flexes column so head + foot stay pinned while the body
   scrolls. Body is centered + max-width capped so long lines stay readable. */
.prep-dialog {
  width: min(880px, 92vw);
  height: min(86vh, 940px);
  box-shadow: var(--shadow-lg);
}
/* display:flex only while [open]: a bare display on a <dialog> overrides the UA
   `dialog:not([open]) { display:none }` (author beats UA), leaving the CLOSED
   dialog visible on the page. Scoping to [open] lets the UA hide it when closed. */
.prep-dialog[open] { display: flex; flex-direction: column; }
.prep-dialog-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  padding: 26px 30px 18px 30px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.prep-dialog-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Geist', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-1);
  padding: 24px 30px;
  max-width: 680px;
  margin-inline: auto;
  background: var(--paper-1);
  flex: 1;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
}
.prep-dialog-foot {
  display: flex; justify-content: flex-end; align-items: center; gap: 8px;
  padding: 18px 26px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.prep-dialog-foot .prep-foot-actions { display: flex; gap: 8px; margin-right: auto; }
/* Copy/Download are inert until a packet with a body loads (disabled drops them
   from the tab order so they are not silent no-ops during loading/failure). */
.prep-dialog-foot .prep-foot-actions .btn[disabled] { opacity: .5; cursor: default; }

/* Draft modal — handles both compose (new) and edit (existing) flows.
   Narrower than the prep modal; the body is an editable textarea, and
   To/Subject sit in the header as compact inline inputs so the user
   can adjust them in either mode. */
.draft-dialog { width: min(640px, 94vw); }
.draft-fields {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.draft-field {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 10px;
}
.draft-field-lbl {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.draft-field input {
  font-family: 'Geist', sans-serif;
  font-size: 13px;
  color: var(--ink-0);
  background: var(--paper-1);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  outline: none;
  transition: border-color .15s var(--ease), background .15s var(--ease);
  min-width: 0;
}
.draft-field input:focus {
  border-color: var(--accent-line);
  background: var(--paper-1);
}
.draft-original {
  margin: 14px 24px 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-1);
  font-size: 13px;
}
.draft-original > summary {
  cursor: pointer;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  list-style: none;
}
.draft-original > summary::-webkit-details-marker { display: none; }
.draft-original > summary::before { content: '▸ '; color: var(--ink-4); }
.draft-original[open] > summary::before { content: '▾ '; }
.draft-original-body {
  padding: 0 14px 12px;
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--ink-1);
  max-height: 30vh;
  overflow-y: auto;
}
.draft-dialog-body {
  font-family: 'Geist', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-0);
  padding: 18px 24px;
  margin: 0;
  width: 100%;
  min-height: 240px;
  max-height: 55vh;
  background: var(--paper-2);
  border: 0;
  border-bottom: 1px solid var(--rule-soft);
  border-top: 1px solid var(--rule-soft);
  outline: none;
  resize: vertical;
  box-sizing: border-box;
}
.draft-dialog-body:focus {
  background: var(--paper-1);
}
.draft-dialog-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px;
}
/* Voice edit affordance — just our logo, no text (speak an instruction to
   rewrite the draft). */
.ve-wrap { display: inline-flex; align-items: center; gap: 6px; }
.ve-logo {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  border: none; background: transparent; cursor: pointer; border-radius: 10px;
  transition: background .12s var(--ease);
}
.ve-logo:hover { background: var(--paper-2); }
.ve-logo svg { width: 26px; height: 26px; display: block; }
.ve-logo.busy { opacity: 0.5; cursor: default; }
.ve-logo.rec::after {
  content: ''; position: absolute; inset: 0; border-radius: 10px;
  box-shadow: 0 0 0 2px var(--bad);
  animation: ve-recring 1.1s ease-in-out infinite;
}
@keyframes ve-recring { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.ve-undo-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: none; background: transparent; color: var(--ink-3); cursor: pointer; border-radius: 8px;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.ve-undo-btn:hover { background: var(--paper-2); color: var(--accent); }
.ve-undo-btn svg { width: 17px; height: 17px; }
/* Original-to-new transition: a brief accent wash when text is replaced. */
.ve-applied { animation: ve-flash 0.9s ease; }
@keyframes ve-flash {
  0% { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-line) inset; }
  100% { background: transparent; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ve-logo.rec::after { animation: none; }
  .ve-applied { animation: none; }
}

/* Event-detail popover (calendar event click). Inspired by Google's
   compact event card — title + time + Join + attendees + actions. */
.event-detail-dialog { width: min(460px, 94vw); }
.event-detail-dialog #eventDetailBody { display: flex; flex-direction: column; }
.ed-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; padding: 22px 22px 14px 22px;
  border-bottom: 1px solid var(--rule-soft);
}
.ed-eyebrow {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ed-title {
  font-size: 20px;
  margin: 4px 0 6px 0;
  color: var(--ink-0);
  letter-spacing: -0.005em;
}
.ed-when {
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}
.ed-body { padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; }
.ed-row { display: grid; grid-template-columns: 20px 1fr; gap: 12px; align-items: flex-start; font-size: 13px; color: var(--ink-1); }
.ed-icon { color: var(--ink-3); font-size: 14px; line-height: 1.4; }
.ed-join { grid-template-columns: 1fr; }
.ed-join .btn { align-self: flex-start; }
.ed-link {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  text-decoration: none;
  margin-top: 6px;
  display: inline-block;
  overflow-wrap: anywhere;
}
.ed-link:hover { color: var(--accent); }
.ed-att-count {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.ed-att-row {
  font-size: 12.5px;
  color: var(--ink-1);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.ed-att-email { color: var(--ink-4); font-family: 'Geist Mono', monospace; font-size: 11px; }
.ed-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; white-space: pre-wrap; }
.ed-foot {
  padding: 14px 22px;
  display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid var(--rule-soft);
}
.ed-foot:empty { display: none; }
.mem-add-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 22px 18px;
}
.mem-add-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-0);
  margin-bottom: 4px;
}
.mem-add-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-1);
}
.mem-add-field span {
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 10.5px;
  color: var(--ink-1);
}
.mem-add-field input,
.mem-add-field textarea,
.mem-add-field select {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-0);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
  box-sizing: border-box;
}
.mem-add-field textarea { resize: vertical; min-height: 80px; }
.mem-add-field input:focus,
.mem-add-field textarea:focus,
.mem-add-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.mem-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
