/* =============================================
   INSV Refresh — Options Page
   Design: midnight ink sidebar, clean light content
   Tokens: variaveis.css is the single source of truth
   (motion durations + easings, font sizes, spacing, radius,
   brand-alpha, semantic surface/border). Match app-chrome.css.
   ============================================= */

/* ── Layout ──────────────────────────────────── */
.layout {
  display: flex;
  font-family: var(--font-ui, 'Outfit', 'Segoe UI', sans-serif);
  color: var(--ink-800);
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  height: 100vh;
  position: fixed;
  width: 260px;
  background: var(--ink-950);
  color: var(--ink-50);
  display: flex;
  flex-direction: column;
  padding: 1.75rem var(--space-4) var(--space-5);
  box-sizing: border-box;
  user-select: none;
  overflow-y: auto;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0.5rem;
  margin-bottom: var(--space-6);
  flex-shrink: 0;
}

.logo-wordmark {
  font-family: var(--font-display, 'YoureGone', sans-serif);
  font-size: 1.4rem;
  color: var(--brand-500);
  letter-spacing: var(--tracking-wordmark);
  font-weight: var(--weight-regular);
  line-height: 1;
}

/* ── Menu ───────────────────────────────────── */
.menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.menu a {
  color: rgba(221, 226, 241, 0.65);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
  font-weight: var(--weight-medium);
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  gap: 11px;
}

.menu a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.menu a:hover,
.menu a:focus {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-50);
}

.menu a.highlight-nav {
  background: var(--brand-a10);
  color: #fff;
  font-weight: var(--weight-semibold);
}

section h1.highlight,
section h2.highlight {
  color: var(--brand-500);
  transition: color var(--dur-slow) var(--ease-in-out);
}

.menu-support {
  color: var(--gold-500) !important;
  font-weight: var(--weight-semibold) !important;
  margin-top: 4px;
}

.menu-support:hover {
  background: rgba(255, 209, 102, 0.12) !important;
}

/* ── Sidebar footer ──────────────────────────── */
.sidebar-footer {
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex-shrink: 0;
}

.sidebar-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: var(--weight-medium);
  color: rgba(221, 226, 241, 0.65);
  cursor: pointer;
  padding: 0 0.5rem;
  transition: color var(--dur-base) var(--ease-out);
}

.sidebar-toggle-row .toggle-switch {
  margin-left: auto;
}

.sidebar-toggle-row:hover {
  color: var(--ink-50);
}

.sidebar-footer .review {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-size: var(--fs-xs);
  padding: 0 0.5rem;
  transition: color var(--dur-base) var(--ease-out);
  margin-top: 2px;
  text-align: center;
  display: block;
}

.sidebar-footer .review:hover {
  color: var(--ink-50);
}

/* ── Main content ────────────────────────────── */
.content {
  margin-left: 260px;
  flex: 1;
  background-color: var(--surface-2, #F5F6FB);
  padding-top: 1rem;
  box-sizing: border-box;
  height: 100vh;
  overflow-y: auto;
}

section {
  padding: var(--space-6) var(--space-8);
  margin: var(--space-6) var(--space-10);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #E5E7EF);
  border-radius: var(--radius-lg);
}

/* ── Typography ──────────────────────────────── */
/* Shared type scale: page h1 = --fs-2xl (28), section h2 = --fs-lg (20).
   Card titles / labels sit on --fs-base + --weight-semibold; secondary
   copy on --fs-sm; meta/badges on --fs-xs. One tier per role. */
h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-2);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-display);
  color: var(--ink-800);
}

h2 {
  font-size: var(--fs-lg);
  padding-top: 0;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-heading);
  color: var(--ink-800);
  padding-bottom: var(--space-2);
}

h1, h2 {
  transition: color var(--dur-slow) var(--ease-in-out);
}

p {
  font-size: var(--fs-base);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-3);
  color: var(--text-muted);
}

ul {
  list-style: disc inside;
  margin-left: var(--space-4);
  margin-bottom: var(--space-4);
}

li {
  margin-top: 6px;
  font-size: var(--fs-base);
  padding-left: 0.9rem;
}

strong {
  color: var(--ink-800);
  font-weight: var(--weight-semibold);
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
  color: var(--ink-400);
}

