/* ============================================================
   Tucan — design system + components (plain CSS)
   Warm "ink" dark theme. Single accent: orange #FF6A2B.
   ============================================================ */

:root {
  /* Neutral grey + black scale, following Spotify's design system: pure black
     only on the page background, neutral greys for surfaces/cards (so the UI
     reads as grey-on-black, not heavy all-black). Orange is the accent only. */
  --bg: #000000;
  --surface: #121212;
  --surface-1: #181818;
  --surface-2: #1f1f1f;
  --surface-3: #252525;
  --surface-4: #2a2a2a;
  --surface-hover: #2e2e2e;

  --text: #FBF6EC;
  --text-muted: #b3b3b3;
  --text-near: #cbcbcb;

  --accent: #FF6A2B;        /* brand: primary actions only */
  --accent-hover: #FF8550;
  --mango: #FFBE3D;
  --teal: #0E9C82;

  --border: rgba(255, 255, 255, 0.10);
  --border-light: #7c7c7c;

  /* Financial semantics — money-in is green (distinct from the brand
     orange), money-out is coral. Clearer at a glance across the app. */
  --inc: #34C79A;
  --inc-hover: #48D6AB;
  --inc-soft: rgba(52, 199, 154, 0.13);
  --exp: #F3727F;
  --exp-soft: rgba(243, 114, 127, 0.12);
  --wrn: #FFBE3D;
  --wrn-soft: rgba(255, 190, 61, 0.13);
  --wrn-line: rgba(255, 190, 61, 0.28);
  --info: #539DF5;

  --shadow-heavy: rgba(0, 0, 0, 0.5) 0px 8px 24px;
  --shadow-card: rgba(0, 0, 0, 0.3) 0px 8px 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  letter-spacing: -0.01em;
  /* Toque: sem o flash cinza do Android/iOS ao tocar, e sem seleção acidental
     de texto ao arrastar uma folha ou um card. */
  -webkit-tap-highlight-color: transparent;
}
/* Só o conteúdo é selecionável; rótulos de UI não devem virar seleção azul
   quando o dedo escorrega. Campos e prosa mantêm a seleção normal. */
@media (pointer: coarse) {
  .navitem, .tab, .filterpill, .btn, .iconbtn, .menu-item, .tab-lbl, .doc-card-title { -webkit-user-select: none; user-select: none; }
  input, textarea, .prose, .live-editor, .msg-user-text { -webkit-user-select: text; user-select: text; }
}

#root { height: 100%; }

h1, h2, h3 { font-family: "Sora", "Hanken Grotesk", sans-serif; letter-spacing: -0.02em; }

button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; letter-spacing: inherit; }
input, textarea, select { font-family: inherit; color: inherit; background: transparent; border: 0; outline: none; }
input[type="date"], input[type="time"] { color-scheme: dark; }
/* Hide the native number-input spinner arrows everywhere. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
a { color: inherit; text-decoration: none; }
::placeholder { color: var(--text-muted); }

.scroll { overflow-y: auto; scrollbar-gutter: stable; }
.scroll::-webkit-scrollbar { width: 12px; height: 12px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb { background: #4d4d4d; border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
.scroll::-webkit-scrollbar-thumb:hover { background: #7c7c7c; background-clip: padding-box; border: 3px solid transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.splash { height: 100%; display: flex; align-items: center; justify-content: center; color: #b3b3b3; font-size: 14px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes drawerIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

.tnum { font-variant-numeric: tabular-nums; }

/* ── Dinheiro ────────────────────────────────────────────
   Nenhum dígito é escondido: o "R$" e os centavos é que recuam (menores e mais
   apagados) para que a ordem de grandeza salte primeiro aos olhos. Tudo em em,
   então o mesmo desenho serve de 12px a 30px. */
.money { display: inline-flex; align-items: baseline; white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -0.025em; line-height: 1.05; }
.money-sign { margin-right: 0.16em; opacity: 0.8; }
.money-cur { font-size: 0.56em; font-weight: 700; opacity: 0.45; letter-spacing: 0.02em; margin-right: 0.34em; transform: translateY(-0.06em); }
.money-cents { font-size: 0.64em; opacity: 0.55; margin-left: 0.03em; }
.sora { font-family: "Sora", sans-serif; }
.hidden { display: none !important; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Brand wordmark ─────────────────────────────────────── */
.brand-row { display: flex; align-items: center; gap: 12px; }
.wordmark { font-family: "Sora", sans-serif; font-weight: 800; letter-spacing: -0.045em; line-height: 0.9; color: var(--text); position: relative; display: inline-block; white-space: nowrap; }
.wordmark .beak { position: absolute; }

/* ── Pills ──────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 9999px; font-weight: 700; letter-spacing: 0.4px; line-height: 1; white-space: nowrap; }
.pill.sm { padding: 2px 8px; font-size: 10px; height: 18px; }
.pill.md { padding: 3px 10px; font-size: 11px; height: 22px; }
.pill.lg { padding: 5px 14px; font-size: 12px; height: 26px; }
.pill.accent  { color: var(--accent); background: rgba(255,106,43,0.12); border: 1px solid rgba(255,106,43,0.30); }
.pill.income  { color: var(--inc); background: var(--inc-soft); border: 1px solid rgba(52,199,154,0.26); }
.pill.expense { color: var(--exp); background: rgba(243,114,127,0.10); border: 1px solid rgba(243,114,127,0.24); }
.pill.warning { color: var(--wrn); background: rgba(255,164,43,0.10); border: 1px solid rgba(255,164,43,0.26); }
.pill.info    { color: var(--info); background: rgba(83,157,245,0.10); border: 1px solid rgba(83,157,245,0.24); }
.pill.muted   { color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); }
.pill.solid   { color: var(--text); background: var(--surface-3); border: 1px solid var(--border); }

.dot { display: inline-block; border-radius: 50%; flex-shrink: 0; }

/* ── Labels ─────────────────────────────────────────────── */
.label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.6px; }

/* ── Avatar ─────────────────────────────────────────────── */
.avatar { display: inline-flex; align-items: center; justify-content: center; color: #000; font-weight: 800; letter-spacing: -0.5px; flex-shrink: 0; }
.avatar.round { border-radius: 50% !important; }

/* ── Cards ──────────────────────────────────────────────── */
.card { background: var(--surface-1); border-radius: 8px; transition: background 160ms; }
.card.hoverable { cursor: pointer; }
.card.hoverable:hover { background: var(--surface-3); }

/* ── Buttons ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 9999px; white-space: nowrap; border: 1px solid transparent; transition: background 160ms, color 160ms, border-color 160ms, transform 80ms; letter-spacing: -0.01em; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { padding: 4px 12px; height: 28px; font-size: 12px; gap: 6px; }
.btn.md { padding: 8px 16px; height: 36px; font-size: 13px; gap: 8px; }
.btn.lg { padding: 10px 24px; height: 44px; font-size: 14px; gap: 10px; }
.btn.block { display: flex; width: 100%; }
.btn.primary { background: var(--accent); color: #17130E; font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.secondary { background: var(--surface-2); color: var(--text); font-weight: 600; }
.btn.secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn.ghost { background: transparent; color: var(--text-muted); font-weight: 500; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.outline { background: transparent; color: var(--text); border-color: var(--border-light); font-weight: 600; }
.btn.outline:hover:not(:disabled) { background: rgba(255,255,255,0.04); border-color: var(--text); }
.btn.danger { background: transparent; color: var(--text-muted); font-weight: 500; }
.btn.danger:hover:not(:disabled) { background: rgba(243,114,127,0.18); color: var(--exp); }

/* ── Icon button ────────────────────────────────────────── */
.iconbtn { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; color: var(--text-muted); background: transparent; transition: background 120ms, color 120ms; }
.iconbtn:hover { background: var(--surface-3); color: var(--text); }
.iconbtn.active { background: var(--surface-3); color: var(--text); }
.iconbtn.danger:hover { color: var(--exp); }

/* ── Inputs ─────────────────────────────────────────────── */
.input { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 4px; padding: 0 14px; height: 40px; border: 1px solid transparent; box-shadow: rgb(124,124,124) 0px 0px 0px 1px inset; transition: border-color 120ms; }
.input:focus-within { border-color: var(--text); box-shadow: none; }
.input .lead { color: var(--text-muted); display: flex; }
.input:focus-within .lead { color: var(--text); }
.input input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 14px; min-width: 0; }
.textarea { width: 100%; background: var(--surface-2); border-radius: 4px; padding: 12px 14px; border: 1px solid transparent; box-shadow: rgb(124,124,124) 0px 0px 0px 1px inset; color: var(--text); font-size: 14px; outline: 0; resize: vertical; line-height: 1.6; }
.textarea:focus { border-color: var(--text); box-shadow: none; }
.selectwrap { position: relative; background: var(--surface-2); border-radius: 4px; height: 40px; box-shadow: rgb(124,124,124) 0px 0px 0px 1px inset; }
.selectwrap select { appearance: none; -webkit-appearance: none; width: 100%; height: 100%; background: transparent; color: var(--text); border: 0; outline: 0; padding: 0 32px 0 14px; font-size: 14px; cursor: pointer; }
.selectwrap select option { background: var(--surface-2); }
.selectwrap .chev { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; display: flex; }

.field { margin-bottom: 16px; }
.field > .label { margin-bottom: 8px; }

/* ── Section header ─────────────────────────────────────── */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.sec-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); line-height: 1.1; }
.sec-head .sub { margin-top: 4px; font-size: 14px; color: var(--text-muted); }

