/* ============================================================
   guto — design system (identidade de gutoexplica.com)
   Papel/creme quente + "night" violeta · Fraunces + Inter self-hosted.
   Tokens: cor semântica, escala tipográfica, escala de espaço, raios.
   Contraste AA · estados (hover/focus/active/disabled/loading).
   ============================================================ */

/* ---------- Fontes (self-hosted, sem CDN) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(/fonts/fraunces-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(/fonts/fraunces-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/fonts/instrument-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/fonts/instrument-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  /* — neutros de papel — */
  --bg: #f4e9d2; --surface: #fffaf1; --surface2: #f6ecd6;
  --ink: #2b1810; --ink2: #62442f;
  --muted: #74624a;                 /* AA: ~4.7:1 no papel */
  --line: #e8dabd; --hair: rgba(43,24,16,.08);
  /* — paleta gutoexplica — */
  --night: #1f1538; --night2: #2e2150;
  --gold: #e8a83e; --yellow: #ffd645; --terracotta: #c4793f; --ember: #a04a1f;
  --coral: #ff6b5b; --peach: #f2c79a; --soul: #2f9fd0; --sage: #6f9a4a;
  --link: #a2531f;                  /* terracota escurecida p/ texto (AA ~5.2:1) */
  /* — semânticas — */
  --danger: #d63b32; --success: #5f8a3c; --warn: #d98a1f;
  /* — aliases herdados (não mexer no HTML/JS) — */
  --navy: var(--night); --navy2: var(--night2);
  --indigo: var(--terracotta); --indigo2: #d68a4a;
  --teal: var(--soul); --teal2: #56b6e0; --cyan: var(--soul); --cyan2: #56b6e0;
  --sky: var(--soul); --violet: #7c53b8; --green: var(--sage); --amber: var(--gold);
  /* — assinatura: pôr-do-sol (texto branco seguro) — */
  --grad: linear-gradient(135deg, #e0863a 0%, #d15b34 50%, #d63b32 100%);
  --grad-soft: linear-gradient(135deg, rgba(232,168,62,.20), rgba(255,107,91,.13));
  --glow1: rgba(232,168,62,.16); --glow2: rgba(255,107,91,.10);
  /* — escala tipográfica (rem: acompanha o tamanho de fonte do navegador) — */
  --t-xs: .6875rem; --t-sm: .75rem; --t-base: .8125rem; --t-md: .875rem; --t-lg: .9375rem;
  --t-xl: 1rem; --t-2xl: 1.125rem; --t-3xl: 1.25rem; --t-4xl: 1.5rem; --t-5xl: 1.6875rem; --t-6xl: 2.125rem;
  --lh-tight: 1.2; --lh-snug: 1.4; --lh-normal: 1.55;
  /* — escala de espaço (base 4) — */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px;
  /* — raios — */
  --r-xs: 8px; --r-sm: 12px; --r: 16px; --r-lg: 20px; --r-xl: 24px; --r-pill: 999px;
  /* — sombras quentes — */
  --sh1: 0 1px 2px rgba(43,24,16,.05), 0 4px 14px rgba(43,24,16,.07);
  --sh2: 0 12px 30px rgba(43,24,16,.13);
  --sh3: 0 28px 60px rgba(43,24,16,.30);
  /* — motion — */
  --ease: cubic-bezier(.22,.8,.28,1); --dur: .2s;
  --ff: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ff-display: "Fraunces", Georgia, "Times New Roman", serif;
  --ff-label: "Instrument Sans", "Inter", -apple-system, sans-serif;
  --safe-t: env(safe-area-inset-top); --safe-b: env(safe-area-inset-bottom);
}

:root[data-theme="dark"] {
  --bg: #17102b; --surface: #241a3d; --surface2: #1c1433;
  --ink: #f7eedb; --ink2: #dccbaa; --muted: #b3a6c6;
  --line: #372c55; --hair: rgba(255,255,255,.06);
  --terracotta: #e79a54; --link: #f0b877; --indigo2: #eab472;
  --soul: #5cc0ec; --teal2: #7fcbee; --cyan2: #7fcbee;
  --violet: #b89be6; --sage: #9cc06c; --green: #9cc06c; --danger: #ff7a6f; --success: #9cc06c; --warn: #f0b24a;
  --glow1: rgba(232,168,62,.18); --glow2: rgba(140,99,201,.20);
  --sh1: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.34);
  --sh2: 0 16px 38px rgba(0,0,0,.5); --sh3: 0 30px 70px rgba(0,0,0,.62);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17102b; --surface: #241a3d; --surface2: #1c1433;
    --ink: #f7eedb; --ink2: #dccbaa; --muted: #b3a6c6;
    --line: #372c55; --hair: rgba(255,255,255,.06);
    --terracotta: #e79a54; --link: #f0b877; --indigo2: #eab472;
    --soul: #5cc0ec; --teal2: #7fcbee; --cyan2: #7fcbee;
    --violet: #b89be6; --sage: #9cc06c; --green: #9cc06c; --danger: #ff7a6f; --success: #9cc06c; --warn: #f0b24a;
    --glow1: rgba(232,168,62,.18); --glow2: rgba(140,99,201,.20);
    --sh1: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.34);
    --sh2: 0 16px 38px rgba(0,0,0,.5); --sh3: 0 30px 70px rgba(0,0,0,.62);
  }
}

/* controles nativos (scrollbar, inputs, date/select) seguem o tema */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

/* ============================================================
   BASE
   ============================================================ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ff); color: var(--ink); overscroll-behavior: none; font-size: var(--t-lg);
  background:
    radial-gradient(120% 85% at 12% -8%, var(--glow1), transparent 55%),
    radial-gradient(100% 75% at 108% 4%, var(--glow2), transparent 52%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-optical-sizing: auto;
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 42%, transparent) transparent;
}
.hidden { display: none !important; }
h2 { font-size: var(--t-2xl); margin: 0 0 var(--s3); letter-spacing: -.01em; font-weight: 700; }

/* scrollbars discretas */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 40%, transparent); border-radius: var(--r-pill); }
::-webkit-scrollbar-track { background: transparent; }

/* motion */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }

/* foco de teclado — visível e consistente */
:focus-visible { outline: 2.5px solid var(--terracotta); outline-offset: 2px; border-radius: var(--r-xs); }
a:focus-visible, button:focus-visible, .nav:focus-visible, .cta:focus-visible, .lastc:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2.5px solid var(--terracotta); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* estado desabilitado padrão */
button:disabled, button[disabled] { opacity: .5; cursor: not-allowed; filter: saturate(.6); box-shadow: none; transform: none !important; }