[data-theme="dark"] input[type="text"]::placeholder,
[data-theme="dark"] input[type="number"]::placeholder {
  color: var(--ink-300);
}

/* ── Feature grid ────────────────────────────── */
/* Informational list, not a set of buttons: no card chrome and no hover
   lift, which would promise a click that does nothing. */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6) var(--space-8);
  margin-top: var(--space-4);
}

.feature-card {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.feature-icon {
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-500);
  width: 28px;
  height: 28px;
}

.feature-icon svg {
  width: 24px;
  height: 24px;
}

.feature-card strong {
  display: block;
  font-size: var(--fs-base);
  color: var(--ink-800);
  margin-bottom: 3px;
}

.feature-card p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink-400);
  line-height: 1.5;
}

/* ── Demo Video Player ───────────────────────── */
.demo {
  margin: var(--space-6) 0;
}

.vp {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--ink-950);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0 0 0 / 0.45);
  user-select: none;
}

.vp video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Center overlay ──────────────────────────── */
.vp-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11 15 26 / 0.28);
  transition: opacity var(--dur-base) var(--ease-out);
}

.vp[data-state="playing"] .vp-overlay {
  opacity: 0;
  pointer-events: none;
}

/* ── Big play button ─────────────────────────── */
.vp-big-play {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-500);
  border: 2px solid var(--brand-400);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}

.vp-big-play:hover {
  background: var(--brand-600);
  border-color: var(--brand-300);
  transform: scale(1.09);
}

.vp-big-play svg {
  width: 30px;
  height: 30px;
  fill: #fff;
  stroke: none;
  margin-left: 4px;
}

/* ── Pulse rings (idle only) ─────────────────── */
.vp-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1.5px solid var(--brand-400);
  opacity: 0;
}

.vp[data-state="idle"] .vp-ring-a {
  animation: vp-pulse 2.6s var(--ease-out) infinite;
}

.vp[data-state="idle"] .vp-ring-b {
  animation: vp-pulse 2.6s var(--ease-out) infinite 0.85s;
}

@keyframes vp-pulse {
  0%   { transform: scale(1);   opacity: 0.65; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* ── HUD (bottom controls) ───────────────────── */
.vp-hud {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 28px 14px 10px;
  background: linear-gradient(transparent, rgba(11 15 26 / 0.94) 50%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  pointer-events: none;
}

.vp:hover .vp-hud,
.vp[data-state="paused"] .vp-hud,
.vp[data-state="ended"] .vp-hud {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.vp[data-state="idle"] .vp-hud {
  opacity: 0;
  pointer-events: none;
}

/* ── Step label ──────────────────────────────── */
.vp-step-text {
  font-size: var(--fs-xs);
  font-weight: var(--weight-semibold);
  color: var(--brand-300);
  letter-spacing: var(--tracking-micro);
  min-height: 15px;
  font-family: var(--font-ui);
}

/* ── Scrub bar ───────────────────────────────── */
.vp-scrub {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  /* The track owns the gesture once grabbed; without this a touch drag scrolls
     the page instead of scrubbing. */
  touch-action: none;
}

.vp-scrub-track {
  position: relative;
  width: 100%;
  height: 3px;
  background: rgba(255 255 255 / 0.16);
  border-radius: var(--radius-full);
  transition: height var(--dur-fast) var(--ease-out);
}

.vp-scrub:hover .vp-scrub-track {
  height: 5px;
}

.vp-scrub-fill {
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 0%;
  background: var(--brand-500);
  border-radius: var(--radius-full);
  transition: width 0.08s linear;
}

.vp-scrub-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0 0 0 / 0.55);
  transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-press) var(--ease-out);
}

.vp-scrub:hover .vp-scrub-thumb {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* ── Step dots ───────────────────────────────── */
.vp-dots {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  pointer-events: auto;
}

.vp-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255 255 255 / 0.28);
  border: 1.5px solid rgba(255 255 255 / 0.55);
  transform: translate(-50%, -50%);
  top: 50%;
  transition: background var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out), border-color var(--dur-base) var(--ease-out);
  cursor: pointer;
}

.vp-dot:hover {
  background: rgba(255 255 255 / 0.55);
  transform: translate(-50%, -50%) scale(1.3);
}

