/* ==========================================================================
   Quinco Projetos v0: casca e componentes
   Pele QNCO, protótipo do designer de 08/11/2026 (design-2026-11-08/).
   Tokens em tokens-qnco.css; fontes embutidas em fonts.css ("Archivo Thin",
   "Archivo Light" e "Archivo SemiBold", todas em peso 400).
   Fundo em degradê suave, cartões brancos com raio de 18 px e sem sombra,
   texto preto, cinza é preto com opacidade, filetes finos, botões em
   pílula, campos em creme sem borda, links sublinhados em lilás.
   Bloco feito em verde, bloco agendado em lilás. Coral só para alerta.
   ========================================================================== */

/* ---------- Base ---------- */

html, body { min-height: 100%; }

body {
  font-family: var(--qp-light);
  font-size: var(--qp-fs);
  line-height: 1.4;
  color: var(--black);
  overflow-x: hidden;
}

b, strong, .semi { font-family: var(--qp-semi); font-weight: 400; }

h1, h2, h3, h4 { font-family: var(--qp-thin); font-weight: 400; line-height: 1.08; letter-spacing: 0; margin: 0; }
h1 { font-size: 38px; }
h2 { font-size: 26px; line-height: 1.1; }
h3 { font-size: 26px; line-height: 1.1; }
h4 { font-family: var(--qp-semi); font-size: 14px; }
h1 b, h1 strong, h2 b, h2 strong, h3 b, h3 strong { font-family: var(--qp-semi); }

p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }

button { font: inherit; color: inherit; }
svg { display: inline-block; vertical-align: middle; }
img { max-width: 100%; }
[hidden] { display: none !important; }

::selection { background: var(--lilac); color: var(--black); }

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

/* ---------- Casca: topo ---------- */

#app { min-height: 100vh; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  flex: none;
  height: var(--qp-topbar-h);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 max(26px, env(safe-area-inset-right, 0px)) 0 max(26px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--ink-09);
  min-width: 0;
}

/* chapéu e menu: no desktop o invólucro não tem caixa, os filhos ficam direto no topo */
.topbar-menu { display: contents; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  color: var(--black);
  text-decoration: none;
}
.brand:hover { background: none; }
.brand-qnco { height: 22px; width: auto; display: block; }
.brand-rule { width: 1px; height: 20px; background: var(--ink-25); flex: none; }
.brand-quinco { height: 16px; width: auto; display: block; }
.brand-sub {
  font-family: var(--qp-semi);
  font-size: 9.5px;
  letter-spacing: .34em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-space { flex: 1; min-width: 0; }

.nav { display: flex; align-items: center; gap: 20px; font-size: 13px; min-width: 0; }
.nav-item {
  color: var(--ink-50);
  text-decoration: none;
  white-space: nowrap;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease-out);
}
.nav-item:hover { color: var(--black); background: none; }
.nav-item.active { color: var(--black); font-family: var(--qp-semi); border-bottom-color: var(--black); padding-bottom: 2px; }
.nav-label-short { display: none; } /* nome curto do item, só no menu do admin no celular */
.nav-item:focus-visible { outline: 2px solid var(--lilac); outline-offset: 3px; }

.person-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  margin-left: 8px;
  padding-left: 20px;
  border-left: 1px solid var(--ink-10);
  min-width: 0;
}
.person-picker .label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.person-picker .select {
  appearance: none;
  -webkit-appearance: none;
  field-sizing: content;
  height: auto;
  min-width: 0;
  max-width: 220px;
  padding: 2px 14px 2px 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-45) 50%), linear-gradient(135deg, var(--ink-45) 50%, transparent 50%);
  background-position: calc(100% - 5px) 55%, 100% 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  font-family: var(--qp-light);
  font-size: 12.5px;
  color: var(--ink-50);
  text-overflow: ellipsis;
  cursor: pointer;
}
.person-picker .select:hover { color: var(--black); }
.person-picker .select:focus { box-shadow: none; }
.person-picker .select:focus-visible { outline: 2px solid var(--lilac); outline-offset: 3px; }

/* chapéu de quem monta projetos: pílula segmentada, ativo preto com texto branco
   (mesma pele da alternância Venda/Custo da página do job) */
