/* Clips tray popover — Loom-style layout, Clips brand, dark/light modes. */

:root {
  color-scheme: light dark;

  /* Clips brand */
  --brand: #1a1a1a;
  --brand-hover: #2e2e2e;
  --brand-ring: rgba(26, 26, 26, 0.28);

  /* Light palette */
  --bg: #ffffff;
  --surface: #f7f7f7;
  --surface-hover: #f0f0f0;
  --surface-strong: #ebebeb;
  --fg: #171717;
  --fg-muted: #737373;
  --fg-subtle: #a3a3a3;
  --border: #e5e5e5;
  --border-strong: #d9d9d9;

  --status-ok: #22c55e;
  --status-warn: #f97316;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  /* Keep the side and bottom shadow clear of the transparent Tauri window.
     The top is intentionally tighter: the popover should feel attached to
     its menu-bar icon, where a clipped shadow is not visible anyway. */
  --popover-shadow-gutter: 24px;
  --popover-shadow-gutter-top: 6px;
  --overlay-shadow-gutter: 18px;

  --shadow-sm: 0 1px 2px rgba(23, 23, 23, 0.06);
  --shadow-md:
    0 4px 16px rgba(23, 23, 23, 0.08), 0 2px 4px rgba(23, 23, 23, 0.04);

  font-family:
    -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #212121;
    --surface: #262626;
    --surface-hover: #2e2e2e;
    --surface-strong: #3d3d3d;
    --fg: #f5f5f5;
    --fg-muted: #a3a3a3;
    --fg-subtle: #737373;
    --border: #3d3d3d;
    --border-strong: #4d4d4d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
    /* Invert brand on dark bg: zinc-900 would disappear, use zinc-100. */
    --brand: #f5f5f5;
    --brand-hover: #e5e5e5;
    --brand-ring: rgba(245, 245, 245, 0.28);
  }
}

* {
  box-sizing: border-box;
}

/* Tauri window is `transparent: true` + `decorations: false`, so the HTML
   paints the visible shape. A padded transparent outer, with a rounded
   inner panel that carries the actual background + shadow, gives us the
   round-cornered chromeless popover. */
html,
body {
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow: visible;
}

body[data-clips-route="popover"] {
  overflow: hidden;
}

html[data-clips-route]:not([data-clips-route="popover"]),
body[data-clips-route]:not([data-clips-route="popover"]) {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

#root {
  width: 100vw;
  background: transparent;
}

body[data-clips-route="popover"] #root {
  min-height: 100vh;
  padding: var(--popover-shadow-gutter-top) var(--popover-shadow-gutter)
    var(--popover-shadow-gutter);
}

body[data-clips-route]:not([data-clips-route="popover"]) #root {
  height: 100vh;
  overflow: hidden;
}

body[data-clips-route="recording-pill"] #root {
  padding: var(--overlay-shadow-gutter);
}

/* ------------------------------------------------------------------------- */
/* App shell                                                                  */
/* ------------------------------------------------------------------------- */

.app {
  margin: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  /* Subtle drop shadow so the popover visually detaches from the menu bar. */
  box-shadow: var(--shadow-md);
  /* No fixed height — the Tauri window is resized to match the rendered
     content via resize_popover, so the shell just flows naturally. */
  max-height: calc(
    100vh - var(--popover-shadow-gutter) - var(--popover-shadow-gutter)
  );
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.app-settings {
  gap: 0;
  padding: 0;
  overflow-y: auto;
}

/* Recorder Home keeps its navigation present even when active-recording
   content exceeds the restored popover height. Only the content region may
   scroll; the window shell and bottom destinations stay put. */
.app-recorder {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.recorder-home-content {
  min-height: 0;
  padding: 14px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.app-recorder > .bottom-row {
  flex: 0 0 auto;
  padding: 7px 14px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* Header — logo + mode toggle + close */

.header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
}

/* Mode toggle lives in the first column — center it horizontally so the
   close button on the right doesn't make the layout look lopsided. */
.header .mode-toggle {
  justify-self: center;
}

/* Variant: truly-centered mode-toggle with an absolutely positioned close X.
   Using a grid column for the close button nudges the mode tabs left by the
   close button's width, which read as "off center" in Steve's screenshot.
   Absolute positioning keeps the X in the top-right corner while the tabs
   occupy the visual center of the popover. */
.header.header-centered {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 28px;
}

.header.header-centered .header-close {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.header.header-centered .header-feedback {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 500;
}

.logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.mode-toggle {
  display: inline-flex;
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 3px;
  justify-self: center;
  border: 1px solid var(--border);
}

.mode-toggle button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    background 120ms,
    color 120ms,
    box-shadow 120ms;
}

.mode-toggle button:hover {
  color: var(--fg);
}

.mode-toggle button.active {
  background: var(--bg);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.mode-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 40;
  pointer-events: none;
  transform: translateX(-50%);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--fg);
  box-shadow: var(--shadow-md);
  color: var(--bg);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
  animation: mode-tooltip-in 120ms ease-out;
}

@keyframes mode-tooltip-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-2px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 120ms,
    color 120ms;
}

.icon-button:hover {
  background: var(--surface-hover);
  color: var(--fg);
}

.icon-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-ring);
}

/* ------------------------------------------------------------------------- */
/* Feedback popover                                                           */
/* ------------------------------------------------------------------------- */

.feedback-popover-content {
  width: min(320px, calc(100vw - 36px));
  z-index: 50;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow-md);
  padding: 12px;
  outline: none;
  transform-origin: var(--radix-popover-content-transform-origin);
}

.feedback-popover-content[data-state="open"] {
  animation: feedback-popover-in 120ms ease-out;
}

.feedback-popover-content[data-state="closed"] {
  animation: feedback-popover-out 90ms ease-out;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feedback-textarea {
  width: 100%;
  min-height: 108px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.4;
  outline: none;
}

.feedback-textarea::placeholder {
  color: var(--fg-subtle);
}

.feedback-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.feedback-honeypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.feedback-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.feedback-hint {
  min-width: 0;
  color: var(--fg-subtle);
  font-size: 11px;
  line-height: 1.3;
}

.feedback-hint.is-error {
  color: #b91c1c;
}

.feedback-submit {
  flex-shrink: 0;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--bg);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 120ms,
    opacity 120ms,
    transform 80ms;
}

.feedback-submit:hover:not(:disabled) {
  background: var(--brand-hover);
}

.feedback-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.feedback-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-ring);
}

.feedback-success {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.feedback-success-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
}

.feedback-success-title {
  font-size: 13px;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .feedback-success-icon {
    background: rgba(34, 197, 94, 0.14);
    color: #4ade80;
  }
}

@keyframes feedback-popover-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-2px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes feedback-popover-out {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.98) translateY(-2px);
  }
}

/* ------------------------------------------------------------------------- */
/* Source / device rows                                                       */
/* ------------------------------------------------------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: default;
  transition:
    background 120ms,
    border-color 120ms;
}

.row-off {
  opacity: 0.6;
}

.row-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.row-on .row-icon {
  color: var(--fg);
}

/* Custom device picker — button + popover menu (replaces native <select>). */
.row-button {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  margin: 0;
  cursor: pointer;
  outline: none;
  text-align: left;
}

.row-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.row-button:focus-visible {
  box-shadow: 0 0 0 2px var(--brand-ring);
  border-radius: 4px;
}

.row-label {
  /* Never shrink the label — the wave line gives up space first so the device
     name always stays fully visible. Cap + ellipsis only for pathological
     long names. */
  flex: 0 0 auto;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Flexible filler between the label and the chevron when there's no meter
   (camera rows / mic off) — keeps the chevron pinned to the right. */
.row-flex {
  flex: 1 1 auto;
}

.row-chev {
  display: inline-flex;
  color: var(--fg-muted);
  flex-shrink: 0;
}

/* Popover menu rendered below a device row. */
.row-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
}

.row-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.row-menu-item:hover {
  background: var(--surface-hover);
}

.row-menu-item.selected {
  color: var(--fg);
  font-weight: 600;
  background: var(--surface-hover);
}

/* System-audio toggle sits below the device list, separated by a divider. */
.row-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding: 10px 10px 8px 34px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

.row-menu-toggle-label {
  font-size: 13px;
  color: var(--fg);
}

.row-menu-check {
  width: 16px;
  display: inline-flex;
  justify-content: center;
  color: var(--fg);
  flex-shrink: 0;
}

.row-menu-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-menu-empty {
  padding: 10px 12px;
  color: var(--fg-muted);
  font-size: 13px;
}

/* Toggle chip — mirrors Loom's On/Off pill. Green when on, subtle when off. */
.toggle {
  border: none;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  height: 22px;
  display: inline-flex;
  align-items: center;
  transition:
    background 120ms,
    color 120ms;
}

.toggle-on {
  background: #16a34a;
  color: white;
}

.toggle-on:hover {
  background: #15803d;
}

.toggle-off {
  background: var(--surface-strong);
  color: var(--fg-muted);
}

.toggle-off:hover {
  color: var(--fg);
}

/* Shadcn-style switch — slim track + sliding thumb. Used in Settings for the
   Voice dictation enable/disable toggle. */
.switch {
  position: relative;
  display: inline-flex;
  width: 32px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 120ms;
  flex-shrink: 0;
}