.vp-dot.active {
  background: var(--brand-400);
  border-color: var(--brand-300);
  transform: translate(-50%, -50%) scale(1.3);
  box-shadow: 0 0 0 3px var(--brand-a25);
}

/* ── Controls row ────────────────────────────── */
.vp-controls-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.vp-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-200);
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out);
  flex-shrink: 0;
}

.vp-btn:hover {
  color: #fff;
  background: rgba(255 255 255 / 0.1);
}

.vp-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.vp-time {
  font-size: 10.5px; /* deliberate HUD micro-size, below the --fs-xs floor */
  color: var(--ink-300);
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-micro);
  white-space: nowrap;
  margin-left: 2px;
}

.vp-spacer { flex: 1; }

/* ── Caption ─────────────────────────────────── */
.caption {
  font-size: var(--fs-sm);
  color: var(--ink-400);
  margin-top: var(--space-2);
  text-align: center;
}

/* ── Drop area ───────────────────────────────── */
.drop-area {
  border: 2px dashed var(--ink-100);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  text-align: center;
  margin: var(--space-5) 0;
  background-color: var(--surface);
  transition: border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
  cursor: pointer;
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-area:hover {
  border-color: var(--brand-500);
  background-color: color-mix(in srgb, var(--brand-500) 5%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--brand-a10);
}

.drop-area.dragover {
  border-color: var(--brand-500);
  background-color: var(--brand-a10);
  border-style: solid;
  /* Solid border + ring + tint say "drop here" without a looping glow. */
  box-shadow: 0 0 0 3px var(--brand-a40);
}

.drop-area.error {
  border-color: var(--danger-500);
  background-color: color-mix(in srgb, var(--danger-500) 12%, #fff);
  animation: shake 0.5s ease-in-out;
}

.drop-content {
  pointer-events: none;
  width: 100%;
}

.drop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  opacity: 0.5;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  color: var(--brand-500);
}

.drop-icon svg {
  width: 36px;
  height: 36px;
}

.drop-area:hover .drop-icon,
.drop-area.dragover .drop-icon {
  opacity: 1;
  transform: scale(1.1);
}

.drop-text {
  margin-bottom: var(--space-3);
}

.drop-text strong {
  font-size: var(--fs-base);
  display: block;
  margin-bottom: var(--space-2);
}

.drop-text p {
  margin: 0;
  color: var(--ink-400);
  font-size: var(--fs-base);
}

.browse-btn {
  background: none;
  border: none;
  color: var(--brand-500);
  cursor: pointer;
  font-size: var(--fs-sm);
  padding: 0;
  margin: 0;
  pointer-events: auto;
  font-weight: var(--weight-semibold);
  transition: color var(--dur-base) var(--ease-out);
}

.browse-btn:hover {
  color: var(--brand-700);
}

.drop-formats {
  font-size: var(--fs-sm);
  color: var(--ink-400); /* ink-200 on white was 1.82:1 */
  margin-top: 8px;
}

/* ── Audio name row ──────────────────────────── */
.audio-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.audio-name-row label {
  font-weight: var(--weight-semibold);
  font-size: var(--fs-base);
  color: var(--ink-700);
  white-space: nowrap;
  cursor: default;
}

.audio-name-row input[type="text"] {
  flex: 1;
  min-width: 160px;
  max-width: 300px;
  padding: 9px 13px;
  border: 1.5px solid var(--ink-100);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  outline: none;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
  font-family: inherit;
}

.audio-name-row input[type="text"]:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-a10);
}

/* ── Save audio button ───────────────────────── */
button {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* Keyboard focus ring for every interactive control (WCAG 2.4.7) */
button:focus-visible,
a:focus-visible,
.lang-select:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* Indicador de foco precisa de 3:1 contra o entorno (WCAG 1.4.11). A 45% de
   alpha o anel dava 1.63:1 no card branco, praticamente invisível. */
.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px var(--brand-600);
}

[data-theme="dark"] button:focus-visible,
[data-theme="dark"] a:focus-visible,
[data-theme="dark"] .lang-select:focus-visible {
  outline-color: var(--brand-400);
}