/* ── Filter pills / segmented control ───────────────────── */
.filterpill { padding: 6px 14px; border-radius: 9999px; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 8px; transition: background 120ms, color 120ms, border-color 120ms; }
.filterpill:hover { background: var(--surface-2); color: var(--text); }
.filterpill.active { background: var(--surface-3); color: var(--text); border-color: var(--border); }
/* Grouped "segmented control" (used by the transactions filter). */
.seg { display: inline-flex; align-items: center; gap: 3px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.seg .filterpill { border-radius: 9px; padding: 6px 13px; }
.seg .filterpill:hover { background: var(--surface-2); }
.seg .filterpill.active { background: var(--surface-3); color: var(--text); border-color: transparent; box-shadow: 0 1px 2px rgba(0,0,0,0.35); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; animation: fadeIn 160ms; }
.modal { max-width: 100%; max-height: 90vh; overflow: auto; background: var(--surface-1); border-radius: 8px; box-shadow: rgba(0,0,0,0.5) 0px 16px 64px; padding: 24px; animation: modalIn 200ms; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* ============================================================
   Layout
   ============================================================ */
.app { height: 100%; display: flex; flex-direction: column; background: var(--bg); padding: 8px; gap: 8px; }
/* dvh acompanha a barra de endereço do navegador móvel ao recolher/expandir;
   com 100% ou 100vh o rodapé fica escondido atrás dela. Fallback acima. */
@supports (height: 100dvh) { .app { height: 100dvh; } }
.app-grid { flex: 1; display: grid; grid-template-columns: 248px 1fr; grid-template-rows: minmax(0,1fr); gap: 8px; min-height: 0; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar { height: 100%; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sb-top { background: var(--surface); border-radius: 8px; padding: 20px 12px 12px; }
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 20px; }
.sb-nav { display: flex; flex-direction: column; gap: 4px; }
.navitem { display: flex; align-items: center; gap: 16px; padding: 12px 14px; border-radius: 6px; color: var(--text-muted); font-weight: 600; font-size: 15px; cursor: pointer; transition: color 120ms, background 120ms; background: transparent; border: 0; width: 100%; text-align: left; }
.navitem:hover { color: var(--text); }
.navitem.active { color: var(--text); font-weight: 700; background: var(--surface-3); }
.navitem .lbl { flex: 1; }

/* ── Main + topbar ──────────────────────────────────────── */
.main { background: var(--surface); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 12px 32px; background: rgba(18,18,18,0.85); backdrop-filter: blur(12px); }
.main-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); padding-left: 4px; border-left: 1px solid var(--border); margin-left: 4px; }
.breadcrumb > span { padding-left: 12px; display: inline-flex; align-items: center; gap: 8px; }
.crumb-link { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 0; }
.crumb-link:hover { color: var(--text); }

/* ── Company switcher ───────────────────────────────────── */
.cosw { position: relative; }
.cosw-btn { display: flex; align-items: center; gap: 11px; background: var(--surface-2); border-radius: 11px; padding: 6px 12px 6px 6px; border: 1px solid transparent; cursor: pointer; color: var(--text); transition: background 120ms, border-color 120ms; }
.cosw-btn:hover, .cosw-btn.open { background: var(--surface-3); }
.cosw-btn.open { border-color: var(--border-light); }
.cosw-cap { font-size: 9.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1.3px; }
.cosw-name { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.menu { position: absolute; background: var(--surface-2); border-radius: 14px; padding: 7px; z-index: 50; border: 1px solid var(--border); box-shadow: rgba(0,0,0,0.55) 0px 16px 48px; animation: modalIn 150ms ease-out; }
.menu-cap { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.4px; padding: 9px 10px 7px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; background: transparent; border-radius: 9px; border: 0; cursor: pointer; color: var(--text); margin-bottom: 2px; position: relative; text-align: left; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.active { background: var(--surface-4); }
.menu-sep { height: 1px; background: var(--border); margin: 7px 6px; }
.menu-act { color: var(--text-muted); }
.menu-act:hover { color: var(--text); }
.menu-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--surface); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.menu-ico.dash { border: 1px dashed var(--border-light); background: transparent; }
.badge-dot { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #17130E; font-size: 10px; font-weight: 800; line-height: 16px; text-align: center; border: 2px solid var(--surface-2); }

/* ── Notifications ──────────────────────────────────────── */
.bell-wrap { position: relative; }
.bell-badge { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #000; font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center; border: 2px solid var(--surface); pointer-events: none; }
.notif-panel { position: absolute; top: calc(100% + 10px); right: 0; width: 380px; background: var(--surface-3); border-radius: 12px; z-index: 50; box-shadow: rgba(0,0,0,0.5) 0px 16px 48px; overflow: hidden; animation: modalIn 160ms ease-out; }
.notif-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; }
.notif-row { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 11px 12px 11px 10px; background: transparent; border-radius: 8px; border: 0; cursor: pointer; color: var(--text); text-align: left; }
.notif-row:hover { background: var(--surface-4); }
.notif-ico { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.notif-foot { display: block; width: 100%; padding: 12px; background: transparent; border: 0; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.notif-foot:hover { background: var(--surface-4); color: var(--text); }

/* ============================================================
   Views — generic page chrome
   ============================================================ */
.page { padding: 0 32px 48px; }
.page-hero { padding-top: 24px; padding-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { font-family: "Sora", sans-serif; font-size: 40px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; }
.page-sub { margin-top: 8px; font-size: 14px; color: var(--text-muted); }
.controls { display: flex; gap: 12px; margin-bottom: 24px; align-items: center; }
.spacer { flex: 1; }
.empty { padding: 80px 20px; text-align: center; background: var(--surface-1); border-radius: 8px; }

/* ── Dashboard ──────────────────────────────────────────── */
.dash-hero { padding-top: 24px; padding-bottom: 32px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.greeting { font-family: "Sora", sans-serif; font-size: 38px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.1; white-space: nowrap; }
.greeting-date { margin-top: 6px; font-size: 14px; color: var(--text-muted); }
.greeting-date::first-letter { text-transform: uppercase; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 32px; }
/* Com o valor por extenso, quatro colunas só cabem em telas largas — e o painel
   do assistente rouba 416px delas. Quebrar em duas é melhor que espremer. */
@media (max-width: 1500px) { .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1181px) { body.assistant-open .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
/* Minimalist stat cards: soft border, generous whitespace, a single tinted
   accent (the icon) per financial tone. No heavy fills, no fake trend lines. */
.stat-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; min-height: 124px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; transition: border-color 160ms, transform 160ms; }
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.stat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.stat-ico { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-muted); }
.stat-ico.income { background: var(--inc-soft); color: var(--inc); }
.stat-ico.expense { background: var(--exp-soft); color: var(--exp); }
.stat-ico.warning { background: var(--wrn-soft); color: var(--wrn); }
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; color: var(--text); min-width: 0; }
.stat-delta .money { color: inherit; }
.stat-card.income .stat-value { color: var(--inc); }
.stat-card.expense .stat-value { color: var(--exp); }
.stat-delta { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-bottom: 32px; }
.proj-mini { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 12px 16px; background: var(--surface-1); border-radius: 6px; border: 0; width: 100%; text-align: left; cursor: pointer; transition: background 120ms; margin-bottom: 6px; }
.proj-mini:hover { background: var(--surface-3); }
.task-mini { display: flex; align-items: center; gap: 12px; padding: 10px 8px; margin: 0 -8px; border-radius: 6px; border-bottom: 1px solid rgba(255,255,255,0.05); background: transparent; cursor: pointer; transition: background 100ms; }
.task-mini:hover { background: var(--surface-3); }
.activity { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.activity-ico { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cover { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: linear-gradient(135deg, var(--surface-4) 0%, var(--surface-2) 100%); border: 1px solid var(--border); font-weight: 800; color: var(--text-near); letter-spacing: -1px; flex-shrink: 0; box-shadow: rgba(0,0,0,0.3) 0px 4px 12px; }

/* ── Projects grid ──────────────────────────────────────── */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.proj-card { background: var(--surface-1); border-radius: 8px; cursor: pointer; transition: background 160ms, transform 200ms; overflow: hidden; position: relative; }
.proj-card:hover { background: var(--surface-3); transform: translateY(-2px); }
.proj-card-hero { height: 120px; background: linear-gradient(135deg, var(--surface-4) 0%, var(--surface-1) 100%); position: relative; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; }
.proj-card-letter { font-size: 56px; font-weight: 800; letter-spacing: -3px; color: var(--text-near); line-height: 1; opacity: 0.92; font-family: "Sora", sans-serif; }
.proj-card-play { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #000; display: flex; align-items: center; justify-content: center; opacity: 0; transform: translateY(8px); transition: all 200ms; box-shadow: rgba(0,0,0,0.3) 0px 8px 16px; }
.proj-card:hover .proj-card-play { opacity: 1; transform: translateY(0); }
.proj-fin { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.08); flex-wrap: wrap; }
.proj-fin-main { min-width: 0; }
.proj-fin-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.proj-fin-line { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* ── Project detail ─────────────────────────────────────── */
.pd-hero { padding: 40px 32px 32px; min-height: 280px; display: flex; align-items: flex-end; gap: 28px; }
.pd-cover { position: relative; width: 200px; height: 200px; border-radius: 6px; box-shadow: rgba(0,0,0,0.5) 0px 4px 60px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
/* Status: só a bolinha colorida (minimalista). A cor vem do status via JS;
   canto superior-direito da capa, com um anel escuro para destacar. */
.pd-cover-badge { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; }
.pd-cover-badge .dot { box-shadow: 0 0 0 3.5px rgba(0,0,0,0.35); }
.pd-cover-inner { width: 100%; height: 100%; border-radius: 6px; background: linear-gradient(135deg, var(--surface-4) 0%, var(--surface-2) 100%); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 140px; font-weight: 800; font-family: "Sora", sans-serif; color: var(--text-near); letter-spacing: -8px; }
.pd-title { font-family: "Sora", sans-serif; font-size: 80px; font-weight: 800; letter-spacing: -0.045em; line-height: 0.95; color: #fff; margin: 0; }
.pd-desc { margin-top: 16px; font-size: 16px; color: rgba(255,255,255,0.92); line-height: 1.5; max-width: 720px; }
.pd-tags { margin-top: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: rgba(255,255,255,0.75); }
.pd-controls { padding: 24px 32px; display: flex; align-items: center; gap: 20px; }
/* Action cluster (Exportar · Editar · Remover) — todos ghost, agrupados, com
   um divisor sutil separando exportar das ações que alteram o projeto. */
.pd-actions { display: flex; align-items: center; gap: 2px; }
.pd-actions-sep { width: 1px; height: 20px; background: var(--border); margin: 0 8px; flex-shrink: 0; }
.pd-play { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #000; display: inline-flex; align-items: center; justify-content: center; box-shadow: rgba(0,0,0,0.4) 0px 8px 16px; transition: transform 120ms; }
.pd-play:hover { transform: scale(1.04); }
.pd-stats { padding: 0 32px 32px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.pd-stat { padding: 18px 20px; border-radius: 14px; border: 1px solid var(--border); display: flex; flex-direction: column; justify-content: space-between; min-height: 104px; }
.pd-stat:hover { border-color: var(--border-light); }
.pd-stat-value { margin-top: 14px; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--text); }
@media (max-width: 1500px) { .pd-stats { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1181px) { body.assistant-open .pd-stats { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.pd-table-sec { padding: 0 32px 48px; }
.tbl { background: var(--surface-1); border-radius: 8px; overflow: hidden; }
.tbl-head, .tbl-row { display: grid; grid-template-columns: 100px 110px minmax(0,1fr) 150px 190px 84px; gap: 16px; align-items: center; }
.tbl-head { padding: 12px 24px; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.4px; }
.tbl-row { padding: 14px 24px; border-bottom: 1px solid rgba(255,255,255,0.04); background: transparent; transition: background 100ms; font-size: 14px; }
.tbl-row:hover { background: var(--surface-3); }

/* ── Tasks ──────────────────────────────────────────────── */
.task-group { margin-bottom: 20px; }
.task-group-head { display: flex; align-items: center; gap: 12px; padding: 10px 4px; cursor: pointer; background: transparent; border: 0; width: 100%; text-align: left; }
.task-group-label { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.task-group-count { font-size: 12px; color: var(--text-muted); font-weight: 700; padding: 2px 8px; background: var(--surface-2); border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.task-group-chev { margin-left: auto; color: var(--text-muted); display: flex; transition: transform 200ms; }
.task-table { background: var(--surface-1); border-radius: 8px; overflow: hidden; padding: 6px; }
.task-row { display: grid; grid-template-columns: 40px 1fr auto auto 36px; gap: 14px; padding: 12px 14px; align-items: center; border-radius: 6px; background: transparent; transition: background 100ms; cursor: pointer; }
.task-row:hover { background: var(--surface-3); }
.task-title { font-size: 15px; font-weight: 600; color: var(--text); }
.task-title.done { color: var(--text-muted); text-decoration: line-through; }
.task-meta { margin-top: 4px; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.task-del { opacity: 0; }
.task-row:hover .task-del { opacity: 1; }

/* ── Task drawer ────────────────────────────────────────── */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 900; animation: fadeIn 160ms; }
.drawer { position: fixed; top: 8px; right: 8px; bottom: 8px; width: 460px; max-width: calc(100vw - 16px); background: var(--surface-1); border-radius: 12px; z-index: 901; display: flex; flex-direction: column; box-shadow: rgba(0,0,0,0.5) -8px 0 40px; animation: drawerIn 240ms cubic-bezier(0.16,1,0.3,1); overflow: hidden; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-title { width: 100%; background: transparent; border: 0; outline: 0; color: var(--text); font-family: "Sora", sans-serif; font-size: 26px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.2; resize: none; margin-bottom: 20px; overflow: hidden; }
.prop-row { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 12px; }
.prop-key { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.seg-btn { flex: 1; padding: 8px 6px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-muted); border: 1px solid transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg-btn.active { background: var(--surface-4); color: var(--text); border: 1px solid var(--border-light); }
.assignee-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; background: var(--surface-2); border-radius: 6px; border: 0; cursor: pointer; color: var(--text); }
.subtask { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; background: transparent; transition: background 100ms; }
.subtask:hover { background: var(--surface-2); }
.subtask-del { opacity: 0; }
.subtask:hover .subtask-del { opacity: 1; }
.progress-track { height: 4px; background: var(--surface-3); border-radius: 2px; margin-bottom: 12px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 220ms; }

/* ── Notes ──────────────────────────────────────────────── */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.note-card { background: var(--surface-1); border-radius: 8px; padding: 20px; cursor: pointer; transition: background 160ms, transform 200ms; position: relative; min-height: 220px; display: flex; flex-direction: column; border-top: 3px solid transparent; }
.note-card:hover { background: var(--surface-3); transform: translateY(-2px); }
.note-card.pinned { border-top: 3px solid var(--accent); }
.note-pin { position: absolute; top: 14px; right: 16px; color: var(--accent); display: flex; }
.note-title { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.3; margin-bottom: 12px; }
.note-body { flex: 1; font-size: 13px; color: var(--text-muted); line-height: 1.65; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 16px; }
.note-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.05); }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-del { opacity: 0; }
.note-card:hover .note-del, .note-foot:hover .note-del { opacity: 1; }
.note-detail { padding: 24px 32px 48px; max-width: 880px; margin: 0 auto; }
.note-detail-title { width: 100%; background: transparent; border: 0; outline: 0; color: var(--text); font-family: "Sora", sans-serif; font-size: 46px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; margin-bottom: 16px; padding: 0; }
.note-detail-body { width: 100%; min-height: 400px; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 16px; line-height: 1.75; resize: vertical; padding: 0; white-space: pre-wrap; }

/* ── Login ──────────────────────────────────────────────── */
.login-root { height: 100%; width: 100%; background: linear-gradient(180deg, #1f1f1f 0%, #121212 280px, #000000 100%); display: flex; flex-direction: column; overflow: auto; }
.login-top { display: flex; align-items: center; gap: 12px; padding: 20px 32px; }
.login-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px 48px; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 12px; padding: 40px 32px; box-shadow: rgba(0,0,0,0.5) 0px 16px 64px; }
.login-title { font-family: "Sora", sans-serif; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; text-align: center; margin-bottom: 32px; line-height: 1.15; }
.login-label { font-size: 13px; font-weight: 700; margin-bottom: 8px; display: block; }
.login-input { width: 100%; height: 48px; background: var(--surface-1); border-radius: 4px; padding: 0 14px; color: var(--text); font-size: 14px; border: 1px solid var(--border-light); outline: 0; margin-bottom: 16px; }
.login-input:focus { border-color: var(--text); }
.login-input.err { border-color: var(--exp); }
.login-submit { width: 100%; height: 48px; border-radius: 9999px; background: var(--accent); color: #000; font-size: 16px; font-weight: 800; border: 0; cursor: pointer; transition: transform 80ms, background 120ms; margin-top: 8px; }
.login-submit:hover { background: var(--accent-hover); }
.login-submit:active { transform: scale(0.98); }
.login-foot { text-align: center; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--surface-3); color: var(--text-muted); font-size: 14px; }
.login-link { background: none; border: 0; color: var(--text); text-decoration: underline; cursor: pointer; font-size: 14px; font-weight: 600; }

/* ── Focus player (Spotify-style transport bar) ─────────── */
.focus-bar { flex-shrink: 0; height: 76px; background: var(--surface); border-radius: 8px; display: grid; grid-template-columns: minmax(190px, 1fr) minmax(0, 1.8fr) minmax(214px, 1.1fr); align-items: center; gap: 16px; padding: 0 18px; }
.focus-artwork:hover .focus-artwork-expand { opacity: 1; }
.focus-volume { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px; background: var(--surface-4); outline: none; }
.focus-volume::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text); cursor: pointer; }
.focus-volume:hover::-webkit-slider-thumb { background: var(--accent); }
.focus-volume::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--text); cursor: pointer; }
@media (max-width: 1080px) { .focus-sound-name { display: none; } }
@keyframes eqbar { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.transport-btn { background: none; border: 0; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; justify-content: center; padding: 2px; transition: color 120ms; }
.transport-btn:hover { color: var(--text); }
.transport-play { width: 44px; height: 44px; border-radius: 50%; background: var(--text); color: #17130E; display: flex; align-items: center; justify-content: center; border: 0; cursor: pointer; transition: transform 100ms; flex-shrink: 0; }
.transport-play:hover { transform: scale(1.06); }

/* ── Focus-sound picker (inside player popover) ─────────── */
.sound-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 7px 8px; border-radius: 9px; border: 0; cursor: pointer; background: transparent; color: var(--text); text-align: left; }
.sound-item:hover { background: var(--surface-2); }
.sound-item.active { background: var(--surface-3); }
.sound-item .sound-ico { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-muted); }
.sound-item.active .sound-ico { background: var(--accent); color: #17130E; }

/* ── Hiper Foco (fullscreen) + shared play button ───────── */
.pomo-play { width: 64px; height: 64px; border-radius: 50%; color: #000; display: flex; align-items: center; justify-content: center; border: 0; cursor: pointer; box-shadow: rgba(0,0,0,0.3) 0px 8px 16px; transition: transform 100ms; }
.pomo-play:hover { transform: scale(1.05); }
.hyper { position: fixed; inset: 0; z-index: 200; background: radial-gradient(circle at 50% 28%, #1f1f1f 0%, #121212 55%, #000000 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; animation: modalIn 260ms ease-out; }
.hyper.no-anim { animation: none; }
.hyper-exit { position: absolute; top: 28px; right: 32px; display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 9999px; background: rgba(251,246,236,0.06); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }
.hyper-exit:hover { color: var(--text); background: rgba(251,246,236,0.1); }
.hyper-task { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 18px; border-radius: 12px; background: rgba(251,246,236,0.04); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 15px; font-weight: 600; transition: border-color 120ms, background 120ms; }
.hyper-task:hover { border-color: var(--accent); background: rgba(255,106,43,0.08); }

/* ── Color picker (modals) ──────────────────────────────── */
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: all 120ms; }
.swatch.on { border: 2px solid var(--text); box-shadow: 0 0 0 2px var(--bg); }

/* ── Date picker (custom calendar) ──────────────────────── */
.dp-field { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 12px; background: var(--surface-2); border-radius: 6px; box-shadow: rgb(124,124,124) 0px 0px 0px 1px inset; color: var(--text); font-size: 14px; cursor: pointer; transition: box-shadow 120ms; }
.dp-field:hover { box-shadow: var(--border-light) 0px 0px 0px 1px inset; }
.dp-field:focus-visible { box-shadow: var(--accent) 0px 0px 0px 2px inset; outline: none; }
.dp-panel { width: 300px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 14px; padding: 12px; z-index: 1100; box-shadow: rgba(0,0,0,0.55) 0px 16px 48px; animation: modalIn 150ms ease-out; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dp-month { font-size: 14px; font-weight: 700; font-family: "Sora", sans-serif; }
.dp-nav { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-muted); cursor: pointer; transition: background 120ms, color 120ms; }
.dp-nav:hover { background: var(--surface-hover); color: var(--text); }
.dp-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.dp-week span { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); padding: 4px 0; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-day { height: 34px; border-radius: 8px; background: transparent; color: var(--text); font-size: 13px; cursor: pointer; transition: background 100ms, color 100ms; }
.dp-day:hover { background: var(--surface-hover); }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--border-light); }
.dp-day.sel { background: var(--accent); color: #17130E; font-weight: 800; }
.dp-day.sel:hover { background: var(--accent-hover); }
.dp-foot { display: flex; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.dp-quick { flex: 1; padding: 8px; border-radius: 8px; background: var(--surface-2); color: var(--text-near); font-size: 13px; font-weight: 600; cursor: pointer; transition: background 120ms, color 120ms; }
.dp-quick:hover { background: var(--surface-hover); color: var(--text); }

/* ── Team modal rows ────────────────────────────────────── */
.member-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: transparent; transition: background 100ms; }
.member-row:hover { background: var(--surface-2); }
.role-btn { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9999px; background: var(--surface-3); color: var(--text); font-size: 13px; font-weight: 600; border: 0; cursor: pointer; }

/* Campos crus da gaveta de tarefa (subtarefa e tags): o tamanho vive aqui,
   não inline, para o bloco mobile poder subir para 16px. */
.subtask-input, .tag-input { font-size: 14px; }

/* ── Task drawer: optional description ───────────────────── */
.drawer-desc { width: 100%; background: transparent; border: 0; outline: 0; color: var(--text-near); font-family: inherit; font-size: 14.5px; line-height: 1.6; resize: none; margin: -6px 0 22px; overflow: hidden; }
.drawer-desc:focus { color: var(--text); }
.drawer-desc::placeholder { color: var(--text-muted); }

/* ── Lançamentos recorrentes a confirmar ─────────────────
   Uma pergunta, não um alerta: borda âmbar fina e fundo quase neutro. Nada de
   cápsula preenchida gritando — o que chama atenção é estar no topo da tela. */
.due-band { border: 1px solid var(--wrn-line); border-radius: 14px; background: rgba(255, 190, 61, 0.06); padding: 16px 18px; margin-bottom: 24px; }
.due-band-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.due-band-title { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.due-band-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-muted); }
.due-list { display: flex; flex-direction: column; gap: 2px; }
.due-row { display: grid; grid-template-columns: 30px minmax(0,1fr) auto auto; gap: 12px; align-items: center; padding: 10px 8px; margin: 0 -8px; border-radius: 10px; transition: background 120ms, opacity 160ms; }
.due-row:hover { background: rgba(255,255,255,0.04); }
.due-row.busy { opacity: 0.45; pointer-events: none; }
.due-mark { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.due-title { font-size: 14px; font-weight: 600; color: var(--text); }
.due-meta { margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.due-actions { display: flex; align-items: center; gap: 4px; }
.due-modal-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
.due-modal-when { margin-left: auto; font-variant-numeric: tabular-nums; }

/* A lista das REGRAS (o que se repete), dentro do projeto. */
.pd-due-sec { padding: 0 32px; }
.pd-rules-sec { margin-top: 36px; }
.rule-list { background: var(--surface-1); border-radius: 12px; padding: 6px; }
.rule-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 8px; transition: background 120ms; }
.rule-row:hover { background: var(--surface-3); }
.rule-row.off { opacity: 0.55; }
.rule-title { font-size: 14px; font-weight: 600; color: var(--text); }
.rule-meta { margin-top: 2px; font-size: 12px; color: var(--text-muted); }

/* Interruptor "Repetir todo mês" no modal de transação. */
.repeat-box { margin: 4px 0 4px; }
.repeat-row { display: flex; align-items: center; gap: 14px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color 140ms; }
.repeat-row:hover { border-color: var(--border-light); }
.repeat-title { font-size: 14px; font-weight: 600; color: var(--text); }
.repeat-desc { margin-top: 4px; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.repeat-desc b { color: var(--text-near); font-weight: 700; }

@media (max-width: 760px) {
  .pd-due-sec { padding: 0 16px; }
  .due-row { grid-template-columns: 30px minmax(0,1fr) auto; row-gap: 8px; }
  .due-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ── CSV import drop zone ────────────────────────────────── */
.import-drop { border: 1.5px dashed var(--border-light); border-radius: 12px; padding: 30px 20px; text-align: center; cursor: pointer; transition: border-color 140ms, background 140ms; }
.import-drop:hover, .import-drop.over { border-color: var(--accent); background: rgba(255,106,43,0.05); }
.import-drop svg { display: block; }

/* ============================================================
   Docs — list, editor, reader
   ============================================================ */
.sb-nav-alt { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

.seg-count { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-left: 2px; }
.filterpill.active .seg-count { color: var(--text-near); }
.linkish { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--text-muted); font-size: 12.5px; font-weight: 600; transition: color 120ms; }
.linkish:hover { color: var(--text); }

/* ── Docs grid ──────────────────────────────────────────── */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 14px; }
.doc-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 18px; cursor: pointer; display: flex; flex-direction: column; min-height: 178px; transition: border-color 160ms, transform 180ms, background 160ms; }
.doc-card:hover { border-color: var(--border-light); transform: translateY(-2px); background: var(--surface-2); }
.doc-card-head { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 12px; }
.doc-mark { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 800; font-family: "Sora", sans-serif; letter-spacing: -0.02em; }
.doc-card-title { font-size: 15.5px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.32; }
.doc-card-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 12px; color: var(--text-muted); }
.doc-card-body { flex: 1; font-size: 13px; color: var(--text-muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.doc-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--border); font-size: 12px; }
.doc-state { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.doc-tags { color: var(--text-muted); min-width: 0; }

.doc-loading { padding: 80px 20px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ── Doc shell ──────────────────────────────────────────── */
.doc-shell { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.doc-header { padding: 18px 32px 0; flex-shrink: 0; }
.doc-bar { display: flex; align-items: center; gap: 12px; }
.doc-actions { display: flex; align-items: center; gap: 10px; }
.doc-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-muted); white-space: nowrap; margin-right: 4px; }

.doc-identity { display: flex; gap: 16px; align-items: flex-start; padding: 22px 0 18px; }
.doc-emoji { width: 56px; height: 56px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--border); font-size: 28px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: border-color 140ms, background 140ms; }
.doc-emoji:hover { border-color: var(--border-light); background: var(--surface-3); }
.doc-emoji.letter { font-family: "Sora", sans-serif; font-size: 24px; font-weight: 800; color: var(--text-near); letter-spacing: -0.03em; }
.doc-title { width: 100%; background: transparent; border: 0; outline: 0; color: var(--text); font-family: "Sora", sans-serif; font-size: 34px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; padding: 0; }
.doc-title::placeholder { color: var(--surface-hover); }
.doc-summary { width: 100%; background: transparent; border: 0; outline: 0; color: var(--text-muted); font-size: 14.5px; line-height: 1.5; padding: 8px 0 0; }

.emoji-panel { padding: 8px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 2px 4px 6px; }
.emoji-opt { height: 30px; border-radius: 7px; background: transparent; border: 0; cursor: pointer; font-size: 17px; line-height: 1; transition: background 100ms; }
.emoji-opt:hover { background: var(--surface-3); }

/* ── Escrita ao vivo ─────────────────────────────────────
   Uma superfície só: a página do documento É o editor. Nada de caixa em volta,
   fundo diferente ou segunda coluna — o texto senta na página exatamente como
   vai ficar. Toda a interface aparece no momento em que é pedida: a barra
   flutuante na seleção, o menu no "/", a alça ao passar o mouse. */
.doc-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 32px 96px; }
.doc-canvas { width: 100%; max-width: 860px; margin: 0 auto; }
.doc-canvas.with-toc { max-width: 1140px; display: grid; grid-template-columns: minmax(0, 1fr) 218px; gap: 52px; align-items: start; }
/* A margem esquerda é onde a alça mora: fora da coluna de texto, sem empurrá-la. */
.doc-write { min-width: 0; position: relative; padding-left: 8px; border-radius: 14px; outline: 2px dashed transparent; transition: outline-color 140ms; }
.doc-write.dropping { outline-color: var(--accent); outline-offset: 14px; }

.live-editor { outline: 0; padding: 22px 0 32px; min-height: 44vh; caret-color: var(--accent); }
.live-editor[contenteditable="true"] { cursor: text; }
.live-editor :focus { outline: none; }
.live-editor .md-task { cursor: pointer; }
/* Tabela em edição precisa das bordas à mostra para se saber onde é cada célula. */
.live-editor table { display: table; }
.live-editor th, .live-editor td { border: 1px solid var(--border); }
.md-empty { color: var(--text-muted); font-style: italic; }

/* Placeholders: o do documento vazio convida; o da linha vazia focada ensina o
   "/". Nunca os dois juntos, nunca numa linha que já tem texto. */
.live-editor [data-ph]::before {
  content: attr(data-ph);
  color: var(--text-muted); opacity: 0.42; pointer-events: none;
  position: absolute; font-weight: 400; font-family: "Hanken Grotesk", sans-serif;
  font-size: 16px; letter-spacing: 0;
}
.live-editor [data-ph] { position: relative; }

/* Bloco sendo arrastado + a linha que mostra onde ele cai. */
.live-editor .ed-dragging { opacity: 0.35; }
.ed-drop { height: 2px; margin: 4px 0; border-radius: 2px; background: var(--accent); box-shadow: 0 0 0 3px rgba(255,106,43,0.16); }

/* ── Alça do bloco (aparece ao passar o mouse) ───────────── */
.ed-gutter { position: absolute; left: -58px; width: 54px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; opacity: 0; pointer-events: none; transition: opacity 120ms; }
.ed-gutter.on { opacity: 1; pointer-events: auto; }
.ed-gut-btn { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; cursor: pointer; color: var(--text-muted); transition: background 110ms, color 110ms; }
.ed-gut-btn:hover { background: var(--surface-2); color: var(--text); }
.ed-grip { cursor: grab; }
.ed-grip:active { cursor: grabbing; }
@media (max-width: 1080px) { .ed-gutter { display: none; } }

/* ── Barra flutuante da seleção ──────────────────────────── */
.ed-bubble { position: fixed; z-index: 1200; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border-light); box-shadow: rgba(0,0,0,0.5) 0 10px 30px; animation: modalIn 110ms ease-out; }
.ed-bub-btn { width: 30px; height: 30px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; cursor: pointer; color: var(--text-near); transition: background 110ms, color 110ms; }
.ed-bub-btn:hover { background: var(--surface-4); color: var(--text); }
.ed-bub-btn.on { background: var(--accent); color: #17130E; }
.ed-bub-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

/* ── Menu de blocos ("/" e "Transformar em") ─────────────── */
.ed-menu { position: fixed; z-index: 1200; width: 292px; max-height: 340px; overflow-y: auto; padding: 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); box-shadow: rgba(0,0,0,0.55) 0 16px 48px; animation: modalIn 120ms ease-out; }
.ed-menu-compact { width: 232px; }
.ed-menu-cap { padding: 8px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-muted); }
.ed-menu-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 9px; background: transparent; border: 0; cursor: pointer; color: var(--text); text-align: left; }
.ed-menu-item.on, .ed-menu-item:hover { background: var(--surface-3); }
.ed-menu-item.danger { color: var(--exp); }
.ed-menu-item.danger:hover { background: rgba(243,114,127,0.12); }
.ed-menu-ico { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface); color: var(--text-muted); }
.ed-menu-item.on .ed-menu-ico, .ed-menu-item:hover .ed-menu-ico { color: var(--text); }
.ed-menu-item.danger .ed-menu-ico { color: inherit; }
.ed-menu-text { display: flex; flex-direction: column; min-width: 0; }
.ed-menu-label { font-size: 13.5px; font-weight: 600; }
.ed-menu-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.ed-menu-sep { height: 1px; background: var(--border); margin: 6px 6px; }

/* ── Rodapé do documento ─────────────────────────────────── */
.doc-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.doc-hint { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; cursor: pointer; font-size: 12px; color: var(--text-muted); transition: color 120ms; }
.doc-hint:hover { color: var(--text); }
.doc-hint kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--text-near); }
.md-count { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Índice lateral ─────────────────────────────────────── */
.doc-toc { position: sticky; top: 56px; padding-top: 34px; }
.doc-toc-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 0 6px 12px; border-left: 2px solid var(--border); color: var(--text-muted); font-size: 13px; line-height: 1.4; cursor: pointer; transition: color 120ms, border-color 120ms; }
.doc-toc-item:hover { color: var(--text); border-left-color: var(--accent); }
.doc-toc-item.sub { padding-left: 24px; font-size: 12.5px; }
@media (max-width: 1080px) { .doc-canvas.with-toc { grid-template-columns: 1fr; } .doc-toc { display: none; } }

/* ── Attachments ────────────────────────────────────────── */
.doc-attachments { flex-shrink: 0; padding-top: 18px; }
.doc-att-row { display: flex; gap: 10px; flex-wrap: wrap; }
.doc-att { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; font-size: 12.5px; color: var(--text-near); max-width: 280px; }
.doc-att img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.doc-att-ico { width: 30px; height: 30px; border-radius: 6px; background: var(--surface-3); color: var(--text-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-att span { min-width: 0; }

/* ── Share modal ────────────────────────────────────────── */
.share-row { display: flex; align-items: flex-start; gap: 14px; padding: 16px; background: var(--surface-2); border-radius: 12px; }
.share-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--surface); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.share-link-row { display: flex; gap: 8px; align-items: center; }
.share-link { flex: 1; min-width: 0; height: 38px; padding: 0 12px; background: var(--surface-2); border-radius: 8px; box-shadow: rgb(124,124,124) 0 0 0 1px inset; color: var(--text); font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.share-actions { display: flex; gap: 20px; margin-top: 16px; }

.switch-row { display: flex; align-items: center; gap: 16px; cursor: pointer; padding: 14px 16px; background: var(--surface-2); border-radius: 12px; }

/* ============================================================
   Prose — one typography for preview, reader, public page, chat
   ============================================================ */
.prose { color: var(--text-near); font-size: 16px; line-height: 1.75; letter-spacing: -0.005em; word-wrap: break-word; }
.prose > *:first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: "Sora", sans-serif; color: var(--text); letter-spacing: -0.03em; line-height: 1.25; scroll-margin-top: 20px; }
.prose h1 { font-size: 30px; font-weight: 800; margin: 40px 0 16px; }
.prose h2 { font-size: 22px; font-weight: 800; margin: 38px 0 14px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 17.5px; font-weight: 700; margin: 30px 0 10px; }
.prose h4 { font-size: 15px; font-weight: 700; margin: 24px 0 8px; color: var(--text-near); }
.prose p { margin: 0 0 17px; }
.prose strong { color: var(--text); font-weight: 700; }
.prose em { font-style: italic; }
.prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(255,106,43,0.35); transition: border-color 120ms, color 120ms; }
.prose a:hover { color: var(--accent-hover); border-bottom-color: var(--accent-hover); }
.prose ul, .prose ol { margin: 0 0 17px; padding-left: 24px; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--text-muted); }
.prose li > p { margin-bottom: 8px; }
.prose blockquote { margin: 22px 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--accent); color: var(--text-muted); font-style: normal; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 34px 0; }
.prose code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 0.875em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1.5px 5px; color: var(--mango); }
.prose pre { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; overflow-x: auto; margin: 0 0 20px; line-height: 1.65; }
.prose pre code { background: none; border: 0; padding: 0; color: var(--text-near); font-size: 13px; }
.prose img { max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); margin: 6px 0; display: block; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 22px; font-size: 14.5px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.prose th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose .md-task { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; accent-color: var(--accent); }
.prose ul:has(.md-task) { list-style: none; padding-left: 4px; }

/* ============================================================
   Assistente — painel lateral presente em toda a aplicação
   ============================================================ */
/* Aberto, o painel EMPURRA o conteúdo em vez de cobri-lo: você continua
   vendo o artefato/tarefa sobre o qual está perguntando. */
.assistant-panel {
  position: fixed; top: 8px; right: 8px; bottom: 92px; width: 400px;
  display: flex; flex-direction: column; min-height: 0; z-index: 120;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: rgba(0,0,0,0.45) 0px 18px 48px;
  transform: translateX(calc(100% + 16px)); opacity: 0; pointer-events: none;
  /* `visibility` (não só opacity) tira o painel fechado da ordem de tabulação e
     dos leitores de tela — senão ele continua focável sem estar visível. */
  visibility: hidden;
  transition: transform 260ms cubic-bezier(0.16,1,0.3,1), opacity 180ms,
              visibility 0s linear 260ms;
}
body.assistant-open .assistant-panel {
  transform: translateX(0); opacity: 1; pointer-events: auto; visibility: visible;
  transition: transform 260ms cubic-bezier(0.16,1,0.3,1), opacity 180ms, visibility 0s;
}
body.assistant-open .app-grid { margin-right: 416px; }
.app-grid { transition: margin-right 260ms cubic-bezier(0.16,1,0.3,1); }
@media (max-width: 1180px) {
  .assistant-panel { width: min(400px, calc(100vw - 16px)); }
  body.assistant-open .app-grid { margin-right: 0; }
}

.as-head { flex-shrink: 0; padding: 12px 12px 0; }
.as-head-row { display: flex; align-items: center; gap: 4px; }
.as-brand { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); padding-left: 6px; }
/* A linha de contexto é o coração do painel: diz, sem ambiguidade, sobre o
   que "isto" da sua pergunta vai falar. */
.as-context { display: flex; align-items: center; gap: 7px; margin: 10px 2px 0; padding: 7px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.as-context svg { color: var(--accent); flex-shrink: 0; }
.as-context span { color: var(--text-near); font-weight: 600; }

.as-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 10px; }
.as-thread { display: flex; flex-direction: column; gap: 20px; }
.as-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 13.5px; }

.as-welcome { padding: 18px 4px; }
/* Só a marca, sem caixa colorida em volta: quem abre o painel já sabe onde
   está — o quadradinho brilhante era enfeite. */
.as-welcome-mark { display: flex; margin-bottom: 16px; opacity: 0.9; }
.as-welcome-title { font-family: "Sora", sans-serif; font-size: 18px; font-weight: 800; letter-spacing: -0.03em; }
.as-welcome-sub { font-size: 13px; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }
.as-sugs { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; }
.as-sug { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 11px; background: var(--surface-1); border: 1px solid var(--border); color: var(--text-near); font-size: 13px; line-height: 1.4; cursor: pointer; transition: border-color 140ms, background 140ms, color 140ms; }
.as-sug span { flex: 1; }
.as-sug svg { color: var(--text-muted); flex-shrink: 0; opacity: 0; transition: opacity 140ms, transform 140ms; transform: translateX(-4px); }
.as-sug:hover { border-color: var(--border-light); background: var(--surface-2); color: var(--text); }
.as-sug:hover svg { opacity: 1; transform: translateX(0); color: var(--accent); }
.as-setup { margin-top: 20px; padding: 14px; border-radius: 12px; background: var(--surface-1); border: 1px solid var(--border); font-size: 13px; }
.as-history { padding: 4px 0; }

.as-footer { flex-shrink: 0; padding: 10px 12px 12px; }
.as-composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px; background: var(--surface-1); border: 1px solid var(--border-light); border-radius: 15px; transition: border-color 140ms, box-shadow 140ms; }
.as-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,106,43,0.10); }
.as-input { flex: 1; min-height: 24px; max-height: 160px; resize: none; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 14px; line-height: 1.5; padding: 4px 0; }
.as-input:disabled { cursor: not-allowed; }
.as-send { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent); color: #17130E; border: 0; cursor: pointer; transition: background 140ms, transform 90ms; }
.as-send:hover:not(:disabled) { background: var(--accent-hover); }
.as-send:active { transform: scale(0.94); }
.as-send:disabled { background: var(--surface-4); color: var(--text-muted); cursor: not-allowed; }
.as-hint { display: flex; align-items: center; gap: 6px; margin: 8px 4px 0; font-size: 11px; color: var(--text-muted); min-width: 0; }

