    :root {
      /* O app é sempre claro. "only light" faz o Chrome e a maioria dos
         navegadores respeitarem o claro mesmo com o aparelho no modo escuro.
         O background-color explícito no html/body abaixo reforça isso.
         Obs.: o Samsung Internet com "modo escuro para sites" ligado inverte
         a página ignorando qualquer CSS — isso é configuração do navegador,
         não dá pra impedir pelo site; só o usuário desligando a opção. */
      color-scheme: only light;
      --bg: #F4F7F8;
      --surface: #FFFFFF;
      --ink: #10262E;
      --muted: #5E747D;
      /* --faint, --recebido e --pend foram escurecidos (sem sair da mesma
         família de cor) porque reprovavam no contraste mínimo sobre o
         branco: 2.66:1, 2.87:1 e 2.45:1. Como carregam justamente os
         valores em dinheiro e os rótulos, eram os textos menos legíveis
         do app — sumiam no sol e quando o celular baixa o brilho sozinho.
         Agora: 4.64:1, 5.38:1 e 4.53:1, todos acima do mínimo de 4.5.

         --faint ficou perto de --muted (4.64 vs 4.92) porque não dá pra
         ser mais claro que isso e ainda passar no mínimo. A diferença
         entre os dois níveis segue existindo pelo tipo — --faint é usado
         em rótulo 11px caixa alta com espaçamento, --muted em texto
         corrido. Se preferir a separação visual de volta, #6B818A dá o
         cinza antigo mais claro, ao custo de cair pra 4.09:1. */
      --faint: #627881;
      --line: #E4ECEE;
      --teal: #0E8C7F;
      --teal-deep: #0B6E63;
      --teal-soft: #E2F2EF;
      --feito: #2C7BE5;
      --feito-soft: #E6F0FD;
      --recebido: #0E7A4A;
      --recebido-soft: #E3F6EC;
      --pend: #A9670A;
      --pend-soft: #FBF0DD;
      --shadow-sm: 0 1px 2px rgba(16, 38, 46, .06), 0 2px 8px rgba(16, 38, 46, .06);
      --shadow: 0 1px 2px rgba(16, 38, 46, .04), 0 8px 24px rgba(16, 38, 46, .06);
      --shadow-lg: 0 12px 40px rgba(16, 38, 46, .16);
      --r: 16px;
    }

    /* Cinto de segurança do tema claro: fundo e cor de texto fixados no html e
       no body. Se um navegador tentar escurecer, ainda acha um fundo claro. */
    html { background-color: #F4F7F8; }
    body { background-color: #F4F7F8; color: #10262E; }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent
    }

    html,
    body {
      height: 100%
    }

    body {
      font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
      background: var(--bg);
      color: var(--ink);
      -webkit-font-smoothing: antialiased;
      line-height: 1.45;
      overscroll-behavior-y: none
    }

    button {
      font-family: inherit;
      cursor: pointer;
      border: none;
      background: none;
      color: inherit
    }

    input,
    select {
      font-family: inherit;
      font-size: 16px
    }

    .num {
      font-family: 'Sora', sans-serif;
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum"
    }

    .app {
      display: flex;
      min-height: 100dvh
    }

    .sidebar {
      display: none
    }

    .main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      padding-bottom: calc(76px + env(safe-area-inset-bottom))
    }

    .view {
      display: none;
      animation: fade .28s ease
    }

    .view.active {
      display: block
    }

    @keyframes fade {
      from {
        opacity: 0;
        transform: translateY(6px)
      }

      to {
        opacity: 1;
        transform: none
      }
    }

    /* Telas de dados: largura fluida, preenchem a área toda (só um respiro
       lateral). Sem teto — o conteúdo é grade/tabela/gráfico, que acompanham. */
    .wrap {
      max-width: none;
      margin: 0 auto;
      padding: 0 32px
    }

    /* Ajustes é formulário: cards de config largos demais ficam com o conteúdo
       esparso e os botões esticados. Fica contido, centralizado, enquanto as
       telas de dados aproveitam a largura toda. */
    #view-ajustes .wrap {
      max-width: 1100px;
    }

    .topbar {
      position: sticky;
      top: 0;
      z-index: 30;
      background: var(--bg);
      padding: calc(env(safe-area-inset-top) + 14px) 18px 8px
    }

    .topbar .wrap2 {
      max-width: none;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 9px;
      font-family: 'Sora';
      font-weight: 700;
      font-size: 21px;
      letter-spacing: -.02em
    }

    .brand .ekg {
      width: 26px;
      height: 26px;
      flex: none;
      display: block;
      object-fit: contain
    }

    .brand b {
      font-weight: 800;
      color: #0E8C7F;
    }

    .gear {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--surface);
      border: 1px solid var(--line);
      display: grid;
      place-items: center;
      color: var(--muted);
      box-shadow: var(--shadow)
    }

    .gear svg {
      width: 20px;
      height: 20px
    }

    .topbar-profile {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--surface);
      border: 1px solid var(--line);
      display: grid;
      place-items: center;
      box-shadow: var(--shadow);
      padding: 0;
      overflow: hidden;
      cursor: pointer;
      transition: transform .15s
    }

    .topbar-profile:active {
      transform: scale(.94)
    }

    h2.title {
      font-family: 'Sora';
      font-weight: 700;
      font-size: 15px;
      letter-spacing: .01em;
      margin: 24px 0 12px;
      display: flex;
      align-items: center;
      justify-content: space-between
    }

    h2.title .link {
      font-family: 'Plus Jakarta Sans';
      font-size: 13px;
      font-weight: 700;
      color: var(--teal);
      background: var(--teal-soft);
      padding: 5px 12px;
      border-radius: 999px;
      border: 1.5px solid rgba(14,140,127,.25);
      transition: all .18s;
      cursor: pointer
    }


    /* ---- Period filter ---- */
    .period {
      margin-top: 6px
    }

    .yearstep {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 5px 6px 5px 14px;
      box-shadow: var(--shadow);
      font-family: 'Sora';
      font-weight: 700;
      font-size: 15px
    }

    .yearstep button {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      color: var(--muted)
    }

    .yearstep button:hover {
      background: var(--bg);
      color: var(--ink)
    }

    .yearstep .yv {
      min-width: 48px;
      text-align: center
    }

    .pl-mes-label {
      font-family: 'Sora';
      font-size: 16px;
      font-weight: 800;
      color: var(--ink);
      text-transform: capitalize;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .cal-nav-btn {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      flex: none;
      display: grid;
      place-items: center;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--muted);
      box-shadow: var(--shadow-sm);
      transition: background .15s, color .15s
    }

    .cal-nav-btn svg {
      width: 18px;
      height: 18px
    }

    .cal-nav-btn:hover {
      background: var(--bg);
      color: var(--ink)
    }

    /* ---- Calendário ---- */
    .cal-weekdays {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      text-align: center;
      font-size: 10.5px;
      font-weight: 700;
      color: var(--faint);
      margin: 14px 0 6px
    }

    .cal-grid {
      display: grid;
      /* minmax(0,1fr) e não 1fr: o chip do lançamento tem white-space:nowrap,
         então com "1fr" a célula não encolhe abaixo do nome do hospital e a
         grade inteira vaza para fora da tela no celular. */
      grid-template-columns: repeat(7, minmax(0, 1fr));
      gap: 4px
    }

    .cal-day {
      aspect-ratio: 1;
      border-radius: 10px;
      border: 1px solid var(--line);
      background: var(--surface);
      padding: 3px;
      display: flex;
      flex-direction: column;
      gap: 1px;
      cursor: pointer;
      overflow: hidden;
      transition: border-color .15s, box-shadow .15s
    }

    .cal-day.empty {
      background: transparent;
      border-color: transparent;
      cursor: default;
      /* Célula vazia não pode ter padding nem proporção fixa: sem conteúdo,
         o padding entra na conta do aspect-ratio e infla a célula, esticando
         a linha inteira. Era por isso que a primeira e a última semana do mês
         saíam quase o dobro da altura das outras. */
      padding: 0;
      aspect-ratio: auto
    }

    .cal-day.today {
      border-color: var(--teal);
      box-shadow: 0 0 0 1.5px var(--teal)
    }

    .cal-day .cal-daynum {
      font-size: 10.5px;
      font-weight: 700;
      color: var(--ink)
    }

    .cal-day.today .cal-daynum {
      color: var(--teal-deep)
    }

    .cal-day .cal-chip {
      font-size: 7.5px;
      font-weight: 700;
      color: #fff;
      border-radius: 4px;
      padding: 1px 3px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .cal-day .cal-more {
      font-size: 7.5px;
      font-weight: 700;
      color: var(--muted)
    }

    .cal-mesano {
      font-family: 'Sora';
      font-size: 15px;
      font-weight: 800;
      color: var(--ink)
    }

    .cal-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      width: 100%;
      padding: 12px 14px;
      border-radius: 12px;
      border: 1.5px solid var(--line);
      background: var(--surface);
      text-align: left;
      transition: border-color .15s, background .15s
    }

    .cal-item:active {
      transform: scale(.98)
    }

    .monthchips {
      display: flex;
      gap: 7px;
      overflow-x: auto;
      padding: 12px 2px 4px;
      scrollbar-width: none;
      -ms-overflow-style: none
    }

    .monthchips::-webkit-scrollbar {
      display: none
    }

    .mchip {
      flex: none;
      padding: 8px 13px;
      border-radius: 999px;
      background: var(--surface);
      border: 1px solid var(--line);
      font-weight: 700;
      font-size: 13px;
      color: var(--muted);
      text-transform: capitalize;
      transition: .15s
    }

    .mchip.on {
      background: var(--teal);
      border-color: var(--teal);
      color: #fff;
      box-shadow: 0 4px 12px rgba(11, 110, 99, .28)
    }

    /* ---- Barra de filtros (mês / tipo / status) ----
       Substitui as fileiras de chips por 3 botões compactos que abrem
       uma sheet pra escolher o valor — mesma função, página mais limpa. */
    .filterbar {
      display: flex;
      gap: 8px;
      margin-top: 12px
    }

    .filterbtn {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 5px;
      padding: 10px 11px;
      border-radius: 12px;
      background: var(--surface);
      border: 1px solid var(--line);
      box-shadow: var(--shadow-sm);
      font-weight: 700;
      font-size: 12.5px;
      color: var(--ink);
      text-align: left;
      transition: border-color .15s, background .15s, color .15s
    }

    .filterbtn span {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap
    }

    .filterbtn svg {
      width: 15px;
      height: 15px;
      flex: none;
      color: var(--faint)
    }

    .filterbtn.active {
      background: var(--teal-soft);
      border-color: var(--teal);
      color: var(--teal-deep)
    }

    .filterbtn.active svg {
      color: var(--teal-deep)
    }

    .filtro-list {
      display: flex;
      flex-direction: column;
      gap: 6px
    }

    .filtro-opt {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      padding: 12px 14px;
      border-radius: 12px;
      border: 1.5px solid var(--line);
      background: var(--surface);
      font-weight: 600;
      font-size: 14px;
      color: var(--ink);
      text-align: left;
      transition: border-color .15s, background .15s
    }

    .filtro-opt.on {
      border-color: var(--teal);
      background: var(--teal-soft);
      color: var(--teal-deep);
      font-weight: 700
    }

    .filtro-opt svg {
      width: 18px;
      height: 18px;
      color: var(--teal-deep);
      flex: none
    }

    /* ---- Summary cards ---- */
    .dashtop {
      display: grid;
      grid-template-columns: 1fr;
      gap: 12px
    }

    .statgrid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px
    }

    .card {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: var(--r);
      padding: 14px;
      box-shadow: var(--shadow);
      display: flex;
      flex-direction: column;
      min-height: 120px
    }

    .card.hero {
      background: linear-gradient(150deg, var(--teal) 0%, var(--teal-deep) 100%);
      border: none;
      color: #fff;
      box-shadow: 0 14px 34px rgba(11, 110, 99, .3);
      position: relative;
      overflow: hidden;
      grid-column: span 2;
      min-height: 100px;
      padding: 12px 16px
    }

    .card.hero::after {
      content: "";
      position: absolute;
      right: -40px;
      top: -50px;
      width: 170px;
      height: 170px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 70%)
    }

    .card .ck {
      font-size: 12.5px;
      color: var(--muted);
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 8px
    }

    .card.hero .ck {
      color: rgba(255, 255, 255, .85)
    }

    .card .ci {
      width: 30px;
      height: 30px;
      border-radius: 9px;
      display: grid;
      place-items: center;
      flex: none;
      font-size: 14px
    }

    .card .cbody {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center
    }

    .card.hero .cbody {
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-top: 4px
    }

    .card .big {
      font-family: 'Sora';
      font-weight: 800;
      font-size: 24px;
      letter-spacing: -.025em;
      line-height: 1.08
    }

    .card .pill {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      margin-top: 10px;
      background: rgba(255, 255, 255, .16);
      padding: 6px 12px;
      border-radius: 999px;
      font-size: 12.5px;
      font-weight: 600;
      align-self: flex-start
    }

    .card.hero .pill {
      margin-top: 0;
      padding: 4px 10px
    }

    .split .row {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
      padding: 6px 0
    }

    .split .row+.row {
      border-top: 1px dashed var(--line)
    }

    .split .rl {
      font-size: 12px;
      font-weight: 600;
      color: var(--muted)
    }

    .split .rv {
      font-family: 'Sora';
      font-weight: 700;
      font-size: 16px
    }

    .rv.recebido {
      color: var(--recebido)
    }

    .rv.pend {
      color: var(--pend)
    }

    .rv.feito {
      color: var(--feito)
    }

    .card.solo .v {
      font-family: 'Sora';
      font-weight: 800;
      font-size: 16px;
      letter-spacing: -.02em;
      color: var(--pend)
    }

    .card.solo .vs {
      font-size: 10px;
      color: var(--faint);
      margin-top: 4px;
      line-height: 1.3
    }

    /* Pontos de cor com significado nas linhas dos cards (no lugar do emoji
       no cabecalho). Escopado em #dash pra nao afetar as outras telas. */
    #dash .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      display: inline-block;
      margin-right: 7px;
      vertical-align: middle;
      flex: none
    }
    #dash .dot.g { background: var(--recebido) }
    #dash .dot.a { background: var(--pend) }
    #dash .dot.b { background: var(--feito) }

    /* Icone de linha nos estados vazios (no lugar do emoji), em qualquer tela */
    .empty .em-ic svg {
      width: 26px;
      height: 26px;
      color: var(--teal)
    }

    /* ---- Big charts ---- */
    .bigcharts {
      display: grid;
      grid-template-columns: 1fr;
      gap: 12px
    }

    @media(min-width:600px) {
      .bigcharts {
        grid-template-columns: 1fr 1fr
      }
    }

    .bigchart {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 18px;
      padding: 16px 14px 12px;
      box-shadow: var(--shadow)
    }

    .bigchart .bc-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 2px;
      padding: 0 2px
    }

    .bigchart .bc-title {
      font-size: 13.5px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 8px
    }

    .bigchart .bc-tot {
      font-family: 'Sora';
      font-weight: 800;
      font-size: 16px
    }

    .bigchart .bc-sub {
      font-size: 11px;
      color: var(--faint);
      padding: 0 2px;
      margin-top: 1px
    }

    .bars {
      display: flex;
      align-items: flex-end;
      gap: 6px;
      height: 160px;
      padding: 10px 2px 0;
      position: relative
    }

    .bars::before {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: 34px;
      height: 1px;
      background: var(--line)
    }

    .bcol {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 7px;
      min-width: 0;
      cursor: pointer;
      position: relative;
      z-index: 1;
      height: 100%;
      justify-content: flex-end
    }

    .btrack {
      width: 100%;
      height: 112px;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      flex: none
    }

    .bar {
      width: 74%;
      max-width: 28px;
      border-radius: 6px 6px 2px 2px;
      transition: height .55s cubic-bezier(.2, .8, .2, 1);
      min-height: 4px;
      opacity: .6
    }

    .bar.feito {
      background: linear-gradient(180deg, var(--feito), #6AA6EE)
    }

    .bar.recebido {
      background: linear-gradient(180deg, var(--recebido), #4ECB91)
    }

    .bar.recebido.partial {
      background: repeating-linear-gradient(135deg, var(--recebido), var(--recebido) 5px, #a9e0c6 5px, #a9e0c6 10px)
    }

    .bcol.cur .bar {
      opacity: 1;
      transform: scaleX(1.15)
    }

    .bcol.cur .bar.feito {
      box-shadow: 0 0 0 3px var(--feito-soft)
    }

    .bcol.cur .bar.recebido {
      box-shadow: 0 0 0 3px var(--recebido-soft)
    }

    .blbl {
      font-size: 10px;
      color: var(--faint);
      font-weight: 700;
      text-transform: capitalize;
      flex: none
    }

    .bcol.cur .blbl {
      color: var(--ink)
    }

    .bval {
      font-size: 9.5px;
      font-weight: 700;
      font-family: 'Sora';
      height: 12px;
      color: var(--muted);
      flex: none
    }

    /* ---- List ---- */
    .list {
      display: flex;
      flex-direction: column;
      gap: 9px
    }

    .item {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 12px 14px;
      display: flex;
      align-items: center;
      gap: 13px;
      box-shadow: var(--shadow);
      cursor: pointer;
      transition: background .15s, box-shadow .15s, border-color .15s, transform .12s
    }


    .item:active {
      transform: scale(.99)
    }

    .ic svg { width: 20px; height: 20px; }
    .ic {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      flex: none;
      display: grid;
      place-items: center;
      font-family: 'Sora';
      font-weight: 700;
      font-size: 14px;
      line-height: 1.05;
      text-align: center
    }

    .item .body {
      flex: 1;
      min-width: 0
    }

    .item .l1 {
      font-weight: 700;
      font-size: 14.5px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .item .l2 {
      font-size: 12.5px;
      color: var(--muted);
      margin-top: 2px;
      display: flex;
      gap: 10px;
      flex-wrap: wrap
    }

    .item .val {
      text-align: right;
      flex: none
    }

    .item .val .v {
      font-family: 'Sora';
      font-weight: 700;
      font-size: 15px
    }

    .badge {
      font-size: 10.5px;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      gap: 4px
    }

    .badge.pago {
      background: var(--recebido-soft);
      color: var(--recebido)
    }

    .badge.aberto {
      background: var(--pend-soft);
      color: var(--pend)
    }

    .badge.parcial {
      background: #FDEFD9;
      color: #B5790F
    }

    .badge.outflow {
      background: var(--feito-soft);
      color: var(--feito)
    }

    .badge.metodo {
      background: var(--bg);
      color: var(--muted);
      border: 1px solid var(--line);
      font-weight: 600
    }

    .badge.tipo {
      background: var(--surface);
      border: 1px solid var(--line);
      font-weight: 700
    }

    .badge.data {
      background: var(--bg);
      color: var(--muted);
      border: 1px solid var(--line);
      font-weight: 600
    }

    .item .l2-txt {
      color: var(--muted);
      font-weight: 600
    }

    .item .l2-meta {
      margin-top: 5px
    }

    /* ---- Escolha do tipo de lançamento ----
       Lista de linhas em vez de grade: alvo de toque cheio na
       largura e leitura em uma passada só no celular. */
    .tipo-list {
      display: flex;
      flex-direction: column;
      gap: 10px
    }

    .tipo-opt {
      display: flex;
      align-items: center;
      gap: 12px;
      width: 100%;
      padding: 13px 14px;
      border-radius: 14px;
      border: 1.5px solid var(--line);
      background: var(--surface);
      box-shadow: var(--shadow-sm);
      text-align: left;
      transition: border-color .16s, box-shadow .16s, transform .12s
    }

    .tipo-opt:hover {
      border-color: var(--teal);
      box-shadow: 0 6px 18px rgba(14, 140, 127, .14)
    }

    .tipo-opt:active {
      transform: scale(.985)
    }

    .tipo-opt .to-ic {
      width: 44px;
      height: 44px;
      border-radius: 13px;
      display: grid;
      place-items: center;
      font-size: 20px;
      line-height: 1;
      flex: none
    }

    .tipo-opt .to-ic svg {
      width: 22px;
      height: 22px
    }

    .tipo-opt .to-body {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px
    }

    .tipo-opt .to-t {
      font-family: 'Sora';
      font-weight: 700;
      font-size: 15px;
      color: var(--ink);
      line-height: 1.2
    }

    .tipo-opt .to-d {
      font-size: 12.5px;
      color: var(--muted);
      line-height: 1.3
    }

    .tipo-opt .to-arrow {
      width: 18px;
      height: 18px;
      color: var(--faint);
      flex: none
    }

    /* ---- Autocomplete (nome do repasse) ---- */
    .suggest-box {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      margin-top: 4px;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 12px;
      box-shadow: var(--shadow);
      z-index: 20;
      max-height: 220px;
      overflow-y: auto;
    }

    .suggest-item {
      display: block;
      width: 100%;
      text-align: left;
      padding: 11px 14px;
      font-size: 14px;
      font-weight: 600;
      color: var(--ink);
      border-bottom: 1px solid var(--line);
      background: var(--surface)
    }

    .suggest-item:last-child {
      border-bottom: none
    }

    .suggest-item:active {
      background: var(--bg)
    }

    .suggest-item.suggest-add {
      color: var(--teal-deep)
    }

    .markpaid-btn {
      flex: none;
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--teal-soft);
      color: var(--teal-deep);
      font-weight: 700;
      font-size: 12px;
      padding: 9px 14px;
      border-radius: 11px;
      border: 1.5px solid rgba(14,140,127,.35);
      white-space: nowrap;
      transition: all 0.18s;
      box-shadow: 0 2px 8px rgba(14,140,127,.1)
    }

    .markpaid-btn:active {
      transform: scale(.96)
    }

    .markpaid-btn svg {
      width: 15px;
      height: 15px
    }

    .markpaid-btn.highlight {
      background: var(--teal);
      color: #fff;
      border: 1px solid var(--teal-deep);
      box-shadow: 0 2px 8px rgba(14,140,127,.25)
    }

    .markpaid-btn.highlight:hover {
      background: var(--teal-deep)
    }

    .markpaid-btn.highlight.outflow {
      background: var(--feito);
      border-color: #1E5FA8;
      box-shadow: 0 2px 8px rgba(44,123,229,.25)
    }

    .markpaid-btn.highlight.outflow:hover {
      background: #1E5FA8
    }

    .listhead {
      display: flex;
      justify-content: space-between;
      padding: 0 2px;
      margin-bottom: 8px
    }

    .listhead span {
      font-size: 11px;
      font-weight: 700;
      color: var(--faint);
      text-transform: uppercase;
      letter-spacing: .04em
    }

    .empty {
      text-align: center;
      padding: 40px 20px;
      color: var(--muted)
    }

    .empty .em-ic {
      width: 56px;
      height: 56px;
      border-radius: 16px;
      background: var(--teal-soft);
      display: grid;
      place-items: center;
      margin: 0 auto 14px;
      font-size: 24px
    }

    .empty h3 {
      font-family: 'Sora';
      font-size: 16px;
      margin-bottom: 6px;
      color: var(--ink)
    }

    .empty p {
      font-size: 13.5px;
      max-width: 300px;
      margin: 0 auto 16px
    }

    .monthhdr {
      font-size: 12px;
      font-weight: 700;
      color: var(--faint);
      text-transform: uppercase;
      letter-spacing: .05em;
      margin: 18px 2px 9px;
      display: flex;
      justify-content: space-between
    }

    .monthhdr .mt {
      color: var(--muted)
    }

    /* ---- Insights ---- */
    .ins-hero {
      background: linear-gradient(150deg, var(--teal) 0%, var(--teal-deep) 100%);
      color: #fff;
      border-radius: 20px;
      padding: 18px 20px;
      box-shadow: 0 14px 34px rgba(11, 110, 99, .3);
      position: relative;
      overflow: hidden
    }

    .ins-hero::after {
      content: "";
      position: absolute;
      right: -30px;
      bottom: -50px;
      width: 160px;
      height: 160px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 70%)
    }

    .ins-hero .ih-k {
      font-size: 12.5px;
      color: rgba(255, 255, 255, 0.85);
      font-weight: 600
    }

    .ins-hero .ih-v {
      font-family: 'Sora';
      font-weight: 800;
      font-size: 26px;
      margin-top: 4px;
      letter-spacing: -.02em;
      color: #fff
    }

    .ins-hero .ih-s {
      font-size: 13px;
      color: rgba(255, 255, 255, 0.7);
      margin-top: 6px
    }

    .histgrid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 12px;
      margin-top: 12px
    }

    @media(min-width:600px) {
      .histgrid {
        grid-template-columns: 1fr 1fr 1fr
      }
    }

    .hist-card {
      background: linear-gradient(150deg, var(--teal) 0%, var(--teal-deep) 100%);
      border-radius: 16px;
      padding: 16px;
      box-shadow: 0 14px 34px rgba(11, 110, 99, .3);
      min-height: 104px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      color: #fff;
      position: relative;
      overflow: hidden
    }

    .hist-card .hk {
      font-size: 12px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 7px;
      color: rgba(255, 255, 255, .85)
    }

    .hist-card .hv {
      font-family: 'Sora';
      font-weight: 800;
      font-size: 23px;
      margin-top: 7px;
      letter-spacing: -.02em;
      color: #fff
    }

    .hist-card .hs {
      font-size: 11px;
      margin-top: 3px;
      color: rgba(255, 255, 255, .7)
    }



    .weekcompare {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 6px;
      font-size: 12px;
      font-weight: 700
    }

    .weekcompare.up {
      color: var(--recebido)
    }

    .weekcompare.down {
      color: #C5733B
    }

    .weekcompare.flat {
      color: var(--faint)
    }

    .donutcard {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 18px;
      padding: 18px;
      box-shadow: var(--shadow);
      margin-top: 12px
    }

    .donutwrap {
      display: flex;
      gap: 18px;
      align-items: center;
      flex-wrap: wrap
    }

    .donut {
      position: relative;
      width: 150px;
      height: 150px;
      flex: none;
      margin: 0 auto
    }

    .donut .ctr {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      text-align: center
    }

    .donut .ctr .ct-k {
      font-size: 10.5px;
      color: var(--muted);
      font-weight: 600
    }

    .donut .ctr .ct-v {
      font-family: 'Sora';
      font-weight: 800;
      font-size: 17px
    }

    .legend {
      flex: 1;
      min-width: 180px;
      display: flex;
      flex-direction: column;
      gap: 9px
    }

    .leg {
      display: flex;
      align-items: center;
      gap: 9px;
      font-size: 13px
    }

    .leg .lc {
      width: 11px;
      height: 11px;
      border-radius: 3px;
      flex: none
    }

    .leg .ln {
      flex: 1;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .leg .lv {
      font-family: 'Sora';
      font-weight: 700
    }

    .leg .lp {
      color: var(--faint);
      font-size: 11.5px;
      font-weight: 600;
      width: 38px;
      text-align: right
    }

    .ins-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      margin-top: 12px
    }

    .ins-card {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 15px;
      box-shadow: var(--shadow)
    }

    .ins-card .ik {
      font-size: 12px;
      color: var(--muted);
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 7px
    }

    .ins-card .iv {
      font-family: 'Sora';
      font-weight: 800;
      font-size: 24px;
      letter-spacing: -.02em;
      margin-top: 8px
    }

    .ins-card .is {
      font-size: 11.5px;
      color: var(--faint);
      margin-top: 4px
    }

    .iemoji {
      font-size: 15px
    }

    /* ---- Bottom nav ---- */
    .tabbar {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 40;
      background: rgba(255, 255, 255, .88);
      backdrop-filter: saturate(180%) blur(18px);
      -webkit-backdrop-filter: saturate(180%) blur(18px);
      border-top: 1px solid var(--line);
      display: flex;
      justify-content: space-around;
      align-items: center;
      padding: 8px 6px calc(8px + env(safe-area-inset-bottom))
    }

    .tab {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      color: var(--faint);
      font-size: 10.5px;
      font-weight: 600;
      flex: 1;
      padding: 4px;
      border-radius: 12px
    }

    .tab svg {
      width: 22px;
      height: 22px
    }

    .tab.on {
      color: var(--teal)
    }

    .fab {
      position: relative;
      top: -20px;
      width: 56px;
      height: 56px;
      border-radius: 18px;
      flex: none;
      background: linear-gradient(150deg, var(--teal), var(--teal-deep));
      color: #fff;
      display: grid;
      place-items: center;
      box-shadow: 0 10px 26px rgba(11, 110, 99, .4);
      transition: transform .18s, box-shadow .18s, filter .15s
    }

    .fab:active {
      transform: scale(.94);
      box-shadow: 0 6px 16px rgba(11, 110, 99, .3)
    }

    .fab svg {
      width: 26px;
      height: 26px
    }

    /* ---- Sheets ---- */
    .scrim {
      position: fixed;
      inset: 0;
      background: rgba(16, 38, 46, .42);
      z-index: 80;
      opacity: 0;
      pointer-events: none;
      transition: opacity .25s
    }

    .scrim.show {
      opacity: 1;
      pointer-events: auto
    }

    .sheet {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 90;
      background: var(--surface);
      border-radius: 24px 24px 0 0;
      box-shadow: var(--shadow-lg);
      transform: translateY(100%);
      transition: transform .32s cubic-bezier(.2, .85, .25, 1), opacity .32s, visibility .32s;
      max-height: 92dvh;
      overflow-y: auto;
      padding-bottom: calc(20px + env(safe-area-inset-bottom));
      pointer-events: none;
      visibility: hidden;
    }

    .sheet.show {
      transform: translateY(0);
      pointer-events: auto;
      visibility: visible;
    }

    /* A alcinha agora é gesto de verdade (arrastar pra baixo fecha), não
       só enfeite. O box-shadow desenha o traço fino de sempre, mas o
       elemento em si é alto o bastante pra ser um alvo de toque. */
    .sheet .grab {
      width: 56px;
      height: 22px;
      margin: 4px auto 0;
      background: transparent;
      border-radius: 0;
      box-shadow: inset 0 9px 0 -7px var(--faint);
      cursor: grab;
      touch-action: none;
    }
    .sheet .grab:active { cursor: grabbing; }

    .sheet .sh-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 6px 20px 14px
    }

    .sheet .sh-head h3 {
      font-family: 'Sora';
      font-size: 18px;
      font-weight: 700
    }

    /* Voltar fica do lado oposto ao fechar: escolher o tipo errado não
       deve obrigar a fechar tudo e recomeçar. Quando a folha foi aberta
       pra editar algo que já existe não há passo anterior, e aí o botão
       fica invisível MAS ocupando o espaço — assim o título não pula de
       posição entre criar e editar. */
    .sheet .x.voltar {
      font-size: 22px;
      line-height: 1;
      padding-bottom: 3px;
    }
    .sheet .x.voltar[hidden] {
      visibility: hidden;
      display: grid;
    }
    .sheet .sh-head:has(.x.voltar) h3 {
      flex: 1;
      text-align: center;
    }

    .sheet .x {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: var(--bg);
      display: grid;
      place-items: center;
      color: var(--muted);
      border: 1px solid var(--line);
      font-size: 13px;
      transition: all .15s
    }

    .form {
      padding: 0 20px;
      display: flex;
      flex-direction: column;
      gap: 15px
    }

    .field label {
      display: block;
      font-size: 12.5px;
      font-weight: 700;
      color: var(--muted);
      margin-bottom: 7px
    }

    .field input,
    .field select {
      width: 100%;
      padding: 13px 14px;
      border: 1.5px solid var(--line);
      border-radius: 12px;
      background: var(--bg);
      color: var(--ink);
      font-weight: 600;
      transition: border-color .15s
    }

    .field input:focus,
    .field select:focus {
      outline: none;
      border-color: var(--teal);
      background: var(--surface)
    }

    .segf {
      display: flex;
      gap: 8px
    }

    .segf button {
      flex: 1;
      padding: 11px 6px;
      border: 1.5px solid var(--line);
      border-radius: 11px;
      background: var(--bg);
      font-weight: 700;
      font-size: 13.5px;
      color: var(--muted);
      transition: all .15s
    }

    .segf button.on {
      border-color: var(--teal);
      background: var(--teal-soft);
      color: var(--teal-deep);
      box-shadow: 0 2px 8px rgba(14,140,127,.15)
    }

    .row2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px
    }

    .btn {
      width: 100%;
      padding: 15px;
      border-radius: 14px;
      /* Borda transparente da mesma espessura da do .btn-sec: sem ela os
         dois ficam com alturas diferentes quando aparecem empilhados,
         porque a borda do secundário soma por fora do padding. */
      border: 1.5px solid transparent;
      background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
      color: #fff;
      font-weight: 700;
      font-size: 15.5px;
      margin-top: 6px;
      box-shadow: 0 8px 20px rgba(11, 110, 99, .28);
      transition: box-shadow .2s, transform .15s, filter .15s;
      letter-spacing: 0.01em
    }

    /* Ação de mesmo peso que o botão principal, mas que não é o caminho
       esperado — "salvar e cadastrar outro" ao lado de "continuar".
       Mesmo tamanho e forma; o que muda é o preenchimento, pra deixar
       claro qual dos dois segue o fluxo. */
    .btn.btn-sec {
      background: var(--surface);
      color: var(--teal-deep);
      border: 1.5px solid var(--teal);
      box-shadow: none;
    }

    .btn:active {
      transform: translateY(1px);
      box-shadow: 0 4px 12px rgba(11, 110, 99, .20);
      filter: brightness(0.97)
    }

    .pay-method-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      padding: 14px 8px;
      border-radius: 14px;
      border: 2px solid var(--line);
      background: var(--bg);
      color: var(--ink);
      font-family: inherit;
      cursor: pointer;
      transition: border-color .15s, background .15s, box-shadow .15s;
    }

    .pay-method-btn:hover {
      border-color: var(--teal);
      background: var(--teal-soft);
    }

    .pay-method-btn.active {
      border-color: var(--teal);
      background: var(--teal-soft);
      box-shadow: 0 0 0 3px rgba(14,140,127,.15);
    }

    .hint {
      font-size: 12px;
      color: var(--faint);
      text-align: center;
      margin-top: 2px
    }

    .del-row {
      display: flex;
      justify-content: center;
      padding: 10px 20px 0
    }

    .del-row button {
      color: #C53B3B;
      font-weight: 700;
      font-size: 13.5px;
      padding: 9px 20px;
      border-radius: 10px;
      border: 1.5px solid rgba(197,59,59,.2);
      background: rgba(197,59,59,.04);
      transition: all .15s
    }

    /* Aviso de alterações na fila de sincronização. Discreto de propósito:
       o dado JÁ está salvo no aparelho, então isso é informação, não erro.
       Fica acima da barra de abas pra não cobrir a navegação. */
    .sync-aviso {
      position: fixed;
      left: 50%;
      transform: translateX(-50%);
      bottom: calc(86px + env(safe-area-inset-bottom));
      z-index: 70;
      display: flex;
      align-items: center;
      gap: 9px;
      max-width: calc(100vw - 32px);
      padding: 10px 15px;
      border-radius: 999px;
      background: var(--pend-soft);
      color: var(--pend);
      border: 1px solid rgba(169,103,10,.22);
      box-shadow: var(--shadow);
      font-size: 12.5px;
      font-weight: 600;
      line-height: 1.35;
    }
    .sync-aviso svg { width: 15px; height: 15px; flex: none; }

    @media (min-width: 900px) {
      .sync-aviso { bottom: 24px; left: auto; right: 24px; transform: none; }
    }

    /* Seleção de plano na tela de pagamento: dropdown no padrão do site, no
       lugar do <select> nativo — que abre uma lista do sistema, fora do
       design. Fechado mostra só o plano escolhido; abre a lista ao tocar. */
    .plano-dd { position: relative; margin-top: 10px; }
    .plano-dd-trigger {
      display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
      padding: 13px 15px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg);
      transition: border-color .15s;
    }
    .plano-dd-trigger:hover, .plano-dd.open .plano-dd-trigger { border-color: var(--teal); }
    .plano-dd-seta { flex: none; color: var(--muted); display: grid; place-items: center; transition: transform .2s; }
    .plano-dd.open .plano-dd-seta { transform: rotate(180deg); }
    /* Fechado: a lista some. Aberta: as opções aparecem NO FLUXO da página,
       empurrando o conteúdo abaixo — não flutuando dentro do card, que é
       pequeno e cortava as opções. Assim dá para ver e rolar tudo. */
    .plano-dd .plano-opcoes { display: none; margin-top: 10px; }
    .plano-dd.open .plano-opcoes { display: flex; }

    .plano-opcoes { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
    .plano-opt {
      display: flex; align-items: center; gap: 12px;
      width: 100%; text-align: left; cursor: pointer;
      padding: 13px 15px; border-radius: 14px;
      border: 1.5px solid var(--line); background: var(--bg);
      transition: border-color .15s, background .15s;
    }
    .plano-opt:hover { border-color: var(--teal); }
    .plano-opt .po-radio {
      width: 20px; height: 20px; border-radius: 50%; flex: none;
      border: 2px solid var(--line); display: grid; place-items: center;
      transition: border-color .15s;
    }
    .plano-opt .po-radio::after {
      content: ""; width: 10px; height: 10px; border-radius: 50%;
      background: var(--teal); transform: scale(0); transition: transform .15s;
    }
    /* Estes valem tanto nos cards da lista quanto no cabeçalho fechado do
       dropdown (.plano-dd-trigger) — sem o trigger na lista de seletores o
       cabeçalho ficava sem estilo: nome e preço pequenos, finos e o valor
       sem ir para a direita. */
    .plano-opt .po-info, .plano-dd-trigger .po-info { flex: 1; min-width: 0; }
    .plano-opt .po-nome, .plano-dd-trigger .po-nome { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 14.5px; color: var(--ink); display: flex; align-items: center; }
    .plano-opt .po-permes, .plano-dd-trigger .po-permes { font-size: 12px; color: var(--muted); margin-top: 2px; }
    .plano-opt .po-permes b, .plano-dd-trigger .po-permes b { color: var(--teal-deep); font-weight: 700; }
    .plano-opt .po-valor, .plano-dd-trigger .po-valor { text-align: right; flex: none; }
    .plano-opt .po-total, .plano-dd-trigger .po-total { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 15.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
    .plano-opt .po-periodo, .plano-dd-trigger .po-periodo { font-size: 11px; color: var(--muted); margin-top: 1px; }
    .plano-opt .po-badge, .plano-dd-trigger .po-badge {
      font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
      color: var(--teal-deep); background: var(--teal-soft);
      padding: 2px 7px; border-radius: 100px; margin-left: 7px; white-space: nowrap;
    }
    /* Selecionado */
    .plano-opt.sel { border-color: var(--teal); background: var(--teal-soft); }
    .plano-opt.sel .po-radio { border-color: var(--teal); }
    .plano-opt.sel .po-radio::after { transform: scale(1); }

    /* Leitura de escala por foto/PDF */
    .esc-drop {
      display: flex; flex-direction: column; align-items: center; gap: 6px;
      padding: 26px 16px; border: 2px dashed var(--teal); border-radius: 16px;
      background: var(--teal-soft); cursor: pointer; text-align: center;
      transition: background .15s;
    }
    .esc-drop:hover { background: color-mix(in srgb, var(--teal) 14%, transparent); }
    /* Anexos aguardando extração */
    .esc-anexo { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
    .esc-anexo-ic { font-size: 18px; flex: none; }
    .esc-anexo-nome { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .esc-anexo-x { flex: none; color: var(--faint); font-size: 15px; padding: 2px 6px; line-height: 1; }

    /* Item de revisão: mesmos campos do cadastro manual, com etiquetas */
    .esc-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--bg); display: flex; flex-direction: column; gap: 11px; }
    .esc-item-top { display: flex; align-items: center; gap: 9px; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 14px; color: var(--ink); cursor: pointer; }
    .esc-item-top input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--teal); }
    /* Pisca o plantão que está barrando o cadastro, para não caçar no meio da lista */
    .esc-item.esc-piscando { animation: escPisca 1.6s ease-out; }
    @keyframes escPisca {
      0%, 100% { border-color: var(--line); box-shadow: none; }
      15%, 55% { border-color: var(--pend); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pend) 22%, transparent); }
    }
    .esc-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
    .esc-f > label { font-size: 10px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
    .esc-f input[type="text"], .esc-f input[type="date"] {
      width: 100%; padding: 9px 11px; font-size: 13px; border: 1.5px solid var(--line); border-radius: 10px;
      background: var(--surface); color: var(--ink); font-weight: 600; font-family: inherit;
    }
    .esc-f .esc-valor { text-align: right; font-weight: 700; }
    .esc-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
    .esc-row3 { display: grid; grid-template-columns: 72px 1fr 1fr; gap: 9px; }
    .esc-hosp-wrap { position: relative; }
    .esc-turno { display: flex; gap: 4px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 3px; height: 37px; }
    .esc-turno button { flex: 1; font-size: 15px; border-radius: 7px; background: transparent; }
    .esc-turno button.on { background: var(--teal-soft); }
    .esc-aviso { font-size: 11.5px; color: var(--pend); line-height: 1.45; }
    /* Checkboxes "já recebi" / "repasse" / "já paguei": mesmo visual do
       formulário manual (checkbox + rótulo numa linha). */
    .esc-check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
    .esc-check input[type="checkbox"] { width: 19px; height: 19px; flex: none; }
    .esc-repasse { display: none; flex-direction: column; gap: 9px; border-top: 1px dashed var(--line); padding-top: 11px; margin-top: 2px; }
    .esc-repasse select { width: 100%; padding: 9px 11px; font-size: 13px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 600; }
    /* Card em destaque no grid de tipos (o recurso novo). */
    .tipo-opt.tipo-opt--ia { border: 1.5px solid var(--teal); background: var(--teal-soft); }

    /* Aviso de vencimento próximo: card pequeno que aparece sozinho e some
       em 10s. Mesma régua do .sync-aviso (acima da tabbar no celular, canto
       inferior no desktop) pra os dois nunca disputarem o mesmo espaço. */
    .aviso-venc {
      position: fixed;
      left: 50%;
      transform: translateX(-50%) translateY(12px);
      bottom: calc(86px + env(safe-area-inset-bottom));
      z-index: 90;
      width: calc(100vw - 32px);
      max-width: 360px;
      padding: 12px 14px;
      border-radius: 14px;
      background: var(--surface);
      border: 1.5px solid var(--pend);
      box-shadow: var(--shadow);
      opacity: 0;
      pointer-events: none;
      transition: opacity .26s ease, transform .26s ease;
    }
    .aviso-venc.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
    .aviso-venc .av-top { display: flex; align-items: flex-start; gap: 8px; }
    .aviso-venc .av-t { font-size: 11px; font-weight: 700; color: var(--pend); text-transform: uppercase; letter-spacing: .04em; }
    /* Tabular pra a contagem não tremer a cada segundo. */
    .aviso-venc .av-c { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 800; color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
    .aviso-venc .av-s { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
    .aviso-venc .av-x { margin-left: auto; color: var(--faint); font-size: 15px; line-height: 1; padding: 2px 4px; flex: none; }
    .aviso-venc .av-btn {
      width: 100%; margin-top: 10px; padding: 9px 12px; border-radius: 10px;
      background: var(--pend); color: #fff; font-size: 12.5px; font-weight: 700;
    }

    @media (min-width: 900px) {
      .aviso-venc { bottom: 24px; left: auto; right: 24px; transform: translateY(12px); }
      .aviso-venc.show { transform: translateY(0); }
    }

    /* Seletor de dias da semana da recorrência. Alvo de 44px de altura
       porque é o controle mais tocado do formulário depois da data. */
    .repete-dias {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 5px;
    }
    .repete-dias button {
      height: 44px;
      border-radius: 11px;
      border: 1.5px solid var(--line);
      background: var(--surface);
      color: var(--muted);
      font-weight: 700;
      font-size: 13.5px;
      transition: background .15s, border-color .15s, color .15s;
    }
    .repete-dias button.on {
      background: var(--teal-soft);
      border-color: var(--teal);
      color: var(--teal-deep);
    }

    /* Botões da folha de pergunta — substituem os confirm() do navegador,
       que no app instalado apareciam com o endereço do site no topo e não
       deixavam destacar o que estava sendo apagado. */
    .pergunta-btn {
      width: 100%;
      padding: 14px 16px;
      border-radius: 13px;
      font-weight: 700;
      font-size: 14.5px;
      text-align: left;
      border: 1.5px solid var(--line);
      background: var(--surface);
      color: var(--ink);
      transition: background .15s, border-color .15s;
    }
    .pergunta-btn .sub {
      display: block;
      font-weight: 500;
      font-size: 12.5px;
      color: var(--muted);
      margin-top: 3px;
    }
    .pergunta-btn.primario {
      background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
      color: #fff;
      border-color: transparent;
      text-align: center;
    }
    .pergunta-btn.primario .sub { color: rgba(255,255,255,.85); }
    .pergunta-btn.perigo {
      color: #C53B3B;
      border-color: rgba(197,59,59,.28);
      background: rgba(197,59,59,.04);
    }
    .pergunta-btn.perigo .sub { color: rgba(197,59,59,.75); }
    .pergunta-btn.neutro { text-align: center; color: var(--muted); }

    .toast {
      position: fixed;
      left: 50%;
      bottom: 96px;
      transform: translateX(-50%) translateY(20px);
      z-index: 100;
      background: var(--ink);
      color: #fff;
      padding: 12px 20px;
      border-radius: 16px;
      font-size: 13.5px;
      font-weight: 600;
      line-height: 1.4;
      text-align: center;
      opacity: 0;
      pointer-events: none;
      transition: .3s;
      box-shadow: var(--shadow-lg);
      max-width: min(88vw, 420px)
    }

    .toast.show {
      opacity: 1;
      pointer-events: auto;
      transform: translateX(-50%) translateY(0)
    }

    .set-card {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 14px;
      box-shadow: var(--shadow);
      overflow: hidden
    }

    /* ---- Preferências da Cora (cora-prefs.js) ---- */
    .cora-cards { display: flex; flex-direction: column; gap: 10px; }
    .cora-card {
      display: flex; align-items: center; gap: 12px;
      padding: 13px 14px; border-radius: 13px;
      border: 1.5px solid var(--line); background: var(--bg);
      transition: border-color .18s, background .18s;
    }
    .cora-card.on { border-color: var(--teal); background: var(--teal-soft); }
    .cora-ic {
      flex: none; width: 38px; height: 38px; border-radius: 10px;
      display: grid; place-items: center;
      background: var(--surface); color: var(--faint);
      transition: background .18s, color .18s;
    }
    .cora-card.on .cora-ic { background: var(--teal); color: #fff; }
    .cora-ic svg { width: 20px; height: 20px; }
    .cora-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
    .cora-t { font-size: 14px; font-weight: 700; color: var(--ink); }
    .cora-d { font-size: 12px; color: var(--muted); line-height: 1.4; }
    /* Switch */
    .cora-switch {
      flex: none; width: 46px; height: 27px; border-radius: 999px;
      border: none; background: var(--line); cursor: pointer; padding: 0;
      position: relative; transition: background .2s;
    }
    .cora-switch.on { background: var(--teal); }
    .cora-knob {
      position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
      border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
      transition: transform .2s;
    }
    .cora-switch.on .cora-knob { transform: translateX(19px); }
    .cora-switch:focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 2px; }

    .set-row {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 15px 16px;
      border-bottom: 1px solid var(--line)
    }

    .set-row:last-child {
      border-bottom: none
    }

    .set-row .si {
      width: 38px;
      height: 38px;
      border-radius: 11px;
      background: var(--teal-soft);
      display: grid;
      place-items: center;
      flex: none
    }

    .set-row .st {
      font-weight: 700;
      font-size: 14px
    }

    .set-row .sd {
      font-size: 12px;
      color: var(--muted)
    }

    /* ---- Confirm sheet ---- */
    .confirm-box {
      padding: 8px 24px 4px;
      text-align: center
    }

    .confirm-ic {
      width: 54px;
      height: 54px;
      border-radius: 16px;
      background: var(--recebido-soft);
      display: grid;
      place-items: center;
      margin: 0 auto 16px;
      font-size: 24px
    }

    .confirm-box h4 {
      font-family: 'Sora';
      font-size: 17px;
      font-weight: 700;
      margin-bottom: 8px
    }

    .confirm-box p {
      font-size: 13.5px;
      color: var(--muted);
      line-height: 1.5;
      margin-bottom: 4px
    }

    .confirm-box .cval {
      font-family: 'Sora';
      font-weight: 800;
      font-size: 22px;
      color: var(--recebido);
      margin: 10px 0 2px
    }

    .confirm-actions {
      display: flex;
      gap: 10px;
      padding: 18px 20px 4px
    }

    .confirm-actions button {
      flex: 1;
      padding: 14px;
      border-radius: 13px;
      font-weight: 700;
      font-size: 14.5px;
      transition: all .15s
    }

    .confirm-actions .cancel {
      background: var(--bg);
      color: var(--muted);
      border: 1.5px solid var(--line)
    }

    .confirm-actions .confirm {
      background: linear-gradient(135deg, var(--recebido), #0B6540);
      color: #fff;
      box-shadow: 0 8px 20px rgba(14, 122, 74, .3)
    }

    .confirm-actions .confirm:active {
      transform: translateY(1px)
    }

    /* ---- Support FAB ---- */
    .support-fab {
      position: fixed;
      right: 18px;
      bottom: calc(86px + env(safe-area-inset-bottom));
      z-index: 50;
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: var(--teal-deep);
      color: #fff;
      display: grid;
      place-items: center;
      box-shadow: 0 10px 24px rgba(11, 110, 99, .38);
      transition: transform .2s
    }

    .support-fab:active {
      transform: scale(.92)
    }

    .support-fab svg {
      width: 23px;
      height: 23px
    }

    .support-fab .ping {
      position: absolute;
      top: -3px;
      right: -3px;
      width: 13px;
      height: 13px;
      border-radius: 50%;
      background: #E5556E;
      border: 2px solid #fff
    }

    @media(min-width:900px) {
      .support-fab {
        bottom: 26px;
        right: 26px
      }
    }

    /* ---- Tour FAB (botão suspenso de tutorial) ----
       Só no site: no app o tutorial mora no topbar, ao lado do perfil. */
    .tour-fab {
      display: none;
      position: fixed;
      right: 26px;
      bottom: 88px;
      z-index: 50;
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--muted);
      place-items: center;
      box-shadow: var(--shadow);
      transition: transform .2s
    }

    .tour-fab:active {
      transform: scale(.92)
    }

    .tour-fab svg {
      width: 23px;
      height: 23px
    }

    @media(min-width:900px) {
      .tour-fab {
        display: grid
      }
    }

    /* ---- Tour (botão no topbar, mobile) ---- */
    .tour-btn {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--surface);
      border: 1px solid var(--line);
      display: grid;
      place-items: center;
      color: var(--muted);
      box-shadow: var(--shadow)
    }

    .tour-btn svg {
      width: 19px;
      height: 19px
    }

    .support-box {
      padding: 6px 22px 4px
    }

    .support-box .sup-ic {
      width: 52px;
      height: 52px;
      border-radius: 16px;
      background: var(--teal-soft);
      display: grid;
      place-items: center;
      margin: 0 auto 14px;
      font-size: 23px
    }

    .support-box h4 {
      font-family: 'Sora';
      font-size: 17px;
      font-weight: 700;
      text-align: center;
      margin-bottom: 6px
    }

    .support-box p {
      font-size: 13px;
      color: var(--muted);
      text-align: center;
      margin-bottom: 18px;
      line-height: 1.5
    }

    .sup-opt {
      display: flex;
      align-items: center;
      gap: 13px;
      padding: 14px;
      border-radius: 14px;
      border: 1.5px solid var(--line);
      margin-bottom: 10px;
      text-align: left;
      text-decoration: none;
      color: inherit
    }

    .sup-opt:hover {
      border-color: var(--teal)
    }

    .sup-opt .soi {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      display: grid;
      place-items: center;
      flex: none;
      font-size: 18px
    }

    .sup-opt .sob {
      flex: 1
    }

    .sup-opt .sot {
      font-weight: 700;
      font-size: 14px
    }

    .sup-opt .sod {
      font-size: 12px;
      color: var(--muted);
      margin-top: 1px
    }

    .sup-opt .soa {
      color: var(--faint);
      font-size: 16px
    }

    /* ---- Tour / Onboarding ---- */
    .tour-scrim {
      position: fixed;
      inset: 0;
      z-index: 200;
      display: none;
      pointer-events: none
    }

    .tour-scrim.show {
      display: block
    }

    .tour-veil {
      position: absolute;
      inset: 0;
      background: transparent;
      transition: background .2s;
      pointer-events: auto
    }

    .tour-card {
      position: absolute;
      z-index: 201;
      background: var(--surface);
      border-radius: 18px;
      box-shadow: var(--shadow-lg);
      width: 280px;
      max-width: 86vw;
      padding: 18px 18px 16px;
      pointer-events: auto;
      transition: top .35s cubic-bezier(.4, 0, .2, 1), left .35s cubic-bezier(.4, 0, .2, 1);
      opacity: 0
    }

    .tour-card.show {
      opacity: 1
    }

    .tour-card .tc-eyebrow {
      font-size: 11px;
      font-weight: 700;
      color: var(--teal);
      text-transform: uppercase;
      letter-spacing: .04em;
      display: flex;
      align-items: center;
      gap: 6px
    }

    .tour-card .tc-title {
      font-family: 'Sora';
      font-weight: 700;
      font-size: 16px;
      margin-top: 6px;
      color: var(--ink)
    }

    .tour-card .tc-body {
      font-size: 13px;
      color: var(--muted);
      line-height: 1.5;
      margin-top: 7px
    }

    .tour-card .tc-foot {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 16px
    }

    .tour-dots {
      display: flex;
      gap: 5px
    }

    .tour-dots span {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--line)
    }

    .tour-dots span.on {
      background: var(--teal);
      width: 16px;
      border-radius: 3px;
      transition: .25s
    }

    .tour-actions {
      display: flex;
      gap: 8px;
      align-items: center
    }

    .tour-close {
      position: absolute;
      top: 14px;
      right: 14px;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: var(--bg);
      color: var(--muted);
      display: grid;
      place-items: center;
      font-size: 14px;
      z-index: 5
    }

    .tour-close:hover {
      background: var(--line);
      color: var(--ink)
    }

    .tour-skip {
      font-size: 12.5px;
      font-weight: 600;
      color: var(--faint);
      padding: 8px 4px
    }

    .tour-next {
      background: var(--teal);
      color: #fff;
      font-weight: 700;
      font-size: 13px;
      padding: 9px 16px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      gap: 5px;
      box-shadow: 0 6px 16px rgba(11, 110, 99, .28)
    }

    .tour-next svg {
      width: 14px;
      height: 14px
    }

    .tour-spot-ring {
      position: absolute;
      z-index: 201;
      border-radius: 16px;
      border: 2.5px solid var(--teal);
      pointer-events: none;
      transition: top .35s cubic-bezier(.4, 0, .2, 1), left .35s cubic-bezier(.4, 0, .2, 1), width .35s, height .35s, box-shadow .25s;
      opacity: 0
    }

    .tour-spot-ring.show {
      opacity: 1
    }

    .tour-center {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      pointer-events: auto
    }

    .tour-intro {
      background: var(--surface);
      border-radius: 22px;
      box-shadow: var(--shadow-lg);
      width: 320px;
      max-width: 88vw;
      padding: 28px 24px;
      text-align: center;
      position: relative
    }

    /* Questionário do primeiro acesso. Mais largo que o cartão do tour
       porque tem formulário dentro, e com altura limitada + rolagem pra
       caber em tela pequena com o teclado aberto. */
    .ob-card {
      background: var(--surface);
      border-radius: 22px;
      box-shadow: var(--shadow-lg);
      width: 380px;
      max-width: 90vw;
      max-height: 88dvh;
      overflow-y: auto;
      padding: 26px 24px 22px;
      text-align: center;
      position: relative;
    }
    .ob-barra {
      display: flex;
      gap: 5px;
      margin-bottom: 20px;
    }
    .ob-barra span {
      flex: 1;
      height: 3px;
      border-radius: 99px;
      background: var(--line);
      transition: background .2s;
    }
    .ob-barra span.on { background: var(--teal); }
    .ob-card .ob-ic {
      width: 58px;
      height: 58px;
      border-radius: 17px;
      background: var(--teal-soft);
      display: grid;
      place-items: center;
      margin: 0 auto 14px;
      font-size: 26px;
    }
    .ob-card .ob-ic svg {
      width: 28px;
      height: 28px;
      color: var(--teal);
    }
    .ob-card h3 {
      font-family: 'Sora';
      font-size: 19px;
      font-weight: 700;
      line-height: 1.25;
    }
    .ob-card .ob-sub {
      font-size: 13.5px;
      color: var(--muted);
      line-height: 1.55;
      margin-top: 8px;
    }
    .ob-card .ob-ja {
      font-size: 12.5px;
      font-weight: 600;
      color: var(--teal-deep);
      background: var(--teal-soft);
      border-radius: 10px;
      padding: 8px 10px;
      margin-top: 12px;
    }
    .ob-campos {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-top: 18px;
      text-align: left;
    }
    .ob-check {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 13.5px;
      font-weight: 600;
      color: var(--muted);
      cursor: pointer;
    }
    .ob-check input {
      width: 20px;
      height: 20px;
      accent-color: var(--teal);
    }
    .ob-acoes { margin-top: 20px; }
    .ob-secundarias {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 10px;
    }
    .ob-link {
      background: none;
      border: none;
      color: var(--muted);
      font-size: 13px;
      font-weight: 600;
      padding: 8px 4px;
      cursor: pointer;
    }

    .tour-intro .ti-ic {
      width: 64px;
      height: 64px;
      border-radius: 18px;
      background: var(--teal-soft);
      display: grid;
      place-items: center;
      margin: 0 auto 16px;
      font-size: 28px
    }

    .tour-intro h3 {
      font-family: 'Sora';
      font-weight: 800;
      font-size: 20px;
      color: var(--ink)
    }

    .tour-intro p {
      font-size: 13.5px;
      color: var(--muted);
      margin-top: 8px;
      line-height: 1.5
    }

    .tour-intro .btn {
      margin-top: 18px
    }

    .tour-intro .skipline {
      display: block;
      text-align: center;
      margin-top: 12px;
      font-size: 12.5px;
      color: var(--faint);
      font-weight: 600
    }

    @media(prefers-reduced-motion:reduce) {

      .tour-card,
      .tour-spot-ring,
      .tour-veil {
        transition: none !important
      }
    }

    /* ---- Desktop ---- */
    @media(min-width:900px) {
      .tabbar {
        display: none
      }

      .sidebar {
        display: flex;
        flex-direction: column;
        width: 240px;
        background: var(--surface);
        border-right: 1px solid var(--line);
        padding: 26px 16px;
        position: sticky;
        top: 0;
        height: 100dvh;
        gap: 4px
      }

      .sidebar .brand {
        padding: 0 10px 26px;
        font-size: 23px
      }

      .snav {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 12px;
        font-weight: 600;
        font-size: 14.5px;
        color: var(--muted)
      }

      .snav svg {
        width: 21px;
        height: 21px
      }

      .snav:hover {
        background: var(--bg);
        color: var(--ink)
      }

      .snav.on {
        background: var(--teal-soft);
        color: var(--teal-deep)
      }

      .snav-add {
        margin-top: 12px;
        background: linear-gradient(135deg, var(--teal), var(--teal-deep));
        color: #fff;
        justify-content: center;
        box-shadow: 0 8px 20px rgba(11, 110, 99, .28);
        font-weight: 700;
        transition: box-shadow .2s, filter .15s
      }

      .snav-add:hover {
        background: linear-gradient(135deg, var(--teal), var(--teal-deep));
        color: #fff;
        box-shadow: 0 12px 28px rgba(11, 110, 99, .4);
        filter: brightness(1.06)
      }

      .sidebar-profile {
        display: none;
        align-items: center;
        padding: 10px;
        border-radius: 14px;
        background: var(--bg);
        border: 1.5px solid var(--line);
        cursor: pointer;
        transition: all .2s;
        margin-top: auto
      }

      .sidebar-profile:hover {
        background: var(--teal-soft);
        border-color: var(--teal)
      }

      .main {
        padding-bottom: 40px
      }

      .topbar {
        display: none
      }

      /* Largura fluida no desktop: preenche a área toda entre a barra lateral
         e a borda, em qualquer tamanho de tela, só com um respiro nas laterais.
         (Ajustes é a exceção — #view-ajustes .wrap fica contido lá em cima.) */
      .wrap,
      .topbar .wrap2 {
        max-width: none;
        padding-left: 32px;
        padding-right: 32px;
      }

      .dashtop {
        display: grid;
        grid-template-columns: 1.05fr .95fr;
        gap: 14px;
        align-items: start
      }

      .sheet {
        left: 50%;
        right: auto;
        bottom: auto;
        top: 50%;
        transform: translate(-50%, -46%) scale(.98);
        width: 460px;
        border-radius: 22px;
        max-height: 88dvh;
        opacity: 0;
        transition: transform .28s, opacity .28s, visibility .28s
      }

      .sheet.show {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1
      }

      .sheet .grab {
        display: none
      }

      .toast {
        bottom: 30px
      }

      .mobileonly {
        display: none !important
      }

      .statgrid {
        grid-template-columns: 1fr 1fr 1fr
      }

      .card {
        min-height: 148px;
        padding: 18px
      }

      .card.hero {
        grid-column: span 1;
        min-height: 148px;
        padding: 18px
      }

      .card.hero .cbody {
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        margin-top: 0
      }

      .card .big {
        font-size: 32px
      }

      .card.hero .pill {
        margin-top: 10px;
        padding: 6px 12px
      }

      .split .row {
        flex-direction: row;
        justify-content: space-between;
        align-items: baseline;
        padding: 7px 0
      }

      .split .rl {
        font-size: 12.5px
      }

      .split .rv {
        font-size: 19px
      }

      .card.solo .v {
        font-size: 28px
      }

      .card.solo .vs {
        font-size: 11.5px;
        margin-top: 6px
      }
    }

    /* ---- Spreadsheet view styles ---- */
    .view-toggle {
      display: inline-flex;
      background: var(--line);
      padding: 3px;
      border-radius: 12px;
      margin-bottom: 18px;
      border: 1px solid var(--line);
      align-self: flex-start;
    }

    .view-toggle .toggle-btn {
      padding: 7px 18px;
      border-radius: 9px;
      font-weight: 700;
      font-size: 13px;
      color: var(--muted);
      transition: all .2s;
    }

    .view-toggle .toggle-btn.active {
      background: var(--surface);
      color: var(--teal-deep);
      box-shadow: var(--shadow);
    }

    /* Planilha é recurso de computador — no mobile só existe Lista e
       Calendário, mas o toggle continua visível (era só o ícone apagado
       no canto, difícil de notar). !important necessário porque
       setPlantaoView() aplica style.display inline via JS, que teria
       prioridade sobre uma regra normal de classe/id. */
    @media (max-width: 899px) {
      #btn-view-tabela { display: none !important; }
      #plantoes-tabela-view { display: none !important; }
      /* No celular quem cria lançamento é o botão flutuante — o link no
         título ficaria repetindo a mesma ação a poucos pixels dele. */
      .pl-add-btn { display: none !important; }
    }

    .table-actions {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      margin-bottom: 12px;
      flex-wrap: wrap;
    }

    .search-box {
      position: relative;
      flex: 1;
      min-width: 220px;
    }

    .search-box input {
      width: 100%;
      padding: 11px 14px 11px 38px;
      border: 1.5px solid var(--line);
      border-radius: 12px;
      background: var(--surface);
      color: var(--ink);
      /* 16px é o mínimo que evita o Safari do iPhone dar zoom sozinho
         ao focar o campo — abaixo disso a tela "pula" e o usuário
         precisa pinçar de volta. Todos os outros inputs do app já
         estão em 16px; este era o único fora do padrão. */
      font-size: 16px;
      transition: border-color .15s;
      box-shadow: var(--shadow);
    }

    .search-box input:focus {
      outline: none;
      border-color: var(--teal);
      background: var(--surface);
    }

    .search-box svg {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      width: 16px;
      height: 16px;
      color: var(--faint);
      pointer-events: none;
    }

    .btn-export {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 11px 16px;
      background: var(--surface);
      border: 1.5px solid var(--line);
      border-radius: 12px;
      font-weight: 700;
      font-size: 13.5px;
      color: var(--muted);
      box-shadow: var(--shadow);
      transition: all .15s;
    }

    .btn-export:hover {
      border-color: var(--teal);
      color: var(--teal-deep);
      background: var(--teal-soft);
    }

    .btn-export svg {
      width: 16px;
      height: 16px;
    }

    .table-responsive {
      width: 100%;
      overflow-x: auto;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: var(--surface);
      box-shadow: var(--shadow);
      scrollbar-width: thin;
    }

    .plantoes-table {
      width: 100%;
      border-collapse: collapse;
      text-align: left;
      font-size: 13.5px;
    }

    .plantoes-table th,
    .plantoes-table td {
      padding: 13px 16px;
      border-bottom: 1px solid var(--line);
      white-space: nowrap;
    }

    .plantoes-table th {
      background: var(--bg);
      font-weight: 700;
      color: var(--muted);
      cursor: pointer;
      user-select: none;
      transition: background .15s;
    }

    .plantoes-table th:hover {
      background: var(--line);
      color: var(--ink);
    }

    .plantoes-table th .sort-dir {
      display: inline-block;
      margin-left: 4px;
      font-size: 10px;
      color: var(--teal);
    }

    .plantoes-table tr:last-child td {
      border-bottom: none;
    }

    .plantoes-table tbody tr {
      cursor: pointer;
      transition: background .15s;
    }

    .plantoes-table tbody tr:hover {
      background: var(--teal-soft);
    }

    .plantoes-table .tbl-actions {
      display: flex;
      gap: 8px;
    }

    .plantoes-table .tbl-btn {
      padding: 5px 9px;
      border-radius: 8px;
      font-size: 11.5px;
      font-weight: 700;
      border: 1.5px solid var(--line);
      background: var(--surface);
      transition: all .15s;
    }

    .plantoes-table .tbl-btn:hover {
      background: var(--bg);
    }

    .plantoes-table .tbl-btn.pay {
      border-color: rgba(14,140,127,.35);
      color: var(--teal-deep);
      background: var(--teal-soft);
    }

    .plantoes-table .tbl-btn.pay:hover {
      background: rgba(14,140,127,.18);
    }

    @media(max-width: 768px) {
      .hide-mobile {
        display: none !important;
      }

      #view-plantoes .wrap {
        padding: 0 8px !important;
      }

      .plantoes-table th,
      .plantoes-table td {
        padding: 10px 6px !important;
        font-size: 12px !important;
      }

      .plantoes-table th .sort-dir {
        margin-left: 2px !important;
        font-size: 9px !important;
      }

      .plantoes-table .tbl-actions {
        gap: 4px !important;
      }

      .plantoes-table .tbl-btn {
        padding: 4px 6px !important;
        font-size: 11px !important;
        border-radius: 6px !important;
      }
    }

    /* ============================================================
       MOBILE LAYOUT — compact view for phones (≤ 430px)
    ============================================================ */
    @media (max-width: 430px) {
      .wrap {
        padding: 0 12px
      }

      .topbar {
        padding: calc(env(safe-area-inset-top) + 10px) 14px 6px
      }

      h2.title {
        font-size: 14px;
        margin: 16px 0 9px
      }

      .statgrid {
        gap: 9px
      }

      .card {
        padding: 12px;
        min-height: 100px
      }

      .card.hero {
        min-height: 88px;
        padding: 10px 14px
      }

      .card .big {
        font-size: 21px
      }

      .card .ck {
        font-size: 11.5px
      }

      .mchip {
        padding: 7px 11px;
        font-size: 12px
      }

      .bigchart {
        padding: 14px 12px 10px
      }

      .bigchart .bc-title {
        font-size: 12.5px
      }

      .bigchart .bc-tot {
        font-size: 14px
      }

      .item {
        padding: 10px 12px;
        gap: 10px
      }

      .ic {
        width: 38px;
        height: 38px;
        border-radius: 11px;
        font-size: 13px
      }

      .item .l1 {
        font-size: 13.5px
      }

      .item .l2 {
        font-size: 11.5px
      }

      .empty {
        padding: 30px 16px
      }

      .empty h3 {
        font-size: 15px
      }

      .empty p {
        font-size: 13px
      }
    }

    @media(prefers-reduced-motion:reduce) {
      * {
        animation: none !important;
        transition: none !important
      }
    }
    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    #pBtnAddDate {
      display: flex !important;
      align-items: center;
      justify-content: center;
      gap: 8px;
      background: var(--teal-soft) !important;
      color: var(--teal-deep) !important;
      border: 2px solid var(--teal) !important;
      padding: 13px 18px !important;
      border-radius: 12px !important;
      font-size: 14px !important;
      font-weight: 700 !important;
      cursor: pointer;
      width: 100%;
      box-sizing: border-box;
      transition: all 0.18s ease;
      margin-top: 10px;
      box-shadow: 0 2px 8px rgba(14, 140, 127, 0.15);
      letter-spacing: 0.01em;
    }
    #pBtnAddDate:active {
      transform: scale(0.97);
      box-shadow: none;
    }

    /* Date input fields inside multi-date container */
    .p-data-input {
      flex: 1;
      padding: 11px 12px;
      border: 1.5px solid var(--line);
      border-radius: 10px;
      background: var(--bg);
      color: var(--ink);
      font-weight: 600;
      font-size: 15px;
      font-family: inherit;
      transition: border-color .15s;
    }
    .p-data-input:focus {
      outline: none;
      border-color: var(--teal);
      background: var(--surface);
    }

    /* Remove date button */
    .btn-del-date {
      color: var(--faint);
      font-size: 14px;
      width: 44px;
      height: 44px;
      min-width: 44px;
      display: grid;
      place-items: center;
      border: 1.5px solid var(--line) !important;
      border-radius: 50%;
      background: var(--surface) !important;
      cursor: pointer;
      transition: all .15s;
    }
    .btn-del-date:active {
      color: #C53B3B;
      border-color: rgba(197,59,59,.4) !important;
      background: rgba(197,59,59,.08) !important;
      transform: scale(.92);
    }

    /* ============================================================
       HOVER EFFECTS — pointer devices only (no sticky on touch)
    ============================================================ */
    @media (hover: hover) and (pointer: fine) {
      .item:hover {
        border-color: rgba(14,140,127,.22);
        box-shadow: 0 4px 18px rgba(14,140,127,.10);
        background: rgba(14,140,127,.04)
      }
      h2.title .link:hover {
        background: rgba(14,140,127,.18);
        border-color: var(--teal)
      }
      .btn:hover {
        box-shadow: 0 12px 28px rgba(11, 110, 99, .38);
        filter: brightness(1.06)
      }
      .fab:hover {
        transform: scale(1.06);
        box-shadow: 0 14px 32px rgba(11, 110, 99, .5);
        filter: brightness(1.07)
      }
      .sheet .x:hover {
        background: var(--line);
        color: var(--ink)
      }
      .confirm-actions .cancel:hover {
        background: var(--line);
        color: var(--ink)
      }
      .confirm-actions .confirm:hover {
        box-shadow: 0 12px 28px rgba(14, 122, 74, .42);
        filter: brightness(1.05)
      }
      .markpaid-btn:hover {
        background: rgba(14,140,127,.18);
        border-color: var(--teal);
        box-shadow: 0 4px 14px rgba(14,140,127,.22)
      }
      .segf button:hover {
        border-color: rgba(14,140,127,.3);
        color: var(--ink)
      }
      .del-row button:hover {
        background: rgba(197,59,59,.09);
        border-color: rgba(197,59,59,.4)
      }
      #pBtnAddDate:hover {
        background: rgba(14, 140, 127, 0.18) !important;
        box-shadow: 0 4px 16px rgba(14, 140, 127, 0.28);
        border-color: var(--teal-deep) !important;
      }
      .btn-del-date:hover {
        color: #C53B3B;
        border-color: rgba(197,59,59,.3) !important;
        background: rgba(197,59,59,.05) !important;
      }
      .snav-add:hover {
        box-shadow: 0 12px 28px rgba(11, 110, 99, .4);
        filter: brightness(1.06)
      }
      .sup-opt:hover {
        border-color: var(--teal)
      }
      .btn-export:hover {
        border-color: var(--teal);
        color: var(--teal-deep);
        background: var(--teal-soft);
      }
      .plantoes-table tbody tr:hover {
        background: var(--teal-soft);
      }
      .plantoes-table .tbl-btn:hover {
        background: var(--bg);
      }
      .plantoes-table .tbl-btn.pay:hover {
        background: rgba(14,140,127,.18);
      }
      .mchip:hover {
        border-color: var(--teal);
        color: var(--teal-deep)
      }
      .sup-opt:hover {
        border-color: var(--teal)
      }
      .topbar-profile:hover {
        border-color: var(--teal)
      }
      .yearstep button:hover {
        background: var(--bg);
        color: var(--ink)
      }
    }

    /* ============================================================
       MOBILE — active feedback for touch (replaces hover)
    ============================================================ */
    @media (hover: none) {
      /* Disable transitions that would cause layout jank on touch */
      .item { transition: transform .1s }
      .item:active {
        transform: scale(.98);
        background: rgba(14,140,127,.07)
      }
      .btn:active {
        filter: brightness(.93);
        transform: translateY(1px)
      }
      .fab:active {
        transform: scale(.90)
      }
      .markpaid-btn:active {
        background: rgba(14,140,127,.20)
      }
      .segf button:active {
        border-color: rgba(14,140,127,.4);
        background: rgba(14,140,127,.07)
      }
      .del-row button:active {
        background: rgba(197,59,59,.1)
      }
      #pBtnAddDate:active {
        background: rgba(11,110,99,.14)
      }
      h2.title .link:active {
        background: rgba(14,140,127,.2)
      }
      .confirm-actions .cancel:active {
        background: var(--line)
      }
      .confirm-actions .confirm:active {
        filter: brightness(.93)
      }
    }

    /* ============================================================
       MOBILE FORM — stacked layout for date + duration fields
    ============================================================ */
    @media (max-width: 480px) {
      /* Stack date(s) and duration vertically on narrow screens */
      #sheetPlantao .row2 {
        grid-template-columns: 1fr !important;
      }

      /* Make duration buttons taller for easier tap */
      .segf button {
        padding: 13px 6px;
        font-size: 14px
      }

      /* Give remove-date button plenty of room */
      .btn-del-date {
        width: 44px;
        height: 44px;
        min-width: 44px
      }

      /* Date inputs fill properly */
      .p-data-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 13px 12px
      }

      /* Add date button bigger on mobile */
      #pBtnAddDate {
        padding: 13px 16px;
        font-size: 14px
      }

      /* Del-row button easier to tap */
      .del-row button {
        padding: 12px 28px
      }

      /* markpaid bigger touch area */
      .markpaid-btn {
        padding: 11px 14px;
        font-size: 13px
      }

      /* Confirm actions full height */
      .confirm-actions button {
        padding: 16px
      }

      /* Toast above tab bar with safe area */
      .toast {
        bottom: calc(90px + env(safe-area-inset-bottom))
      }
    }