.hats {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 0;
  margin-left: 6px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .85);
}
.hat {
  padding: 5px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-55);
  font-family: var(--qp-light);
  font-size: 12.5px;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.hat:hover { background: var(--ink-07); color: var(--black); }
.hat.active { background: var(--black); color: var(--white); font-family: var(--qp-semi); cursor: default; }
.hat:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }

/* Novo projeto no topo (chapéu Gestão), à direita do menu. No celular vira "+" redondo. */
.topbar-new { flex: none; min-height: 0; padding: 6px 15px; font-size: 12.5px; }
.topbar-new-plus { display: none; }

/* o ponto do Quinco */
.quica { position: relative; width: 22px; height: 22px; display: inline-block; flex: none; cursor: pointer; }
.quica-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.quica-orbit { position: absolute; inset: 0; transform-origin: 50% 50%; }
.quica-dot { position: absolute; top: 3.7%; left: 77%; width: 16.6%; height: 16.6%; border-radius: 50%; background: var(--green); }
.quica:hover { animation: qnToim .6s cubic-bezier(.34, 1.56, .64, 1); }
.quica:hover .quica-orbit { animation: qnOrbita 1.4s linear infinite; }

/* ---------- Casca: conteúdo e rodapé ---------- */

.shell-main {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px max(36px, env(safe-area-inset-right, 0px)) 40px max(36px, env(safe-area-inset-left, 0px));
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main { min-width: 0; animation: qnfade .32s var(--ease-out); }
.main:focus { outline: none; }

.shell-foot { margin-top: 40px; font-size: 11.5px; color: var(--ink-35); }

/* aviso fixo da casca, entre o topo e a tela */
.shell-alerts { margin-bottom: 18px; }
.shell-alerts:empty { display: none; }
.alert.shell-alert { align-items: center; }
.shell-alert .btn-ghost { margin-left: auto; flex: none; }

/* ---------- Cabeçalho de página e layout ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head > :first-child { flex: 1; min-width: 260px; }
.page-title { font-family: var(--qp-thin); font-size: 38px; line-height: 1.08; margin: 0; }
.page-title b { font-family: var(--qp-semi); }
.page-sub { margin-top: 6px; font-size: 13px; color: var(--ink-50); }
.page-actions { display: flex; align-items: center; gap: 10px; flex: none; flex-wrap: wrap; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack.tight { gap: 6px; }
.spacer { flex: 1; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }

.muted { color: var(--ink-50); }
.small { font-size: 12.5px; }
.num { font-family: var(--qp-semi); font-variant-numeric: tabular-nums; }
.light { font-family: var(--qp-light); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hl { background: var(--lilac); padding: 0 .25em; }
.hairline { border: 0; border-top: 1px solid var(--ink-08); margin: 16px 0; }

.link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: var(--black);
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-decoration-color: var(--lilac);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link:hover { color: var(--black); background: var(--lilac); text-decoration-color: transparent; }

/* ---------- Cartão ---------- */

.card {
  background: var(--white);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  min-width: 0;
}
.card.flush { padding: 0; }
.card.flush > .card-title { padding: 20px 24px 0; }
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 14px;
  font-family: var(--qp-semi);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-45);
}
.card-title .btn { text-transform: none; letter-spacing: 0; }

/* ---------- Botões ----------
   .btn: pílula de contorno fino, a dos "Novo item", "Ler linhas", "Nova fase".
   .btn-primary: o Button primary do design system (preto, hover lilás).
   .page-actions .btn: o Button secondary (borda 1,5 px preta, hover preto).
   .btn-ghost: texto com sublinhado lilás. .btn-sm: pílula pequena. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 14px;
  border: 1px solid var(--ink-22);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--black);
  font-family: var(--qp-light);
  font-size: 13px;
  line-height: 1.15;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}
.btn:hover { background: var(--black); border-color: var(--black); color: var(--white); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .35; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary, .page-actions .btn {
  padding: 8px 16px;
  border: 1.5px solid var(--black);
  font-family: var(--qp-semi);
  font-size: 13px;
  letter-spacing: .01em;
}
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: var(--lilac); border-color: var(--lilac); color: var(--black); }
.btn-primary:active { background: var(--green); border-color: var(--green); color: var(--black); }
.page-actions .btn:not(.btn-primary) { background: transparent; color: var(--black); }
.page-actions .btn:not(.btn-primary):hover { background: var(--black); color: var(--white); }

.btn-ghost {
  min-height: 0;
  padding: 4px 4px;
  border-color: transparent;
  background: transparent;
  font-family: var(--qp-light);
  text-decoration: underline;
  text-decoration-color: var(--lilac);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.btn-ghost:hover { background: var(--lilac); border-color: transparent; color: var(--black); text-decoration-color: transparent; }

.btn-danger { background: var(--coral); border-color: var(--coral); color: var(--black); font-family: var(--qp-semi); }
.btn-danger:hover { background: var(--qp-coral-deep); border-color: var(--qp-coral-deep); color: var(--black); }

.btn-sm { min-height: 26px; padding: 3px 12px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { width: 32px; min-height: 32px; padding: 0; border-color: transparent; text-decoration: none; }
.btn-sm.btn-icon { width: 26px; min-height: 26px; }
.btn-icon:hover { background: var(--ink-07); color: var(--black); }

/* ---------- Campos ---------- */

