/* SIR.BERNARDO Leads · a linguagem do sirbernardo.com, em app */
:root {
  --bg: #070707;
  --surface: #111214;
  --surface-2: #17181b;
  --line: rgba(243,241,233,0.08);
  --line-strong: rgba(243,241,233,0.22);
  --brand: #7f1b17;         /* vermelho sir.bernardo · botões */
  --brand-2: #96221c;       /* hover / ativo */
  --accent: #e7503f;        /* vermelho vivo · sinal, seleção, prioridade */
  --accent-soft: rgba(231,80,63,0.16);
  --bone: #efe6d8;          /* osso · texto sobre vermelho, chips ativos */
  --warn: #e0a84f;          /* atenção */
  --warn-soft: rgba(224,168,79,0.16);
  --danger: #ff6b5b;        /* atrasado */
  --danger-soft: rgba(255,107,91,0.16);
  --ok: #5fbf7a;            /* entregue */
  --ok-soft: rgba(95,191,122,0.16);
  --ink: #f3f1e9;
  --ink-2: #cfccc3;
  --muted: #a09f98;
  --dim: #7d7c76;
  --r-s: 10px; --r-m: 18px; --r-l: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 48px;
  --tab-h: 60px;
}
* { box-sizing: border-box; }
html, body { margin: 0; touch-action: manipulation; -webkit-text-size-adjust: 100%; -webkit-touch-callout: none; background: var(--bg); color: var(--ink); font-family: Manrope, -apple-system, "Segoe UI", Arial, sans-serif; letter-spacing: -0.2px; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
img { display: block; }

#app { min-height: 100dvh; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; }

/* Header */
.header { position: fixed; top: 0; left: 0; right: 0; z-index: 10; transform: none; filter: none; -webkit-font-smoothing: antialiased; height: calc(var(--header-h) + var(--safe-top)); padding: var(--safe-top) 20px 0; display: flex; align-items: center; justify-content: space-between; background: var(--bg); }
.header .logo { height: 13px; width: auto; }
.header .label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.4px; text-transform: uppercase; }
.iconbtn { width: 44px; height: 44px; margin: 0 -10px; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--ink); border-radius: 999px; }
.avatar { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line-strong); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; background: transparent; }

/* Conteúdo */
.main { flex: 1; padding: calc(var(--header-h) + var(--safe-top) + 16px) 20px calc(var(--tab-h) + var(--safe-bottom) + 24px); display: flex; flex-direction: column; gap: 18px; }
.main.no-tabs { padding-bottom: calc(var(--safe-bottom) + 32px); }
.title { font-size: 34px; font-weight: 500; letter-spacing: -1.4px; line-height: 1.05; }
.title.sm { font-size: 30px; letter-spacing: -1.2px; }
.subtitle { font-size: 15px; color: var(--muted); margin-top: 4px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.4px; text-transform: uppercase; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }

/* Pílulas */
.pill { height: 26px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; white-space: nowrap; border: 1px solid transparent; }
.pill.filled { background: var(--brand); color: var(--bone); font-weight: 700; }
.pill.outline { border-color: var(--line-strong); color: var(--ink-2); background: rgba(243,241,233,0.04); }
.pill.dashed { border: 1px dashed var(--warn); color: var(--warn); background: var(--warn-soft); }
.pill.ghost { border-color: var(--line-strong); color: var(--ink-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.dim { background: rgba(243,241,233,0.06); color: var(--muted); border-color: transparent; }
.pill.white { background: var(--bone); color: #070707; font-weight: 700; }

/* Segmented / chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 36px; padding: 0 16px; border-radius: 999px; background: transparent; color: var(--ink); border: 1px solid var(--line-strong); font-size: 14px; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
.chip.on { background: var(--bone); color: #070707; border-color: var(--bone); font-weight: 600; }
.chip:disabled { opacity: 0.5; }

/* Cartões */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); box-shadow: inset 0 1px 0 rgba(243,241,233,0.04); }
a.card:active, button.card:active { background: var(--surface-2); }
.card.row { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card .name { font-size: 17px; font-weight: 600; letter-spacing: -0.4px; }
.card .meta { font-size: 14px; color: var(--ink-2); }
.card.done { opacity: 0.55; }

/* Prazos e contagens */
.due.soon { color: var(--warn); }
.due.late { color: var(--danger); font-weight: 600; }
.n.has { color: var(--accent); }
.big.ok { color: var(--ok); }
.chip.on { background: var(--bone); color: #070707; border-color: var(--bone); }
.chip.on.accent { background: var(--brand); color: var(--bone); border-color: var(--brand); }
.dot-p { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; display: inline-block; }
.dot-p.prioritaria { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dot-p.em_acompanhamento { background: var(--ink-2); }
.dot-p.validacao_necessaria { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }

/* Lista agrupada (pipeline) */
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; box-shadow: inset 0 1px 0 rgba(243,241,233,0.04); }
.group .item { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid rgba(243,241,233,0.08); width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: var(--ink); }
.group .item:last-child { border-bottom: 0; }
.group .item .t { font-size: 16px; font-weight: 600; }
.group .item .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.group .item .n { font-size: 20px; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .k { font-size: 12px; color: var(--dim); }
.kv .v { font-size: 15px; font-weight: 500; }
.stat .big { font-size: 28px; font-weight: 500; letter-spacing: -1px; }

/* Botões */
.btn { height: 52px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font-size: 16px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.btn.primary { background: var(--brand); color: var(--bone); border-color: var(--brand); font-weight: 600; }
.btn.primary:active { background: var(--brand-2); }
.btn.sm { height: 40px; font-size: 14px; padding: 0 16px; width: auto; }
.btn:disabled { opacity: 0.5; cursor: default; }
.check { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.check.on { background: var(--ok); color: #070707; border-color: var(--ok); }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.4px; text-transform: uppercase; }
.input, select.input, textarea.input { height: 54px; width: 100%; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 17px; padding: 0 18px; outline: none; -webkit-appearance: none; appearance: none; }
textarea.input { height: auto; min-height: 96px; padding: 14px 18px; resize: vertical; }
.input:focus { border-color: var(--ink); }
.input.code { text-align: center; letter-spacing: 8px; font-size: 26px; font-weight: 600; }
.error { font-size: 14px; color: #ff9b8f; }

/* Barra inferior */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--tab-h) + var(--safe-bottom)); padding: 8px 12px calc(var(--safe-bottom) + 4px); border-top: 1px solid var(--line); background: var(--bg); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--dim); padding-top: 2px; }
.tabs a.on { color: var(--accent); font-weight: 600; }

/* Folha inferior (bottom sheet) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 20; display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 90dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l) var(--r-l) 0 0; padding: 20px 20px calc(var(--safe-bottom) + 24px); display: flex; flex-direction: column; gap: 16px; }
.sheet .handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 4px; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option { height: 52px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font-size: 16px; text-align: left; width: 100%; }
.option.on { background: var(--bone); color: #070707; border-color: var(--bone); font-weight: 600; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl { display: grid; grid-template-columns: 14px 1fr; gap: 12px; }
.tl .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--muted); margin-top: 6px; }
.tl .dot.sys { background: transparent; border: 1px solid var(--muted); }
.tl .txt { font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.tl .when { font-size: 12px; color: var(--dim); margin-top: 2px; }

/* Funil */
.bar { height: 22px; border-radius: 6px; background: var(--brand-2); min-width: 2px; }
.bar.o { background: var(--ok); }

/* Menu inteiro */
.menu { display: flex; flex-direction: column; gap: 6px; padding-top: 40px; flex: 1; }
.menu a, .menu button { font-size: 38px; font-weight: 500; letter-spacing: -1.6px; line-height: 1.15; padding: 8px 0; background: none; border: 0; text-align: left; color: var(--ink); }
.menu .sep { height: 1px; background: rgba(243,241,233,0.12); margin: 20px 0; }
.menu .sec a, .menu .sec button { font-size: 20px; letter-spacing: -0.5px; color: var(--ink-2); }

/* Estados */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.5; }
.skeleton { height: 96px; border-radius: var(--r-m); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-bottom) + 16px); transform: translateX(-50%) translateY(20px); background: var(--bone); color: #070707; font-size: 14px; font-weight: 600; padding: 12px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 720px) {
  .screen { max-width: 480px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100dvh; }
  .tabs, .header { max-width: 480px; margin: 0 auto; }
  .sheet { max-width: 480px; margin: 0 auto; }
}

/* ---------- Movimento ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Só o conteúdo anima; cabeçalho e barra ficam sempre fixos e opacos */
  .screen > .main { animation: screen-in .3s cubic-bezier(.2,.8,.2,1) backwards; }
  .screen.back > .main { animation-name: screen-back; }
  @keyframes screen-in { from { transform: translateY(12px); } to { transform: none; } }
  @keyframes screen-back { from { transform: translateX(-12px); } to { transform: none; } }
  .screen.quiet *, .screen.quiet > .main { animation: none !important; }

  .list > * { animation: rise .42s cubic-bezier(.2,.8,.2,1) backwards; }
  .list > *:nth-child(1) { animation-delay: .03s } .list > *:nth-child(2) { animation-delay: .07s } .list > *:nth-child(3) { animation-delay: .11s }
  .list > *:nth-child(4) { animation-delay: .15s } .list > *:nth-child(5) { animation-delay: .19s } .list > *:nth-child(6) { animation-delay: .23s }
  .list > *:nth-child(7) { animation-delay: .27s } .list > *:nth-child(8) { animation-delay: .31s } .list > *:nth-child(n+9) { animation-delay: .34s }
  .group .item { animation: rise .4s cubic-bezier(.2,.8,.2,1) backwards; }
  .group .item:nth-child(2) { animation-delay: .05s } .group .item:nth-child(3) { animation-delay: .1s } .group .item:nth-child(4) { animation-delay: .15s } .group .item:nth-child(5) { animation-delay: .2s } .group .item:nth-child(6) { animation-delay: .25s }
  @keyframes rise { from { transform: translateY(10px); } to { transform: none; } }

  .card, .chip, .btn, .check, .option, .avatar, .iconbtn, .tabs a, .pill.ghost, .group .item { transition: transform .18s cubic-bezier(.2,.8,.2,1), background-color .18s, border-color .18s; }
  a.card:active, button.card:active, .group .item:active { transform: scale(.985); }
  .btn:active, .chip:active, .option:active { transform: scale(.97); }
  .check:active, .avatar:active, .iconbtn:active { transform: scale(.9); }
  .tabs a:active { transform: translateY(1px) scale(.95); }
  .tabs a svg { transition: transform .22s cubic-bezier(.2,.8,.2,1); }
  .tabs a.on svg { transform: translateY(-1px) scale(1.08); }

  .bar { transform-origin: left; animation: grow .7s cubic-bezier(.2,.8,.2,1) both; }
  .bar:nth-of-type(1) { animation-delay: .05s }
  @keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

  .sheet { animation: sheet-up .32s cubic-bezier(.2,.8,.2,1) backwards; }
  .sheet-backdrop.closing .sheet { animation: sheet-up .2s ease-in reverse both; }
  @keyframes fade { from { opacity: 0 } to { opacity: 1 } }
  @keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }



  .refresh-dot { background: var(--accent) !important; position: fixed; top: calc(var(--safe-top) + 14px); left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 999px; background: var(--ink); opacity: 0; z-index: 11; transition: opacity .2s; }
  .refresh-dot.on { opacity: 1; animation: pulse 1s infinite; }
  @keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1 } 50% { transform: scale(1.6); opacity: .4 } }
}

