:root {
  --bg: #f6f7f9; --fg: #14181f; --muted: #5b6573; --card: #ffffff; --line: #d9dee5;
  --accent: #0f4c81; --accent-fg: #ffffff; --rec: #c62828; --ok: #2e7d32;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1216; --fg: #e8ebef; --muted: #9aa4b1; --card: #181c22; --line: #2a3038;
    --accent: #4f8fd1; --accent-fg: #0b0e12; --rec: #ef5350; --ok: #66bb6a; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 16px calc(24px + env(safe-area-inset-bottom)); }
main { max-width: 560px; margin: 0 auto; }
header { padding: 16px 0 8px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 28px 0 8px; }
h2 small { color: var(--muted); font-weight: normal; }
#status { margin: 4px 0 0; color: var(--muted); min-height: 1.45em; }
.aviso { font-weight: 600; }
.gravar { width: 100%; min-height: 200px; margin: 12px 0 20px; border: 0; border-radius: 24px;
  background: var(--accent); color: var(--accent-fg); font-size: 1.25rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; }
.gravar.gravando { background: var(--rec); color: #fff; }
.gravar.ocupado { opacity: .7; }
.gravar .icone { width: 28px; height: 44px; border-radius: 14px; background: currentColor; }
.gravar.gravando .icone { border-radius: 6px; width: 34px; height: 34px; }
.tempo { font-variant-numeric: tabular-nums; font-size: 1rem; min-height: 1.2em; }
.rotulo { display: block; font-weight: 600; margin-bottom: 6px; }
textarea { width: 100%; font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; resize: vertical; }
.copiar { width: 100%; margin-top: 10px; min-height: 52px; border-radius: 12px; border: 0;
  background: var(--fg); color: var(--bg); font-size: 1.05rem; font-weight: 600; }
.copiar:disabled { opacity: .4; }
button { font: inherit; cursor: pointer; }
#historico { list-style: none; padding: 0; margin: 0; }
#historico li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
#historico .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
#historico .txt { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
#historico button { border: 1px solid var(--line); background: transparent; color: var(--fg); border-radius: 8px; padding: 4px 10px; }
.vazio { color: var(--muted); }
.opcoes { margin-top: 24px; display: grid; gap: 10px; }
.opcoes select { font: inherit; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
.secundario { min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
.perigo { color: var(--rec); }