.input, .select {
  min-width: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--radius-control);
  background-color: var(--cream);
  color: var(--black);
  font-family: var(--qp-light);
  font-size: 14px;
  line-height: 1.2;
  transition: box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
textarea.input { min-height: 110px; padding: 12px 14px; resize: vertical; font-size: 13.5px; line-height: 1.55; }
.input:focus, .select:focus { outline: none; box-shadow: 0 0 0 1px var(--ink-35); }
.input:disabled, .select:disabled { color: var(--ink-35); cursor: not-allowed; }
.input.num, .input[type="number"] { text-align: right; font-family: var(--qp-semi); font-variant-numeric: tabular-nums; }
.input.num::placeholder { font-family: var(--qp-light); }
.input.sm, .select.sm { padding: 6px 10px; border-radius: var(--radius-control-s); font-size: 12.5px; }
.input.inline { background-color: transparent; padding: 4px 6px; border-radius: 8px; }
.input.inline:hover { background-color: var(--cream); }
.input.inline:focus { background-color: var(--cream); }
.input.title { font-family: var(--qp-thin); font-size: 34px; line-height: 1.1; padding: 2px 12px; background-color: var(--white); }
.input.wide, .select.wide { width: 100%; }
.input[type="date"] { font-variant-numeric: tabular-nums; }
.input[type="date"]::-webkit-calendar-picker-indicator { opacity: .45; cursor: pointer; }
.input[type="file"] { padding: 8px 12px; font-size: 13px; }
.input[type="file"]::file-selector-button { margin-right: 10px; padding: 4px 12px; border: 1px solid var(--ink-22); border-radius: var(--radius-pill); background: transparent; font-family: var(--qp-light); font-size: 12.5px; color: var(--black); cursor: pointer; }
.input[type="file"]::file-selector-button:hover { background: var(--black); border-color: var(--black); color: var(--white); }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-55) 50%), linear-gradient(135deg, var(--ink-55) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.select.sm { padding-right: 28px; background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; }

/* sobre o fundo da página (fora de cartão) o campo é branco, como no protótipo */
.page-head .input, .page-head .select,
.main > .toolbar .input, .main > .toolbar .select,
.cfg-body > .toolbar .input { background-color: var(--white); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.inline-field { flex-direction: row; align-items: center; gap: 10px; }
.label {
  font-family: var(--qp-semi);
  font-size: 12px;
  color: var(--ink-55);
}
.field.inline-field > .label { font-family: var(--qp-light); font-size: 12.5px; color: var(--ink-50); }
.hint { font-size: 12px; color: var(--ink-45); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 16px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input, input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--black); cursor: pointer; }

/* ---------- Pílulas ----------
   .pill: valor em creme (SemiBold). Estado (.pill-play e afins): contorno
   fino com ponto colorido, como no protótipo. Alerta: coral suave. */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 10px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--cream);
  color: var(--black);
  font-family: var(--qp-semi);
  font-size: 11.5px;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}
.pill svg { width: 12px; height: 12px; }