.save-audio-btn {
  background-color: var(--brand-600); /* white on brand-500 was 2.93:1 — below AA */
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  font-size: var(--fs-base);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
  white-space: nowrap;
  font-family: inherit;
}

.save-audio-btn:hover:not(:disabled) {
  background-color: var(--brand-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--brand-a25);
}

.save-audio-btn:disabled {
  background-color: var(--ink-200);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ── How-to audio box ────────────────────────── */
.how-to-audio {
  background-color: color-mix(in srgb, var(--brand-500) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-500) 18%, transparent);
  padding: var(--space-4);
  margin-top: var(--space-5);
  border-radius: var(--radius-lg);

}

.how-to-audio h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--brand-500);
  font-weight: var(--weight-semibold);
  font-size: var(--fs-base);
}

.how-to-audio ul {
  margin: 0;
  color: var(--ink-500);
}

/* ── Audio list ──────────────────────────────── */
#custom-audios-list p {
  color: var(--ink-400);
  font-style: italic;
  font-size: var(--fs-base);
}

#custom-audios-list > div {
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: 0.6rem;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: box-shadow var(--dur-fast) var(--ease-out);
}

#custom-audios-list > div:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.audio-play-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--brand-50);
  /* Ícone é gráfico não-textual (mín. 3:1): brand-500 sobre brand-50 dava
     2.64:1, brand-700 dá 5.42:1 */
  color: var(--brand-700);
  border: 1px solid var(--brand-200);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  padding: 0;
}

.audio-play-btn:hover {transform: scale(1.05); }
.audio-play-btn .icon-pause { display: none; }
.audio-play-btn.playing .icon-play { display: none; }
.audio-play-btn.playing .icon-pause { display: block; }

.audio-info {
  flex: 1;
  min-width: 0;
}

.audio-info strong {
  font-size: var(--fs-base);
  color: var(--ink-800);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-meta {
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  color: var(--ink-400); /* ink-200 on white was 1.82:1 */
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

button.delete-audio-btn {
  background: transparent;
  color: var(--danger-500);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md);
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out);
  flex-shrink: 0;
}

button.delete-audio-btn:hover {
  background: var(--danger-500);
  color: white;
}

#audio-preview {
  margin: 1rem 0;
  padding: 1rem 1.2rem;
  background: var(--brand-50);
  border-radius: var(--radius-lg);
  border: 1px solid var(--ink-100);
}

#audio-preview:empty {
  display: none;
}

#audio-preview audio {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: block;
}

/* ── Status notification ─────────────────────── */
.queue-manager-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 310px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 0.4rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.queue-manager-list::-webkit-scrollbar {
  display: none;
}


/* Queue-manager row label (used by createQueueManagerRow) */
/* Fixed-width, read-only field. The queue name can be longer than the column,
   so it lives in a non-editable <input>: the full value stays reachable by
   scrolling/selecting (and via the native title on hover) without the column
   ever resizing. */
.status-rule-queue-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 172px;
  flex-shrink: 0;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-sm);
  background: var(--surface-2, #f5f6fb);
  padding: 4px 8px 4px 10px;
}

.qm-label-icon {
  flex-shrink: 0;
  stroke: var(--brand-500);
  opacity: 0.8;
}

.queue-manager-row input.qm-queue-name {
  flex: 1 1 0;
  min-width: 0;
  padding: 1px 0;
  border: none;
  background: transparent;
  box-shadow: none;
  font-size: var(--fs-sm);
  font-weight: var(--weight-semibold);
  color: var(--brand-700); /* brand-600 was 3.84:1 on the surface-2 row — below AA */
  cursor: text;
  text-overflow: ellipsis;
}

.queue-manager-row input.qm-queue-name:focus {
  border: none;
  box-shadow: none;
  text-overflow: clip;
}

/* Queue-manager row (rendered by createQueueManagerRow) */
.queue-manager-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--ink-100);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  flex-shrink: 0;
}

.queue-manager-row input[type="text"],
.queue-manager-row select {
  padding: 7px 10px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  outline: none;
  background: var(--surface);
  color: var(--ink-800);
  font-family: inherit;
  transition: border-color var(--dur-base) var(--ease-out);
}

.queue-manager-row input[type="text"]:focus,
.queue-manager-row select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-a10);
}