/* ============================================================
   Árvore de indicações (admin → Financeiro)
   Layout hierárquico de cima para baixo: cada nível é um <ul>, cada
   pessoa um <li>. Os conectores são bordas nos pseudo-elementos do
   <li>, técnica que dispensa qualquer cálculo em JS e acompanha o
   tamanho real dos cards.
============================================================ */
.gen-scroll {
  overflow-x: auto;
  padding: 4px 0 12px;
}

.gen-tree {
  display: inline-block;
  min-width: 100%;
}

.gen-tree ul {
  display: flex;
  justify-content: center;
  padding-top: 26px;
  position: relative;
  list-style: none;
  margin: 0;
}

.gen-tree > ul {
  padding-top: 0;
}

.gen-tree li {
  list-style: none;
  position: relative;
  padding: 26px 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Meia-linha horizontal de cada lado, formando a barra que liga os irmãos */
.gen-tree li::before,
.gen-tree li::after {
  content: '';
  position: absolute;
  top: 0;
  right: 50%;
  width: 50%;
  height: 26px;
  border-top: 2px solid var(--line);
}

.gen-tree li::after {
  right: auto;
  left: 50%;
  border-left: 2px solid var(--line);
}

/* Filho único não precisa da barra horizontal, só do tronco vertical */
.gen-tree li:only-child::before,
.gen-tree li:only-child::after {
  display: none;
}

.gen-tree li:only-child {
  padding-top: 26px;
}

/* As pontas da barra não podem passar do primeiro/último irmão */
.gen-tree li:first-child::before,
.gen-tree li:last-child::after {
  border: 0 none;
}

.gen-tree li:last-child::before {
  border-right: 2px solid var(--line);
  border-radius: 0 7px 0 0;
}

.gen-tree li:first-child::after {
  border-radius: 7px 0 0 0;
}

/* Tronco que desce do pai até a barra dos filhos */
.gen-tree ul ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 2px solid var(--line);
  width: 0;
  height: 26px;
}