/* Botão da topbar — mostra o nome em telas largas, só o ícone nas estreitas. */
.as-toggle { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 9999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-near); font-size: 13px; font-weight: 600; cursor: pointer; transition: background 140ms, color 140ms, border-color 140ms; }
.as-toggle:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-light); }
.as-toggle.on { background: var(--surface-3); border-color: var(--border-light); color: var(--text); }
@media (max-width: 1080px) { .as-toggle-lbl { display: none; } .as-toggle { padding: 0 10px; } }

.chat-conv { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border-radius: 10px; background: transparent; border: 0; cursor: pointer; color: var(--text); text-align: left; transition: background 110ms; }
.chat-conv:hover { background: var(--surface-2); }
.chat-conv.active { background: var(--surface-3); }
.chat-conv-title { font-size: 13.5px; font-weight: 600; }
.chat-conv-when { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.chat-conv .iconbtn { opacity: 0; }
.chat-conv:hover .iconbtn { opacity: 1; }

.msg.user { align-self: flex-end; max-width: 88%; }
.msg-user-text { background: var(--surface-3); border-radius: 14px 14px 4px 14px; padding: 10px 13px; font-size: 13.5px; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.msg.assistant { max-width: 100%; }
.msg-body { font-size: 14px; }
/* Dentro do painel a prosa precisa respirar em 370px: títulos menores,
   blocos mais compactos, tabelas com rolagem própria. */
.assistant-panel .prose { font-size: 14px; line-height: 1.65; }
.assistant-panel .prose h1 { font-size: 20px; margin: 22px 0 10px; }
.assistant-panel .prose h2 { font-size: 17px; margin: 22px 0 9px; padding-bottom: 7px; }
.assistant-panel .prose h3 { font-size: 15px; margin: 18px 0 7px; }
.assistant-panel .prose p { margin-bottom: 12px; }
.assistant-panel .prose ul, .assistant-panel .prose ol { padding-left: 20px; margin-bottom: 12px; }
.assistant-panel .prose pre { padding: 12px; border-radius: 10px; font-size: 12px; }
.assistant-panel .prose table { font-size: 12.5px; }
.assistant-panel .prose th, .assistant-panel .prose td { padding: 7px 9px; }
.msg-body.streaming::after { content: ""; display: inline-block; width: 7px; height: 15px; background: var(--accent); margin-left: 3px; vertical-align: -2px; animation: caret 900ms steps(2) infinite; }
@keyframes caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.msg-error { display: flex; align-items: center; gap: 9px; margin-top: 10px; padding: 11px 14px; border-radius: 10px; background: rgba(243,114,127,0.10); border: 1px solid rgba(243,114,127,0.28); color: var(--exp); font-size: 13.5px; font-weight: 600; }

/* Tool trail — what the assistant looked at, kept out of the way. */
.tool-trail { margin-bottom: 12px; }
.tool-live { display: inline-flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.tool-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface-4); border-top-color: var(--accent); animation: spin 700ms linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.tool-summary { display: inline-flex; align-items: center; gap: 7px; padding: 4px 0; background: none; border: 0; cursor: pointer; color: var(--text-muted); font-size: 12.5px; font-weight: 600; transition: color 120ms; }
.tool-summary:hover { color: var(--text); }
.tool-summary svg:last-child { transition: transform 160ms; }
.tool-summary.open svg:last-child { transform: rotate(180deg); }
.tool-detail { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; padding-left: 3px; }
.tool-detail.hidden { display: none; }
.tool-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-muted); }
.tool-name { color: var(--text-near); font-weight: 600; }
.tool-sum { min-width: 0; font-variant-numeric: tabular-nums; }