.queue-manager-row .qm-statuses { flex: 1 1 0; min-width: 140px; }

/* Bell + custom sound dropdown. The dropdown (.queue-sound-select) carries its
   own themed surface/border (styles/sound-dropdown.css), so the wrapper is a
   plain flex row — no box around it. */
.qm-sound-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.qm-bell-icon {
  width: 15px;
  height: 15px;
  stroke: var(--brand-500);
  flex-shrink: 0;
  opacity: 0.8;
}

.qm-sound-wrapper .queue-sound-select {
  width: 128px;
}

.qm-label-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── Avançado section ────────────────────────── */
.advanced-shortcuts-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 0 var(--space-5);
  margin-bottom: var(--space-4);
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) 0;
}

.shortcut-item-info {
  flex: 1;
  min-width: 0;
}

.shortcut-divider {
  border: none;
  border-top: 1px solid var(--border, #eef0f8);
  margin: 0;
}

.advanced-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: var(--space-6) var(--space-10);
}

.advanced-bottom-row > section { margin: 0; }

/* O gap do card já separa o título do corpo; o padding do h2 duplicaria. */
.advanced-bottom-card h2 { padding-bottom: 0; }

.advanced-bottom-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.advanced-bottom-card p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-muted, #666);
  line-height: 1.5;
  flex: 1;
}

.field-label {
  font-weight: var(--weight-semibold);
  font-size: var(--fs-base);
  color: var(--ink-800);
  cursor: default;
  display: block;
}

.field-desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: var(--space-1) 0 0;
  line-height: 1.5;
}


.shortcut-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.shortcut-capture {
  flex: 1;
  min-width: 160px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1.5px dashed var(--ink-100);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--ink-800);
  font-family: inherit;
  font-size: var(--fs-base);
  cursor: pointer;
  outline: none;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}

.shortcut-capture:hover { border-color: var(--brand-500); }

.shortcut-capture:focus-visible {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-a15);
}

.shortcut-capture.capturing {
  border-style: solid;
  border-color: var(--brand-500);
  background: color-mix(in srgb, var(--brand-500) 8%, #fff);
  box-shadow: 0 0 0 3px var(--brand-a15);
  animation: pulse 1.5s infinite;
}

.shortcut-capture.capture-error {
  border-color: var(--danger-500);
  background: color-mix(in srgb, var(--danger-500) 12%, #fff);
  animation: shake 0.4s ease-in-out;
}

.shortcut-capture.has-shortcut { border-style: solid; }

/* ink-400 dava 4.34:1 sobre surface-2; ink-500 dá 6.21:1 */
.shortcut-placeholder { color: var(--text-muted); font-size: var(--fs-sm); }

.shortcut-capture kbd {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--ink-200);
  border-bottom-width: 2.5px;
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: var(--font-mono, monospace);
  font-size: var(--fs-sm);
  font-weight: var(--weight-bold);
  color: var(--ink-800);
  white-space: nowrap;
}

.kbd-plus { color: var(--ink-400); font-weight: var(--weight-semibold); margin: 0 2px; } /* #999 was 2.64:1 */

/* Light defaults (the card is white in light mode — the old colors were
   dark-surface-only and unreadable here). Dark treatment is themed below. */
.shortcut-clear {
  background: transparent;
  color: var(--ink-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), transform var(--dur-press) var(--ease-out);
}

.shortcut-clear:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-800);
}

[data-theme="dark"] .shortcut-clear {
  color: var(--ink-100);
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .shortcut-clear:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-50);
}

/* ── Toggle switch ───────────────────────────── */
.toggle-switch-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: var(--weight-semibold);
  font-size: var(--fs-base);
  color: var(--ink-800);
  cursor: pointer;
  user-select: none;
  margin-top: var(--space-1);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch--sm {
  width: 34px;
  height: 18px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  transition: background-color var(--dur-slow) var(--ease-in-out);
  cursor: pointer;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--dur-slow) var(--ease-in-out);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch--sm .toggle-slider::before {
  width: 12px;
  height: 12px;
  left: 3px;
  top: 3px;
}