.pill-play, .pill-paused, .pill-done, .pill-archived, .pill-internal {
  padding: 3px 12px;
  border: 1px solid var(--ink-18);
  background: transparent;
  font-family: var(--qp-light);
  font-size: 12px;
}
.pill-play::before, .pill-paused::before, .pill-done::before, .pill-archived::before, .pill-internal::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--black);
}
.pill-paused { border-style: dashed; }
.pill-paused::before { background: var(--ink-30); }
.pill-done::before { background: var(--green); }
.pill-archived { color: var(--ink-50); }
.pill-archived::before { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-35); }
.pill-internal::before { background: var(--lilac); }
.pill-alert { background: var(--coral-soft); border-color: var(--coral-soft); color: var(--black); font-family: var(--qp-semi); }

/* pílula de filtro (lista de jobs) e alternância Venda/Custo */
button.pill, .pill-filter {
  cursor: pointer;
  padding: 5px 13px;
  border: 1px solid var(--ink-22);
  background: transparent;
  font-family: var(--qp-light);
  font-size: 12.5px;
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
button.pill:hover, .pill-filter:hover { border-color: var(--black); }
button.pill.active, .pill-filter.active { background: var(--black); border-color: var(--black); color: var(--white); font-family: var(--qp-semi); }
.pills { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Barra de progresso ---------- */

.bar {
  display: flex;
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--ink-07);
  overflow: hidden;
}
.bar-fill {
  flex: none;
  height: 100%;
  max-width: 100%;
  background: var(--black);
  transition: width var(--dur-med) var(--ease-out);
}
.bar-fill.scheduled { background: var(--ink-25); }
.bar.money .bar-fill { background: var(--green); }
.bar.over { background: var(--qp-coral-tint); }
.bar.over .bar-fill { background: var(--coral); }
.bar.thin { height: 3px; background: var(--ink-08); }
.bar.thick { height: 8px; }

.bar-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-line .bar { flex: 1; min-width: 60px; }
.bar-line .num { flex: none; font-size: 13px; }
.bar-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-family: var(--qp-light);
  font-size: 12px;
  color: var(--ink-50);
  font-variant-numeric: tabular-nums;
}
.table td.num .bar-legend { justify-content: flex-end; }

/* ---------- Tabela ---------- */

.table-wrap { overflow: auto; max-width: 100%; background: var(--white); border-radius: var(--radius-card); }
.card .table-wrap { background: transparent; border-radius: 0; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  padding: 16px 12px 10px;
  border-bottom: 1px solid var(--ink-09);
  font-family: var(--qp-semi);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-45);
  white-space: nowrap;
}
.table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--ink-07);
  vertical-align: middle;
}
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--hover-cream); }
.table tr.clickable:focus-visible { outline: 2px solid var(--lilac); outline-offset: -2px; }
.table .num, .table th.num, .table td.num { text-align: right; font-family: var(--qp-semi); font-variant-numeric: tabular-nums; }
.table .bar { min-width: 80px; margin-top: 7px; }
.table .bar-line { min-width: 160px; }
.table tfoot td { border-top: 1px solid var(--ink-10); border-bottom: none; font-family: var(--qp-semi); }
.table tr.group td { background: var(--cream); font-family: var(--qp-semi); }
.table .btn { min-height: 26px; padding: 3px 12px; font-size: 12px; }
.table .btn-icon { width: 26px; padding: 0; }
.table .cell-main { display: block; font-family: var(--qp-semi); font-size: 14px; }
.table .cell-sub { display: block; font-size: 11.5px; color: var(--ink-45); }
.table.dense td { padding: 10px 10px; }
.table.dense th { padding: 14px 10px 8px; font-size: 10px; letter-spacing: .1em; }
.table.dense th:first-child, .table.dense td:first-child { padding-left: 22px; }
.table.dense th:last-child, .table.dense td:last-child { padding-right: 22px; }
/* tabela dentro de cartão com respiro próprio: alinha com o texto do cartão */
.card:not(.flush) > .table th:first-child, .card:not(.flush) > .table td:first-child { padding-left: 0; }
.card:not(.flush) > .table th:last-child, .card:not(.flush) > .table td:last-child { padding-right: 0; }

/* ---------- Abas ---------- */

.tabs {
  display: flex;
  align-items: flex-end;
  gap: 26px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--ink-10);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0 0 10px;
  font-family: var(--qp-light);
  font-size: 14px;
  color: var(--ink-50);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--black); }
