/* ==========================================================================
   Anotaco — Design tokens e componentes base
   Identidade: amarelo #FBB614 (marca), pastéis #FADC87 / #8EC9F9 / #8CCFBB,
   preto #000, branco #FFF, tipografia Inter + Quicksand (logotipo)
   ========================================================================== */

:root {
  --brand: #FBB614;
  --brand-600: #E9A300;
  --brand-soft: #FADC87;
  --brand-tint: #FFF4D6;
  --blue: #8EC9F9;
  --blue-tint: #E3F2FE;
  --green: #8CCFBB;
  --green-tint: #E0F3EC;
  --red: #F08A7E;
  --red-tint: #FDE6E3;
  --purple: #C9B8F6;

  --ink: #1C1C1C;
  --ink-2: #4A4A4A;
  --ink-3: #8A8A8A;
  --ink-4: #B8B8B8;
  --line: #E7E7E7;
  --line-2: #F0F0F0;
  --bg: #EFEFEF;
  --surface: #FFFFFF;
  --surface-2: #F6F6F6;
  --overlay: rgba(20, 20, 20, .38);

  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius: 22px;
  --radius-lg: 28px;
  --pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 6px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.14);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-logo: 'Quicksand', 'Inter', sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
}

[data-theme="dark"] {
  --ink: #F2F2F2;
  --ink-2: #C9C9C9;
  --ink-3: #8F8F8F;
  --ink-4: #5E5E5E;
  --line: #2E2E2E;
  --line-2: #262626;
  --bg: #121212;
  --surface: #1C1C1C;
  --surface-2: #242424;
  --brand-tint: #3A2F12;
  --blue-tint: #18303F;
  --green-tint: #183229;
  --red-tint: #3B1F1C;
  --overlay: rgba(0,0,0,.6);
  --shadow: 0 6px 24px rgba(0,0,0,.4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
::selection { background: var(--brand-soft); color: #1c1c1c; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Logo ---------- */
/* v4: a logomarca oficial (símbolo + nome) vem de brand_logo() e assets/css/brand.css */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo .brand-icon { width: 34px; height: 34px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--pill);
  background: var(--surface-2); color: var(--ink);
  font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background .2s, transform .1s, box-shadow .2s, border-color .2s;
}
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--line); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--ink); color: var(--surface); }
.btn-primary:hover { background: #333; }
[data-theme="dark"] .btn-primary { background: var(--brand); color: #1c1c1c; }
[data-theme="dark"] .btn-primary:hover { background: var(--brand-600); }
.btn-brand { background: var(--brand); color: #1c1c1c; }
.btn-brand:hover { background: var(--brand-600); }
.btn-outline { background: transparent; border-color: var(--line); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--red-tint); color: #B4382B; }
.btn-danger:hover { background: #F9D2CD; }
[data-theme="dark"] .btn-danger { color: #FFB4AA; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn.plain:hover { background: var(--surface-2); }
.icon-btn.active { color: #1c1c1c; background: var(--brand-soft); border-color: transparent; }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.textarea { height: auto; min-height: 96px; padding: 12px 16px; resize: vertical; }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238A8A8A' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(251,182,20,.18); }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.field.has-error .input { border-color: var(--red); }
.field-error { font-size: 12px; color: #C2412F; }
.hint { font-size: 12px; color: var(--ink-3); }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.input-icon .input { padding-left: 42px; }
.input-icon .toggle-pass { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--ink-2); user-select: none; }
.check input { appearance: none; width: 20px; height: 20px; border: 1.5px solid var(--ink-4); border-radius: 6px; display: grid; place-items: center; margin: 0; cursor: pointer; transition: .15s; background: var(--surface); }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { content: ''; width: 10px; height: 6px; border: 2px solid #1c1c1c; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }

.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); }

/* ---------- Alertas ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert-error { background: var(--red-tint); color: #A3352A; }
.alert-success { background: var(--green-tint); color: #1E6B52; }
.alert-info { background: var(--brand-tint); color: #7A5A00; }
[data-theme="dark"] .alert-error { color: #FFB4AA; }
[data-theme="dark"] .alert-success { color: #9FE3C9; }
[data-theme="dark"] .alert-info { color: var(--brand-soft); }

.pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: var(--pill); background: var(--surface-2); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ==========================================================================
   Idiomas, login com Google e ditado por voz (compartilhado entre site e app)
   ========================================================================== */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--pill); background: var(--surface); border: 1px solid var(--line); }
.lang-switch svg { width: 15px; height: 15px; color: var(--ink-3); margin: 0 4px 0 6px; flex: none; }
.lang-switch a { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--ink-3); text-decoration: none; padding: 6px 9px; border-radius: var(--pill); line-height: 1; }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a.on { background: var(--brand); color: #1C1C1C; }

.btn-google { background: var(--surface); border-color: var(--line); color: var(--ink); gap: 10px; }
.btn-google:hover { background: var(--surface-2); }
.btn-google svg { width: 20px; height: 20px; flex: none; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--ink-3); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-note-small { margin-top: 14px; font-size: 12px; color: var(--ink-3); text-align: center; }
.auth-note-small a { color: var(--ink-2); }
.auth-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 36px; }
.auth-card-top .logo { margin-bottom: 0 !important; }

.inline-ic { width: 16px; height: 16px; vertical-align: -3px; }
.google-pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 10px 3px 6px; border-radius: var(--pill); background: var(--surface-2); font-size: 12px; color: var(--ink-2); }
.google-pill svg { width: 14px; height: 14px; }

/* Botão "Ditar" ao lado do rótulo de campos */
label.with-mic { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mic-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: var(--pill); padding: 3px 10px 3px 7px; font: 500 12px/1.4 inherit; cursor: pointer; }
.mic-chip svg { width: 14px; height: 14px; }
.mic-chip:hover { border-color: var(--brand); color: var(--ink); }
.mic-chip.on { background: #E5484D; border-color: #E5484D; color: #fff; animation: micPulse 1.4s infinite; }

/* Balão "Ouvindo…" do ditado por voz */
.dictation-bubble { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 14px; max-width: min(560px, calc(100vw - 24px)); padding: 12px 12px 12px 18px; border-radius: 20px; background: #1C1C1C; color: #fff; box-shadow: var(--shadow-lg); }
.dictation-bubble[hidden] { display: none; }
.dictation-bubble .db-text { display: grid; min-width: 0; flex: 1; }
.dictation-bubble .db-text b { font-size: 13px; color: var(--brand); }
.dictation-bubble .db-text span { font-size: 14px; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dictation-bubble .btn { background: #fff; color: #1C1C1C; border-color: #fff; flex: none; }
.dictation-bubble .btn svg { width: 16px; height: 16px; }
.db-wave { display: inline-flex; align-items: center; gap: 3px; height: 22px; flex: none; }
.db-wave i { width: 4px; height: 8px; border-radius: 3px; background: #E5484D; animation: wave 1s ease-in-out infinite; }
.db-wave i:nth-child(2) { animation-delay: .15s; }
.db-wave i:nth-child(3) { animation-delay: .3s; }
.db-wave i:nth-child(4) { animation-delay: .45s; }
@keyframes wave { 0%, 100% { height: 6px; } 50% { height: 22px; } }
@keyframes micPulse { 0% { box-shadow: 0 0 0 0 rgba(229,72,77,.45); } 70% { box-shadow: 0 0 0 10px rgba(229,72,77,0); } 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } }
@media (max-width: 900px) { .dictation-bubble { bottom: 92px; } }
@media (max-width: 640px) { .hide-sm { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .db-wave i, .mic-chip.on { animation: none; } }

/* ================= v5 — Barra de rolagem ================= */
/* Fina, arredondada e nas cores do Anotaco; acompanha os temas claro e escuro. Celulares usam a barra nativa (sobreposta). */
html { scrollbar-color: color-mix(in srgb, var(--ink-4, #b8b8b8) 70%, transparent) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--ink-4, #b8b8b8) 70%, transparent); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--brand, #FBB615); }
::-webkit-scrollbar-corner { background: transparent; }