/* skeleton loading */
.skel { background: linear-gradient(90deg, var(--surface2) 25%, color-mix(in srgb, var(--surface2) 55%, var(--line)) 37%, var(--surface2) 63%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: var(--r-sm); }
.skel-card { height: 84px; margin-bottom: var(--s4); border-radius: var(--r); }
.skel-tile { height: 98px; border-radius: var(--r-lg); }

/* empty states */
.empty { text-align: center; padding: 48px var(--s5) 40px; color: var(--muted); animation: fadeUp .3s var(--ease); }
.empty svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .55; margin-bottom: var(--s3); }
.empty .et { font-family: var(--ff-display); font-weight: 600; font-size: var(--t-xl); color: var(--ink2); margin-bottom: var(--s1); letter-spacing: -.01em; }
.empty .eh { font-size: var(--t-md); line-height: var(--lh-snug); max-width: 30ch; margin: 0 auto; }

/* ============================================================
   LOGIN
   ============================================================ */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--s6);
  background:
    radial-gradient(120% 80% at 15% -10%, rgba(232,168,62,.5) 0%, transparent 55%),
    radial-gradient(100% 70% at 100% 0%, rgba(255,107,91,.4) 0%, transparent 55%),
    linear-gradient(180deg, #2c2150 0%, #17102b 72%); }
.login-card { position: relative; background: var(--surface); border-radius: var(--r-xl); padding: var(--s7) var(--s6) var(--s5); width: 100%; max-width: 380px; text-align: center; box-shadow: var(--sh3); border: 1px solid var(--hair); overflow: hidden; }
.login-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--grad); }
.login-mark { position: relative; width: 96px; margin: var(--s2) auto var(--s4); }
.login-photo { width: 96px; height: 96px; aspect-ratio: 1; object-fit: cover; object-position: center; border-radius: 28px; display: block;
  border: 3px solid var(--surface); box-shadow: 0 0 0 3px rgba(232,168,62,.45), 0 14px 30px rgba(43,24,16,.26); }
.login-badge { position: absolute; right: -5px; bottom: -5px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad); color: #fff; border: 3px solid var(--surface); box-shadow: var(--sh1); }
.login-badge svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.login-card .brand { font-family: var(--ff-display); font-size: var(--t-6xl); font-weight: 600; letter-spacing: -.03em; color: var(--terracotta); line-height: 1; }
.login-tag { color: var(--muted); margin: 6px 0 var(--s5); font-size: var(--t-md); }
.field { position: relative; display: block; margin-bottom: var(--s3); text-align: left; }
.field-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; place-items: center; pointer-events: none; transition: color var(--dur); }
.field-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.field:focus-within .field-ic { color: var(--terracotta); }
.login-card input { width: 100%; padding: var(--s4) var(--s4) var(--s4) 44px; border: 1.5px solid var(--line); border-radius: var(--r-sm); font-size: 1rem; background: var(--surface2); color: var(--ink); font-family: inherit; transition: border-color var(--dur), box-shadow var(--dur); }
.login-card input:focus { outline: none; border-color: var(--terracotta); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--terracotta) 15%, transparent); }
.form button, .login-btn {
  background: var(--grad); color: #fff; border: 0; border-radius: var(--r-sm); padding: var(--s4); font-size: 1rem; font-weight: 700; width: 100%; font-family: inherit; cursor: pointer;
  box-shadow: 0 12px 26px -10px rgba(209,91,52,.7); transition: transform var(--dur) var(--ease), box-shadow var(--dur), filter var(--dur); letter-spacing: -.01em; }
.form button:active, .login-btn:active { transform: translateY(1px) scale(.99); }
.login-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-btn .btn-spin { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.login-btn.loading .btn-label { visibility: hidden; }
.login-btn.loading .btn-spin { display: block; position: absolute; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-help { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: var(--t-sm); line-height: var(--lh-snug); margin: var(--s3) 0 0; }
.login-help svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; flex: 0 0 auto; }
.err { color: var(--danger); font-size: var(--t-base); display: block; margin-top: var(--s2); min-height: 1em; }
.msg-inline { color: var(--success); font-size: var(--t-base); display: block; margin-top: var(--s3); line-height: var(--lh-snug); }
.login-sent { animation: fadeUp .3s var(--ease); }
.sent-ic { width: 64px; height: 64px; margin: var(--s2) auto var(--s4); border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--terracotta)); box-shadow: 0 12px 26px -8px rgba(196,121,63,.5); }
.sent-ic svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sent-t { font-family: var(--ff-display); font-size: var(--t-4xl); font-weight: 600; letter-spacing: -.02em; }
.sent-p { color: var(--ink2); font-size: var(--t-md); line-height: var(--lh-normal); margin: 6px 0 var(--s5); }
.login-ghost { background: none; border: 1.5px solid var(--line); color: var(--ink2); border-radius: var(--r-sm); padding: var(--s3) var(--s5); font-size: var(--t-md); font-weight: 700; font-family: inherit; cursor: pointer; transition: border-color var(--dur), color var(--dur); }
.login-ghost:hover { border-color: var(--terracotta); color: var(--terracotta); }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--t-xs); }
.login-foot svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: var(--s2); padding: calc(var(--safe-t) + var(--s3)) var(--s4) var(--s3);
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  color: var(--ink); z-index: 30; border-bottom: 1px solid var(--hair); }
.burger, .iconbtn { background: var(--surface2); border: 1px solid var(--line); color: var(--ink2); font-size: var(--t-xl); line-height: 1; width: 44px; height: 44px; border-radius: var(--r-sm); display: grid; place-items: center; transition: background var(--dur), transform .12s; flex: 0 0 auto; cursor: pointer; }
.burger:active, .iconbtn:active { background: var(--line); transform: scale(.94); }
.iconbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; animation: iconPop .25s var(--ease); }
@keyframes iconPop { from { opacity: 0; transform: rotate(-35deg) scale(.7); } to { opacity: 1; transform: none; } }
.top-title { font-family: var(--ff-display); font-weight: 600; font-size: var(--t-3xl); letter-spacing: -.02em; margin: 0; }
.topbar .spacer { margin-left: auto; }
.avatar { width: 40px; height: 40px; aspect-ratio: 1; border-radius: var(--r-pill); object-fit: cover; object-position: center; border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--terracotta), 0 4px 12px -3px rgba(43,24,16,.4); flex: 0 0 auto; }