.switch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-ring);
}

.switch:disabled {
  opacity: 0.42;
  filter: grayscale(0.55);
  cursor: not-allowed;
}

.switch-on {
  background: #16a34a;
}

.switch-off {
  background: var(--surface-strong);
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  transition: transform 120ms;
  pointer-events: none;
}

.switch-on .switch-thumb {
  transform: translateX(14px);
}

/* Live mic level meter — a single wave line driven by real audio, sitting
   inline between the device label and the chevron. The ends are masked so the
   line fades in/out instead of butting against the label or chevron. */
.mic-wave {
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
  margin: 0 4px;
  pointer-events: none;
  /* Soft fade at both ends so the line reads as ambient, not boxed-in. */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 12%,
    #000 88%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 12%,
    #000 88%,
    transparent 100%
  );
}

.mic-wave-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mic-wave-path {
  fill: none;
  /* Matches the recording pill's mic waveform accent. */
  stroke: rgba(74, 222, 128, 0.95);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* Keep the line crisp regardless of the non-uniform x-stretch. */
  vector-effect: non-scaling-stroke;
}

.live-audio-bars {
  display: inline-flex;
  width: 48px;
  height: 26px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
}

.live-audio-bars-compact {
  width: 24px;
  height: 22px;
  gap: 3px;
}

.live-audio-bar {
  display: block;
  width: 2.5px;
  min-height: 2.5px;
  border-radius: 999px;
  background: rgba(132, 204, 22, 0.98);
  box-shadow: 0 0 5px rgba(132, 204, 22, 0.35);
  transition: height 90ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .live-audio-bar {
    transition: none;
  }
}

/* ------------------------------------------------------------------------- */
/* Primary CTA                                                                */
/* ------------------------------------------------------------------------- */

.primary {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--brand);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition:
    background 120ms,
    transform 80ms,
    box-shadow 120ms;
}

.primary:hover {
  background: var(--brand-hover);
}

.primary:active {
  transform: translateY(1px);
}

.secondary {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background 120ms,
    border-color 120ms,
    color 120ms;
}

.secondary:hover {
  background: var(--surface-hover);
}

.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.setup-connect-button {
  height: 38px;
  margin-top: 2px;
}

.primary.start {
  margin-top: 2px;
}

/* ------------------------------------------------------------------------- */
/* Readiness disclosure                                                       */
/* ------------------------------------------------------------------------- */

.recorder-disclosures {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.readiness {
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  flex-shrink: 0;
}

.readiness-open {
  border-color: transparent;
  background: transparent;
}

.readiness-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  cursor: pointer;
  padding: 7px 12px;
  text-align: left;
  transition: color 120ms;
}

.readiness-summary:hover,
.readiness-summary:focus-visible {
  color: var(--fg);
}

.readiness-summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.readiness-open .readiness-summary {
  min-height: 36px;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  background: transparent;
}

.readiness-title {
  color: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.readiness-open .readiness-title {
  color: inherit;
}

.readiness-action {
  display: flex;
  align-items: center;
  gap: 3px;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.readiness-action svg,
.rewind-home-state svg {
  width: 11px;
  height: 11px;
}

.readiness-open .readiness-action {
  color: inherit;
}

.readiness-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.readiness-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
}

.readiness-item:hover {
  background: var(--surface);
}

.readiness-item-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.readiness-item-title {
  color: var(--fg);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.readiness-item-detail {
  color: var(--fg-muted);
  font-size: 11px;
  line-height: 1.3;
}

.readiness-open-button {
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 0 9px;
  transition:
    background 120ms,
    border-color 120ms,
    box-shadow 120ms;
}

.readiness-open-button:hover {
  background: var(--surface-hover);
}

.readiness-open-button:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.readiness-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.readiness-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.readiness-status-ok {
  color: var(--status-ok);
}

.readiness-status-warn {
  color: var(--status-warn);
}

.readiness-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition:
    color 120ms,
    background 120ms;
  flex-shrink: 0;
}

.readiness-refresh:hover {
  color: var(--fg);
  background: var(--surface-hover);
}

.readiness-refresh:disabled {
  opacity: 0.6;
  cursor: default;
}

.readiness-refresh-spinning svg {
  animation: readiness-spin 0.8s linear infinite;
}

@keyframes readiness-spin {
  to {
    transform: rotate(360deg);
  }
}

.readiness-empty {
  padding: 8px;
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.3;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.active-recording-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.active-recording-dot {
  margin-top: 4px;
}

.active-recording-copy strong {
  display: block;
  font-size: 13px;
}

.active-recording-copy p {
  margin: 3px 0 0;
  color: var(--fg-muted);
  font-size: 11px;
  line-height: 1.4;
}

.active-recording-stop {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.active-recording-card-compact {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.active-recording-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
}

.active-recording-live-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.active-recording-live-dot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: inherit;
  animation: active-recording-pulse 1.2s ease-out infinite;
}

@keyframes active-recording-pulse {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  75%,
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

.active-recording-card-compact .active-recording-stop {
  grid-column: auto;
  margin-top: 0;
  min-height: 28px;
  height: 28px;
  padding: 5px 10px;
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .active-recording-live-dot::after {
    animation: none;
    opacity: 0.65;
    transform: none;
  }
}

/* Active-recording state on the primary button: softened orange-red
   (Tailwind orange-700) — semantic "recording is live" without the harsh
   pure-red assault. White square icon + live pulsing dot still read as
   "stop". Hover stays the same shade (no brighten-on-hover) to keep the
   affordance calm. */
.primary.start.rec-active {
  background: #c2410c;
  color: #fff;
}
.primary.start.rec-active:hover {
  background: #9a3412;
}

.rec-dot-live {
  position: relative;
  background: white;
}

.rec-dot-live::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.6);
  animation: rec-live-pulse 1.2s ease-out infinite;
  pointer-events: none;
}

@keyframes rec-live-pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  70% {
    transform: scale(2.4);
    opacity: 0;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rec-dot-live::after {
    animation: none;
    opacity: 0.6;
    transform: none;
  }
}

/* ------------------------------------------------------------------------- */
/* Bottom quick-actions row                                                   */
/* ------------------------------------------------------------------------- */

.bottom-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.bottom-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  cursor: pointer;
  transition:
    background 120ms,
    color 120ms;
}

.bottom-btn:hover {
  background: var(--surface-hover);
  color: var(--fg);
}

.bottom-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
}

.bottom-btn:hover .bottom-icon {
  color: var(--fg);
}

.bottom-label {
  font-size: 11px;
  font-weight: 500;
}

/* ------------------------------------------------------------------------- */
/* Popover drill-in views                                                     */
/* ------------------------------------------------------------------------- */

.app-popover-view {
  gap: 0;
  padding: 0;
}

.popover-view {
  min-height: 260px;
}

.popover-view-header {
  margin-bottom: 2px;
}

.popover-view-header-spacer {
  flex: 1;
}

.popover-view-link {
  font-size: 11px;
}

/* Rewind is a calm everyday status first; configuration is a drill-in. */
.rewind-home-card {
  display: grid;
  gap: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.rewind-home-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 7px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  text-align: left;
  transition: color 120ms;
}

.rewind-home-summary:hover,
.rewind-home-summary:focus-visible {
  color: var(--fg);
}

.rewind-home-summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.rewind-home-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.rewind-home-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.rewind-home-details {
  display: grid;
  gap: 10px;
  padding: 0 12px 10px;
}

.rewind-home-details p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 11px;
  line-height: 1.4;
}

.rewind-home-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rewind-home-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.rewind-docs-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.rewind-docs-link:hover {
  color: var(--fg);
}

.rewind-docs-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
  border-radius: 4px;
}

.rewind-settings-entry-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
}

.rewind-home-lock-note,
.rewind-capture-lock-note {
  margin: 0;
  color: var(--fg-muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.rewind-capture-lock-note {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.rewind-agent-prompt-copy {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}

.rewind-agent-prompt-copy:hover {
  color: var(--fg);
}

.rewind-agent-prompt-copy:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.rewind-home-dot {
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--fg-subtle);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--fg-subtle) 13%, transparent);
  flex-shrink: 0;
}

.rewind-home-dot.is-live {
  background: var(--status-ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-ok) 15%, transparent);
}

.rewind-home-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.rewind-home-actions button {
  min-width: 0;
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 600;
}

.rewind-home-actions button:hover:not(:disabled) {
  background: var(--surface-hover);
}

.rewind-home-actions button:disabled {
  opacity: 0.42;
  cursor: default;
}

.rewind-home-actions button:focus-visible,
.rewind-consent-choices button:focus-visible,
.rewind-consent-primary:focus-visible,
.rewind-quiet-button:focus-visible,
.rewind-search-row input:focus-visible,
.rewind-search-row button:focus-visible,
.rewind-setting-control:focus-visible,
.rewind-settings-entry .secondary:focus-visible,
.rewind-evidence-card .secondary:focus-visible,
.rewind-memory-empty .secondary:focus-visible,
.setup-back:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.rewind-home-actions .icon {
  width: 14px;
  height: 14px;
}

.rewind-consent {
  min-height: 430px;
  align-items: center;
  padding: 24px;
  text-align: center;
}

.rewind-consent-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--surface);
}