.provider-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.provider-card { padding: 14px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; text-align: left; transition: border-color 140ms, background 140ms; }
.provider-card:hover:not(:disabled) { border-color: var(--border-light); }
.provider-card.on { border-color: var(--accent); background: rgba(255,106,43,0.07); }
/* Sem chave ainda: mais apagado, mas clicável — selecionar é justamente o
   caminho para chegar ao campo onde a chave dele é cadastrada. */
.provider-card.off { color: var(--text-muted); border-style: dashed; }
.provider-card.off .provider-name { color: var(--text-muted); }
.provider-card:disabled { opacity: 0.55; cursor: not-allowed; }
.provider-name { font-size: 14.5px; font-weight: 700; color: var(--text); }
.provider-state { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }

/* ── Criação: os dois pontos de partida ─────────────────── */
.create-menu { padding: 7px; }
.create-opt { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 11px 10px; border-radius: 11px; background: transparent; border: 0; cursor: pointer; text-align: left; color: var(--text); transition: background 110ms; }
.create-opt:hover { background: var(--surface-3); }
.create-ico { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface); color: var(--text-muted); }
.create-opt:hover .create-ico { color: var(--accent); }
.create-title { font-size: 14px; font-weight: 700; }
.create-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.create-foot { padding: 10px 12px 4px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }

.doc-mark.note { background: var(--surface-2); color: var(--text-muted); border: 1px dashed var(--border-light); }
.doc-card.is-note { background: transparent; border-style: dashed; min-height: 150px; }
.doc-card.is-note:hover { background: var(--surface-1); border-style: solid; }
.doc-kind { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }

/* Formato nota: uma coluna só, largura de leitura confortável. */
.doc-identity.note { padding-top: 18px; }
.doc-title.note { font-size: 28px; }
/* Nota nunca abre índice lateral: é uma coluna, e ponto. */
.doc-shell.note .doc-canvas, .doc-shell.note .doc-canvas.with-toc { max-width: 780px; display: block; }
.doc-shell.note .doc-toc { display: none; }
/* O título tem de nascer na mesma coluna do texto — 780px de conteúdo mais os
   32px de respiro de cada lado do cabeçalho. */
.doc-shell.note .doc-header { max-width: 844px; margin: 0 auto; width: 100%; }
.doc-shell:not(.note) .doc-header { max-width: 1204px; margin: 0 auto; width: 100%; }

/* ============================================================
   Configurações
   ============================================================ */
.cfg-page { max-width: 820px; }
.cfg-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; margin-bottom: 18px; }
.cfg-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.cfg-title { font-family: "Sora", sans-serif; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.cfg-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }
.cfg-row { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 4px; }
.cfg-avatar { width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #17130E; font-family: "Sora", sans-serif; font-weight: 800; font-size: 20px; }
.cfg-static { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; font-size: 14px; color: var(--text-near); }
.cfg-note { font-size: 12px; color: var(--text-muted); }
.cfg-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.cfg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.cfg-locked { display: flex; align-items: center; gap: 9px; padding: 11px 14px; margin-bottom: 18px; border-radius: 10px; background: var(--surface-2); color: var(--text-muted); font-size: 13px; }
.cfg-alert { display: flex; gap: 12px; padding: 15px 16px; margin-bottom: 20px; border-radius: 12px; background: var(--wrn-soft); border: 1px solid var(--wrn-line); font-size: 13.5px; }
.cfg-code { margin-top: 10px; padding: 11px 13px; border-radius: 9px; background: rgba(0,0,0,0.35); color: var(--text-near); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.7; overflow-x: auto; }

/* ── Chave de API da empresa ─────────────────────────────
   Campo de escrita apenas: o que já está guardado aparece como um trecho
   (sk-ant…9f3c) ao lado do cadeado, nunca como valor do input. */
.cfg-key-row { display: flex; align-items: center; gap: 10px; }
.cfg-key-row .btn { flex-shrink: 0; }
.cfg-key-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; min-height: 20px; }
.cfg-key-saved { display: inline-flex; align-items: center; gap: 7px; color: var(--inc); font-weight: 600; }
.cfg-key-saved code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--text-near); background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; }
@media (max-width: 760px) {
  .cfg-key-row { flex-direction: column; align-items: stretch; }
  .cfg-key-row .btn { width: 100%; }
}
.cfg-alert code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: rgba(0,0,0,0.3); padding: 1px 5px; border-radius: 4px; }