.tab.active { color: var(--black); font-family: var(--qp-semi); border-bottom-color: var(--black); }
.tab:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }
.tab .count { margin-left: 6px; font-family: var(--qp-light); color: var(--ink-50); }

/* ---------- Bloco de hora ----------
   Feito em verde, agendado em lilás, texto preto, cantos de 12 px.
   Item pausado: borda tracejada. As telas ajustam altura e alça. */

.block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 8px 10px 12px;
  border: 0;
  border-radius: var(--radius-block);
  background: var(--lilac);
  color: var(--black);
  font-size: 11.5px;
  line-height: 1.35;
  cursor: grab;
  user-select: none;
  min-width: 0;
  overflow: hidden;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.block:active { cursor: grabbing; }
.block.dragging { opacity: .35; }
.block.selected { outline: 2px solid var(--black); outline-offset: 1px; }
.block-planned { background: var(--lilac); }
.block-done { background: var(--green); }
.block-paused { outline: 1.5px dashed var(--black); outline-offset: -1.5px; }
.block-paused.selected { outline: 2px dashed var(--black); outline-offset: 1px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-width: 0; flex: none; font-family: var(--qp-semi); }
.block-job { font-family: var(--qp-semi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.block-min { flex: none; font-family: var(--qp-semi); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* número do job no bloco: em bloco estreito o prefixo (QP-) some e o número fica inteiro */
.block-head { container: bhead / inline-size; }
@container bhead (max-width: 79px) { .block-job-pre { display: none; } }
.block-item { flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(0, 0, 0, .78); }
.block-jobname { flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--ink-55); }
.block-note { flex: none; font-size: 11px; color: var(--ink-55); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.block-actions { display: flex; gap: 4px; margin-top: 6px; }
.block-actions .btn { min-height: 22px; padding: 2px 9px; font-size: 11px; }
.block .timer { font-family: var(--qp-semi); font-variant-numeric: tabular-nums; }

/* zona de soltar (Agendado e Feito na tela Hoje) */
.zone { padding: 6px; min-height: 64px; }
.zone-title {
  margin: 0 0 4px;
  font-family: var(--qp-semi);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-45);
}
.zone.drop { background: var(--ink-04); }

/* ---------- Grade de semana (Hoje e Agenda) ---------- */

.grid-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.grid-week.has-rows { grid-template-columns: 150px repeat(7, minmax(0, 1fr)); }
.grid-cell { min-width: 0; min-height: 72px; padding: 8px 7px; border-left: 1px solid var(--ink-07); }
.grid-head {
  min-height: 0;
  padding: 16px 8px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.grid-head > span:first-child {
  font-family: var(--qp-semi);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-45);
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}
.grid-head .day-num { font-family: var(--qp-thin); font-size: 24px; line-height: 1; color: var(--black); }
.grid-head.today > span:first-child { color: var(--black); border-bottom-color: var(--lilac); }
.grid-cell.weekend { background: rgba(0, 0, 0, .018); }
.grid-cell.drop { background: var(--ink-04); }
.grid-label { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; font-family: var(--qp-semi); font-size: 13.5px; border-left: 0; }
.grid-label .muted { font-family: var(--qp-light); font-size: 12px; }
.cell-total {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-55);
  font-variant-numeric: tabular-nums;
}
.cell-total .bar { flex: 1; }
.cell-total .bar-fill.done { background: var(--green); }
.cell-total .bar-fill.planned { background: var(--lilac); }
.cell-total .num { font-family: var(--qp-light); font-size: 11.5px; white-space: nowrap; }
.cell-total.over .num { color: var(--black); background: var(--coral-soft); padding: 0 5px; border-radius: var(--radius-pill); }

.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav .range { font-family: var(--qp-semi); font-size: 13px; white-space: nowrap; padding: 0 4px; }
.week-nav .btn-icon { width: 26px; min-height: 26px; color: var(--ink-55); }
.week-nav .btn-icon:hover { background: none; color: var(--black); }
/* "Hoje" ao lado das setas: pílula pequena de contorno */
.week-nav + .btn-ghost {
  padding: 3px 12px;
  border: 1px solid var(--ink-22);
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  text-decoration: none;
}
.week-nav + .btn-ghost:hover { background: var(--black); border-color: var(--black); color: var(--white); }

/* ---------- Avisos ----------
   Caixa arredondada em coral suave; no Pulso, linha simples com ponto. */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-control);
  background: rgba(255, 159, 168, .24);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--black);
}
.alert + .alert { margin-top: 6px; }
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.alert-info { background: var(--cream); }
.alert-ok { background: var(--green-soft); }
.alert .alert-text { flex: 1; min-width: 0; }
.alert .btn { flex: none; margin-left: auto; }
.alert-list { display: flex; flex-direction: column; gap: 12px; }
.alert-list .alert, .card .alert-ok { padding: 0; background: none; border-radius: 0; align-items: baseline; }
.alert-list .alert + .alert { margin-top: 0; }
.alert-list .alert::before, .card .alert-ok::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--coral-soft);
  transform: translateY(-1px);
}
.card .alert-ok::before { background: var(--green); }