/* Drawer */
.overlay { position: absolute; inset: 0; background: rgba(15,9,30,.55); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 40; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer { position: absolute; top: 0; left: 0; bottom: 0; width: 84%; max-width: 300px; z-index: 50;
  background: linear-gradient(180deg, #2c2150 0%, #17102b 100%); color: #f7eedb; transform: translateX(-101%); visibility: hidden; transition: transform .26s var(--ease), visibility .26s;
  padding: calc(var(--safe-t) + var(--s4)) var(--s3) calc(var(--safe-b) + var(--s4)); overflow-y: auto; }
.drawer.open { transform: translateX(0); visibility: visible; box-shadow: var(--sh3); }
.drawer-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s1) var(--s3) var(--s4); margin-bottom: var(--s3); border-bottom: 1px solid rgba(247,238,219,.14); }
.drawer-head img { width: 50px; height: 50px; aspect-ratio: 1; border-radius: var(--r-sm); object-fit: cover; border: 2px solid rgba(247,238,219,.85); box-shadow: 0 0 0 3px rgba(232,168,62,.5); }
.drawer-head strong { display: block; font-family: var(--ff-display); font-size: var(--t-2xl); font-weight: 600; letter-spacing: -.01em; }
.drawer-head small { color: rgba(247,238,219,.55); font-size: var(--t-xs); }
.nav { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border-radius: var(--r-sm); color: #d8ccbb; font-size: var(--t-lg); font-weight: 500; cursor: pointer; text-decoration: none; margin-bottom: 2px; white-space: nowrap; transition: background var(--dur), color var(--dur); }
.nav > i { width: 34px; height: 34px; border-radius: var(--r-xs); background: rgba(247,238,219,.08); display: inline-grid; place-items: center; font-style: normal; flex: 0 0 auto; }
.nav > i svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav.active { background: rgba(232,168,62,.18); color: #fff; }
.nav.active > i { background: linear-gradient(135deg, rgba(232,168,62,.5), rgba(255,107,91,.42)); color: #fff; }
.nav:active { background: rgba(247,238,219,.08); }

/* Tab bar flutuante */
.tabbar { flex: 0 0 auto; z-index: 20; display: flex; align-items: center; justify-content: space-around; gap: var(--s1);
  margin: var(--s2) var(--s3) calc(var(--safe-b) + var(--s2)); padding: var(--s2); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(20px) saturate(170%); -webkit-backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid var(--hair); box-shadow: var(--sh2); }
.tabbar .nav { flex: 1; min-width: 0; min-height: 48px; flex-direction: column; justify-content: center; gap: 3px; margin: 0; padding: var(--s2) var(--s1); border-radius: var(--r-sm);
  color: var(--muted); font-size: var(--t-xs); font-weight: 700; letter-spacing: -.01em; background: none; }
.tabbar .nav svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s var(--ease); }
.tabbar .nav.active { color: var(--link); background: var(--grad-soft); }
.tabbar .nav.active svg { filter: drop-shadow(0 3px 6px rgba(196,121,63,.4)); }
.tabbar .nav:active svg { transform: scale(.9); }

/* Views */
.view { flex: 1; min-height: 0; }
.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.view:not(.hidden) > .pad { animation: fadeUp .28s var(--ease); }
.pad { padding: var(--s4) var(--s4) var(--s6); max-width: 780px; margin: 0 auto; }

/* ============================================================
   CARDS & PADRÕES
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); margin-bottom: var(--s4); box-shadow: var(--sh1); }
.card h2 { margin-bottom: var(--s3); font-family: var(--ff-display); font-weight: 600; font-size: var(--t-2xl); }
.section-title { display: flex; align-items: center; gap: var(--s2); font-family: var(--ff-label); font-size: var(--t-sm); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin: var(--s6) var(--s1) var(--s3); }
.section-title::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--grad); flex: 0 0 auto; }
.pad > .section-title:first-child { margin-top: var(--s2); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Hero */
.hero-card { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: var(--s5); margin-bottom: var(--s4); color: #f7eedb;
  background: linear-gradient(135deg, #33265c 0%, #1a1030 74%); box-shadow: var(--sh2); }
.hero-card::before { content: ""; position: absolute; width: 240px; height: 240px; right: -80px; top: -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232,168,62,.6), transparent 70%); }
.hero-card::after { content: ""; position: absolute; width: 200px; height: 200px; left: -70px; bottom: -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,107,91,.5), transparent 70%); }
.hero-row { position: relative; display: flex; align-items: center; gap: var(--s4); }
.hero-row img { width: 78px; height: 78px; aspect-ratio: 1; border-radius: var(--r-xl); object-fit: cover; border: 3px solid rgba(247,238,219,.9); box-shadow: 0 0 0 4px rgba(232,168,62,.45), 0 10px 24px rgba(0,0,0,.32); }
.hero-name { font-family: var(--ff-display); font-size: var(--t-5xl); font-weight: 600; letter-spacing: -.02em; line-height: var(--lh-tight); }
.hero-sub { font-size: var(--t-base); color: rgba(247,238,219,.78); margin-top: var(--s1); }
.chips { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s3); }
.chip { background: rgba(247,238,219,.14); border: 1px solid rgba(247,238,219,.18); border-radius: var(--r-pill); padding: 5px var(--s3); font-size: var(--t-sm); font-weight: 600; backdrop-filter: blur(4px); }

