/* Dictate workspace presentation — preserves the existing slate / indigo identity. */
html:has(#dictate-workspace-root),
body:has(#dictate-workspace-root) { background: #fff !important; }

.dictate-workspace .dictate-header-button { border-color: #e2e8f0; }
.dictate-workspace .dictate-folder-wrap { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.dictate-workspace .dictate-folder-wrap select { max-width: 150px; min-height: 40px; }

.dictate-workspace {
  box-sizing: border-box;
}

.dictate-workspace *,
.dictate-workspace *::before,
.dictate-workspace *::after {
  box-sizing: border-box;
}

.dictate-workspace button,
.dictate-workspace input,
.dictate-workspace select,
.dictate-workspace textarea {
  font-family: inherit;
}

.dictate-workspace button:focus-visible,
.dictate-workspace input:focus-visible,
.dictate-workspace select:focus-visible,
.dictate-workspace textarea:focus-visible,
.dictate-workspace summary:focus-visible {
  outline: 2px solid #a5b4fc;
  outline-offset: 3px;
}

.dictate-workspace .dictate-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

/* Keep the textarea and transcript mirror on precisely the same line grid. */
.dictate-workspace .dictate-live-editor__mirror,
.dictate-workspace .dictate-live-editor__input,
.dictate-workspace [data-testid="dictate-editor"] {
  line-height: 1.6 !important;
}

.dictate-workspace .dictate-live-editor__input,
.dictate-workspace [data-testid="dictate-editor"] {
  caret-color: #4f46e5 !important;
}

.dictate-workspace .dictate-clear-all,
.dictate-workspace .dictate-copy-all {
  border-color: #4f46e5;
  background: #4f46e5;
  color: #fff;
  font-size: 14px;
  min-height: 44px;
  padding-inline: 17px;
}

.dictate-workspace .dictate-clear-all:hover:not(:disabled),
.dictate-workspace .dictate-copy-all:hover:not(:disabled) {
  border-color: #818cf8;
  background: #4338ca;
}

.dictate-workspace .dictate-action-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.dictate-workspace .dictate-copy-all {
  min-width: 104px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dictate-workspace .dictate-share-secondary {
  min-height: 44px;
}

.dictate-workspace .dictate-clear-confirmation {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 14px;
}

.dictate-workspace .dictate-clear-confirmation[hidden] {
  display: flex;
  visibility: hidden;
  pointer-events: none;
}

.dictate-feedback {
  position: fixed;
  z-index: 60;
  inset-inline: max(16px, env(safe-area-inset-left, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px) + var(--dictate-keyboard-offset, 0px));
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.dictate-feedback > * {
  max-width: min(100%, 42rem);
  pointer-events: auto;
}

.dictate-workspace [data-testid="dictate-editor"] {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  resize: none;
}


/* ── Floating dock: Copy All · Dictate · Share ───────────────────────────── */
.dictate-workspace .dictate-capture-dock {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  width: min(calc(100% - 24px), 576px);
  margin: 0 auto calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 12px 24px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
}

.dictate-workspace .dictate-capture-dock__readout {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  min-height: 26px;
  padding-bottom: 6px;
}

.dictate-workspace .dictate-capture-dock__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}

.dictate-workspace .dictate-capture-dock__status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #64748b;
}

.dictate-workspace .dictate-capture-dock__status--recording .dictate-capture-dock__status-dot { background: #4f46e5; }
.dictate-workspace .dictate-capture-dock__status--paused .dictate-capture-dock__status-dot { background: #818cf8; }
.dictate-workspace .dictate-capture-dock__status--connecting .dictate-capture-dock__status-dot,
.dictate-workspace .dictate-capture-dock__status--finishing .dictate-capture-dock__status-dot { background: #a5b4fc; }
.dictate-workspace .dictate-capture-dock__status--disconnected .dictate-capture-dock__status-dot { background: #64748b; }

.dictate-workspace .dictate-capture-dock__elapsed {
  color: #0f172a;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: 0.035em;
}

.dictate-workspace .dictate-capture-dock__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.5fr);
  align-items: center;
  gap: 8px;
}

.dictate-workspace .dictate-capture-dock__share { position: relative; min-width: 0; flex: 1 1 0; }
.dictate-workspace .dictate-capture-dock__end { display: flex; min-width: 0; align-items: center; gap: 6px; }
.dictate-workspace .dictate-capture-dock__end .dictate-capture-dock__side { flex: 1 1 0; padding: 0 8px; }

.dictate-workspace .dictate-capture-dock button {
  box-sizing: border-box;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.dictate-workspace .dictate-capture-dock button:hover:not(:disabled) { background: #f8fafc; border-color: #a5b4fc; }
.dictate-workspace .dictate-capture-dock button:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 2px; }
.dictate-workspace .dictate-capture-dock button:disabled { opacity: 0.48; cursor: not-allowed; }

.dictate-workspace .dictate-capture-dock__side,
.dictate-workspace .dictate-capture-dock__secondary,
.dictate-workspace .dictate-capture-dock__primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.dictate-workspace .dictate-capture-dock__side { width: 100%; padding: 0 14px; border-color: rgba(226, 232, 240, 0.6); color: #334155; font-size: 14px; font-weight: 500; }
.dictate-workspace .dictate-capture-dock__side:hover:not(:disabled) { color: #0f172a; background: #f1f5f9; border-color: rgba(226, 232, 240, 0.9); }
.dictate-workspace .dictate-capture-dock__secondary { min-height: 32px; padding: 0 12px; font-size: 13px; }

.dictate-workspace .dictate-capture-dock__primary {
  position: relative;
  min-width: 128px;
  min-height: 52px;
  padding: 0 24px;
  border-color: #4f46e5;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.25), 0 2px 4px -2px rgba(79, 70, 229, 0.25);
  color: #fff;
  background: #4f46e5;
  font-size: 16px;
}

.dictate-workspace .dictate-capture-dock__primary:hover:not(:disabled) { border-color: #4338ca; background: #4338ca; }
.dictate-workspace .dictate-capture-dock__primary:active:not(:disabled) { border-color: #3730a3; background: #3730a3; }

.dictate-workspace .dictate-capture-dock__primary--active,
.dictate-workspace .dictate-capture-dock__primary--active:hover:not(:disabled) {
  border-color: #e11d48;
  background: #e11d48;
  animation: dictate-dock-pulse 1.4s ease-out infinite;
}

.dictate-workspace .dictate-capture-dock svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.dictate-workspace .dictate-capture-dock__primary svg { width: 22px; height: 22px; flex-basis: 22px; }
.dictate-workspace .dictate-capture-dock__primary svg:not(.lucide) rect { fill: currentColor; stroke: currentColor; }
.dictate-workspace .dictate-capture-dock__side svg.lucide { color: #475569; }

.dictate-workspace .dictate-capture-dock__level {
  display: none;
  height: 22px;
  align-items: center;
  gap: 3px;
}

.dictate-workspace .dictate-capture-dock__primary--active .dictate-capture-dock__level { display: inline-flex; }

.dictate-workspace .dictate-capture-dock__level span {
  width: 3px;
  height: calc(6px + var(--dictate-level, 0) * 14px);
  border-radius: 3px;
  background: currentColor;
  opacity: 0.85;
  transition: height 80ms linear;
}

.dictate-workspace .dictate-capture-dock__level span:nth-child(2) { height: calc(10px + var(--dictate-level, 0) * 18px); }
.dictate-workspace .dictate-capture-dock__level span:nth-child(3) { height: calc(8px + var(--dictate-level, 0) * 16px); }
.dictate-workspace .dictate-capture-dock__level span:nth-child(4) { height: calc(5px + var(--dictate-level, 0) * 12px); }

.dictate-workspace .dictate-share-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 20;
  display: flex;
  min-width: 232px;
  flex-direction: column;
  padding: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
}

.dictate-workspace .dictate-capture-dock .dictate-share-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

@keyframes dictate-dock-pulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45); }
  100% { box-shadow: 0 0 0 16px rgba(79, 70, 229, 0); }
}

@media (max-width: 479px) {
  .dictate-workspace .dictate-capture-dock__label { display: none; }
  .dictate-workspace .dictate-capture-dock__primary { min-width: 112px; padding-inline: 16px; gap: 6px; }
  .dictate-workspace .dictate-capture-dock { width: calc(100% - 16px); }
}

@media (max-width: 767px) {
  .dictate-workspace input,
  .dictate-workspace select,
  .dictate-workspace textarea {
    font-size: 16px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dictate-workspace .dictate-capture-dock,
  .dictate-workspace .dictate-capture-dock *,
  .dictate-workspace .dictate-capture-dock button {
    transition: none !important;
    animation: none !important;
  }
}


/* ── Fluid viewport, header, folder pill, filter and toast ───────────────── */
.dictate-workspace .dictate-fluid-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  box-sizing: content-box;
  padding: env(safe-area-inset-top, 0px) 8px 0;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.dictate-workspace .dictate-fluid-title {
  min-width: 0;
  flex: 1 1 auto;
  padding: 6px 4px;
  color: #0f172a;
  background: transparent;
  border: 0;
  font-size: 16px;
  font-weight: 650;
  text-overflow: ellipsis;
}

.dictate-workspace .dictate-header-button {
  display: inline-flex;
  min-height: 40px;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  color: #334155;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.dictate-workspace .dictate-header-button[aria-expanded="true"] { color: #4338ca; background: #eef2ff; border-color: #c7d2fe; }
.dictate-workspace .dictate-folder-pill { max-width: 150px; padding-right: 8px; appearance: auto; }

.dictate-workspace .dictate-filter-row {
  display: grid;
  flex: 0 0 auto;
  grid-template-rows: 0fr;
  transition: grid-template-rows 180ms ease;
}

.dictate-workspace .dictate-filter-row[data-open="true"] { grid-template-rows: 1fr; }
.dictate-workspace .dictate-filter-row > div { min-height: 0; overflow: hidden; }

.dictate-workspace .dictate-filter-row input {
  width: calc(100% - 24px);
  margin: 8px 12px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 16px;
}

.dictate-workspace .dictate-filter-results { margin: 0 12px 8px; padding: 0; list-style: none; }
.dictate-workspace .dictate-filter-results button { width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: #fff; text-align: left; font-size: 14px; }

.dictate-workspace .dictate-fluid-toast {
  position: absolute;
  top: 64px;
  left: 50%;
  z-index: 70;
  padding: 8px 16px;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 650;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Native editor surface: overlay mirror + transparent textarea share every metric. */
.dictate-workspace .dictate-fluid-editor { position: relative; flex: 1 1 auto; min-height: 0; }
.dictate-workspace .dictate-fluid-editor .dictate-live-editor { position: absolute; inset: 0; height: 100%; }

.dictate-workspace .dictate-live-editor__mirror,
.dictate-workspace .dictate-live-editor__input {
  box-sizing: border-box;
  margin: 0;
  border: 0 !important;
  padding: 16px 16px 192px !important;
  font-size: 18px !important;
  line-height: 1.6 !important;
  letter-spacing: normal;
  font-family: inherit;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

@media (min-width: 640px) {
  .dictate-workspace .dictate-live-editor__mirror,
  .dictate-workspace .dictate-live-editor__input { padding: 32px 32px 128px !important; }
}

@media (max-width: 767px) {
  /* iOS zooms any focused control below 16px; the editor must stay 18px so the mirror matches. */
  .dictate-workspace .dictate-live-editor__input { font-size: 18px !important; }
}

.dictate-workspace .dictate-feedback {
  bottom: calc(200px + env(safe-area-inset-bottom, 0px) + var(--dictate-keyboard-offset, 0px));
}

/* ── Custom folders, tags and inline notices (ChurchSeries: white, slate, indigo) ── */
.dictate-workspace .dictate-folder-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dictate-workspace .dictate-folder-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; max-width: 100%; padding: 0 14px;
  border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; color: #334155; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background-color 120ms, border-color 120ms, color 120ms;
}
.dictate-workspace .dictate-folder-chip:hover { background: #f8fafc; }
.dictate-workspace .dictate-folder-chip[aria-pressed="true"] { border-color: #4f46e5; background: #4f46e5; color: #fff; }
.dictate-workspace .dictate-folder-chip--add { border-style: dashed; color: #4f46e5; }
.dictate-workspace .dictate-folder-chip:focus-visible,
.dictate-workspace .dictate-folder-save:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.dictate-workspace .dictate-folder-manage { display: flex; gap: 8px; }
.dictate-workspace .dictate-folder-form { display: flex; align-items: center; gap: 8px; }
.dictate-workspace .dictate-folder-form input {
  min-width: 0; flex: 1; min-height: 40px; padding: 0 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; color: #0f172a;
}
.dictate-workspace .dictate-folder-form input:focus-visible { border-color: #4f46e5; outline: 3px solid rgba(79, 70, 229, 0.16); }
.dictate-workspace .dictate-folder-save {
  min-height: 40px; padding: 0 14px; border: 1px solid #4f46e5; border-radius: 12px; background: #4f46e5; color: #fff; font-size: 14px; font-weight: 600;
}
.dictate-workspace .dictate-folder-save:disabled { opacity: 0.45; }
.dictate-workspace .dictate-inline-error { margin: 0; color: #334155; font-size: 13px; }
.dictate-workspace .dictate-inline-error::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #4f46e5; }
.dictate-workspace .dictate-inline-note { margin: 4px 14px 0; color: #64748b; font-size: 12px; }
.dictate-workspace .dictate-tags-row {
  display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 14px 0; background: #fff;
}
.dictate-workspace .dictate-tag {
  display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 6px 0 10px;
  border: 1px solid #c7d2fe; border-radius: 999px; background: #eef2ff; color: #4338ca; font-size: 13px; font-weight: 600;
}
.dictate-workspace .dictate-tag button { display: grid; width: 24px; height: 24px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #4338ca; }
.dictate-workspace .dictate-tags-row input {
  min-width: 0; flex: 1 1 120px; min-height: 32px; border: 0; background: transparent; color: #0f172a; font-size: 14px;
}
.dictate-workspace .dictate-tags-row input:focus-visible { outline: none; }