/* ---------- Estado vazio ---------- */

.empty {
  padding: 36px 20px;
  border: 1px dashed var(--ink-18);
  border-radius: var(--radius-card);
  text-align: center;
  color: var(--ink-45);
  font-size: 13.5px;
}
.empty .title {
  display: block;
  margin-bottom: 6px;
  font-family: var(--qp-thin);
  font-size: 24px;
  color: var(--black);
}
.empty .btn { margin-top: 12px; }
/* membro numa tela de gestão */
.empty-barred { max-width: 620px; margin: 40px auto 0; padding: 48px 32px; background: rgba(255, 255, 255, .55); }
.empty-barred p { max-width: 440px; margin: 0 auto; line-height: 1.5; }
.empty-barred .btn { margin-top: 20px; }

/* ---------- Número grande (KPI) ---------- */

.kpi { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.kpi-label {
  font-family: var(--qp-semi);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-45);
}
.kpi-value {
  font-family: var(--qp-thin);
  font-size: 24px;
  line-height: 1.15;
  color: var(--black);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi-value b { font-family: var(--qp-semi); }
.kpi-value small { font-family: var(--qp-semi); font-size: 13px; letter-spacing: 0; color: var(--black); }
.kpi-sub { font-size: 12.5px; line-height: 1.5; color: var(--ink-55); }
.kpi.over .kpi-value { display: inline-block; align-self: flex-start; background: var(--coral-soft); padding: 0 8px; border-radius: 8px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 14px; }

/* ---------- Barra de ferramentas ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 13px;
}
.toolbar .spacer { flex: 1; }
.toolbar .input.search { width: 290px; max-width: 100%; padding: 10px 14px; font-size: 13px; }
.toolbar .select { width: auto; }

/* ---------- Avatar ---------- */

.avatar {
  width: 28px;
  height: 28px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--ink-15);
  color: var(--black);
  font-family: var(--qp-semi);
  font-size: 9.5px;
  line-height: 1;
}
.avatar.sm { width: 28px; height: 28px; font-size: 9.5px; }
.avatar.navy { background: var(--black); color: var(--white); border-color: var(--black); }
.avatar.coral { background: var(--coral-soft); border-color: var(--coral-soft); }
.avatar-group { display: inline-flex; align-items: center; padding-left: 5px; }
.avatar-group .avatar { margin-left: -5px; }

/* ---------- Painel lateral (drawer) ---------- */

.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .4); }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  width: 440px;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--white);
  transform: translateX(100%);
  transition: transform var(--dur-med) var(--ease-out);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--ink-09); }
.drawer-title { margin: 0; font-family: var(--qp-thin); font-size: 26px; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 22px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--ink-09); }

/* ---------- Diálogo ---------- */

/* z-index 58: acima da folha do cronograma no celular (fundo 54, folha 55) e abaixo do aviso curto (60) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, .4);
  animation: qnfade .2s var(--ease-out);
}
.modal {
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 26px 28px 24px;
  border-radius: var(--radius-card);
  background: var(--white);
}
.modal:focus { outline: none; } /* tabindex -1: o clique no texto do diálogo deixa o foco nele, sem contorno */
.modal.wide { max-width: 720px; }
.modal-title { margin: 0 0 8px; font-family: var(--qp-thin); font-size: 26px; line-height: 1.1; }
.modal-text { margin: 0 0 20px; font-size: 14px; line-height: 1.5; color: var(--black); }
.modal-title + .modal-text { color: var(--ink-55); font-size: 13px; }
.modal-body { margin: 0 0 22px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px 14px; }
.modal-actions .btn:not(.btn-ghost) { padding: 8px 16px; border: 1.5px solid var(--black); font-family: var(--qp-semi); }
.modal-actions .btn-primary { border-color: var(--black); }
.modal-actions .btn-primary:hover { border-color: var(--lilac); }
.modal-actions .btn-danger { border-color: var(--coral); }