/* CTA */
.cta { display: flex; align-items: center; justify-content: center; gap: var(--s2); border-radius: var(--r); padding: var(--s4); font-weight: 700; font-size: var(--t-lg); text-decoration: none; margin-bottom: var(--s5); letter-spacing: -.01em;
  background: var(--grad); color: #fff; box-shadow: 0 12px 26px -10px rgba(209,91,52,.65); transition: transform .12s var(--ease), box-shadow var(--dur), filter var(--dur); }
.cta svg { width: 20px; height: 20px; }
.cta:active { transform: translateY(1px) scale(.99); }

.dash-cols { display: grid; grid-template-columns: 1fr; }
.dash-b .section-title:first-child { margin-top: var(--s6); }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4); box-shadow: var(--sh1); position: relative; overflow: hidden; transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.tile:active { transform: scale(.985); }
.tile .ic { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; margin-bottom: var(--s3); }
.tile .ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile .v { font-family: var(--ff-display); font-size: var(--t-5xl); font-weight: 600; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.tile .v small { font-family: var(--ff); font-size: var(--t-base); font-weight: 700; color: var(--muted); }
.tile .k { font-size: var(--t-sm); color: var(--muted); font-weight: 650; margin-top: var(--s1); }
.tile .sub { font-size: var(--t-xs); color: var(--muted); margin-top: 2px; }
.tile.danger .ic { background: rgba(214,59,50,.13); color: var(--danger); }
.tile.cyan .ic { background: rgba(47,159,208,.15); color: var(--soul); }
.tile.violet .ic { background: rgba(124,83,184,.15); color: var(--violet); }
.tile.amber .ic { background: rgba(232,168,62,.18); color: var(--gold); }

/* Última consulta */
.lastc { display: block; border-radius: var(--r); padding: var(--s4); margin: var(--s4) 0; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh1); position: relative; overflow: hidden; transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.lastc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gold); }
.lc-h { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: var(--t-base); }
.lc-h svg { width: 15px; height: 15px; color: var(--gold); flex: 0 0 auto; }
.lc-s { font-size: var(--t-base); color: var(--ink2); line-height: var(--lh-snug); margin-top: 6px; }
.lc-more { font-size: var(--t-sm); font-weight: 750; margin-top: var(--s2); color: var(--link); }

/* Foco atual */
.focus-card { position: relative; overflow: hidden; border-radius: var(--r); padding: var(--s4); margin: var(--s4) 0; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #d15b34, var(--ember)); box-shadow: var(--sh2); transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.focus-card::after { content: ""; position: absolute; right: -30px; top: -40px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, rgba(255,214,69,.55), transparent 70%); }
.focus-card .k { font-family: var(--ff-label); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.82); font-weight: 700; position: relative; }
.focus-card .v { font-family: var(--ff-display); font-size: var(--t-3xl); font-weight: 600; margin-top: 5px; letter-spacing: -.01em; position: relative; }
.focus-card .s { font-size: var(--t-base); color: rgba(255,255,255,.85); margin-top: var(--s1); line-height: var(--lh-snug); position: relative; }

/* Próximos passos */
.prio-head { font-family: var(--ff-label); font-size: var(--t-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; margin: var(--s5) var(--s1) var(--s3); display: flex; align-items: center; gap: var(--s2); }
.prio-head::before { content: ""; width: 9px; height: 9px; border-radius: 50%; }
.prio-head.prio-1 { color: var(--danger); } .prio-head.prio-1::before { background: var(--danger); box-shadow: 0 0 0 4px rgba(214,59,50,.16); }
.prio-head.prio-2 { color: var(--link); } .prio-head.prio-2::before { background: var(--terracotta); box-shadow: 0 0 0 4px rgba(196,121,63,.16); }
.prio-head.prio-3 { color: var(--muted); } .prio-head.prio-3::before { background: var(--muted); box-shadow: 0 0 0 4px rgba(116,98,74,.16); }
.step { padding: var(--s4); border-radius: var(--r); box-shadow: var(--sh1); background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden; }
.step::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.step.step-1::before { background: var(--danger); }
.step.step-2::before { background: var(--terracotta); }
.step.step-3::before { background: var(--muted); }
.step .t { font-weight: 700; font-size: var(--t-md); margin-bottom: 5px; letter-spacing: -.01em; }
.step .dt { font-size: var(--t-base); color: var(--ink2); line-height: var(--lh-normal); }

/* Charts */
.chart-wrap { overflow-x: auto; margin: var(--s1) -4px 0; }
svg.chart { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--t-sm); color: var(--muted); margin-top: var(--s3); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.bar-row { margin-bottom: var(--s4); }
.bar-row .top { display: flex; justify-content: space-between; font-size: var(--t-base); margin-bottom: 6px; font-weight: 600; }
.bar-row .top b { font-weight: 700; color: var(--ink2); font-variant-numeric: tabular-nums; }
.bar-track { height: 12px; background: var(--surface2); border-radius: var(--r-xs); overflow: hidden; box-shadow: inset 0 1px 2px rgba(43,24,16,.09); }
.bar-fill { height: 100%; border-radius: var(--r-xs); background: linear-gradient(90deg, var(--gold), var(--terracotta)); }
.note { font-size: var(--t-base); color: var(--muted); line-height: var(--lh-normal); margin-top: var(--s2); }

/* Exames / meds */
.exam { border-left: 4px solid var(--soul); }
.exam.Genética { border-left-color: var(--violet); }
.exam.Neuro { border-left-color: var(--soul); }
.exam.Imagem { border-left-color: var(--sage); }
.exam.Metabólico { border-left-color: var(--gold); }
.exam.Urgência { border-left-color: var(--danger); }
.exam.Avaliação { border-left-color: var(--violet); }
.exam.Medicação { border-left-color: var(--sage); }
.exam .cat { font-family: var(--ff-label); font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.exam .nm { font-family: var(--ff-display); font-weight: 600; font-size: var(--t-xl); margin: 2px 0 var(--s1); letter-spacing: -.01em; }
.exam .rs { font-size: var(--t-lg); font-weight: 600; color: var(--ink); }
.exam .ip { font-size: var(--t-base); color: var(--ink2); margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--line); line-height: var(--lh-snug); }
.card.med { border-left: 4px solid var(--sage); }
.med .cl { font-family: var(--ff-label); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.med .nm { font-family: var(--ff-display); font-weight: 600; font-size: var(--t-xl); margin: 2px 0 var(--s2); letter-spacing: -.01em; }
.med .ds { display: flex; align-items: center; gap: 7px; font-size: var(--t-lg); font-weight: 700; color: var(--ink); }
.med .ds svg { width: 17px; height: 17px; color: var(--terracotta); flex: 0 0 auto; }
.med-when { display: flex; align-items: center; gap: 6px; font-size: var(--t-base); color: var(--muted); margin-top: 5px; }
.med-when svg { width: 14px; height: 14px; flex: 0 0 auto; }
.med .tg { font-size: var(--t-base); color: var(--ink2); margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--line); }
.card.consulta-item { border-left: 4px solid var(--terracotta); }
.doclink { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s3); font-size: var(--t-base); font-weight: 700; color: var(--link); text-decoration: none; padding: 7px var(--s3); background: rgba(196,121,63,.1); border-radius: var(--r-xs); transition: background var(--dur); }
.doclink svg { width: 15px; height: 15px; }
.up-toggle { color: var(--link); font-weight: 800; font-size: var(--t-md); cursor: pointer; }
.up-form { margin-top: var(--s3); }
.up-form button { width: auto; padding: var(--s3) var(--s6); }
.doc-del { display: inline-flex; align-items: center; gap: 5px; margin-top: var(--s3); margin-left: var(--s2); background: none; border: 1px solid var(--line); color: var(--muted); font-size: var(--t-sm); font-weight: 600; padding: 6px var(--s3); border-radius: var(--r-xs); cursor: pointer; transition: border-color var(--dur), color var(--dur); }
.doc-del svg { width: 13px; height: 13px; }
.plaud-note { background: var(--grad-soft); border: 1px solid rgba(232,168,62,.28); border-radius: var(--r); padding: var(--s4); font-size: var(--t-base); line-height: var(--lh-normal); color: var(--ink2); margin-bottom: var(--s4); }
.plaud-note b { color: var(--ink); }
.tx-view { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s3); font-size: var(--t-base); color: var(--link); font-weight: 700; cursor: pointer; }
.tx-view svg { width: 15px; height: 15px; }
.tx-full { margin-top: var(--s3); font-size: var(--t-base); line-height: var(--lh-normal); white-space: pre-wrap; color: var(--ink2); border-top: 1px solid var(--line); padding-top: var(--s3); }

