/* ════════════════════════════════════════════════════════════
   Center Notes — Voice Note widget styles (v1)
   Warm design tokens (design-tokens.css), light + dark via
   [data-theme]. Terracotta mic button, anchored recorder popover
   (bottom sheet < 560px). 44px coarse targets, reduced-motion,
   print hiding.
   ════════════════════════════════════════════════════════════ */

/* ── Mic button (labeled pill on desktop/tablet; compact icon on mobile or .cnv-compact) ── */
.cnv-btn {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; height: 34px; padding: 0 12px;
  border: 1.5px solid var(--clay-soft, #F8DDD3);
  border-radius: 999px;
  background: var(--clay-wash, rgba(175, 95, 74, 0.10));
  color: var(--clay-deep, #B04A2C);
  font-family: var(--font-display, "Baloo 2", system-ui, sans-serif);
  font-size: 0.8rem; font-weight: 700; line-height: 1; white-space: nowrap;
  cursor: pointer; vertical-align: middle;
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}
.cnv-btn.cnv-compact,
.cnv-btn.cn-assist-voice {
  width: 36px; height: 36px; padding: 0; border-radius: 10px;
}
.cnv-btn.cnv-compact .cnv-btn-label,
.cnv-btn.cn-assist-voice .cnv-btn-label { display: none; }
.cnv-btn:hover { background: var(--clay-soft, #F8DDD3); transform: translateY(-1px); }
.cnv-btn:active { transform: translateY(0) scale(0.96); }
.cnv-btn:focus-visible { outline: 2px solid var(--line-focus, #A84822); outline-offset: 2px; }
.cnv-btn.cnv-active {
  background: #B04A2C; border-color: #B04A2C; color: #fff;
}
.cnv-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.cnv-btn.cnv-compact svg,
.cnv-btn.cn-assist-voice svg { width: 18px; height: 18px; }
html[data-theme="dark"] .cnv-btn {
  background: rgba(175, 95, 74, 0.22);
  border-color: rgba(232, 140, 112, 0.36);
  color: #F4B7A4;
}
html[data-theme="dark"] .cnv-btn:hover {
  background: rgba(175, 95, 74, 0.34);
  border-color: rgba(232, 140, 112, 0.52);
}
html[data-theme="dark"] .cnv-btn.cnv-active {
  background: #C45B3B; border-color: #C45B3B; color: #fff;
}

/* Label row wrapper: mic sits beside the field label, spacing preserved. */
.cnv-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cnv-label-row > label { min-width: 0; }

/* ── Recorder popover ── */
.cnv-pop {
  position: fixed; z-index: 3000;
  width: 288px; max-width: calc(100vw - 16px);
  padding: 14px;
  background: var(--surface, #FFFFFF); color: var(--ink, #3A2E25);
  border: 1px solid var(--line-strong, rgba(58, 46, 37, 0.15));
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(30, 22, 16, 0.28), 0 4px 12px rgba(30, 22, 16, 0.14);
  font-family: var(--font-body, "Nunito", system-ui, sans-serif);
}
.cnv-pop[hidden] { display: none !important; }

.cnv-live { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 700; }
.cnv-live[hidden] { display: none !important; }
.cnv-dot {
  flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: var(--clay, #AF5F4A);
  animation: cnv-pulse 1.2s ease-in-out infinite;
}
.cnv-dot.cnv-posting { animation: none; opacity: 0.55; }
@keyframes cnv-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}
.cnv-timer {
  margin-left: auto; font-size: 0.8rem; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--muted, #7A6C5D);
}
.cnv-timer[hidden] { display: none !important; }

.cnv-msg { margin-top: 2px; font-size: 0.85rem; line-height: 1.45; color: var(--ink-soft, #6E5F52); }
.cnv-msg[hidden] { display: none !important; }

.cnv-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.cnv-actions:empty { display: none; }
.cnv-stop, .cnv-cancel, .cnv-close, .cnv-retry, .cnv-signin {
  min-height: 40px; padding: 0 14px;
  border-radius: 10px; font: inherit; font-size: 0.85rem; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background 140ms ease, transform 140ms ease;
}
.cnv-stop {
  flex: 1; border: none;
  background: #B04A2C; color: #fff;
  font-family: var(--font-display, "Baloo 2", system-ui, sans-serif); font-weight: 800;
}
.cnv-stop:hover { background: #963C22; }
html[data-theme="dark"] .cnv-stop { background: #C45B3B; color: #fff; }
html[data-theme="dark"] .cnv-stop:hover { background: #AE4C2E; color: #fff; }
.cnv-cancel, .cnv-close {
  border: 1.5px solid var(--line-strong, rgba(58, 46, 37, 0.15));
  background: var(--surface, #FFFFFF); color: var(--ink, #3A2E25);
}
.cnv-cancel:hover, .cnv-close:hover { background: var(--surface-tint, #FDFBF7); }
.cnv-retry {
  flex: 1; border: 1.5px solid var(--clay-soft, #F8DDD3);
  background: var(--clay-wash, rgba(175, 95, 74, 0.10)); color: var(--clay-deep, #B04A2C);
}
.cnv-retry:hover { background: var(--clay-soft, #F8DDD3); }
html[data-theme="dark"] .cnv-retry {
  background: rgba(175, 95, 74, 0.22);
  border-color: rgba(232, 140, 112, 0.38);
  color: #F4B7A4;
}
html[data-theme="dark"] .cnv-retry:hover { background: rgba(175, 95, 74, 0.34); }
.cnv-signin {
  flex: 1; border: none;
  background: #B04A2C; color: #fff;
}
.cnv-signin:hover { background: #963C22; color: #fff; }
html[data-theme="dark"] .cnv-signin { background: #C45B3B; color: #fff; }
html[data-theme="dark"] .cnv-signin:hover { background: #AE4C2E; color: #fff; }
.cnv-stop[hidden], .cnv-cancel[hidden], .cnv-close[hidden],
.cnv-retry[hidden], .cnv-signin[hidden] { display: none !important; }

/* ── Mobile: icon-only mic + bottom sheet below 560px ── */
@media (max-width: 559px) {
  .cnv-btn { width: 36px; height: 36px; padding: 0; border-radius: 10px; }
  .cnv-btn .cnv-btn-label { display: none; }
  .cnv-btn svg { width: 18px; height: 18px; }
  .cnv-pop.cnv-sheet {
    left: 8px !important; right: 8px; top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto; max-width: none;
    border-radius: 18px;
    padding: 16px;
  }
}

/* ── Coarse pointers: 44px touch targets ── */
@media (pointer: coarse) {
  .cnv-btn { min-width: 44px; min-height: 44px; }
  .cnv-btn.cnv-compact,
  .cnv-btn.cn-assist-voice { width: 44px; height: 44px; border-radius: 12px; }
  .cnv-btn svg { width: 18px; height: 18px; }
  .cnv-stop, .cnv-cancel, .cnv-close, .cnv-retry, .cnv-signin { min-height: 44px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .cnv-dot { animation: none; }
  .cnv-btn, .cnv-stop, .cnv-cancel, .cnv-close, .cnv-retry, .cnv-signin { transition: none; }
}

/* ── Print: never show the mic or recorder on printed records ── */
@media print {
  .cnv-btn, .cnv-pop, .cnv-label-row .cnv-btn { display: none !important; }
}