/* ---------- Aviso curto (toast) ---------- */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  /* max-content: sem isso, preso em left 50%, o aviso só tinha meia tela de largura e quebrava em duas linhas no celular */
  width: max-content;
  max-width: min(720px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-control);
  background: var(--black);
  color: var(--white);
  font-family: var(--qp-light);
  font-size: 14px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--green); }
.toast.show { opacity: 1; transform: none; }
.toast.alert { margin: 0; padding: 14px 18px; border-radius: var(--radius-control); background: var(--black); color: var(--white); align-items: center; font-size: 14px; }
.toast.alert::before { background: var(--coral); }

/* ---------- Trilha (log) ---------- */

.log { list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--ink-50); }
.log li { padding: 6px 0; border-bottom: 1px solid var(--ink-07); }
.log li:last-child { border-bottom: 0; }
.log .when { font-family: var(--qp-semi); margin-right: 6px; color: var(--black); }

/* ---------- Acessibilidade ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Telas estreitas ---------- */

/* topo do gestor em tela média: o "Projetos" da marca sai para caber chapéu, menu e Novo projeto */
@media (max-width: 1200px) {
  .topbar.is-manager { column-gap: 16px; }
  .topbar.is-manager .brand-sub { display: none; }
  .topbar.is-manager .nav { gap: 16px; }
}

@media (max-width: 1024px) {
  .shell-main { padding: 24px max(20px, env(safe-area-inset-right, 0px)) 36px max(20px, env(safe-area-inset-left, 0px)); }
  .layout-side { grid-template-columns: 1fr; }
  .drawer { width: 380px; }
}

/* abaixo de 1024 px o menu desce para uma segunda linha e rola dentro da barra.
   Era 900 px até 16/11; com a Medição, o menu da Gestão tem quatro itens e não cabia de 901 a 1009 px. */