.gen-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 210px;
  transition: border-color .16s, box-shadow .16s;
}

.gen-card:hover {
  border-color: var(--teal);
  box-shadow: 0 6px 18px rgba(14, 140, 127, .14);
}

/* Quem tem indicados abaixo ganha destaque — é o nó que importa ler */
.gen-card--pai {
  border-color: rgba(14, 140, 127, .45);
}

.gen-card--root {
  background: var(--teal-soft);
  border-color: var(--teal);
}

.gen-top {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.gen-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #fff;
  font-family: 'Sora';
  font-weight: 700;
  font-size: 11.5px;
}

.gen-card--root .gen-avatar {
  background: var(--teal-deep);
}

.gen-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}

.gen-name {
  font-family: 'Sora';
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gen-sub {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gen-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.gen-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.gen-badge--pago {
  background: var(--recebido-soft);
  color: var(--recebido);
}

.gen-badge--pendente {
  background: var(--pend-soft);
  color: var(--pend);
}

.gen-badge--free {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.gen-badge--plano {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  text-transform: capitalize;
}

.gen-code {
  font-family: monospace;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--teal-deep);
  background: var(--surface);
  border: 1px dashed var(--teal);
  padding: 1px 6px;
  border-radius: 5px;
}

.gen-rede {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--feito-soft);
  color: var(--feito);
  white-space: nowrap;
}

/* Contas sem indicador: lista simples, sem árvore de um nó só */
.gen-soltos {
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  margin-top: 4px;
}

.gen-soltos-tit {
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
}

.gen-soltos-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gen-card--solto {
  width: 210px;
}

@media (max-width: 560px) {
  .gen-card,
  .gen-card--solto {
    width: 175px;
  }

  .gen-tree li {
    padding-left: 5px;
    padding-right: 5px;
  }
}

/* ============================================================
   Console do consultor (aba Conversas do admin).
   Layout de duas colunas no desktop; no celular a lista e a conversa
   se revezam na tela, como no WhatsApp.
============================================================ */
.wa-console {
  display: flex;
  height: calc(100vh - 260px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* ---- coluna da esquerda: lista ---- */
.wa-lista-pane {
  width: 340px;
  flex: 0 0 340px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.wa-lista-topo { padding: 12px; border-bottom: 1px solid var(--line); }
.wa-lista-topo input {
  width: 100%; padding: 9px 12px; font-size: 13.5px; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--ink);
}
/* Wrap em vez de flex:1 numa linha só: com 6 filtros num painel estreito (e
   pior no celular) eles se espremiam e os últimos — Minhas, Bloqueados —
   ficavam fora da tela, sem como rolar. Quebrando em linhas, todos aparecem
   sempre, do tamanho do próprio texto. */
.wa-filtros { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.wa-filtro {
  padding: 6px 12px; font-size: 12.5px; font-weight: 600; font-family: inherit;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  white-space: nowrap;
}
.wa-filtro:hover { border-color: var(--teal); color: var(--teal-deep); }
.wa-filtro.active { background: var(--teal-soft); color: var(--teal-deep); border-color: var(--teal-soft); }
.wa-badge {
  display: none; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: #C53B3B; color: #fff; font-size: 10px; line-height: 16px; font-weight: 700;
}

.wa-lista-itens { flex: 1; overflow-y: auto; }
.wa-vazio-lista { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 13px; }

.wa-item {
  width: 100%; display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: none; cursor: pointer; text-align: left; font-family: inherit;
}
.wa-item:hover { background: var(--bg); }
.wa-item.ativa { background: var(--teal-soft); }
.wa-item-corpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wa-item-linha1 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.wa-item-nome {
  font-weight: 700; font-size: 14px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wa-item-hora { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.wa-item-linha2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wa-item-previa {
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wa-previa-eu { color: var(--faint); }
.wa-bolinha { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); flex: 0 0 auto; }
.wa-item-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.wa-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.wa-tag-ia { background: var(--bg); color: var(--faint); }
.wa-tag-humano { background: var(--feito-soft); color: var(--feito); }
.wa-tag-alerta { background: var(--pend-soft); color: var(--pend); }
.wa-tag-fechada { background: #FBEAEA; color: #C53B3B; }

/* Prospect: quem escreveu sem ter conta. Cor propria porque o atendimento e
   outro — nao ha historico de plantoes pra consultar, o objetivo e converter. */
.wa-tag-prospect { background: #EFE4FB; color: #6B3FA0; }
.wa-tag-inativo  { background: #FFF0DB; color: #96601A; }
.wa-item.wa-prospect { border-left: 3px solid #8A5CC7; }
.wa-item.wa-inativo  { border-left: 3px solid #D9922E; }
/* Bolha da resposta automatica: nao e a Cora, entao nao usa a cor dela. */
.wa-bolha-sistema { background: var(--bg); border: 1px dashed var(--line); }
.wa-autor-sistema { color: var(--faint); }

/* ---- cor por tipo de conta: barra lateral colorida na lista ----
   Premium ambar · Basico teal (cor da marca) · nao-cliente vermelho ·
   bloqueado cinza esmaecido. O consultor bate o olho e sabe com quem fala. */
.wa-item.wa-tipo-premium    { border-left: 3px solid #C8890B; }
.wa-item.wa-tipo-basico     { border-left: 3px solid var(--teal); }
.wa-item.wa-tipo-naocliente { border-left: 3px solid #C53B3B; }
.wa-item.wa-tipo-bloqueada  { border-left: 3px solid #98A2A0; opacity: .66; }
.wa-tag-premium   { background: #FBEFD6; color: #8A5B0C; }
.wa-tag-basico    { background: var(--teal-soft); color: var(--teal-deep); }
.wa-tag-bloqueado { background: #F4EAEA; color: #B0453F; }

/* ---- acoes de moderacao (cabecalho do chat) ---- */
.wa-acao-icone {
  flex: 0 0 auto; width: 34px; height: 34px; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
}
.wa-acao-icone:hover { background: var(--bg); color: var(--ink); }
.wa-acao-icone.ativo { background: #FBEAEA; border-color: #E6B4B4; color: #C53B3B; }
.wa-acao-perigo:hover { background: #FBEAEA; border-color: #E6B4B4; color: #C53B3B; }

/* ---- apagar uma mensagem (aparece ao passar o mouse na linha) ---- */
.wa-del-msg {
  flex: 0 0 auto; border: 0; background: none; color: var(--faint); cursor: pointer;
  padding: 4px; border-radius: 6px; opacity: 0; transition: opacity .12s;
}
.wa-saiu .wa-del-msg { order: -1; }
.wa-linha:hover .wa-del-msg { opacity: .6; }
.wa-del-msg:hover { opacity: 1; color: #C53B3B; background: var(--bg); }

/* ---- cadastro do medico: celular + atalho para os contatos (A1) ----
   Fica no cadastro do MEDICO, nao no repasse: o telefone e atributo da pessoa,
   preenchido uma vez e reaproveitado em todo repasse seguinte. */
.rep-fone-linha { display: flex; gap: 8px; align-items: stretch; }
.rep-fone-linha input { flex: 1; min-width: 0; }
.rep-fone-contatos {
  flex: 0 0 auto;
  width: 46px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.rep-fone-contatos:active { background: var(--bg); }

.rep-fone-contatos svg { width: 20px; height: 20px; color: var(--muted); display: block; margin: 0 auto; }

/* .rep-avisar saiu: o "avisar o colega" virou checkbox no padrao dos outros da
   folha (repasse pago, plantao recebido), so que marcado por padrao. */

/* ---- mini-cadastro do colega, dentro da caixa de sugestao ----
   Aparece quando o medico digita um nome que ainda nao existe. Pede o celular
   ali mesmo: mandar ele ate Hospitais no meio do lancamento de um plantao e um
   desvio que ninguem faz, e o cadastro nasceria sem telefone. */
.rep-novo { padding: 12px; }
.rep-novo-titulo { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.rep-novo-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.rep-novo-obrig {
  font-weight: 600;
  color: var(--pend);
  background: var(--pend-soft);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  font-size: 10px;
  text-transform: lowercase;
}
.rep-novo-hint { margin: 6px 0 0; font-size: 11px; color: var(--faint); }
.rep-novo-acoes { display: flex; gap: 8px; margin-top: 12px; }
.rep-novo-acoes button {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--line);
}
.rep-novo-cancelar { background: var(--surface); color: var(--muted); }
.rep-novo-ok { background: var(--teal); border-color: var(--teal); color: #fff; }
/* Sem Contact Picker (iOS, desktop) o botao some: botao que nao faz nada e pior
   que botao ausente. quem esconde e o escolherContatoMedico(). */
.rep-fone-contatos[hidden] { display: none; }

/* ---- avatar de iniciais (a Cloud API nao entrega foto de perfil) ---- */
.wa-avatar {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; font-family: 'Sora', sans-serif;
}

/* ---- coluna da direita: conversa ---- */
.wa-chat-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wa-vazio {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--muted); padding: 24px;
}
.wa-vazio-icone { font-size: 40px; }

.wa-chat-topo {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.wa-chat-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wa-chat-id strong { font-size: 14.5px; color: var(--ink); }
.wa-chat-id span { font-size: 11.5px; color: var(--muted); }
.wa-voltar { display: none; background: none; border: 0; font-size: 20px; color: var(--teal-deep); cursor: pointer; padding: 0 4px; }
.wa-janela { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--recebido-soft); color: var(--recebido); white-space: nowrap; }
.wa-janela-alerta { background: var(--pend-soft); color: var(--pend); }
.wa-janela-fechada { background: #FBEAEA; color: #C53B3B; }
.wa-modo {
  font-size: 11.5px; font-weight: 700; font-family: inherit; padding: 6px 11px;
  border-radius: 999px; border: 1.5px solid var(--teal); background: var(--surface);
  color: var(--teal-deep); cursor: pointer; white-space: nowrap;
}

/* ---- mensagens ---- */
.wa-msgs {
  flex: 1; overflow-y: auto; padding: 16px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 6px;
}
.wa-dia { text-align: center; margin: 10px 0 4px; }
.wa-dia span {
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--surface); padding: 3px 12px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.wa-linha { display: flex; align-items: center; gap: 4px; }
.wa-entrou { justify-content: flex-start; }
.wa-saiu { justify-content: flex-end; }
.wa-bolha {
  max-width: min(78%, 520px); padding: 7px 11px 5px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 14px; line-height: 1.45; color: var(--ink);
  display: flex; flex-direction: column;
}
.wa-bolha-ia { background: #E9F3F1; }
.wa-bolha-consultor { background: var(--teal-soft); }
.wa-autor { font-size: 10.5px; font-weight: 700; margin-bottom: 2px; color: var(--faint); }
.wa-autor-consultor { color: var(--teal-deep); }
.wa-texto { word-wrap: break-word; overflow-wrap: anywhere; }
.wa-hora { align-self: flex-end; font-size: 10px; color: var(--muted); margin-top: 2px; }
.wa-img { max-width: 260px; border-radius: 8px; display: block; cursor: zoom-in; }
.wa-audio { width: 240px; max-width: 100%; margin: 2px 0; }
.wa-doc { color: var(--teal-deep); font-weight: 600; text-decoration: none; }
.wa-legenda { margin-top: 4px; }
.wa-transcricao {
  margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted); font-style: italic;
}

/* ---- caixa de escrita ---- */
.wa-composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface);
}
.wa-composer textarea {
  flex: 1; resize: none; max-height: 120px; padding: 10px 12px;
  font-family: inherit; font-size: 14px; line-height: 1.4;
  border: 1.5px solid var(--line); border-radius: 18px;
  background: var(--bg); color: var(--ink);
}
.wa-acao {
  background: none; border: 0; font-size: 19px; cursor: pointer;
  padding: 6px; border-radius: 50%; line-height: 1;
}
.wa-acao:hover { background: var(--bg); }
.wa-acao.gravando { background: #FBEAEA; animation: wa-pulso 1s ease-in-out infinite; }
@keyframes wa-pulso { 50% { opacity: .5; } }
.wa-enviar {
  width: 40px; height: 40px; flex: 0 0 40px; border: 0; border-radius: 50%;
  background: var(--teal); color: #fff; font-size: 16px; cursor: pointer;
}
.wa-enviar:disabled { opacity: .5; cursor: default; }
.wa-janela-aviso {
  padding: 12px 16px; background: #FBEAEA; color: #8C2F2F;
  font-size: 12.5px; line-height: 1.5; border-top: 1px solid var(--line);
}

/* ---- celular: uma coluna de cada vez ---- */
@media (max-width: 860px) {
  .wa-console { height: calc(100vh - 200px); border-radius: 12px; }
  .wa-lista-pane { width: 100%; flex: 1 1 auto; border-right: 0; }
  .wa-chat-pane { display: none; }
  .wa-console.wa-mobile-chat .wa-lista-pane { display: none; }
  .wa-console.wa-mobile-chat .wa-chat-pane { display: flex; }
  .wa-voltar { display: block; }
  .wa-modo { display: none; }
}