/* Entenda */
.explain-card { display: flex; align-items: center; gap: var(--s4); cursor: pointer; transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.explain-card .em { width: 46px; height: 46px; border-radius: var(--r-sm); background: var(--grad-soft); display: grid; place-items: center; font-size: var(--t-4xl); flex: 0 0 auto; }
.explain-card .tt { font-family: var(--ff-display); font-weight: 600; font-size: var(--t-xl); letter-spacing: -.01em; }
.explain-card .tg { font-family: var(--ff-label); font-size: var(--t-xs); color: var(--link); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.explain-card .arw { margin-left: auto; color: var(--muted); font-size: var(--t-2xl); }
.reader { line-height: 1.68; font-size: var(--t-xl); }
.reader h1 { font-family: var(--ff-display); font-size: var(--t-5xl); font-weight: 600; margin: 0 0 var(--s4); letter-spacing: -.02em; line-height: 1.15; text-wrap: balance; }
.reader h2 { font-family: var(--ff-display); font-size: var(--t-3xl); font-weight: 600; margin: var(--s6) 0 var(--s2); color: var(--terracotta); letter-spacing: -.01em; }
.reader h3 { font-family: var(--ff-display); font-size: var(--t-xl); font-weight: 600; margin: var(--s4) 0 7px; }
.reader p { margin: 0 0 var(--s3); }
.reader ul { padding-left: var(--s5); margin: 0 0 var(--s3); }
.reader li { margin-bottom: var(--s2); }
.reader strong { color: var(--ink); }
.reader code { background: var(--surface2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.reader blockquote { border-left: 3px solid var(--gold); margin: var(--s4) 0; padding: var(--s3) var(--s4); background: rgba(232,168,62,.09); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--ink2); font-size: var(--t-md); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--link); font-weight: 750; font-size: var(--t-md); cursor: pointer; margin-bottom: var(--s3); }

/* Chat */
.chat-view { display: flex; flex-direction: column; }
.chat-top { display: flex; justify-content: flex-end; padding: var(--s3) var(--s4) 0; }
.chat-new { background: var(--surface); border: 1px solid var(--line); color: var(--link); font-weight: 700; font-size: var(--t-base); padding: var(--s2) var(--s4); min-height: 40px; border-radius: var(--r-pill); cursor: pointer; box-shadow: var(--sh1); transition: filter var(--dur), transform .12s; }
.chat-new:active { transform: scale(.97); }
.conv-hint { align-self: center; color: var(--muted); font-size: var(--t-base); font-style: italic; margin: var(--s2) 0; }
.conv-collapsed { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); margin: 0 auto var(--s3); max-width: 88%; width: 100%; box-shadow: var(--sh1); overflow: hidden; }
.cc-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); cursor: pointer; }
.cc-ic { width: 30px; height: 30px; border-radius: var(--r-xs); background: var(--grad-soft); display: grid; place-items: center; flex: 0 0 auto; }
.cc-ic svg { width: 16px; height: 16px; color: var(--terracotta); }
.cc-main { min-width: 0; flex: 1; }
.cc-t { font-weight: 700; font-size: var(--t-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-sum { font-size: var(--t-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.cc-n { flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface2); color: var(--muted); font-size: var(--t-xs); font-weight: 700; display: grid; place-items: center; }
.cc-x { flex: 0 0 auto; color: var(--muted); font-size: var(--t-base); transition: transform .2s; }
.conv-collapsed.open .cc-x { transform: rotate(180deg); }
.cc-body { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s1) var(--s3) var(--s4); }
.cc-body .msg { max-width: 100%; }
.messages { flex: 1; overflow-y: auto; padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.msg { max-width: 88%; padding: var(--s3) var(--s4); border-radius: var(--r-lg); font-size: var(--t-lg); line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; animation: fadeUp .2s var(--ease); }
.msg.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 8px 18px -8px rgba(209,91,52,.6); }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh1); border-bottom-left-radius: 6px; }
.msg.bot.typing::after { content: "▍"; animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg.thinking { color: var(--muted); display: flex; align-items: center; gap: 7px; }
.tk { font-style: italic; }
.tk-dots { display: inline-flex; gap: 3px; }
.tk-dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; display: inline-block; animation: tkb 1s infinite ease-in-out; }
.tk-dots i:nth-child(2) { animation-delay: .15s; }
.tk-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tkb { 0%, 70%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
.composer { display: flex; gap: var(--s2); padding: var(--s3) var(--s3) calc(var(--safe-b) + var(--s3)); background: var(--surface); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: var(--s3) var(--s4); font-size: 1rem; max-height: 120px; font-family: inherit; background: var(--surface2); color: var(--ink); transition: border-color var(--dur), box-shadow var(--dur); }
.composer textarea:focus { outline: none; border-color: var(--terracotta); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--terracotta) 14%, transparent); }
.composer button { width: 47px; height: 47px; border-radius: 50%; flex: 0 0 auto; font-size: var(--t-2xl); background: var(--grad); color: #fff; border: 0; cursor: pointer; box-shadow: 0 8px 18px -6px rgba(209,91,52,.55); transition: filter var(--dur), transform .12s; }
.composer button:active { transform: scale(.94); }
.composer button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Cora — avatar/identidade nos balões dela */
.botrow { display: flex; gap: var(--s2); align-items: flex-end; align-self: flex-start; max-width: 90%; }
.bot-av { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: var(--t-sm); font-weight: 800; color: #fff; background: var(--grad); box-shadow: 0 4px 10px -3px rgba(209,91,52,.5); align-self: flex-start; margin-bottom: 2px; }
.botrow .msg.bot { align-self: auto; max-width: 100%; }

/* Markdown dentro dos balões da Cora */
.msg.md { white-space: normal; }
.msg.md > :first-child { margin-top: 0; }
.msg.md > :last-child { margin-bottom: 0; }
.msg.md p { margin: 0 0 var(--s2); }
.msg.md ul { margin: 0 0 var(--s2); padding-left: 18px; }
.msg.md li { margin-bottom: var(--s1); }
.msg.md strong { font-weight: 700; color: var(--ink); }
.msg.md h1, .msg.md h2, .msg.md h3 { font-family: var(--ff-display); font-weight: 600; margin: var(--s2) 0 var(--s1); font-size: var(--t-lg); line-height: 1.25; }
.msg.md code { background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.msg.md blockquote { border-left: 2px solid var(--terracotta); padding-left: 10px; margin: var(--s2) 0; color: var(--ink2); }

/* Sugestões de perguntas (conversa vazia) */
.suggest { display: flex; flex-direction: column; gap: var(--s2); align-self: flex-start; max-width: 92%; animation: fadeUp .3s var(--ease); }
.suggest-label { font-family: var(--ff-label); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; margin: var(--s1) 0 2px 2px; }
.sug { text-align: left; background: var(--surface); border: 1px solid var(--line); color: var(--link); font-weight: 600; font-size: var(--t-base); font-family: inherit; padding: 11px var(--s4); border-radius: var(--r-sm); cursor: pointer; box-shadow: var(--sh1); transition: transform .12s var(--ease), border-color var(--dur), background var(--dur); }
.sug:active { transform: scale(.98); }

/* timestamps das mensagens */
.msg-t { font-size: 10px; color: var(--muted); margin: -6px 2px 2px; font-variant-numeric: tabular-nums; }
.msg-t.user { align-self: flex-end; }
.msg-t.bot { align-self: flex-start; margin-left: 36px; }
.cc-date { flex: 0 0 auto; font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 2px; }

/* Forms */
.form label { display: flex; flex-direction: column; gap: 5px; font-size: var(--t-sm); color: var(--muted); margin-bottom: var(--s3); font-weight: 600; }
.form input, .form select, .form textarea { border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: var(--s3); font-size: 1rem; font-family: inherit; background: var(--surface2); color: var(--ink); transition: border-color var(--dur), box-shadow var(--dur); }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--terracotta); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--terracotta) 14%, transparent); }
.form .chk { flex-direction: row; align-items: center; gap: var(--s2); font-size: var(--t-lg); color: var(--ink); font-weight: 500; }
.form .chk input { width: 20px; height: 20px; accent-color: var(--terracotta); }
.form .filepick { font-size: var(--t-sm); }