.toggle-switch input:checked + .toggle-slider { background-color: var(--brand-500); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch--sm input:checked + .toggle-slider::before { transform: translateX(16px); }

/* toggle in light content area needs visible track */
.content .toggle-slider { background-color: var(--ink-200); }

/* ── Language select ─────────────────────────── */
.lang-select {
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-family: inherit;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(221, 226, 241, 0.8);
  cursor: pointer;
  outline: none;
  transition: border-color var(--dur-base) var(--ease-out);
  flex: 1;
}

.lang-select:focus {
  border-color: var(--brand-500);
}

.lang-select option {
  background: var(--ink-800);
  color: var(--ink-50);
}

/* ── Export / Import ─────────────────────────── */
.export-import-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.export-import-btn {
  background-color: var(--surface);
  color: var(--ink-700);
  border: 1.5px solid var(--border, #e0e4f0);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out), border-color var(--dur-base) var(--ease-out);
  text-decoration: none;
  font-family: inherit;
}

.export-import-btn:hover {
  background-color: var(--ink-800);
  color: #fff;
  border-color: var(--ink-800);
  transform: translateY(-1px);
}

/* Containing block do input escondido: sem isso o position:absolute sobe até
   o ICB, escapa do clip de .content (que é overflow-y:auto mas static) e
   estica a altura do DOCUMENTO até a posição do card, criando um vazio
   gigante abaixo do footer. */
.import-label { position: relative; cursor: pointer; }

/* O input de arquivo estava com display:none, o que o tira da ordem de foco.
   Como <label> também não é focável, "Importar" não tinha NENHUM caminho por
   teclado (WCAG 2.1.1). Escondido visualmente mas ainda focável, o Tab chega
   nele e Enter/Espaço abrem o seletor de arquivo; o anel vai no rótulo. */
.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.import-label:focus-within {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

[data-theme="dark"] .import-label:focus-within {
  outline-color: var(--brand-400);
}

/* ── Banners ─────────────────────────────────── */
.changelog-banner {
  background: color-mix(in srgb, var(--brand-500) 7%, transparent);
  border: 1.5px solid var(--brand-a40);
  border-radius: var(--radius-lg);
  padding: var(--space-6) 1.75rem;
  margin: var(--space-10);
  box-shadow: 0 2px 10px var(--brand-a10);
}

.changelog-banner strong {
  /* brand-600 sobre o tint claro do banner dava 3.57:1; brand-700 dá 5.19:1 */
  color: var(--brand-700);
  font-size: var(--fs-base);
  display: block;
  margin-bottom: var(--space-4);
}

.changelog-banner ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.changelog-banner ul li {
  font-size: var(--fs-base);
  line-height: 1.4;
  color: var(--ink-700);
  padding-left: var(--space-6);
  position: relative;
}

.changelog-banner ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--brand-500);
  font-weight: var(--weight-bold);
}

.changelog-banner #changelog-dismiss {
  margin-top: var(--space-5);
  background: var(--brand-600); /* white on brand-500 was 2.93:1 — below AA */
  color: white;
  border: none;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: var(--weight-semibold);
  transition: background-color var(--dur-base) var(--ease-out), transform var(--dur-press) var(--ease-out);
  font-family: inherit;
}

.changelog-banner #changelog-dismiss:hover { background: var(--brand-700); }

/* Toast styling is shared (showToast in scripts/util.js injects .insv-toast). */

/* The sparkle stays still: a glow looping forever in the sidebar pulls the
   eye away from the settings the page is for. */
.glowPulse {
  text-decoration: none;
}