/* ============================================================
   Public document page (no app shell, no login)
   ============================================================ */
body.pub-body { overflow: auto; height: auto; background: var(--bg); }
.pub-shell { min-height: 100vh; display: flex; flex-direction: column; }
.pub-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 32px; background: rgba(0,0,0,0.72); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.pub-org { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: var(--text); }
.pub-org-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #000; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; letter-spacing: -0.5px; }
.pub-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.pub-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--inc); }
.pub-main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 56px 32px 80px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; }
.pub-main:has(.pub-toc) { grid-template-columns: minmax(0, 1fr) 208px; }
.pub-article { max-width: 760px; min-width: 0; }
.pub-title-row { display: flex; align-items: flex-start; gap: 14px; }
.pub-emoji { font-size: 38px; line-height: 1.1; }
.pub-title { font-family: "Sora", sans-serif; font-size: 42px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; color: var(--text); }
.pub-summary { margin-top: 16px; font-size: 17px; line-height: 1.6; color: var(--text-muted); }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 22px 0 34px; padding-bottom: 26px; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted); }
.pub-tags { color: var(--accent); }
.pub-prose { font-size: 16.5px; }
.pub-toc { position: sticky; top: 88px; align-self: start; }
.pub-toc-item { display: block; padding: 6px 0 6px 12px; border-left: 2px solid var(--border); color: var(--text-muted); font-size: 13px; line-height: 1.4; transition: color 120ms, border-color 120ms; }
.pub-toc-item:hover { color: var(--text); border-left-color: var(--accent); }
.pub-toc-item.sub { padding-left: 24px; font-size: 12.5px; }
.pub-foot { padding: 26px 32px 40px; text-align: center; font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 7px; border-top: 1px solid var(--border); }
.pub-brand { font-family: "Sora", sans-serif; font-weight: 800; letter-spacing: -0.04em; color: var(--text); }
@media (max-width: 940px) {
  .pub-main, .pub-main:has(.pub-toc) { grid-template-columns: 1fr; padding: 36px 22px 60px; gap: 0; }
  .pub-toc { display: none; }
  .pub-title { font-size: 32px; }
}