/* Timeline / registro */
.tl-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); margin-bottom: var(--s3); box-shadow: var(--sh1); border-left: 4px solid var(--soul); }
.tl-item.avaliacao { border-left-color: var(--violet); }
.tl-item.medicacao { border-left-color: var(--sage); }
.tl-item.marco { border-left-color: var(--gold); }
.tl-item.consulta { border-left-color: var(--terracotta); }
.tl-date { font-size: var(--t-sm); color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.tl-title { font-family: var(--ff-display); font-weight: 600; font-size: var(--t-xl); margin: var(--s1) 0; letter-spacing: -.01em; }
.tl-detail { font-size: var(--t-md); color: var(--ink2); line-height: var(--lh-snug); }
.log-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s3) var(--s4); margin-bottom: var(--s2); font-size: var(--t-md); box-shadow: var(--sh1); }
.log-item.crise { box-shadow: var(--sh1), inset 3px 0 0 var(--danger); }
.log-item .d, .consulta-item .d { font-size: var(--t-sm); color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.consulta-item .d { display: block; margin-bottom: 2px; }
.badge { display: inline-block; background: var(--danger); color: #fff; font-size: var(--t-xs); padding: 2px 7px; border-radius: 7px; margin-left: 6px; font-weight: 700; }
.consulta-item .summary { font-size: var(--t-base); color: var(--ink2); line-height: var(--lh-normal); margin-top: 6px; }
.consulta-item .summary > :first-child { margin-top: 0; }
.consulta-item .summary > :last-child { margin-bottom: 0; }
.consulta-item .summary p { margin: 0 0 var(--s2); }
.consulta-item .summary ul { margin: 0 0 var(--s2); padding-left: 18px; }
.consulta-item .summary strong { color: var(--ink); }

/* ============================================================
   ESTADOS HOVER (dispositivos com ponteiro)
   ============================================================ */
@media (hover: hover) {
  .cta:hover, .login-card button:hover, .form button:hover, .composer button:hover, .chat-new:hover { filter: brightness(1.06); }
  .cta:hover { transform: translateY(-1px); }
  .tile:hover, .lastc:hover, .focus-card:hover, .card.explain-card:hover { transform: translateY(-2px); box-shadow: var(--sh2); }
  .nav:hover { background: rgba(247,238,219,.1); color: #fff; }
  .tabbar .nav:hover { color: var(--link); background: color-mix(in srgb, var(--terracotta) 8%, transparent); }
  .doclink:hover { background: rgba(196,121,63,.18); }
  .sug:hover { border-color: var(--terracotta); background: var(--surface2); }
  .doc-del:hover { border-color: var(--danger); color: var(--danger); }
  .up-toggle:hover, .tx-view:hover, .back:hover, .lc-more:hover { filter: brightness(1.1); text-decoration: underline; text-underline-offset: 3px; }
  .burger:hover, .iconbtn:hover { background: var(--line); }
}

/* ============================================================
   DESKTOP
   ============================================================ */
@media (min-width: 860px) {
  .drawer { transform: translateX(0); visibility: visible; box-shadow: none; border-right: 1px solid rgba(247,238,219,.06); z-index: 60; width: 268px; }
  .overlay { display: none; }
  .burger { display: none; }
  .avatar { display: none; }
  .tabbar { display: none; }
  .app { padding-left: 268px; }
  .topbar { padding-left: var(--s7); }
  .top-title { font-size: var(--t-4xl); }
  .pad { margin: 0 auto; max-width: 860px; padding: var(--s6) var(--s7) 48px; }
  .messages { padding-left: max(var(--s4), calc((100% - 900px) / 2)); padding-right: max(var(--s4), calc((100% - 900px) / 2)); }
  .composer { padding-left: max(var(--s3), calc((100% - 900px) / 2)); padding-right: max(var(--s3), calc((100% - 900px) / 2)); }
  #v-dashboard .pad { max-width: 1180px; }
  .dash-cols { grid-template-columns: 1.05fr .95fr; gap: var(--s6); align-items: start; }
  .dash-b .section-title:first-child { margin-top: 0; }
}
@media (min-width: 1500px) { #v-dashboard .pad { max-width: 1320px; } }

/* Botões de ação na resposta da Cora (copiar / e-mail) — tema do guto */
.msg-actions { display: flex; gap: var(--s2); margin-top: var(--s3); padding-top: var(--s2); border-top: 1px solid var(--hair); }
.msg-actions button { background: var(--surface2); border: 1px solid var(--line); color: var(--muted); font-family: var(--ff-label); font-weight: 600; font-size: var(--t-sm); padding: 6px 12px; border-radius: var(--r-xs); cursor: pointer; transition: transform .12s var(--ease); }
.msg-actions button:hover { color: var(--ink); }
.msg-actions button:active { transform: scale(.96); }

/* Upload à base + fichamento (documentos) */
.up-hint { color: var(--muted); font-size: var(--t-sm, .82rem); margin: 0 0 .2rem; line-height: 1.45; }
.up-opt { color: var(--muted); font-weight: 400; font-size: .78rem; }
.doc-badge { display: inline-block; font-family: var(--ff-label); font-size: .68rem; letter-spacing: .03em; text-transform: uppercase; padding: .12em .5em; border-radius: 999px; border: 1px solid var(--line); vertical-align: middle; }
.doc-badge.proc { color: var(--muted); animation: docpulse 1.4s ease-in-out infinite; }
.doc-badge.ok { color: #1f7a4d; border-color: #1f7a4d55; background: #1f7a4d12; }
.doc-badge.warn { color: #9a5b12; border-color: #9a5b1255; background: #9a5b1212; }
@keyframes docpulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.doc-note { margin: .5rem 0 .2rem; }
.doc-note > summary { cursor: pointer; color: var(--muted); font-family: var(--ff-label); font-size: .74rem; letter-spacing: .02em; text-transform: uppercase; }
.doc-note > div { margin-top: .45rem; padding: .6rem .7rem; border-left: 2px solid var(--line); background: var(--surface2); border-radius: var(--r-xs, 8px); font-size: var(--t-sm, .88rem); line-height: 1.5; white-space: pre-wrap; }
@media (prefers-color-scheme: dark) { .doc-badge.ok { background: #2fae7418; } .doc-badge.warn { background: #d08b2a18; } }

/* Panorama da Cora (topo da home, auto-escrito) */
.panorama-card { border: 1px solid var(--line); border-radius: var(--r-md, 14px); background: var(--surface2); padding: .85rem .95rem; margin: 0 0 var(--s3, 12px); }
.pano-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.pano-k { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--ff-label); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.pano-k svg { width: 15px; height: 15px; }
.pano-refresh { display: inline-flex; align-items: center; gap: .3rem; font-family: var(--ff-label); font-size: .68rem; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: .2em .6em; cursor: pointer; }
.pano-refresh svg { width: 13px; height: 13px; }
.pano-refresh:disabled { opacity: .6; cursor: default; }
.pano-refresh.spin svg { animation: panospin 1s linear infinite; }
@keyframes panospin { to { transform: rotate(360deg); } }
.pano-body { font-size: var(--t-sm, .92rem); line-height: 1.5; color: var(--ink, inherit); }
.pano-body p { margin: 0 0 .4rem; } .pano-body p:last-child { margin-bottom: 0; }
.pano-body ul { margin: .2rem 0; padding-left: 1.1rem; } .pano-body li { margin: .15rem 0; }
.pano-empty { color: var(--muted); font-size: var(--t-sm, .9rem); }
.pano-when { margin-top: .5rem; font-size: .68rem; color: var(--muted); text-align: right; }

/* Widgets automáticos (contadores + últimos da base + humor) */
.base-card { border: 1px solid var(--line); border-radius: var(--r-md, 14px); background: var(--surface2); padding: .7rem .85rem; margin: var(--s3, 12px) 0; }
.base-nums { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: var(--t-sm, .86rem); color: var(--muted); }
.base-nums b { color: var(--ink, inherit); font-weight: 700; }
.base-sub { margin: .6rem 0 .3rem; font-family: var(--ff-label); font-size: .68rem; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.base-doc { display: flex; flex-direction: column; gap: .1rem; padding: .35rem 0; border-top: 1px solid var(--hair, var(--line)); cursor: pointer; text-decoration: none; color: inherit; }
.base-doc .bd-t { font-size: var(--t-sm, .88rem); }
.base-doc .bd-cat { font-size: .72rem; color: var(--muted); }
.base-mood { margin-top: .55rem; font-size: .74rem; color: var(--muted); }

/* Botão de upload no topo da tela Exames — ação primária, destacada */
.up-card { padding: 0; overflow: hidden; border: 1px solid var(--cyan, var(--line)); }
.up-toggle { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; width: 100%; text-align: left; background: color-mix(in srgb, var(--cyan, #17a2b8) 10%, transparent); border: 0; cursor: pointer; padding: .9rem 1rem; font-size: var(--t-base, 1rem); font-weight: 600; color: var(--ink, inherit); }
.up-toggle svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--cyan); }
.up-toggle > span { flex: 1 1 auto; }
.up-toggle > small { flex: 1 0 100%; font-weight: 400; font-size: var(--t-sm, .8rem); color: var(--muted); margin-left: 1.6rem; }
.up-card .up-form { padding: 0 1rem 1rem; }

/* ============ MÓDULO CLÍNICA ============ */
.hidden { display: none !important; }
.view.scroll { min-height: 100vh; }
.pad { padding: 12px 14px calc(90px + var(--safe-b)); }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 24px; box-shadow: var(--sh2); text-align: center; }
.login-card .brand { font-family: var(--ff-display); font-size: var(--t-4xl); font-weight: 600; }
.login-tag { color: var(--muted); margin: 4px 0 20px; }
.login-card input { width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface2); color: var(--ink); font-size: 16px; margin-bottom: 10px; }
.btn-primary { width: 100%; background: var(--grad); color: #fff; border: 0; border-radius: var(--r-sm); padding: 14px; font-weight: 700; font-size: var(--t-lg); cursor: pointer; }
.btn-primary:disabled { opacity: .6; }
.btn-ghost { width: 100%; background: transparent; color: var(--link); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.err { color: var(--danger); font-size: var(--t-sm); margin: 6px 0 0; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 12px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--hair); }
.topbar-title { flex: 1; font-family: var(--ff-display); font-weight: 600; font-size: var(--t-2xl); }
.icon-btn { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r-pill); width: 38px; height: 38px; font-size: 20px; color: var(--ink); cursor: pointer; display: grid; place-items: center; }

/* Roster */
.clinic-block { margin-bottom: 20px; }
.role-tag { font-family: var(--ff-label); font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 7px; }
.pat-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--sh1); }
.pat-card:active { transform: scale(.99); }
.pat-av { width: 46px; height: 46px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-family: var(--ff-display); font-size: 22px; font-weight: 600; flex: 0 0 auto; }
.pat-info { flex: 1; min-width: 0; }
.pat-name { font-weight: 700; font-size: var(--t-lg); }
.pat-sub { color: var(--muted); font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pat-arrow { color: var(--muted); font-size: 24px; }
.add-pat { width: 100%; background: transparent; border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 12px; color: var(--link); font-weight: 600; cursor: pointer; }

/* Paciente */
.pat-hero { background: linear-gradient(135deg,#33265c,#1a1030); color: #f7eedb; border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--sh2); margin-bottom: 14px; }
.pat-hero-name { font-family: var(--ff-display); font-size: var(--t-4xl); font-weight: 600; }
.pat-hero-sub { color: rgba(247,238,219,.8); font-size: var(--t-sm); margin-top: 2px; }
.register-btn { width: 100%; background: var(--grad); color: #fff; border: 0; border-radius: var(--r); padding: 18px; font-weight: 700; font-size: var(--t-2xl); cursor: pointer; box-shadow: 0 12px 26px -10px rgba(209,91,52,.65); margin-bottom: 8px; }
.register-btn:active { transform: translateY(1px) scale(.99); }

/* Lista de eventos */
.ev-list { display: flex; flex-direction: column; gap: 6px; }
.ev-row { display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.ev-ic { font-size: 22px; }
.ev-body { flex: 1; min-width: 0; }
.ev-t { font-weight: 650; }
.ev-int { font-size: .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 6px; }
.ev-meta { color: var(--muted); font-size: var(--t-sm); }
.ev-note { font-size: var(--t-sm); margin-top: 2px; }

/* Bottom sheet */
.sheet-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 92vh; background: var(--bg); border-radius: 24px 24px 0 0; display: flex; flex-direction: column; padding: 8px 16px calc(16px + var(--safe-b)); animation: sheetup .22s var(--ease); }
@keyframes sheetup { from { transform: translateY(100%); } }
.sheet-grip { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 6px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 8px; font-size: var(--t-xl); }
.sheet-scroll { overflow-y: auto; }
.q { font-family: var(--ff-label); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 8px; font-weight: 700; }
.q .opt { font-weight: 400; text-transform: none; letter-spacing: 0; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-btn { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 14px 12px; font-weight: 600; font-size: var(--t-md); color: var(--ink); cursor: pointer; text-align: left; }
.type-btn .te { font-size: 22px; }
.type-btn.on { border-color: var(--coral); background: var(--grad-soft); }
.int-row { display: flex; gap: 8px; }
.int-dot { flex: 1; height: 52px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); font-size: var(--t-2xl); font-weight: 700; color: var(--ink); cursor: pointer; }
.int-dot.on { border-color: var(--coral); background: var(--grad); color: #fff; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-btn { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-pill); padding: 9px 14px; font-size: var(--t-md); color: var(--ink); cursor: pointer; }
.chip-btn.on { border-color: var(--coral); background: var(--grad-soft); font-weight: 600; }
.note-input { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface2); color: var(--ink); padding: 10px; font-size: 16px; resize: vertical; }

/* Toast */
.toast { position: fixed; bottom: calc(24px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--night); color: #fff; padding: 12px 20px; border-radius: var(--r-pill); font-weight: 600; z-index: 60; box-shadow: var(--sh2); }

/* Relatório */
.report { background: #fff; color: #1a1a1a; border-radius: var(--r); padding: 24px; box-shadow: var(--sh1); }
.rep-head { display: flex; justify-content: space-between; border-bottom: 2px solid #e0863a; padding-bottom: 10px; margin-bottom: 12px; }
.rep-clinic { font-family: var(--ff-display); font-size: 1.3rem; font-weight: 600; color: #1a1030; }
.rep-title { color: #666; font-size: .85rem; }
.rep-pat { font-size: .95rem; margin-bottom: 12px; }
.rep-month { color: #666; font-size: .82rem; }
.rep-kpi { display: flex; gap: 10px; margin: 12px 0 16px; }
.kpi { flex: 1; background: #faf3e6; border-radius: 12px; padding: 12px; text-align: center; }
.kpi-v { font-family: var(--ff-display); font-size: 1.8rem; font-weight: 600; color: #d15b34; }
.kpi-k { font-size: .72rem; color: #666; }
.rep-sec { font-family: var(--ff-label); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #999; margin: 16px 0 8px; font-weight: 700; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: .82rem; }
.bar-lbl { width: 42%; }
.bar-track { flex: 1; background: #eee; border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg,#e0863a,#d63b32); }
.bar-n { width: 24px; text-align: right; font-weight: 700; }
.rep-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.rep-table th { text-align: left; color: #999; border-bottom: 1px solid #ddd; padding: 5px 4px; font-weight: 600; }
.rep-table td { border-bottom: 1px solid #f0f0f0; padding: 5px 4px; vertical-align: top; }
.rep-sign { margin-top: 28px; text-align: center; }
.sign-line { width: 220px; border-top: 1px solid #333; margin: 0 auto 4px; }
.rep-date { color: #999; font-size: .72rem; margin-top: 6px; }

@media print {
  body { background: #fff; }
  .topbar, .no-print, #backBtn { display: none !important; }
  .pad { padding: 0; }
  .report { box-shadow: none; border-radius: 0; padding: 0; }
  .rep-kpi .kpi { background: #faf3e6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bar-fill, .rep-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