.rewind-kicker {
  margin: -4px 0 -10px;
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.rewind-consent h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.rewind-consent-copy,
.rewind-surface-lede {
  margin: 0;
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.5;
}

.rewind-consent-choices {
  width: 100%;
  display: grid;
  gap: 8px;
}

.rewind-consent-choices button {
  display: grid;
  gap: 3px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  text-align: left;
}

.rewind-consent-choices button.selected {
  border-color: var(--fg);
  box-shadow: 0 0 0 1px var(--fg);
}

.rewind-consent-choices span {
  color: var(--fg-muted);
  font-size: 11px;
}

.rewind-local-promise {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  width: 100%;
  padding: 11px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg-muted);
  text-align: left;
}

.rewind-local-promise p {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.rewind-local-promise strong {
  color: var(--fg);
}

.rewind-consent-primary {
  width: 100%;
  min-height: 42px;
}

.rewind-quiet-button {
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.rewind-memory-surface,
.rewind-settings-surface {
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.rewind-settings-surface {
  padding-bottom: 18px;
}

.rewind-search-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding-left: 11px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--bg);
}

.rewind-search-row input {
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
}

.rewind-search-row button {
  align-self: stretch;
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0 10px 10px 0;
  background: var(--surface);
  padding: 0 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.rewind-search-row button:disabled {
  opacity: 0.45;
  cursor: default;
}

.rewind-search-results {
  display: grid;
  gap: 8px;
}

.rewind-result-summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--fg-muted);
  font-size: 10.5px;
}

.rewind-result-summary strong {
  color: var(--fg);
}

.rewind-evidence-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.rewind-evidence-card p {
  margin: 0;
  line-height: 1.45;
}

.rewind-evidence-meta {
  color: var(--fg-muted);
  font-size: 10.5px;
  font-weight: 600;
}

.rewind-memory-empty {
  margin-top: 4px;
}

.rewind-coverage-details {
  margin-top: 2px;
}

.rewind-setting-row {
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 142px;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}

.rewind-setting-row > * {
  min-width: 0;
}

.rewind-setting-control {
  width: 142px;
  max-width: 100%;
  padding-right: 28px;
}

.rewind-settings-status,
.rewind-boundary-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg-muted);
  font-size: 11px;
  line-height: 1.45;
}

.rewind-boundary-note {
  margin: -4px 0 0;
}

.rewind-settings-status-copy {
  display: grid;
  gap: 1px;
}

.rewind-settings-status-copy strong {
  color: var(--fg);
  font-weight: 600;
}

.rewind-agent-row {
  border-bottom: none;
}

.rewind-excluded-apps {
  display: grid;
  gap: 9px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.rewind-excluded-apps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.rewind-choose-apps.secondary {
  width: auto;
  flex: 0 0 auto;
  padding: 7px 9px;
  font-size: 10.5px;
}

.rewind-excluded-app-list {
  display: grid;
  gap: 5px;
}

.rewind-excluded-app {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.rewind-excluded-app.is-missing {
  opacity: 0.62;
}

.rewind-excluded-app-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 700;
}

.rewind-excluded-app-copy {
  display: grid;
  min-width: 0;
}

.rewind-excluded-app-copy strong,
.rewind-excluded-app-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rewind-excluded-app-copy strong {
  font-size: 11px;
}

.rewind-excluded-app-copy span {
  color: var(--fg-muted);
  font-size: 9.5px;
}

.rewind-excluded-app-remove {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}

.rewind-excluded-app-remove:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--fg);
}

.rewind-agent-guide {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 78%, var(--bg));
}

.rewind-agent-guide-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--bg);
}

.rewind-agent-guide p {
  margin: 2px 0 5px;
  line-height: 1.45;
}

.rewind-text-button {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rewind-text-button:hover {
  color: var(--fg);
}

.rewind-detail-label {
  font-size: 11px;
}

.rewind-memory-actions {
  display: grid;
}

.rewind-memory-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 156px);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.rewind-memory-action:first-child {
  padding-top: 2px;
}

.rewind-memory-action:last-child {
  padding-bottom: 2px;
  border-bottom: none;
}

.rewind-memory-action p {
  margin: 3px 0 0;
  color: var(--fg-muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.rewind-memory-action-copy {
  min-width: 0;
}

.rewind-inline-receipt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  color: #15803d;
  font-size: 10.5px;
  font-weight: 600;
}

.rewind-inline-receipt .rewind-text-button {
  color: inherit;
}

.rewind-agent-repair .rewind-memory-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.rewind-agent-repair .secondary {
  min-width: 0;
  white-space: normal;
}

@media (max-width: 420px) {
  .rewind-setting-row,
  .rewind-memory-action {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .rewind-setting-control {
    width: 100%;
  }

  .rewind-agent-repair .rewind-memory-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

.rewind-memory-action .secondary {
  width: 100%;
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
}

.rewind-memory-action.is-danger strong {
  color: #991b1b;
}

.rewind-danger-button {
  color: #b91c1c;
}

.setup .rewind-settings-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.rewind-settings-entry .secondary {
  width: auto;
}

.setup .setup-rewind-legacy {
  display: none;
}

.popover-empty-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.popover-empty-card strong {
  font-size: 13px;
  color: var(--fg);
}

.popover-card-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.popover-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.popover-list::-webkit-scrollbar {
  width: 4px;
}

.popover-list::-webkit-scrollbar-track {
  background: transparent;
}

.popover-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.popover-list::-webkit-scrollbar-thumb:hover {
  background: var(--fg-subtle);
}

.popover-list-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.popover-list-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.popover-list-main {
  flex: 1;
  min-width: 0;
}

.popover-list-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popover-list-sub {
  margin-top: 1px;
  font-size: 11px;
  color: var(--fg-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popover-list-action {
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.popover-list-action:hover {
  background: var(--surface-hover);
}

.popover-list-action-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--bg);
}

.popover-list-action-primary:hover {
  background: var(--brand-hover);
}

.popover-list-action-active {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: rgba(34, 197, 94, 0.36);
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.popover-list-action-active:hover {
  background: rgba(34, 197, 94, 0.18);
}

.popover-list-action-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.popover-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 11px;
}

.popover-kv span {
  color: var(--fg-subtle);
}

.popover-kv strong {
  min-width: 0;
  text-align: right;
  font-size: 11px;
}

.badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  border-radius: 7px;
  background: var(--brand);
  color: var(--bg);
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}

/* ------------------------------------------------------------------------- */
/* Recent list (collapsible)                                                  */
/* ------------------------------------------------------------------------- */

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 120ms;
}

.recent-item:hover {
  background: var(--surface-hover);
}

.thumb {
  width: 48px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-strong);
}

.thumb-placeholder {
  background: linear-gradient(
    135deg,
    var(--surface-strong),
    var(--surface-hover)
  );
}

.recent-meta {
  flex: 1;
  min-width: 0;
}

.recent-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-sub {
  font-size: 11px;
  color: var(--fg-subtle);
  margin-top: 1px;
}

/* ------------------------------------------------------------------------- */
/* Footer                                                                     */
/* ------------------------------------------------------------------------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-subtle);
  padding: 0 4px;
}

.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--fg-muted);
  letter-spacing: 0.5px;
}

.footer-link {
  color: var(--fg-muted);
  cursor: pointer;
  text-decoration: none;
}

.footer-link:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* ------------------------------------------------------------------------- */
/* Setup overlay (server URL change)                                          */
/* ------------------------------------------------------------------------- */

.setup {
  width: 100%;
  background: var(--bg);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: none;
  overflow: visible;
  overscroll-behavior: contain;
}

/* Meetings / dictation drill-ins: a touch more room under the last row so
   content isn't flush with the panel edge. Must follow `.setup` so it wins
   over the shorthand padding above. */
.setup.popover-view {
  padding-bottom: 32px;
}

.setup h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.setup p {
  margin: 0;
  font-size: 12px;
  color: var(--fg-muted);
}

.setup input,
.setup-select,
.setup-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms;
}

.setup input:focus,
.setup-select:focus,
.setup-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.setup-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setup-section-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.setup-advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.setup-advanced-summary {
  padding: 9px 10px;
  cursor: pointer;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  list-style-position: inside;
}

.setup-advanced-summary:hover {
  color: var(--fg);
}

.setup-advanced-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding: 10px;
}

.setup-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setup-header h2 {
  margin: 0;
}

.setup-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition:
    background 120ms,
    color 120ms;
}

.setup-back:hover {
  background: var(--surface-hover);
  color: var(--fg);
}

.setup-back:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-ring);
}

.setup-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
}

.setup-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--fg-muted);
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 120ms;
}

.setup-help:hover,
.setup-help:focus-visible,
.setup-help[data-state="delayed-open"],
.setup-help[data-state="instant-open"] {
  opacity: 1;
}

.setup-help:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--brand-ring);
}

/* ------------------------------------------------------------------------- */
/* Tooltip (shadcn-style, Radix-backed)                                       */
/* ------------------------------------------------------------------------- */

.tooltip-content {
  z-index: 60;
  max-width: 260px;
  /* No border: shadcn's tooltip is borderless (solid bg + shadow). A border
     would also detach visually from the Radix arrow, whose flush base can't
     carry a matching CSS border. Shadow alone gives separation in both
     themes. */
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow-md);
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  user-select: none;
  transform-origin: var(--radix-tooltip-content-transform-origin);
}

.tooltip-content-wide {
  max-width: 320px;
}

.tooltip-content[data-state="delayed-open"] {
  animation: tooltip-in 120ms ease-out;
}

.tooltip-content[data-state="instant-open"] {
  animation: none;
}

.tooltip-content[data-state="closed"] {
  animation: tooltip-out 90ms ease-out;
}

.tooltip-arrow {
  fill: var(--bg);
}

@keyframes tooltip-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes tooltip-out {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

.setup-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setup-shortcut-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.setup-shortcut-row .setup-warning,
.setup-shortcut-row .setup-success {
  grid-column: 1 / -1;
}

.setup-shortcut-recorder,
.setup-shortcut-clear,
.setup-permission-button {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  transition:
    background 120ms,
    border-color 120ms,
    color 120ms,
    box-shadow 120ms;
}

.setup-shortcut-recorder {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.setup-shortcut-recorder:hover,
.setup-shortcut-clear:hover,
.setup-permission-button:hover {
  background: var(--surface-hover);
}

.setup-shortcut-recorder:focus-visible,
.setup-shortcut-clear:focus-visible,
.setup-permission-button:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.setup-shortcut-recorder.recording {
  border-color: var(--brand);
  background: var(--bg);
  color: var(--brand);
}

.setup-shortcut-clear {
  height: 38px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
}

.setup-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.setup-permission-button {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.setup-hint {
  margin: 0;
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.4;
}

.setup-warning {
  margin: 0;
  font-size: 11px;
  color: #b45309;
  line-height: 1.4;
}

.setup-success {
  margin: 0;
  font-size: 11px;
  color: #15803d;
  line-height: 1.4;
}

.setup-select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--fg-muted) 50%),
    linear-gradient(135deg, var(--fg-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
}

.setup-select:disabled {
  opacity: 0.48;
  color: var(--fg-muted);
  background-color: var(--surface);
  cursor: not-allowed;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.setup-mini-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 600;
}

.setup-textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.4;
}

.setup-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.setup-button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
  gap: 8px;
}

.setup-button-row .secondary {
  min-width: 0;
  height: 36px;
  padding-inline: 10px;
}

.setup-key-save {
  width: auto;
  min-width: 72px;
  height: 38px;
  padding-inline: 12px;
}

.setup-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.setup-account--no-border {
  border-top: none;
  padding-top: 0;
}

.setup-account-email {
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background 120ms;
}

.link-button:hover {
  background: var(--surface-hover);
}

.storage-flow-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: #eff6ff;
  color: #1e3a8a;
}

.storage-flow-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  flex-shrink: 0;
}

.storage-flow-copy {
  min-width: 0;
}

.storage-flow-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.storage-flow-sub {
  margin-top: 3px;
  color: #3b5f9a;
  font-size: 11px;
  line-height: 1.35;
}

.storage-flow-connect {
  grid-column: 2;
  justify-self: start;
  height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: white;
  color: #1d4ed8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
  transition:
    background 120ms,
    border-color 120ms;
}

.storage-flow-connect:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.pending-upload-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: #eff6ff;
  color: #1e3a8a;
}

.pending-upload-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  flex-shrink: 0;
}

.pending-upload-copy {
  min-width: 0;
}

.pending-upload-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.pending-upload-sub {
  margin-top: 2px;
  color: #3b5f9a;
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-upload-sub-wrap {
  overflow: visible;
  white-space: normal;
}

.pending-upload-why {
  margin-top: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #737373;
  cursor: help;
  font-size: 11px;
  line-height: 1.2;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.pending-upload-why:hover,
.pending-upload-why:focus-visible {
  color: #334155;
  outline: none;
}

.pending-upload-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pending-upload-connect,
.pending-upload-retry {
  height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: white;
  color: #1d4ed8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
  transition:
    background 120ms,
    border-color 120ms,
    opacity 120ms;
}

.pending-upload-connect {
  padding: 0 8px;
}

.pending-upload-dismiss {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #3b5f9a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition:
    color 120ms,
    opacity 120ms;
}

.pending-upload-folder {
  width: 28px;
  height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.76);
  color: #1d4ed8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition:
    background 120ms,
    border-color 120ms,
    color 120ms,
    opacity 120ms;
}

.pending-upload-retry:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.pending-upload-connect:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.pending-upload-folder:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.pending-upload-dismiss:hover {
  color: #1e3a8a;
}

.pending-upload-retry:disabled,
.pending-upload-connect:disabled,
.pending-upload-folder:disabled,
.pending-upload-dismiss:disabled {
  cursor: default;
  opacity: 0.6;
}

.local-recording-banner,
.local-save-banner,
.share-link-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  font-size: 11px;
  line-height: 1.3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.local-recording-banner svg {
  flex: 0 0 auto;
  color: var(--fg-muted);
}

.local-save-banner,
.share-link-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.local-save-copy {
  min-width: 0;
}

.local-save-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.local-save-sub {
  margin-top: 2px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-save-banner button,
.share-link-banner button {
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--fg);
  color: var(--bg);
  cursor: pointer;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
  transition:
    background 120ms,
    border-color 120ms;
}

.local-save-banner button:hover,
.share-link-banner button:hover {
  background: var(--brand-hover);
  border-color: transparent;
}

.local-save-banner .local-save-dismiss,
.share-link-banner .local-save-dismiss {
  background: transparent;
  color: var(--fg-muted);
}

.local-save-banner .local-save-dismiss:hover,
.share-link-banner .local-save-dismiss:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--fg);
}

.error-banner {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.permission-banner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.permission-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.35;
  min-width: 0;
}

.permission-title {
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

.permission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.permission-actions button {
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
  color: #991b1b;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  transition:
    background 120ms,
    border-color 120ms;
}

.permission-actions button:hover {
  background: white;
  border-color: #fca5a5;
}

.permission-actions .permission-retry {
  background: #991b1b;
  border-color: #991b1b;
  color: white;
}

.permission-actions .permission-retry:hover {
  background: #7f1d1d;
  border-color: #7f1d1d;
}

@media (prefers-color-scheme: dark) {
  .setup-warning {
    color: #fbbf24;
  }

  .setup-success {
    color: #86efac;
  }

  .pending-upload-banner {
    background: rgba(29, 78, 216, 0.16);
    border-color: rgba(96, 165, 250, 0.42);
    color: #bfdbfe;
  }

  .pending-upload-icon {
    background: rgba(96, 165, 250, 0.14);
    color: #93c5fd;
  }

  .pending-upload-sub {
    color: #93c5fd;
  }

  .pending-upload-why {
    color: #a3a3a3;
  }

  .pending-upload-why:hover,
  .pending-upload-why:focus-visible {
    color: #cbd5e1;
  }

  .pending-upload-connect,
  .pending-upload-retry {
    background: rgba(23, 23, 23, 0.7);
    border-color: rgba(96, 165, 250, 0.38);
    color: #dbeafe;
  }

  .pending-upload-dismiss {
    color: #93c5fd;
  }

  .pending-upload-folder {
    background: rgba(23, 23, 23, 0.58);
    border-color: rgba(96, 165, 250, 0.38);
    color: #dbeafe;
  }

  .pending-upload-retry:hover {
    background: rgba(30, 64, 175, 0.34);
    border-color: rgba(147, 197, 253, 0.62);
  }

  .pending-upload-connect:hover {
    background: rgba(30, 64, 175, 0.34);
    border-color: rgba(147, 197, 253, 0.62);
  }

  .pending-upload-folder:hover {
    background: rgba(30, 64, 175, 0.34);
    border-color: rgba(147, 197, 253, 0.62);
  }

  .pending-upload-dismiss:hover {
    color: #dbeafe;
  }

  .error-banner {
    background: rgba(185, 28, 28, 0.14);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
  }

  .permission-title {
    color: #fecaca;
  }

  .permission-actions button {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fecaca;
  }

  .permission-actions button:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(248, 113, 113, 0.6);
  }

  .permission-actions .permission-retry {
    background: #fecaca;
    border-color: #fecaca;
    color: #7f1d1d;
  }

  .permission-actions .permission-retry:hover {
    background: white;
    border-color: white;
  }
}

/* ------------------------------------------------------------------------- */
/* Overlay: countdown                                                         */
/* ------------------------------------------------------------------------- */

.countdown-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

/*
 * Horizontal row of [cancel] [number] [skip]. The two circular buttons are
 * absolutely centered at exactly ±200px (logical) from the row center so the
 * native cursor-poll hit-rects in clips/mod.rs (CONTROL_OFFSET_X = 200.0,
 * CONTROL_DIAMETER = 64.0) line up with the rendered controls. Keep these
 * numbers in sync with that Rust code.
 */
.countdown-controls {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-control {
  position: absolute;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(10, 12, 16, 0.42);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color: #ffffff;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  transform: translateY(-50%);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

.countdown-control-cancel {
  /* center at -200px from row center: -200 - (64 / 2) = -232px */
  left: -232px;
}

.countdown-control-skip {
  /* center at +200px from row center: 200 - (64 / 2) = 168px */
  left: 168px;
}

.countdown-control:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.95);
  color: #0b0d12;
}

.countdown-control:active {
  transform: translateY(-50%) scale(0.94);
}

.countdown-control:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/*
 * Absolutely centers the number without contributing width to .countdown-controls.
 * This keeps the controls div at zero width so the cancel/skip button positions
 * (left: -232px, left: 168px) line up exactly with the Rust cursor-poll hit-rects
 * (CONTROL_OFFSET_X = 200.0) measured from the window center.
 */
.countdown-number-wrap {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.countdown-number {
  font-size: 240px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  /*
   * Do NOT use -webkit-text-stroke here: it joins with a hard miter and no way
   * to set stroke-linejoin, so at this size/weight the sharp concave corner of
   * the "2" (where the curved top meets the flat bottom bar) sprouts star-shaped
   * miter spikes. We fake a soft dark edge with a 4-direction 1px shadow halo
   * instead, which has no join geometry and cannot spike.
   */
  text-shadow:
    1px 0 1px rgba(17, 24, 39, 0.22),
    -1px 0 1px rgba(17, 24, 39, 0.22),
    0 1px 1px rgba(17, 24, 39, 0.22),
    0 -1px 1px rgba(17, 24, 39, 0.22),
    0 2px 4px rgba(0, 0, 0, 0.48),
    0 12px 34px rgba(0, 0, 0, 0.36),
    0 0 2px rgba(0, 0, 0, 0.72);
  animation: cd-pop 1s ease-out forwards;
  line-height: 1;
}

.countdown-hint {
  position: fixed;
  left: 50%;
  bottom: 34px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  background: rgba(10, 12, 16, 0.28);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.countdown-hint span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.countdown-hint kbd {
  min-width: 24px;
  padding: 3px 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.74);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

@keyframes cd-pop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  25% {
    transform: scale(1.1);
    opacity: 1;
  }
  80% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0;
  }
}

/* ------------------------------------------------------------------------- */
/* Overlay: finalizing spinner                                                */
/* ------------------------------------------------------------------------- */

.preparing-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 10px;
  background: transparent;
}

.preparing-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(20, 22, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.3);
  color: white;
  font-size: 13px;
  font-weight: 600;
}

.preparing-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: #ffffff;
  animation: finalizing-spin 0.9s linear infinite;
}

/*
 * Compact transparent window shown after the user clicks Stop. Keeping the OS
 * window close to the card's bounds lets its open/dismiss controls stay
 * interactive without blocking the rest of the screen.
 */
.finalizing-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 10px;
  background: transparent;
}

.finalizing-card {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(20, 22, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.3);
  color: white;
}

/*
 * CSS-only spinner — no dependency on @tabler/icons-react (the desktop
 * bundle doesn't pull that in). A ring with one highlighted quadrant is
 * rotated continuously.
 */
.finalizing-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: #ffffff;
  animation: finalizing-spin 0.9s linear infinite;
}

.finalizing-status-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.finalizing-status-icon-success {
  color: #8ce99a;
}

.finalizing-status-icon-failed {
  color: #ffb4a8;
}

@keyframes finalizing-spin {
  to {
    transform: rotate(360deg);
  }
}

.finalizing-caption {
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  color: white;
  text-align: left;
}

.finalizing-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.finalizing-action {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.64);
  cursor: pointer;
  transition:
    color 140ms ease-out,
    background-color 140ms ease-out;
}

.finalizing-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.finalizing-action:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 1px;
}

.finalizing-action svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.finalizing-progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.finalizing-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.88);
  transition: width 180ms ease;
}

.finalizing-progress-fill-indeterminate {
  width: 42%;
  animation: finalizing-progress-sweep 1.1s ease-in-out infinite;
}

@keyframes finalizing-progress-sweep {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(250%);
  }
}

/* ------------------------------------------------------------------------- */
/* Overlay: toolbar                                                           */
/* ------------------------------------------------------------------------- */

.toolbar-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.toolbar-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 22, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  cursor: grab;
}

.toolbar-inner:active {
  cursor: grabbing;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  cursor: pointer;
  transition:
    background 120ms,
    transform 80ms;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.toolbar-btn:active {
  transform: scale(0.94);
}

.toolbar-stop {
  background: #ef4444;
  color: white;
}

.toolbar-stop:hover {
  background: #dc2626;
}

.stop-square {
  width: 10px;
  height: 10px;
  background: currentColor;
  border-radius: 2px;
  display: inline-block;
}

.toolbar-cancel {
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
}

.toolbar-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.toolbar-timer {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  min-width: 56px;
  justify-content: center;
}

.rec-pulse {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

.rec-pulse::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(239, 68, 68, 0.6);
  animation: rec-live-pulse 1.4s ease-out infinite;
  pointer-events: none;
}

.rec-pulse-paused {
  background: #f59e0b;
}

.rec-pulse-paused::after {
  animation: none;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .rec-pulse::after {
    animation: none;
    opacity: 0.6;
    transform: none;
  }
}

.toolbar-paused .toolbar-inner {
  background: rgba(60, 45, 15, 0.94);
  border-color: rgba(245, 158, 11, 0.35);
}

/* ------------------------------------------------------------------------- */
/* Vertical Loom-style recording pill                                         */
/* ------------------------------------------------------------------------- */

.toolbar-v {
  position: fixed;
  left: var(--overlay-shadow-gutter);
  top: var(--overlay-shadow-gutter);
  width: 72px;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Pin content to the top in BOTH states. The primary controls are
     centered inside their own fixed-height zone (.toolbar-v-primary), so
     the collapsed→expanded growth only adds room BELOW them. Without this,
     flipping justify-content center→flex-start on hover yanked the Stop
     button up toward the bar's top edge. */
  justify-content: flex-start;
  /* Equal inset on all four sides from the pill edge to the buttons. */
  padding: 10px;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(20, 22, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  transition: border-radius 170ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toolbar-v:hover,
.toolbar-v:focus-within {
  /* Matches TOOLBAR_EXPANDED_HEIGHT in toolbar.tsx — the fixed 130px primary
     zone + 88px hover actions (+2 margin) + 20px vertical padding. */
  height: 240px;
  border-radius: 26px;
}

.toolbar-v:active {
  cursor: grabbing;
}

/* Fixed-height home for Stop / time / Pause. Its height equals the collapsed
   pill's content box (150px − 20px vertical padding = 130px), so the trio is
   centered exactly as before when collapsed and never shifts when the pill
   grows on hover — the extra height flows into .toolbar-v-hover-actions below. */
.toolbar-v-primary {
  flex: 0 0 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.toolbar-v-stop {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  flex: 0 0 30px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: none;
  /* orange-500 — a touch softer than the red-orange we had before. */
  background: #f97316;
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.toolbar-v-stop:hover {
  background: #ea580c;
}

.toolbar-v-stop:active {
  transform: scale(0.94);
}

.toolbar-v-stop-square {
  width: 14px;
  height: 14px;
  background: currentColor;
  border-radius: 2px;
  display: inline-block;
}

.toolbar-v-spinner {
  animation: toolbar-v-spin 0.8s linear infinite;
}

@keyframes toolbar-v-spin {
  to {
    transform: rotate(360deg);
  }
}

.toolbar-v-time {
  flex: 0 0 auto;
  appearance: none;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  color: white;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.toolbar-v-time:hover,
.toolbar-v-time:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.toolbar-v-time-preparing {
  font-size: 9px;
  letter-spacing: 0;
}

.toolbar-v-pause {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  flex: 0 0 30px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.toolbar-v-pause:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.toolbar-v-hover-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 130ms ease-out,
    transform 170ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toolbar-v:hover .toolbar-v-hover-actions,
.toolbar-v:focus-within .toolbar-v-hover-actions {
  height: 88px;
  margin-top: 2px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.toolbar-v-action {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  flex: 0 0 40px;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition:
    background-color 120ms ease-out,
    color 120ms ease-out,
    transform 120ms ease-out;
}

.toolbar-v-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.toolbar-v-action:active {
  transform: scale(0.94);
}

.toolbar-v-action-danger:hover {
  background: rgba(255, 255, 255, 0.14);
}

.toolbar-v-paused {
  border-color: rgba(245, 158, 11, 0.35);
}

/* Pre-record state: the toolbar is visible during the bubble session so the
   user can drag + position it before hitting Start. Buttons are disabled
   (no recorder to drive yet). Greyed out + not-allowed cursor makes the
   "not yet" affordance obvious. */
.toolbar-v-disabled .toolbar-v-stop,
.toolbar-v-disabled .toolbar-v-pause,
.toolbar-v-disabled .toolbar-v-action {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.35);
  cursor: not-allowed;
  pointer-events: auto;
}
.toolbar-v-disabled .toolbar-v-stop:hover,
.toolbar-v-disabled .toolbar-v-pause:hover,
.toolbar-v-disabled .toolbar-v-action:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.35);
}
.toolbar-v-stop:disabled,
.toolbar-v-pause:disabled,
.toolbar-v-action:disabled {
  cursor: not-allowed;
}

.toolbar-v-disk-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f59e0b;
  opacity: 0.9;
  flex-shrink: 0;
}

.toolbar-v-disk-indicator-critical {
  color: #ef4444;
  animation: toolbar-v-disk-pulse 1.4s ease-in-out infinite;
}

@keyframes toolbar-v-disk-pulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.toolbar-v-disk-warning {
  border-color: rgba(245, 158, 11, 0.45);
}

.toolbar-v-disk-critical {
  border-color: rgba(239, 68, 68, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .toolbar-v,
  .toolbar-v-hover-actions,
  .toolbar-v-action {
    transition: none;
  }
  .toolbar-v-disk-indicator-critical {
    animation: none;
  }
}

/* ------------------------------------------------------------------------- */
/* Overlay: camera bubble                                                     */
/* ------------------------------------------------------------------------- */

/*
 * The Tauri bubble window is sized (in Rust) to exactly the circle diameter
 * PLUS a `--bubble-controls-budget` strip at the top, so the hover pill
 * has real window real-estate to render into. Everything outside window
 * bounds is invisible no matter the CSS `overflow` — you can't paint where
 * the OS hasn't given you pixels — so we build in the budget up front.
 *
 *   ┌──────────────┐
 *   │  ·  ●        │  ← .bubble-controls pill (hover-faded)
 *   └──────────────┘
 *   ┌──────────────┐
 *   │ .bubble-root │  ← circle (drag region, data-tauri-drag-region)
 *   │     ◯        │    Canvas lives here with pointer-events: none so
 *   │              │    drags reach the drag-region parent.
 *   └──────────────┘
 */
.bubble-wrapper {
  position: fixed;
  inset: var(--overlay-shadow-gutter);
  display: flex;
  /* Reverse the stack so the circle stays at the bottom of the window and
     the hover pill occupies the reserved space above it. */
  flex-direction: column-reverse;
  align-items: center;
  /* Transparent background — the Tauri window is `transparent: true`,
     so the circular camera surface below paints through. */
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.bubble-root {
  /* Circle fills the bottom of the wrapper. We use `flex: 0 0 auto` + a
     1:1 aspect-ratio so the circle is always square regardless of the
     actual window height (which includes the controls budget above it). */
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
  /* Width = 100% of wrapper → the wrapper is exactly bubble-diameter
     wide (Rust sizes the window that way). */
  width: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  /* Position context for absolute children (close X, canvas). */
  position: relative;
  /* Cursor hint — the drag region is here. */
  cursor: grab;
}

.bubble-root:active {
  cursor: grabbing;
}

.bubble-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transform: scaleX(-1); /* Mirror — feels more natural for selfie view. */
  will-change: transform, opacity;
  backface-visibility: hidden;
  /* CRITICAL: clicks MUST pass through the canvas to the
     `data-tauri-drag-region` parent. Without this, the canvas swallows
     mousedown and the bubble can't be dragged — cursor shows the grab
     affordance but the window never moves. */
  pointer-events: none;
}

.bubble-wrapper[data-path="canvas"] .bubble-root {
  animation: bubble-compositor-heartbeat 1s steps(60) infinite;
}

@keyframes bubble-compositor-heartbeat {
  from {
    transform: translateZ(0);
  }
  to {
    transform: translateZ(0);
  }
}

.bubble-error {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
  text-align: center;
  padding: 12px;
}

/* Hover controls — close X + size-toggle pill. */

.bubble-close,
.bubble-controls {
  /* Snappy fade — per Steve's 150ms-max rule for decorative transitions. */
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease-out;
}

.bubble-close.is-visible,
.bubble-controls.is-visible {
  opacity: 1;
  /* Close button and pill MUST receive clicks — they sit over the
     drag region / inside the hover wrapper but must not be treated as
     drag surfaces. */
  pointer-events: auto;
}

/* Top-right X close button. Small circle with a subtle dark backdrop so it
   reads against any camera feed (light or dark subjects). */
.bubble-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 20, 20, 0.7);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 3;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.bubble-close:hover {
  background: rgba(60, 60, 60, 0.85);
  color: white;
}

/* Size-control pill — lives in the top strip of the wrapper (above
   the circle). Centered horizontally, fades in on hover, matches Loom's
   visual weight. Because it's a sibling of `.bubble-root` (not a child),
   the border-radius clipping on the circle can't eat it. */
.bubble-controls {
  /* `flex: 0 0 auto` + margin-bottom creates the small gap between the
     pill and the circle. */
  flex: 0 0 auto;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 3;
  /* Cursor over the pill should not be a grab cursor (we're not dragging
     the bubble when clicking its controls). */
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

/* Dot buttons — filled circles sized to convey Small vs Medium at a glance,
   matching Loom's tiny / slightly-larger dots. Active dot gets a white ring
   so the current size is always legible. */
.bubble-dot {
  border: none;
  background: rgba(255, 255, 255, 0.55);
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  transition:
    background 120ms,
    box-shadow 120ms;
}

.bubble-control-button {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.86);
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 120ms,
    color 120ms;
}

.bubble-control-button:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.bubble-dot:hover {
  background: rgba(255, 255, 255, 0.85);
}

.bubble-dot.is-active {
  background: white;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.bubble-dot-small {
  width: 10px;
  height: 10px;
}

.bubble-dot-medium {
  width: 16px;
  height: 16px;
}

/* ------------------------------------------------------------------------- */
/* Inline sign-in form                                                        */
/* ------------------------------------------------------------------------- */

.signin {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 0;
}

.signin-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  text-align: center;
  margin-bottom: 2px;
}

.signin input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  outline: none;
}

.signin input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.signin .primary {
  margin-top: 2px;
}

.signin .primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.signin-alt {
  background: transparent;
  border: none;
  padding: 4px 0 0;
  font-size: 11px;
  text-align: center;
  cursor: pointer;
}

.signin-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 4px 0;
}

.signin-divider::before,
.signin-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.signin-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.signin-google:hover {
  background: var(--surface-hover, var(--surface));
  border-color: var(--border-strong, var(--border));
}

/* --- Pending Google sign-in state ---------------------------------------- */
.signin-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px;
  flex: 1;
}

.signin-pending-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--fg-muted, #888);
  border-radius: 50%;
  animation: signin-spin 0.8s linear infinite;
}

@keyframes signin-spin {
  to {
    transform: rotate(360deg);
  }
}

.signin-pending-text {
  font-size: 13px;
  color: var(--fg-muted, #888);
  margin: 0;
  text-align: center;
}

.signin-pending-cancel {
  font-size: 12px;
  color: var(--fg-muted, #888);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 4px;
}

.signin-pending-cancel:hover {
  color: var(--fg);
}

/* --- Update banner -------------------------------------------------------
 * Slots into the top of the popover when an update is in flight or ready.
 * Two visual states:
 *  - pending: subtle inline row, just keeps the user informed.
 *  - ready:   accent color + actions (dismiss / Restart) since clicking
 *             Restart is the thing we actually want them to do.
 */
.update-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.3;
}

.update-banner--pending {
  background: var(--surface);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.update-banner--ready {
  background: var(--surface-strong);
  color: var(--fg);
  border: 1px solid var(--border-strong, var(--border));
  flex-wrap: nowrap;
}

.update-banner--error {
  background: color-mix(in srgb, var(--error, #dc2626) 10%, transparent);
  color: var(--error, #dc2626);
  border: 1px solid color-mix(in srgb, var(--error, #dc2626) 40%, transparent);
  flex-wrap: wrap;
}

.update-banner-text {
  flex: 1;
  min-width: 0;
}

.update-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.update-banner-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.update-banner-btn--ghost {
  background: transparent;
  color: var(--fg-muted);
  border-color: var(--border);
}

.update-banner-btn--ghost:hover {
  background: var(--surface-hover, var(--surface));
  color: var(--fg);
}

.update-banner-btn--dismiss {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  color: var(--fg-muted);
}

.update-banner-btn--dismiss:hover {
  background: var(--surface-hover, var(--surface));
  color: var(--fg);
}

.update-banner-btn--dismiss:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-ring);
}

.update-banner-btn--primary {
  background: var(--brand);
  color: var(--bg);
}

.update-banner-btn--primary:hover {
  background: var(--brand-hover, var(--brand));
}

.update-spinner {
  animation: update-spin 1s linear infinite;
}

@keyframes update-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------------- */
/* Overlay: onboarding                                                        */
/* ------------------------------------------------------------------------- */

.onboarding-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #212121;
  color: #f5f5f5;
}

.onboarding-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 36px;
  max-width: 380px;
  width: 100%;
}

.onboarding-title {
  font-size: 22px;
  font-weight: 700;
  color: white;
  margin: 0;
  letter-spacing: -0.3px;
}

.onboarding-subtitle {
  font-size: 14px;
  color: #a3a3a3;
  margin: -8px 0 0;
}

.onboarding-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.onboarding-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
}

.onboarding-feature:hover {
  background: rgba(255, 255, 255, 0.06);
}

.onboarding-checkbox {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: #16a34a;
  cursor: pointer;
  flex-shrink: 0;
}

.onboarding-feature-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.onboarding-feature-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.onboarding-feature-desc {
  font-size: 12px;
  color: #a3a3a3;
  line-height: 1.4;
}

.onboarding-cta {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  background: #f5f5f5;
  color: #212121;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.onboarding-cta:hover {
  background: #e5e5e5;
}

.onboarding-cta:active {
  transform: translateY(1px);
}

.onboarding-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------------- */
/* Overlay: meeting notification                                              */
/* ------------------------------------------------------------------------- */

.meeting-notification-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  /* Extra horizontal room so the card's drop shadow isn't clipped by the
     transparent window edges (shadow blur is ~30px). */
  padding: 12px 32px;
  background: transparent;
  pointer-events: none;
}

.meeting-notification {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(20, 22, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.3);
  color: white;
  pointer-events: auto;
  min-width: 320px;
  max-width: 440px;
}

.meeting-notification-bar {
  width: 3px;
  height: 36px;
  border-radius: 999px;
  flex-shrink: 0;
}

.meeting-notification-bar-calendar {
  background: #7dd3fc;
}

.meeting-notification-bar-adhoc {
  background: transparent;
  border-left: 3px dashed #a3a3a3;
  width: 3px;
  border-radius: 0;
}

.meeting-notification-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 4px;
}

.meeting-notification-title {
  font-size: 13px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meeting-notification-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.meeting-notification-split {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  overflow: visible;
  background: rgba(255, 255, 255, 0.04);
}

.meeting-notification-split-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: white;
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
  min-height: 40px;
}

.meeting-notification-split-main:hover {
  background: rgba(255, 255, 255, 0.06);
}

.meeting-notification-split-main:disabled {
  opacity: 0.65;
  cursor: progress;
}

.meeting-notification-split-copy {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.15;
}

.meeting-notification-split-primary {
  font-size: 12px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}

.meeting-notification-split-secondary {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.meeting-notification-split-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  border-radius: 0 10px 10px 0;
}

.meeting-notification-split-chevron:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

.meeting-notification-provider {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.meeting-notification-provider-zoom {
  background: #2d8cff;
}

.meeting-notification-provider-meet {
  background: #34a853;
}

.meeting-notification-provider-teams {
  background: #6264a7;
}

.meeting-notification-provider-other {
  background: rgba(255, 255, 255, 0.12);
}

.meeting-notification-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(24, 26, 32, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meeting-notification-menu-item {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.meeting-notification-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.meeting-notification-menu-item:disabled {
  opacity: 0.5;
  cursor: progress;
}

.meeting-notification-error {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  color: #fca5a5;
}

.meeting-notification-close {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(28, 30, 38, 0.98);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 6;
}

.meeting-notification-close:hover {
  background: rgba(48, 50, 60, 0.98);
  color: white;
}

/* ------------------------------------------------------------------------- */
/* Overlay: meeting nub                                                       */
/* ------------------------------------------------------------------------- */

.meeting-nub-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.meeting-nub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 10px;
  border-radius: 22px;
  background: rgba(20, 22, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  color: white;
}

.meeting-nub-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
}

.meeting-nub-dot::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(22, 163, 74, 0.55);
  animation: rec-live-pulse 1.4s ease-out infinite;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .meeting-nub-dot::after {
    animation: none;
    opacity: 0.6;
    transform: none;
  }
}

.meeting-nub-initial {
  font-size: 16px;
  font-weight: 700;
  color: white;
  line-height: 1;
}

.meeting-nub-handle {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  opacity: 0.4;
  cursor: grab;
}

.meeting-nub-handle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: white;
  border-radius: 1px;
}

.meeting-nub-handle:active {
  cursor: grabbing;
}

/* ------------------------------------------------------------------------- */
/* Overlay: flow bar (voice dictation)                                        */
/* ------------------------------------------------------------------------- */

/* Wispr Flow-style dictation pill: small capsule anchored to the bottom
   of its (transparent) overlay window. The window itself is positioned
   bottom-center on the primary display by show_flow_bar in Rust. */
.flow-bar-root {
  position: fixed;
  inset: var(--overlay-shadow-gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-bottom: 8px;
  background: transparent;
  pointer-events: none;
}

.flow-bar-transcript-preview {
  max-width: 560px;
  max-height: 90px;
  padding: 5px 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(18, 18, 20, 0.92);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
  word-break: break-word;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.flow-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border-radius: 16px;
  background: rgba(18, 18, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: white;
  pointer-events: auto;
  /* Subtle fade-in so the pill doesn't hard-pop on appear. */
  animation: flow-bar-in 140ms ease-out;
  /* Fade out to opacity 0 when state goes idle (after Fn release).
     Keeping the pill in the DOM lets the waveform fade instead of pop. */
  transition: opacity 220ms ease-out;
}

/* When the dictation engine reports idle, fade the pill out without
   unmounting it. Pointer-events go off so the invisible pill cannot
   catch clicks. */
.flow-bar-idle {
  opacity: 0;
  pointer-events: none;
}

.flow-bar-recording {
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-bar-canvas {
  display: block;
}

.flow-bar-processing {
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-bar-shimmer {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.1px;
  animation: flow-shimmer 1.2s ease-in-out infinite;
}

.flow-bar-error {
  font-size: 12px;
  font-weight: 500;
  color: #fecaca;
}

/* Right-edge cancel — subtle monochrome chip, only there if the user
   needs it. Reads as a quiet utility affordance, not an alarm. Hover
   ramps up so the button still registers as clickable. */
.flow-bar-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  /* Tight against the right edge — the chip should feel like it lives
     at the pill's perimeter, not inset. Vertical centering is automatic
     via flex (pill 32px ÷ chip 18px → 7px above/below). */
  margin: 0 4px 0 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  /* Override the root's `pointer-events: none` so the click registers. */
  pointer-events: auto;
  transition:
    background 100ms ease-out,
    color 100ms ease-out;
}

.flow-bar-cancel:hover {
  background: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.95);
}

.flow-bar-cancel:active {
  background: rgba(255, 255, 255, 0.3);
}

.flow-bar-cancel svg {
  display: block;
}

/* ------------------------------------------------------------------------- */
/* Overlay: private screen region guides                                      */
/* ------------------------------------------------------------------------- */

.region-guides-layer,
.region-guides-editor {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.region-guides-layer {
  pointer-events: none;
}

.region-guides-editor {
  cursor: crosshair;
  user-select: none;
  background: rgba(0, 0, 0, 0.015);
  touch-action: none;
}

.region-guide-rect {
  position: absolute;
  border: 1.5px solid rgba(255, 255, 255, 0.62);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.018);
  box-shadow:
    0 0 120px 42px rgba(0, 0, 0, 0.075),
    inset 0 0 34px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.12);
}

.region-guide-rect-editable {
  pointer-events: auto;
  cursor: move;
  touch-action: none;
}

.region-guide-rect-editable:hover,
.region-guide-rect-editable.selected {
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 150px 50px rgba(0, 0, 0, 0.105),
    inset 0 0 36px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.2);
}

.region-guide-rect-editable:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 0 0 2px rgba(23, 23, 23, 0.5),
    0 0 150px 50px rgba(0, 0, 0, 0.12),
    inset 0 0 36px rgba(0, 0, 0, 0.08);
}

.region-guide-rect-draft {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.035);
}

.region-guide-handle {
  position: absolute;
  z-index: 2;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(23, 23, 23, 0.38);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 3px 12px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.35);
}

.region-guide-handle-nw {
  top: 0;
  left: 0;
  cursor: nwse-resize;
  transform: translate(-50%, -50%);
}

.region-guide-handle-ne {
  top: 0;
  right: 0;
  cursor: nesw-resize;
  transform: translate(50%, -50%);
}

.region-guide-handle-sw {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
  transform: translate(-50%, 50%);
}

.region-guide-handle-se {
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  transform: translate(50%, 50%);
}

.region-guide-editor-bar {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(760px, calc(100vw - 36px));
  padding: 9px 10px 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(15, 17, 21, 0.74);
  color: #f8fafc;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.region-guide-editor-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.region-guide-editor-count {
  color: rgba(248, 250, 252, 0.58);
  font-size: 11px;
  font-weight: 600;
}

.region-guide-editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.region-guide-editor-button,
.region-guide-editor-icon {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  cursor: pointer;
  transition:
    background 120ms,
    border-color 120ms,
    color 120ms;
}

.region-guide-editor-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 72px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.region-guide-editor-button-primary {
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
}

.region-guide-editor-button:hover,
.region-guide-editor-icon:hover {
  background: rgba(255, 255, 255, 0.16);
}

.region-guide-editor-button-primary:hover {
  background: #ffffff;
}

.region-guide-editor-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.region-guide-editor-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
}

.region-guide-editor-message {
  min-width: 78px;
  color: rgba(248, 250, 252, 0.68);
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.region-guide-editor-hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 36px));
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(15, 17, 21, 0.6);
  color: rgba(248, 250, 252, 0.76);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

/* ------------------------------------------------------------------------- */
/* Overlay: live recording-region border                                      */
/* ------------------------------------------------------------------------- */

.region-record-border-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  pointer-events: none;
}

.region-record-border-frame {
  position: absolute;
  border-radius: 5px;
  /* No fill, and the stroke is painted OUTWARD with an outset box-shadow so it
     lands just outside the captured rect — never inside the recorded video. */
  box-shadow:
    0 0 0 2px rgba(239, 68, 68, 0.95),
    0 0 0 4px rgba(239, 68, 68, 0.32),
    0 0 26px 6px rgba(239, 68, 68, 0.26);
  animation: region-record-border-pulse 1.8s ease-in-out infinite;
}

/* Gentle pulse that mirrors the live recording dot, signalling "recording
   now". Honour reduced-motion by holding the frame steady. */
@keyframes region-record-border-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(239, 68, 68, 0.9),
      0 0 0 4px rgba(239, 68, 68, 0.28),
      0 0 22px 5px rgba(239, 68, 68, 0.2);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(239, 68, 68, 1),
      0 0 0 4px rgba(239, 68, 68, 0.44),
      0 0 30px 8px rgba(239, 68, 68, 0.34);
  }
}

@media (prefers-reduced-motion: reduce) {
  .region-record-border-frame {
    animation: none;
  }
}

@keyframes flow-bar-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flow-shimmer {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

/* ------------------------------------------------------------------------- */
/* Overlay: recording pill                                                    */
/* ------------------------------------------------------------------------- */

/* Fills the window minus the shadow gutter `#root` already pads out. The
   collapsed capsule centers here rather than hugging a corner: hover is polled
   against the window frame, so slack between frame and capsule would light the
   pill up while the cursor is nowhere near it. */
.pill-outer {
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
}

.pill-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  border-radius: 16px;
  background: rgba(26, 26, 26, 0.95);
  color: white;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
  cursor: grab;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pill-inner:active {
  cursor: grabbing;
}

.pill-inner:not(.pill-inner-compact) {
  animation: pill-transcript-in 180ms ease-out;
}

@keyframes pill-transcript-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Collapsed (not expanded). Shrinks to logo + waveform; the whole capsule is
   the click-to-expand target and the whole capsule is what highlights. */
.pill-inner-compact {
  width: fit-content;
  height: fit-content;
  border-radius: 18px;
  cursor: pointer;
  transition:
    background 120ms ease,
    box-shadow 120ms ease;
}

/* CSS :hover covers the focused case; .pill-hovered is the Rust-polled
   fallback for when another app is focused (see clips:pill-hover). */
.pill-inner-compact:hover,
.pill-inner-compact.pill-hovered {
  background: rgba(42, 42, 42, 0.97);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.pill-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    max-width 160ms ease,
    opacity 120ms ease;
}

/* Revealed on hover in the compact/detached bar, always visible when expanded.
   The vertical capsule hides them outright — it expands on click instead. */
.pill-inner-compact:hover .pill-controls,
.pill-inner-compact.pill-hovered .pill-controls,
.pill-inner:not(.pill-inner-compact) .pill-controls {
  max-width: 160px;
  opacity: 1;
  pointer-events: auto;
}

.pill-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 4px 0 12px;
}

.pill-inner-compact .pill-header {
  gap: 6px;
  height: 36px;
  padding: 0 4px 0 8px;
}

.pill-header-detached {
  height: 40px;
  padding: 0 8px;
}

.pill-logo {
  height: 14px;
  width: auto;
  flex-shrink: 0;
}

.pill-inner-compact .pill-logo {
  height: 12px;
}

/* Collapsed = vertical capsule: logo on top, waveform below. */
.pill-inner-compact .pill-header.pill-vertical {
  flex-direction: column;
  gap: 6px;
  height: auto;
  width: auto;
  padding: 12px 10px 10px;
  cursor: pointer;
}

.pill-vertical .pill-logo {
  height: 12px;
}

/* Controls (timer / pause / stop / chevron) live in the expanded view — the
   collapsed capsule is just logo + waveform and expands on click. */
.pill-vertical .pill-controls {
  display: none;
}

.pill-vertical .pill-wave-meter {
  height: 22px;
  width: 24px;
}

/* Wrapper around logo + waveform. */
.pill-media {
  display: contents;
}

.pill-vertical .pill-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.pill-timer {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Layout only. `display` must stay flex here — a `block` override collapses
   the meter's bars into a single stacked column instead of a waveform. */
.pill-wave-meter {
  height: 26px;
  width: 48px;
  flex-shrink: 0;
}

.pill-stop-btn {
  margin-left: 0;
  display: inline-flex;
  height: 28px;
  width: 28px;
  flex-shrink: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  border: none;
  transition:
    background 120ms,
    opacity 120ms;
}

.pill-stop-btn:hover:not(:disabled) {
  background: #f87171;
}

.pill-stop-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.pill-expand-btn {
  margin-left: 4px;
  display: inline-flex;
  height: 28px;
  width: 28px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #e5e5e5;
  border: none;
  background: transparent;
  transition: background 120ms;
}

.pill-expand-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Whisper model status row in Settings */

.whisper-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--fg-muted);
}

.whisper-status-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.whisper-status-ready {
  color: #16a34a;
}

@media (prefers-color-scheme: dark) {
  .whisper-status-ready {
    color: #4ade80;
  }
}

.whisper-status-disabled,
.whisper-status-missing {
  color: #b45309;
}

@media (prefers-color-scheme: dark) {
  .whisper-status-disabled,
  .whisper-status-missing {
    color: #fbbf24;
  }
}

.whisper-status-path {
  flex-basis: 100%;
  font-size: 10px;
  color: var(--fg-subtle);
  word-break: break-all;
}

.whisper-status-downloading {
  flex-direction: column;
  align-items: stretch;
}

.whisper-progress-bar {
  width: 100%;
  height: 4px;
  margin-top: 4px;
  border: none;
  border-radius: 999px;
  appearance: none;
  overflow: hidden;
  background: var(--surface-strong);
  color: #16a34a;
}

.whisper-progress-bar::-webkit-progress-bar {
  border-radius: inherit;
  background: var(--surface-strong);
}

.whisper-progress-bar::-webkit-progress-value {
  border-radius: inherit;
  background: #16a34a;
}

.whisper-progress-bar::-moz-progress-bar {
  border-radius: inherit;
  background: #16a34a;
}

@media (prefers-color-scheme: dark) {
  .whisper-progress-bar {
    color: #4ade80;
  }

  .whisper-progress-bar::-webkit-progress-value,
  .whisper-progress-bar::-moz-progress-bar {
    background: #4ade80;
  }
}

.whisper-progress-label {
  font-size: 11px;
  color: var(--fg-muted);
}

.whisper-download-btn {
  flex-shrink: 0;
  height: 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 0 8px;
  transition: background 120ms;
}

.whisper-download-btn:hover {
  background: var(--surface-hover);
}

.whisper-other-models {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.whisper-other-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.whisper-other-model-name {
  font-size: 11px;
  color: var(--fg-muted);
}

.whisper-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition:
    background 120ms,
    color 120ms,
    border-color 120ms;
}

.whisper-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

@media (prefers-color-scheme: dark) {
  .whisper-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
  }
}

/* ---- */

.pill-error {
  margin: 0 10px 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 11px;
  line-height: 1.35;
  flex-shrink: 0;
}

.pill-divider {
  margin: 0 12px;
  height: 1px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
}

.pill-transcript-area {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pill-pane-label {
  flex-shrink: 0;
  padding: 8px 12px 2px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(245, 245, 245, 0.4);
}

.pill-pane-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pill-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: rgba(245, 245, 245, 0.5);
  cursor: pointer;
  transition:
    background 120ms,
    color 120ms;
}

.pill-copy-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #f5f5f5;
}

.pill-copy-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.pill-ask-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 10px;
}

.pill-ask-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #f5f5f5;
  font: inherit;
  font-size: 12px;
  outline: none;
  transition:
    background 120ms,
    border-color 120ms;
}

.pill-ask-input::placeholder {
  color: rgba(245, 245, 245, 0.35);
}

.pill-ask-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.pill-ask-input:disabled {
  opacity: 0.5;
}

.pill-ask-send,
.pill-ask-open {
  display: inline-flex;
  height: 28px;
  width: 28px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(245, 245, 245, 0.6);
  cursor: pointer;
  transition:
    background 120ms,
    color 120ms,
    opacity 120ms;
}

.pill-ask-send:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: #f5f5f5;
}

.pill-ask-send:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.22);
}

.pill-ask-send:disabled {
  opacity: 0.35;
  cursor: default;
}

.pill-ask-open:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f5f5f5;
}

.lt-chat {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.35;
  color: #f5f5f5;
}

.lt-empty {
  color: #71717a;
}

.lt-row {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.lt-row-you {
  align-items: flex-end;
}

.lt-row-them {
  align-items: flex-start;
}

.lt-row-pending {
  opacity: 0.6;
}

.lt-label {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lt-time {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  opacity: 0.55;
}

.lt-row-you .lt-label {
  color: rgba(245, 245, 245, 0.5);
}

.lt-row-them .lt-label {
  color: rgba(245, 245, 245, 0.38);
}

.lt-bubble {
  max-width: 85%;
  padding: 6px 10px;
  border-radius: 16px;
  word-break: break-word;
}

.lt-row-you .lt-bubble {
  background: rgba(255, 255, 255, 0.13);
  color: #fafafa;
  border-bottom-right-radius: 4px;
}

.lt-row-them .lt-bubble {
  background: rgba(255, 255, 255, 0.06);
  color: #e5e5e5;
  border-bottom-left-radius: 4px;
}

.pill-pause-btn {
  display: inline-flex;
  height: 28px;
  width: 28px;
  flex-shrink: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #e5e5e5;
  border: none;
  transition: background 120ms;
}

.pill-pause-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.pill-spinner {
  animation: pill-spin 0.8s linear infinite;
}

@keyframes pill-spin {
  to {
    transform: rotate(360deg);
  }
}