/* ============================================================
   MOBILE  (--bp-mobile: 760px — o mesmo valor vive em dom.js)

   O celular não é o desktop encolhido: a barra lateral vira abas no rodapé,
   os menus ancorados viram folhas que sobem, as tabelas viram cartões e o
   player de foco simplesmente não existe (é uma ferramenta de mesa).
   ============================================================ */

/* ── Folhas de baixo: menus e modais no celular ─────────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); display: flex; align-items: flex-end; animation: fadeIn 180ms; }
.sheet-backdrop.out { animation: fadeOut 180ms forwards; }
.sheet { width: 100%; max-height: 85vh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface-2); border-radius: 20px 20px 0 0; border-top: 1px solid var(--border); padding: 8px 10px calc(14px + env(safe-area-inset-bottom)); animation: sheetIn 280ms cubic-bezier(0.16,1,0.3,1); transition: transform 120ms; }
.sheet.out { animation: sheetOut 200ms forwards; }
/* A "alcinha" que diz, sem texto, que dá para arrastar para baixo. */
.sheet-grip { width: 38px; height: 4px; border-radius: 999px; background: var(--surface-hover); margin: 4px auto 10px; flex-shrink: 0; }
.sheet-title { font-family: "Sora", sans-serif; font-size: 16px; font-weight: 800; letter-spacing: -0.02em; padding: 2px 10px 10px; }
.sheet-panel { position: static !important; width: 100% !important; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; animation: none !important; }
body.sheet-open { overflow: hidden; }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
@keyframes fadeOut { to { opacity: 0; } }