@media (max-width: 1023px) {
  .topbar { height: auto; flex-wrap: wrap; row-gap: 0; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
  .brand { height: 52px; }
  .topbar-space { display: none; }
  /* linha 1: marca e pessoa; linha 2 (gestor): chapéu e Novo projeto; linha 3: menu */
  .person-picker { order: 1; margin-left: auto; }
  .topbar::after { content: ''; order: 1; flex-basis: 100%; height: 0; }
  .hats { order: 2; margin: 0 0 10px; }
  .topbar-new { order: 2; margin: 0 0 10px auto; }
  .nav {
    order: 3;
    flex: 1 0 100%;
    height: 42px;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid var(--ink-07);
  }
  .nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 900px) {
  .two, .three { grid-template-columns: 1fr; }
}

/* ---------- Celular (abaixo de 720 px) ----------
   Topo: marca, pessoa e o ponto do Quinco em cima. Para quem monta projetos, o chapéu
   e o Novo projeto ("+" redondo) numa linha própria. O menu do chapéu na linha de baixo.
   Margem lateral de no mínimo 16 px (ou a área segura do aparelho), cartões com
   respiro menor e nenhum texto de tela abaixo de 11 px. */
@media (max-width: 719px) {
  .shell-main { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }

  .topbar { column-gap: 10px; }
  .topbar::after { border-top: 1px solid var(--ink-07); }
  .brand { gap: 10px; height: 54px; min-width: 0; }
  .brand-sub, .topbar.is-manager .brand-sub { display: none; }
  .brand-qnco { height: 21px; }
  .brand-rule { height: 18px; }
  .brand-quinco { height: 15px; }
  .person-picker { padding-left: 12px; gap: 10px; flex: 0 1 auto; margin-left: auto; }
  .topbar { container-type: inline-size; }
  .person-picker .select { max-width: calc(100cqw - 166px); min-height: 40px; font-size: 13px; }

  /* linha 2 (só gestor): chapéu à esquerda e Novo projeto à direita; linha 3: menu.
     O chapéu tem linha própria e nunca fica escondido; o menu de cada chapéu cabe sem rolar. */
  .hats { margin: 10px 0; }
  .hat { padding: 7px 15px; font-size: 13px; }
  .nav { height: 46px; gap: 22px; font-size: 14px; }
  .topbar:not(.is-manager) .nav { border-top: 0; }
  .nav-item { display: flex; align-items: center; align-self: stretch; padding: 2px 0 0; border-bottom: 2px solid transparent; }
  .nav-item.active { padding-bottom: 0; border-bottom-color: var(--black); }
  /* reserva para letra grande: se o menu não couber, rola de lado com as bordas esmaecidas */
  .nav.more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
  .nav.more-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px); mask-image: linear-gradient(90deg, transparent, #000 24px); }
  .nav.more-left.more-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 32px), transparent); }
  /* Gestão do admin (18/11): com Acessos são cinco itens. "Agenda do time" vira "Agenda" e o espaço
     entre os itens encolhe um pouco, para o menu caber sem rolar de 360 px para cima. */
  .topbar.is-manager .nav[data-hat="gestao:admin"] { gap: 14px; }
  .nav[data-hat="gestao:admin"] .nav-label-full { display: none; }
  .nav[data-hat="gestao:admin"] .nav-label-short { display: inline; }

  .topbar-new { order: 2; align-self: center; width: 36px; height: 36px; min-height: 36px; margin: 10px 0 10px auto; padding: 0; border-radius: 50%; }
  .topbar-new-plus { display: inline-flex; }
  .topbar-new .topbar-new-plus svg { width: 18px; height: 18px; }
  .topbar-new-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

  .page-title, h1 { font-size: 32px; }
  .page-head { gap: 14px; margin-bottom: 18px; }
  .page-head > :first-child { min-width: 0; flex-basis: 100%; }
  .page-actions { flex-wrap: wrap; max-width: 100%; }
  .page-head > .page-actions:has(.inline-field) { flex: 1 1 100%; min-width: 0; }
  .page-actions > .field.inline-field { flex: 1 1 auto; min-width: 0; }
  .page-actions > .field.inline-field > .select { flex: 1 1 auto; width: 0; min-width: 0; }
  .toolbar { gap: 10px 14px; }
  .toolbar .input.search { width: 100%; }
  .card { padding: 18px 16px; }
  .card.flush > .card-title { padding: 18px 16px 0; }
  .table th:first-child, .table td:first-child, .table.dense th:first-child, .table.dense td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child, .table.dense th:last-child, .table.dense td:last-child { padding-right: 16px; }
  .card-title, .table th, .table.dense th, .kpi-label, .zone-title, .grid-head > span:first-child { font-size: 11px; }
  .pill { font-size: 12px; }
  .avatar, .avatar.sm { font-size: 11px; }
  .empty { padding: 28px 16px; }
  .empty-barred { margin-top: 16px; padding: 32px 18px; }

  .modal { padding: 22px 18px 18px; max-height: calc(100vh - 32px); }
  .modal-backdrop { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); }
  .modal-actions { flex-wrap: wrap; justify-content: flex-end; row-gap: 10px; }
  .toast { min-width: 0; }
}

/* toque: botões da barra de ferramentas (Hoje, semana anterior e seguinte) com área de pelo menos 36 px */
@media (hover: none) {
  .toolbar > .btn-ghost:not(.btn-icon) { min-height: 36px; }
  .week-nav .btn-icon { width: 36px; min-height: 36px; }
}

/* tablet de toque (abaixo de 1024 px, sem hover): o mesmo piso de 11 px do celular */
@media (max-width: 1023px) and (hover: none) {
  .card-title, .table th, .table.dense th, .kpi-label, .zone-title, .grid-head > span:first-child { font-size: 11px; }
  .avatar, .avatar.sm { font-size: 11px; }
  .brand-sub { font-size: 11px; letter-spacing: .28em; }
}

/* tela muito estreita: a marca encolhe para a pessoa caber */
@media (max-width: 374px) {
  .brand { gap: 8px; }
  .brand-qnco { height: 19px; }
  .brand-quinco { height: 13px; }
  .person-picker { padding-left: 10px; gap: 8px; }
  .person-picker .select { max-width: calc(100cqw - 148px); }
}