/* ── Animations ──────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-20px); }
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--brand-a40); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ── Dark mode ───────────────────────────────── */
[data-theme="dark"] body { background: var(--ink-950); color: var(--ink-100); }
[data-theme="dark"] .content { background: var(--ink-950); }
[data-theme="dark"] .sidebar {
  background: var(--ink-950);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

/* Carded sections sit one step above the ink-950 content bg in dark mode. */
[data-theme="dark"] section {
  background: var(--ink-800);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] h2 { color: var(--ink-100); border-color: rgba(255, 255, 255, 0.1); }
/* Neutral title in dark to match the light-mode ink heading (was brand-400,
   which read as a link and clashed with the neutral h2 section titles). */
[data-theme="dark"] h1 { color: var(--ink-50); }

[data-theme="dark"] section h1.highlight,
[data-theme="dark"] section h2.highlight { color: var(--brand-300); }
[data-theme="dark"] p { color: var(--ink-200); }
[data-theme="dark"] label { color: var(--ink-200); }
[data-theme="dark"] strong { color: var(--ink-50); }
[data-theme="dark"] ul { color: var(--ink-200); }

[data-theme="dark"] .feature-card strong { color: var(--ink-50); }
[data-theme="dark"] .feature-card p { color: var(--ink-200); }

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] .queue-manager-row input[type="text"],
[data-theme="dark"] .queue-manager-row select {
  background: var(--ink-950);
  color: var(--ink-100);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .queue-manager-row {
  background: var(--ink-800);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .status-rule-queue-label {
  background: var(--ink-950);
  border-color: rgba(255, 255, 255, 0.1);
}
/* Keep the read-only name field borderless/transparent in dark mode; the
   generic dark input rule above would otherwise box it in. */
[data-theme="dark"] .queue-manager-row input.qm-queue-name {
  background: transparent;
  border: none;
  color: var(--brand-300);
}

[data-theme="dark"] .audio-name-row input[type="text"] {
  background: var(--ink-950);
  color: var(--ink-100);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .shortcut-capture {
  background: var(--ink-800);
  color: var(--ink-100);
  border-color: rgba(255, 255, 255, 0.12);
}


[data-theme="dark"] .shortcut-capture.capturing {
  background: color-mix(in srgb, var(--brand-500) 12%, var(--ink-800));
  border-color: var(--brand-500);
}

[data-theme="dark"] .shortcut-capture.capture-error {
  background: color-mix(in srgb, var(--danger-500) 15%, var(--ink-800));
  border-color: var(--danger-500);
}

[data-theme="dark"] .shortcut-capture kbd {
  background: var(--ink-950);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--ink-100);
}

[data-theme="dark"] .field-label { color: var(--ink-200); }

[data-theme="dark"] .toggle-switch-label { color: var(--ink-200); }

[data-theme="dark"] .how-to-audio {
  background: color-mix(in srgb, var(--brand-500) 8%, transparent);
  border-color: var(--brand-a30);
}
[data-theme="dark"] .how-to-audio h3 { color: var(--brand-300); }
[data-theme="dark"] .how-to-audio ul { color: var(--ink-200); }

[data-theme="dark"] .drop-area {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}
/* Dark state affordances — without these the generic dark .drop-area rule
   (earlier in source, equal specificity) wins and erases the brand/red cue. */
[data-theme="dark"] .drop-area.dragover {
  border-color: var(--brand-500);
  background-color: var(--brand-a10);
}
[data-theme="dark"] .drop-area.error {
  border-color: var(--danger-500);
  background-color: color-mix(in srgb, var(--danger-500) 15%, var(--ink-800));
}
[data-theme="dark"] .browse-btn:hover { color: var(--brand-300); }

[data-theme="dark"] #audio-preview { background: var(--ink-800); border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] #custom-audios-list p { color: var(--ink-300); }
[data-theme="dark"] #custom-audios-list > div {
  background: var(--ink-700);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .audio-info strong { color: var(--ink-50); }
[data-theme="dark"] .audio-meta { color: var(--ink-200); } /* ink-300 on ink-700 was 4.25:1 */
/* Pale brand-50 chip read as a light hole on the dark row; give it a dark
   brand-tinted treatment like the other row controls. */
[data-theme="dark"] .audio-play-btn {
  background: var(--brand-a12);
  color: var(--brand-300);
  border-color: var(--brand-a35);
}
[data-theme="dark"] button.delete-audio-btn {
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--danger-500);
}
/* Without this, the dark base rule above (equal specificity, later in source)
   overrides the generic :hover color, so the icon turns red on a red fill. */
[data-theme="dark"] button.delete-audio-btn:hover {
  background: var(--danger-500);
  color: #fff;
}

[data-theme="dark"] .changelog-banner {
  background: var(--brand-a10);
  border-color: var(--brand-a30);
}
[data-theme="dark"] .changelog-banner strong { color: var(--brand-300); }
[data-theme="dark"] .changelog-banner ul li { color: var(--ink-200); }

[data-theme="dark"] .menu a.highlight-nav {
  background: color-mix(in srgb, var(--brand-500) 20%, transparent);
  color: var(--brand-300);
}

[data-theme="dark"] .advanced-shortcuts-card {
  background: var(--ink-800);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .shortcut-divider {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .advanced-bottom-card {
  background: var(--ink-800);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Backup e Legacy são <section>: a borda acompanha as seções vizinhas. */
[data-theme="dark"] .advanced-bottom-row > section { border-color: rgba(255, 255, 255, 0.06); }

[data-theme="dark"] .export-import-btn {
  background-color: var(--ink-700);
  color: var(--ink-100);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .export-import-btn:hover {
  background-color: var(--ink-100);
  color: var(--ink-950);
  border-color: var(--ink-100);
}

/* Footer is provided by the shared app-chrome.css (.app-footer). The
   options footer sits inside .content, so add a little top margin. */
.app-footer { margin-top: var(--space-4); }

/* ── Press feedback (Emil) ───────────────────── */
/* Pressable controls dip on :active. Buttons with a hover lift keep it and
   add the dip; the rest scale subtly. Feedback belongs on the press, not on
   the release: a control that only reacts once the click completes reads as
   dead for the whole time the pointer is held down on it. */
.vp-btn:active,
.vp-big-play:active,
.vp-dot:active,
.audio-play-btn:active,
.export-import-btn:active,
.shortcut-clear:active,
.changelog-banner #changelog-dismiss:active,
button.delete-audio-btn:active {
  transform: scale(0.97);
}

.save-audio-btn:active:not(:disabled) {
  transform: translateY(-1px) scale(0.97);
}

/* Rows and inline text buttons take the press as a tint or a colour step
   instead. A full-width row that shrinks under the pointer reads as a card
   coming loose, and a button that is only its label has nothing to scale. */
.menu a:active {
  background: rgba(255, 255, 255, 0.14);
}

/* Its own hover is !important, so the press has to match to land at all. */
.menu-support:active {
  background: rgba(255, 209, 102, 0.22) !important;
}

.sidebar-toggle-row:active,
.sidebar-footer .review:active {
  color: var(--ink-50);
}

.browse-btn:active { color: var(--brand-700); }

/* ── Reduced motion ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  /* Reduced motion is not "no feedback". What has to go is travel: transforms,
     slides, anything that moves across the screen. Opacity and colour still
     carry meaning — a control acknowledging a press, a panel becoming the
     active one — so they keep a short linear cross-fade instead of being
     flattened to nothing along with the movement. */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-property: opacity, color, background, background-color, border-color, box-shadow, fill, stroke !important;
    transition-duration: var(--dur-fast) !important;
    transition-timing-function: linear !important;
  }

  .shortcut-capture.capturing {
    animation: none;
    box-shadow: 0 0 0 3px var(--brand-a15);
  }

}

/* ── Horário de expediente ─────────────────────────────────── */
.ws-card {
  gap: var(--space-3);
}

.ws-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: opacity var(--dur-base) var(--ease-out);
}

/* Toggle desligado: campos visíveis (dá pra ver o que está configurado)
   porém inertes e apagados */
.ws-fields.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.ws-time-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.ws-time-label {
  font-size: var(--fs-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink-800);
}

.ws-time-label + input[type="time"] {
  margin-right: var(--space-3);
}

.ws-time-row input[type="time"] {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: inherit;
  font-family: inherit;
  font-size: var(--fs-sm);
  padding: 5px 8px;
}

.ws-time-row input[type="time"]:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 1px;
}

.ws-days {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ws-day {
  position: relative;
}

.ws-day input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ws-day span {
  display: inline-block;
  padding: 4px 11px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.ws-day input:checked + span {
  background: var(--brand-600);
  color: var(--white-color, #fff);
}

.ws-day input:focus-visible + span {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

[data-theme="dark"] .ws-time-label {
  color: var(--ink-50);
}

[data-theme="dark"] .ws-time-row input[type="time"] {
  background: var(--ink-850);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--ink-50);
  color-scheme: dark;
}

[data-theme="dark"] .ws-day span {
  border-color: rgba(255, 255, 255, 0.16);
}