@media (max-width: 760px) {
  /* ── Casca ──────────────────────────────────────────────── */
  .app { padding: 0; gap: 0; }
  .app-grid { grid-template-columns: 1fr; gap: 0; }
  .sidebar, #sidebar-host { display: none; }
  .focus-bar { display: none; }        /* player é só desktop */
  .main { border-radius: 0; }
  /* Espaço para a barra de abas + área segura (barra de gestos do iPhone). */
  .main-scroll { padding-bottom: calc(72px + env(safe-area-inset-bottom)); overscroll-behavior-y: contain; }

  /* ── Topbar compacta ────────────────────────────────────── */
  .topbar { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 6px 10px; padding-top: calc(6px + env(safe-area-inset-top)); background: rgba(18,18,18,0.92); border-bottom: 1px solid var(--border); }
  .mtop-back, .mtop-co-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: 12px; color: var(--text); cursor: pointer; padding: 0; }
  .mtop-back:active, .mtop-co-btn:active { background: var(--surface-3); }
  .mtop-title { font-family: "Sora", sans-serif; font-size: 16.5px; font-weight: 800; letter-spacing: -0.025em; text-align: center; }
  .mtop-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
  .breadcrumb { display: none; }

  /* ── Barra de abas ──────────────────────────────────────── */
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -8px 24px rgba(0,0,0,0.45); }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 56px; background: transparent; border: 0; cursor: pointer; color: var(--text-muted); transition: color 140ms; -webkit-tap-highlight-color: transparent; }
  .tab.active { color: var(--accent); }
  .tab-ico { position: relative; display: flex; }
  .tab-lbl { font-size: 10.5px; font-weight: 600; letter-spacing: -0.01em; }
  .tab-badge { position: absolute; top: -5px; right: -9px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #17130E; font-size: 10px; font-weight: 800; line-height: 16px; text-align: center; }
  .tab.active .tab-badge { background: var(--accent); }

  /* ── Toque: nada abaixo de 44px, nada com fonte < 16px ─── */
  /* O iOS dá zoom sozinho em qualquer campo com fonte menor que 16px. Subimos
     só os que estavam abaixo disso — uma regra genérica em `input` achataria
     os títulos grandes do editor e da gaveta, que já são campos de texto. */
  .input input, .textarea, .selectwrap select, .dp-field,
  .login-input, .live-editor, .as-input, .share-link, .drawer-desc,
  .doc-summary, .chat-input, .subtask-input, .tag-input { font-size: 16px; }
  .input, .selectwrap, .dp-field { height: 48px; }
  .textarea { padding: 12px 14px; }
  .btn.md, .btn.lg { height: 44px; padding: 0 18px; font-size: 14px; }
  .btn.sm { height: 40px; padding: 0 14px; }
  .iconbtn { min-width: 40px; min-height: 40px; }
  .filterpill { min-height: 40px; padding: 9px 14px; font-size: 13.5px; }
  /* Área de toque de 44px sem mexer no desenho: um alvo invisível por cima.
     Usado nos controles pequenos por natureza (avatar, bolinha de status). */
  .hit-44::after { content: ""; position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); z-index: 1; }
  [role="switch"] { position: relative; }
  [role="switch"]::after { content: ""; position: absolute; inset: -11px -6px; z-index: 1; }
  .seg-btn { min-height: 40px; }
  .ed-menu-item { min-height: 44px; }
  .as-send { width: 40px; height: 40px; }
  .as-input { min-height: 40px; }
  /* Links de texto do login: alvo confortável sem virar botão. */
  .login-link, .login-foot a, .login-card a { display: inline-block; padding: 12px 6px; }
  .menu-item { padding: 13px 12px; font-size: 15px; border-radius: 12px; }
  .menu-cap { font-size: 11px; padding: 6px 12px 8px; }
  .swatch { width: 40px; height: 40px; }

  /* ── Páginas ────────────────────────────────────────────── */
  .page { padding: 0 16px 32px; }
  .page-hero { flex-direction: column; align-items: stretch; gap: 14px; padding: 18px 0 16px; }
  .page-title { font-size: 28px; }
  .page-sub { font-size: 13.5px; margin-top: 5px; }
  .page-hero .btn { width: 100%; justify-content: center; }
  .sec-head h2 { font-size: 20px; }

  /* Filtros e controles: uma faixa que rola de lado em vez de quebrar linha. */
  .controls { gap: 10px; flex-direction: column; align-items: stretch; margin-bottom: 18px; }
  .controls .spacer { display: none; }
  .controls > div[style*="width"] { width: 100% !important; }
  .seg { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; max-width: 100%; justify-content: flex-start; }
  .seg::-webkit-scrollbar { display: none; }
  .seg .filterpill { flex-shrink: 0; }

  /* Dashboard */
  .dash-hero { flex-direction: column; align-items: stretch; gap: 14px; padding: 18px 0 20px; }
  .greeting { font-size: 26px; white-space: normal; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
  .stat-card { min-height: 104px; padding: 14px 15px; border-radius: 12px; }
  .stat-head { margin-bottom: 10px; }
  .stat-ico { width: 32px; height: 32px; border-radius: 9px; }
  .stat-value { font-size: 21px; }
  .stat-delta { font-size: 11.5px; margin-top: 7px; }
  .two-col { grid-template-columns: 1fr; gap: 16px; margin-bottom: 22px; }

  /* Projetos */
  .proj-grid { grid-template-columns: 1fr; gap: 12px; }
  .proj-card-hero { height: 96px; padding: 16px; }
  .proj-card-letter { font-size: 40px; }
  .proj-card-play { opacity: 1; transform: none; width: 40px; height: 40px; }
  .proj-fin { gap: 10px; padding-top: 12px; }

  /* Projeto: a capa de 200px e o título de 80px são de desktop. */
  .pd-hero { flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px 16px 18px; min-height: 0; }
  .pd-cover { width: 84px; height: 84px; }
  .pd-cover-inner { font-size: 52px; letter-spacing: -4px; }
  .pd-title { font-size: 30px; line-height: 1.05; }
  .pd-desc { font-size: 14.5px; margin-top: 10px; }
  .pd-tags { margin-top: 12px; font-size: 12.5px; }
  .pd-controls { padding: 14px 16px; gap: 10px; flex-wrap: wrap; }
  .pd-controls .spacer { display: none; }   /* virava uma linha vazia ao quebrar */
  .pd-actions { width: 100%; justify-content: space-between; }
  .pd-play { width: 48px; height: 48px; }
  .pd-stats { grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 20px; }
  .pd-table-sec { padding: 0 16px 32px; }

  /* Extrato: a grade de 6 colunas vira cartão de duas linhas. */
  .tbl-head { display: none; }
  .tbl-row { grid-template-columns: auto auto minmax(0,1fr) auto; grid-template-rows: auto auto; gap: 7px 10px; padding: 13px 14px; align-items: center; }
  .tbl-row > *:nth-child(3) { grid-area: 1 / 1 / 2 / 4; font-size: 14.5px; font-weight: 600; white-space: normal; }
  .tbl-row > *:nth-child(5) { grid-area: 1 / 4 / 2 / 5; font-size: 15px; }
  .tbl-row > *:nth-child(1) { grid-area: 2 / 1 / 3 / 2; }
  .tbl-row > *:nth-child(1) > div { display: inline; margin-left: 5px; }
  .tbl-row > *:nth-child(2) { grid-area: 2 / 2 / 3 / 3; }
  .tbl-row > *:nth-child(4) { grid-area: 2 / 3 / 3 / 4; font-size: 12px; }
  .tbl-row > *:nth-child(6) { grid-area: 2 / 4 / 3 / 5; }

  /* Tarefas */
  .task-row { grid-template-columns: 34px minmax(0,1fr) auto; gap: 10px; padding: 12px 10px; }
  .task-row > *:nth-child(4) { display: none; }   /* prazo/etiqueta extra */
  .task-del { opacity: 1; }
  .task-title { font-size: 14.5px; }
  .task-group-label { font-size: 17px; }

  /* Artefatos */
  .docs-grid { grid-template-columns: 1fr; gap: 12px; }
  .doc-card { min-height: 0; padding: 15px; }
  .doc-card-body { -webkit-line-clamp: 2; }

  /* Editor de artefato */
  .doc-header { padding: 12px 16px 0; }
  .doc-bar { flex-wrap: wrap; gap: 8px; }
  .doc-bar > .btn.ghost:first-child { display: none; }   /* a seta da topbar já volta */
  .doc-actions { width: 100%; justify-content: space-between; gap: 6px; }
  .doc-status { display: none; }         /* o estado aparece na barra de salvar */
  .doc-identity { padding: 14px 0 12px; gap: 12px; }
  .doc-emoji { width: 44px; height: 44px; font-size: 22px; border-radius: 12px; }
  .doc-title { font-size: 25px; }
  .doc-title.note { font-size: 24px; }
  .doc-summary { font-size: 16px; }
  .doc-body { padding: 0 16px 40px; }
  .doc-canvas, .doc-canvas.with-toc, .doc-shell.note .doc-canvas, .doc-shell.note .doc-header { max-width: none; display: block; }
  .doc-write { padding-left: 0; }
  .live-editor { padding: 16px 0 24px; min-height: 40vh; }
  .live-editor [data-ph]::before { font-size: 15px; }
  /* Sem mouse não há "passar o mouse": no celular o menu vem pelo "/" e pela
     dica do rodapé, e a barra de seleção é a do próprio sistema. */
  .ed-gutter { display: none; }
  .ed-menu { width: calc(100vw - 24px); max-height: 52vh; }
  .ed-bubble { display: none; }
  .doc-att { max-width: 100%; }

  /* Configurações */
  .cfg-card { padding: 18px 16px; border-radius: 14px; }
  .cfg-card-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .cfg-row { flex-direction: column; gap: 14px; }
  /* Sem isto as amostras de cor eram espremidas a 4px de largura. */
  .cfg-swatches { flex-wrap: wrap; gap: 12px; }
  .cfg-row > div[style*="grid"] { grid-template-columns: 1fr !important; }
  .cfg-actions { flex-direction: column-reverse; }
  .cfg-actions .btn { width: 100%; }
  .provider-grid { grid-template-columns: 1fr; gap: 8px; }
  .provider-card { display: flex; align-items: center; justify-content: space-between; }
  .provider-state { margin-top: 0; }
  .cfg-code { font-size: 11px; }

  /* Prosa: margens menores, mas altura de linha de leitura preservada. */
  .prose { font-size: 16px; }
  .prose h1 { font-size: 24px; margin: 28px 0 12px; }
  .prose h2 { font-size: 19px; margin: 26px 0 11px; }
  .prose h3 { font-size: 16.5px; }
  .prose pre { padding: 13px 14px; font-size: 13px; }
  .prose table { font-size: 13.5px; }

  /* Modal vira folha */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { width: 100% !important; max-width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); animation: sheetIn 280ms cubic-bezier(0.16,1,0.3,1); }
  .modal-head { margin-bottom: 16px; }
  .modal-head h2 { font-size: 19px; }
  .form-actions { flex-direction: column-reverse; gap: 8px; }
  .form-actions .btn { width: 100%; }

  /* Gaveta de tarefa vira tela cheia */
  .drawer { top: 0; right: 0; bottom: 0; left: 0; width: 100%; max-width: 100%; border-radius: 0; animation: sheetIn 260ms cubic-bezier(0.16,1,0.3,1); }
  .drawer-head { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
  .drawer-body { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
  .drawer-title { font-size: 22px; }
  .prop-row { grid-template-columns: 88px 1fr; }

  /* Assistente: tela cheia, com o compositor acima do teclado */
  .assistant-panel { top: 0; right: 0; bottom: 0; left: 0; width: 100%; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); z-index: 1300; }
  .as-scrim { display: none; }
  .as-head { padding: 10px 12px 0; }
  .as-footer { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
  .as-toggle { padding: 0; width: 40px; height: 40px; justify-content: center; border-radius: 50%; background: transparent; border-color: transparent; }
  .as-toggle.on { background: rgba(255,106,43,0.14); }
  .as-sug { padding: 13px 14px; font-size: 14px; }
  .as-sug svg { opacity: 1; transform: none; }
  body.assistant-open .app-grid { margin-right: 0; }

  /* Toasts acima da barra de abas, largura da tela */
  .toast-host { left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }

  /* Login */
  .login-top { padding: calc(16px + env(safe-area-inset-top)) 20px 8px; }
  .login-center { padding: 12px 16px 40px; align-items: flex-start; }
  .login-card { padding: 28px 20px; border-radius: 16px; }
  .login-title { font-size: 23px; margin-bottom: 24px; }
  .login-input { height: 52px; }
  .login-submit { height: 52px; }

  /* Página pública */
  .pub-head { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
  .pub-main { padding: 26px 16px calc(40px + env(safe-area-inset-bottom)); }
  .pub-title { font-size: 27px; }
  .pub-emoji { font-size: 30px; }
  .pub-summary { font-size: 15px; margin-top: 12px; }
  .pub-meta { margin: 16px 0 24px; padding-bottom: 18px; }
  .pub-prose { font-size: 16px; }
  .pub-foot { padding: 22px 16px calc(28px + env(safe-area-inset-bottom)); }

  /* Estados vazios e seletor de data */
  .empty { padding: 48px 18px; border-radius: 14px; }
  .dp-day { height: 42px; font-size: 14px; }
}

/* Telas muito estreitas (iPhone SE, 320–360px) */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
  .pd-stats { grid-template-columns: 1fr; }
  .tab-lbl { font-size: 10px; }
  .page-title { font-size: 25px; }
  .pd-title { font-size: 26px; }
}

/* Tablet retrato: a sidebar FICA (só mais estreita). As abas de baixo só
   existem abaixo de 760px — esconder a sidebar aqui deixaria o tablet sem
   navegação nenhuma. */
@media (min-width: 761px) and (max-width: 1024px) {
  .app-grid { grid-template-columns: 204px 1fr; }
  .navitem { padding: 11px 12px; font-size: 14.5px; gap: 12px; }
  .sb-brand { padding: 0 8px 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .page { padding: 0 24px 40px; }
  .pd-hero { padding: 28px 24px 24px; min-height: 0; }
  .pd-cover { width: 132px; height: 132px; }
  .pd-cover-inner { font-size: 84px; letter-spacing: -5px; }
  .pd-title { font-size: 44px; }
  .pd-controls, .pd-stats, .pd-table-sec { padding-left: 24px; padding-right: 24px; }
  .tbl-head, .tbl-row { grid-template-columns: 88px 96px 1fr 120px 120px 76px; gap: 10px; }
}

/* Paisagem baixinha (celular deitado): o cabeçalho não pode comer a tela */
@media (max-height: 480px) and (orientation: landscape) and (max-width: 940px) {
  .page-hero, .dash-hero { padding: 12px 0 10px; }
  .page-title, .greeting { font-size: 22px; }
  .pd-hero { padding: 12px 16px; }
  .chat-welcome, .as-welcome { padding-top: 12px; }
}

/* Quem prefere menos movimento não deve levar folhas deslizando na cara. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ── Toasts (surface API failures the UI used to swallow) ── */
.toast-host { position: fixed; right: 20px; bottom: 96px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 12px 16px; border-radius: 12px; background: var(--surface-4); color: var(--text); font-size: 13.5px; font-weight: 600; line-height: 1.35; box-shadow: var(--shadow-heavy); border: 1px solid var(--border); pointer-events: auto; animation: toastIn 220ms cubic-bezier(0.16,1,0.3,1); }
.toast.error { border-color: rgba(243,114,127,0.45); color: var(--exp); }
.toast.success { border-color: rgba(52,199,154,0.45); color: var(--inc); }
.toast.error span, .toast.success span { color: var(--text); }
.toast.out { animation: toastOut 200ms forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }
