/* Calendarq · a casca: menu lateral com as 7 áreas, topo, "+", abas do projeto,
   barra do celular, botão do Assistente, Desfazer e o fundo com manchas
   (Fundação, 25/11). Só tokens. Prefixo cq- em tudo que é novo. */

/* ---------- Fundo: manchas verde-cinza fixas e a grade fina ---------- */
body.app {
  --rail-w: 216px;
  background-color: var(--bg);
  background-image: linear-gradient(to right, var(--grid-line) 1px, transparent 1px), linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  background-attachment: fixed;
}
body.app::before {
  content: '';
  position: fixed;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  opacity: var(--blob-op);
  background:
    radial-gradient(38% 42% at 12% 18%, var(--blob-a), transparent 70%),
    radial-gradient(34% 40% at 88% 22%, var(--blob-b), transparent 70%),
    radial-gradient(40% 44% at 70% 88%, var(--blob-c), transparent 70%),
    radial-gradient(26% 30% at 30% 78%, var(--blob-d), transparent 70%);
  filter: blur(40px);
}

/* ---------- Menu lateral ---------- */
.cq-lado {
  position: fixed;
  z-index: 50;
  top: var(--rail-gap);
  bottom: var(--rail-gap);
  left: var(--rail-gap);
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 10px 10px;
  border-radius: 22px;
  overflow-y: auto;
  scrollbar-width: none;
}
.cq-lado-marca { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.cq-lado-nav { display: flex; flex-direction: column; gap: 2px; }
.cq-nav {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 38px; padding: 0 11px;
  border-radius: 11px; color: var(--ink-3); font-size: 13.5px; font-weight: 500; line-height: 1.25; text-align: left;
  transition: background .35s var(--ease), color .35s var(--ease);
}
.cq-nav .ic { font-size: 17px; }
.cq-nav:hover { background: var(--g1); color: var(--ink); }
.cq-nav.on { background: var(--pri-bg); color: var(--pri-ink); box-shadow: var(--pri-sh); }
.cq-lado-sp { flex: 1; }
.cq-lado-quem {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 12px 8px 4px;
  border-top: 1px solid var(--line); text-align: left; color: var(--ink-3); font-size: 12px; line-height: 1.35;
}
.cq-lado-quem:hover b { text-decoration: underline; text-underline-offset: 3px; }
.cq-lado-quem-txt { display: grid; min-width: 0; }
.cq-lado-quem b { overflow: hidden; color: var(--ink); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.cq-lado-quem small { overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.cq-lado-esc, .cq-topo-marca > span {
  position: relative; flex: none; width: 30px; height: 30px; display: grid; place-items: center; overflow: hidden;
  border-radius: 9px; background: var(--g-900); color: var(--g-0); font-size: 11px; font-weight: 600;
}
.cq-lado-esc img, .cq-topo-marca img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Topo ---------- */
.cq-topo {
  background: var(--g-sheen), var(--g2);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--g-edge-low);
}
.cq-topo .topbar-inner { gap: 12px; }
.cq-topo .push { flex: 1; }
.cq-topo-marca { display: none; }
.cq-crumb { min-width: 0; }
.cq-crumb-de { color: var(--ink-3); }
.cq-topo .topbar-actions { display: flex; align-items: center; gap: 6px; }
.cq-mais {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: var(--pri-bg); color: var(--pri-ink); box-shadow: var(--pri-sh); font-size: 18px;
  transition: transform .35s var(--ease);
}
.cq-mais:hover { transform: translateY(-1px); }
.cq-mais:active { transform: scale(.96); }

/* ---------- Menu do "+" ---------- */
.cq-menu { position: fixed; z-index: 120; width: 248px; padding: 6px; border-radius: 16px; }
.cq-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 11px;
  border-radius: 10px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; line-height: 1.3; text-align: left;
}
.cq-menu-item .ic { font-size: 17px; color: var(--ink-3); }
.cq-menu-item:hover, .cq-menu-item:focus-visible { background: var(--sunk); color: var(--ink); }
.cq-menu-item small { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 400; }

/* ---------- Projeto: topo fixo e abas ---------- */
.cq-projeto { padding-top: 18px; }
.cq-ptopo {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px;
  margin-bottom: 14px; padding: 14px 18px; border-radius: var(--r-lg);
}
.cq-ptopo-txt { flex: 1 1 240px; min-width: 0; display: grid; gap: 2px; }
.cq-ptopo-nome { overflow-wrap: anywhere; font-size: clamp(22px, 2.6vw, 30px); font-weight: 600; line-height: 1.08; letter-spacing: -.035em; }
.cq-ptopo-sub { color: var(--ink-3); font-size: 13px; }
.cq-ptopo-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cq-abas {
  display: flex; gap: 2px; width: max-content; max-width: 100%; margin-bottom: 6px; padding: 4px;
  border-radius: 14px; overflow-x: auto; scrollbar-width: none;
}
.cq-abas::-webkit-scrollbar { display: none; }
.cq-aba {
  display: inline-flex; flex: none; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; color: var(--ink-3); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background .35s var(--ease), color .35s var(--ease), box-shadow .35s var(--ease);
}
.cq-aba:hover { color: var(--ink); }
.cq-aba.on { background: var(--g3); color: var(--ink); box-shadow: var(--g-hl), var(--g-sh); }
.cq-aba .ic { font-size: 14px; }
.cq-cadeado {
  display: inline-flex; align-items: center; height: 18px; margin-left: 2px; padding: 0 7px;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--ink-3);
  font-size: 9.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.cq-aba.on .cq-cadeado { border-color: transparent; background: var(--ok-s); color: var(--ok); }

/* ---------- Capa do projeto (U.capa) ---------- */
/* A padrão é a do esboço 2.1: clara, com a grade fina da prancha, a casa ao
   centro e as iniciais em letra de máquina no canto de baixo. */
.capa {
  position: relative; flex: none; display: grid; place-items: center; overflow: hidden;
  background-color: var(--surface-2); color: var(--ink-3);
}
.capa-quadricula { background-image: linear-gradient(to right, var(--hair) 1px, transparent 1px), linear-gradient(to bottom, var(--hair) 1px, transparent 1px); background-size: 14px 14px; }
.capa-linhas { background-image: repeating-linear-gradient(-45deg, var(--hair) 0 1px, transparent 1px 9px); }
.capa.has-img { background: var(--sunk); filter: brightness(var(--cover-dim)); }
.capa img { width: 100%; height: 100%; object-fit: cover; }
.capa > .capa-casa { width: 46px; height: 46px; color: var(--ink-3); stroke-width: 1.2; }
.capa-ini { font-family: var(--mono); font-weight: 400; letter-spacing: .16em; }
.capa-md > .capa-ini { position: absolute; left: 12px; bottom: 10px; font-size: 10px; }
.capa-sm { width: 56px; height: 56px; border-radius: 14px; font-size: 13px; }
.capa-md { width: 100%; height: 112px; }
/* A grande é fundo do topo do projeto e do link do cliente, com o nome em
   letra clara por cima: continua na faixa escura da prancha, sem a casa. */
.capa-lg { width: 100%; height: 200px; font-size: 48px; }
.capa-lg:not(.has-img) { background: var(--banner-bg); color: var(--banner-ink); filter: brightness(var(--cover-dim)); }
.capa-lg.capa-quadricula:not(.has-img) { background-image: linear-gradient(to right, var(--banner-tile-line) 1px, transparent 1px), linear-gradient(to bottom, var(--banner-tile-line) 1px, transparent 1px), var(--banner-bg); background-size: 14px 14px, 14px 14px, auto; }
.capa-lg.capa-linhas:not(.has-img) { background-image: repeating-linear-gradient(-45deg, var(--banner-tile-line) 0 1px, transparent 1px 9px), var(--banner-bg); }
.capa-lg > .capa-ini { font-family: inherit; font-weight: 600; letter-spacing: -.02em; }

/* ---------- Telas do menu (esqueletos da Fundação) ---------- */
.cq-tela { padding-top: 26px; padding-bottom: 56px; }
.cq-tela-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; }
.cq-tela-t { margin-top: 6px; font-size: clamp(28px, 4vw, 40px); font-weight: 600; line-height: 1.02; letter-spacing: -.04em; }
.cq-tela-t .acc { font-size: 1.08em; letter-spacing: -.02em; }
.cq-sec h2 { margin: 30px 0 12px; font-size: 19px; font-weight: 600; letter-spacing: -.03em; }
.cq-pc-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cq-pc { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-lg); color: var(--ink); text-align: left; transition: box-shadow .35s var(--ease), transform .35s var(--ease); }
.cq-pc:hover { box-shadow: var(--g-hl), var(--g-sh-3); transform: translateY(-1px); }
.cq-pc-txt { display: grid; gap: 3px; padding: 12px 14px 14px; }
.cq-pc-txt b { font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.cq-pc-txt small { color: var(--ink-3); font-size: 12.5px; }
.cq-pc-prog { display: block; height: 4px; margin-top: 8px; overflow: hidden; border-radius: 9px; background: var(--sunk-2); }
.cq-pc-prog i { display: block; width: var(--p); height: 100%; border-radius: 9px; background: var(--ink); }
.cq-vazio { color: var(--ink-3); }
.cq-construcao { padding-top: 40px; padding-bottom: 64px; }
.cq-construcao-t { margin: 8px 0 10px; font-size: clamp(24px, 3vw, 32px); font-weight: 600; letter-spacing: -.035em; }
.cq-construcao p { max-width: 60ch; color: var(--ink-3); }
.cq-construcao-nota { margin-top: 22px; color: var(--ink-3); font-size: 12.5px; }
.cq-cfg { margin-bottom: 14px; padding: 18px 20px; border-radius: var(--r-lg); }
.cq-cfg h2 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.cq-cfg > p { margin: 4px 0 12px; color: var(--ink-3); font-size: 13.5px; }
.cq-cfg-tema { max-width: 100%; overflow-x: auto; }

/* ---------- Botão do Assistente ---------- */
.cq-fab {
  position: fixed; z-index: 45; right: 22px; bottom: 22px; display: flex; align-items: center; gap: 9px;
  height: 42px; padding: 0 16px 0 7px; border-radius: var(--r-pill); color: var(--ink); font-size: 13px; font-weight: 500;
}
.cq-fab-s { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--pri-bg); color: var(--pri-ink); font-size: 15px; }
/* Fica pequeno (só a estrela) para não cobrir a coluna da direita; o nome
   aparece ao passar o mouse ou com o teclado. O fim da página ganha folga
   para o último cartão sair de baixo dele. */
.cq-fab { padding: 0 7px; }
.cq-fab-t { display: none; }
@media (hover: hover) and (min-width: 901px) {
  .cq-fab:hover, .cq-fab:focus-visible { padding: 0 16px 0 7px; }
  .cq-fab:hover .cq-fab-t, .cq-fab:focus-visible .cq-fab-t { display: inline; }
}
.app .shell > main { padding-bottom: 64px; }

/* ---------- Desfazer e avisos, no escritório: vidro denso ---------- */
.app .toast {
  background: var(--g-sheen), var(--g3); color: var(--ink);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--g-edge); box-shadow: var(--g-hl), var(--g-sh-3);
}
.app .toast .ic { color: var(--success); }
.app .toast-action { border: 1px solid var(--g-edge); background: var(--g1); color: var(--ink); }
.app .toast-action:hover { background: var(--sunk); }

/* ---------- Barra de baixo (celular) ---------- */
.cq-barra { display: none; }
@media (max-width: 900px) {
  .cq-lado { display: none; }
  .cq-topo-marca { display: block; }
  .cq-barra {
    position: fixed; z-index: 55; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; height: 66px; padding: 0 6px; border-radius: 22px;
  }
  /* Sem o menu lateral, o conteúdo não guarda a margem dele (o legado só
     zerava abaixo de 720 px: entre 721 e 900 sobrava o vão do menu). */
  .app .shell { padding-left: 0; padding-bottom: 92px; }
  .app .overlay-grid { padding-left: var(--gutter); }
  .cq-barra-item { display: grid; justify-items: center; align-content: center; gap: 3px; min-width: 0; height: 60px; color: var(--ink-3); font-size: 10.5px; font-weight: 500; }
  .cq-barra-ic { display: grid; place-items: center; height: 30px; padding: 0 12px; border-radius: 11px; font-size: 19px; transition: background .3s var(--ease); }
  .cq-barra-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cq-barra-item.on { color: var(--ink); font-weight: 600; }
  .cq-barra-item.on .cq-barra-ic { background: var(--pri-bg); color: var(--pri-ink); }
  .cq-barra-mais { justify-self: center; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: var(--pri-bg); color: var(--pri-ink); box-shadow: var(--pri-sh); font-size: 20px; }
  .cq-fab { right: 16px; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); padding: 0 7px; }
  .cq-fab-t { display: none; }
  .app .toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .cq-topo .save-state { display: none; }
}
@media (max-width: 560px) {
  .cq-crumb .cq-crumb-de, .cq-crumb .cq-crumb-de + .sep { display: none; }
  .cq-ptopo { padding: 12px 14px; }
  .cq-ptopo-acoes { width: 100%; }
}

/* O caminho do topo encolhe antes das ações (celular). */
.cq-topo .cq-crumb { flex: 0 1 auto; overflow: hidden; }
.cq-crumb .proj { min-width: 0; }
.cq-crumb .crumb-select { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) {
  .cq-crumb .back { font-size: 0; }
  .cq-crumb .back .ic { font-size: 18px; }
}
@media (max-width: 560px) {
  .cq-cfg-tema .seg .ic { display: none; }
}
