/*
 * Estilos só do app. O design system fica em app.css, cópia de docs/design/assets/app.css:
 * mudanças no visual entram nos dois arquivos (ver docs/design/DESIGN-SYSTEM.md).
 */

.nav { display: flex; flex-direction: column; gap: 2px; }

/* Itens do menu ainda não construídos */
.it.soon { display: flex; justify-content: space-between; align-items: center; gap: 8px; opacity: .55; cursor: default; }
.it.soon:hover { background: transparent; color: var(--muted); }
.it.soon small { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }

/* Avisos (flash) */
.flash { justify-content: space-between; align-items: center; }
.flash .icon-btn { width: 28px; height: 28px; }

/* Menu do usuário na barra superior */
.user-menu { position: relative; }
.notif-menu { margin-left: 4px; }
.user-pop { top: calc(100% + 10px); right: 0; width: 300px; }
.user-pop .card-head { border-bottom: 1px solid var(--rule); }
.user-pop form { margin: 0; }
.signout { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-top: 0; background: transparent; cursor: pointer; font: inherit; text-align: left; }

/* Telas de acesso */
.auth-wrap { width: min(420px, 100%); }
.auth-foot { margin-top: 20px; text-align: center; }
.pw { position: relative; }
.pw .input { padding-right: 44px; width: 100%; }
.pw .icon-btn { position: absolute; right: 2px; top: 0; }

/* Erros de formulário */
.field_with_errors { display: contents; }
.field_with_errors .input, .field_with_errors .select, .field_with_errors .textarea { border-color: var(--crit-line); }
.field .error { font-size: 12px; color: var(--crit); }

/* Pessoa em tabela */
.who { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
tr.inactive td { color: var(--faint); }
tr.inactive .avatar { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-strong); }
.link-btn.danger { color: var(--crit); }
.inline-form { display: inline; margin: 0; }
.row-actions { display: inline-flex; align-items: center; gap: 14px; }

/* Matriz de permissões */
.matrix td, .matrix th { padding: 10px 14px; }
.matrix th:not(:first-child), .matrix td:not(:first-child) { text-align: center; }
.select.perm { height: 34px; width: 128px; font-size: 13px; font-weight: 600; padding-left: 10px; }
.pv { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; width: 128px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
.v-full { color: var(--cyan-300); background-color: var(--cyan-tint); border-color: var(--cyan-line); }
.v-edit { color: var(--good); background-color: var(--good-bg); border-color: var(--good-line); }
.v-read { color: var(--blue); background-color: rgba(96, 165, 250, 0.08); border-color: rgba(59, 130, 246, 0.3); }
.v-own { color: var(--warn); background-color: var(--warn-bg); border-color: var(--warn-line); }
.v-none { color: var(--faint); background-color: var(--surface-solid); }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 0 20px 20px; }
.legend-grid div { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.legend-grid .pv { width: auto; height: 26px; padding: 0 10px; align-self: flex-start; border: 1px solid; }
@media (max-width: 960px) { .matrix td:not(:first-child) { text-align: right; } .select.perm { width: 140px; } }

/* Filtro de status com links (recarrega no servidor) */
.seg a { height: 32px; padding: 0 12px; border-radius: 6px; font-size: 13px; color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.seg a:hover { color: var(--white); }
.seg a.on { background: var(--cyan); color: var(--bg); font-weight: 600; }

/* Gaveta: o turbo-frame ocupa a altura toda */
.drawer turbo-frame { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.drawer turbo-frame > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Formulário de gaveta aberto como página própria (sem JavaScript ou com erro de validação) */
.form-page { max-width: 640px; background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.form-page turbo-frame { display: block; }

/* Células com avatar */
.co-cell, .p-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.co-cell .cell-sub, .p-cell .cell-sub { white-space: normal; }
@media (max-width: 960px) { .co-cell .co-avatar, .p-cell .avatar { display: none; } }

tr[data-href] { cursor: pointer; }
.table tr.soon td { background: rgba(245, 158, 11, 0.05); }
.toolbar form { display: contents; }

/* Visão 360º */
.head360 { display: flex; align-items: center; gap: 16px; min-width: 0; }
.tab .c { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.tab.on .c { color: var(--cyan-300); }
.contact { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--rule); font-size: 13px; }
.contact .nm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text); font-weight: 600; font-size: 14px; }
.contact .ln { color: var(--muted); }
.tl i.warn { background: var(--warn); }
.tl i.good { background: var(--good); }
.tl i.crit { background: var(--crit-dot); }
.tl i.mute { background: var(--border-strong); }
.file-ic { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--cyan); flex: none; }
.hcell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.soon-card { opacity: .6; }
@media (max-width: 960px) { .head360 .co-avatar { width: 44px; height: 44px; font-size: 15px; } .hcell .file-ic { display: none; } }

/* Contratos */
.exp { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--rule); font-size: 14px; }
.exp .days { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 52px; border-radius: 10px; background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); color: var(--warn); font-weight: 700; font-size: 18px; line-height: 1; font-variant-numeric: tabular-nums; }
.exp .days.crit { background: var(--crit-bg); box-shadow: inset 0 0 0 1px var(--crit-line); color: var(--crit); }
.exp .days small { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.exp .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.table td[data-label="Vigência"] .cell-sub { white-space: normal; }
.who { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.chg { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.chg s { color: var(--muted); text-decoration-color: var(--faint); }
.chg b { color: var(--text); font-weight: 600; }
.file-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--rule); font-size: 13px; }
.vig-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.vig-ends b { display: block; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.alert-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--rule); font-size: 14px; }
.alert-row .d { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 960px) {
  .exp { grid-template-columns: 52px minmax(0, 1fr); }
  .exp .acts { grid-column: 1 / -1; justify-content: flex-start; }
  table.table.cards tr.soon { background: var(--warn-bg); }
  table.table.cards tr.soon td { background: transparent; }
}

/* Serviços contratados: regra de mensalização */
.mrr-rule { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.mrr-rule div { padding: 14px 20px; border-left: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.mrr-rule div:first-child { border-left: 0; }
.mrr-rule b { color: var(--text); font-size: 15px; font-weight: 600; }
@media (max-width: 960px) {
  .mrr-rule { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mrr-rule div { border-left: 0; border-top: 1px solid var(--rule); }
}

/* Notificações */
.notif-pop { top: calc(100% + 10px); right: -52px; width: 380px; }
.notif-row { width: 100%; border: 0; background: transparent; cursor: pointer; font: inherit; text-align: left; }
.notif-row.read { color: var(--muted); }
.palette-item:focus, .palette-item.on { background: var(--cyan-tint); color: var(--white); outline: none; }
@media (max-width: 960px) { .notif-pop { right: -48px; width: min(360px, calc(100vw - 24px)); } }

/* Pipeline */
.kcard.dragging { opacity: .5; }
.lane.over { border-color: var(--cyan); background: var(--cyan-tint); }
.lane.drop.over { color: var(--crit); border-color: var(--crit-line); background: var(--crit-bg); }
.kcard .r .val { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* Editor de itens da proposta */
.items .select, .items .input { width: 100%; }
.items td { vertical-align: top; }

/* Operação: projetos */
.prog-cell { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.prog-cell .progress { flex: 1; }
.prog-cell b { font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; width: 34px; text-align: right; }
.big-prog { display: flex; align-items: baseline; gap: 10px; }
.big-prog .v { font-size: 34px; font-weight: 700; color: var(--white); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.progress.lg { height: 12px; }
.progress.off { opacity: .5; }
.progress.off > i { background: var(--faint); }
.mini-board { grid-auto-columns: minmax(200px, 1fr); }
.mini-board .lane { min-height: 0; }
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.late-text { color: var(--crit); font-weight: 600; }
@media (max-width: 960px) { .prog-cell { min-width: 0; width: 60%; } }

/* Operação: tarefas */
.kcard { color: inherit; }
.kcard.late { border-color: var(--crit-line); background: linear-gradient(var(--crit-bg), var(--crit-bg)), var(--surface-2); }
.kcard .proj { font-size: 12px; font-weight: 600; color: var(--cyan); }
.kcard .hrs { display: flex; flex-direction: column; gap: 4px; }
.kcard .hrs .meta { display: flex; justify-content: space-between; gap: 8px; }
.over { color: var(--crit); font-weight: 600; }
.lane .more { border: 0; padding: 6px 4px; font-size: 13px; }

/* Operação: horas */
.hbars.wide .hbar { grid-template-columns: 120px minmax(0, 1fr) 64px; }
.hbar .who, .hbar a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Chamados */
.msg.note .bubble { background: transparent; border-style: dashed; border-color: var(--border-strong); }
.msg .bubble p { margin: 0 0 8px; }
.msg .bubble p:last-child { margin-bottom: 0; }
.msg .who .badge { margin-left: 6px; vertical-align: 1px; }
.reply-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg label { height: 32px; padding: 0 12px; border-radius: 6px; font-size: 13px; color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; cursor: pointer; }
.seg label:hover { color: var(--white); }
.seg label:has(input:checked) { background: var(--cyan); color: var(--bg); font-weight: 600; }
.seg label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 2px; }
.steps .cell-sub { font-weight: 500; }
.msg .who { display: block; white-space: normal; }
.kcard .meta { white-space: nowrap; }
/* Rodapé dos cards do pipeline: o contato encolhe com reticências, a data fica sempre visível. */
.kcard .n, .kcard .s { overflow-wrap: anywhere; }
.kcard .kfoot { display: flex; gap: 4px; min-width: 0; }
.kcard .kfoot .kf-who { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kcard .kfoot .kf-when { flex-shrink: 0; }

/* Financeiro */
.bars .pair { display: flex; align-items: flex-end; justify-content: center; gap: 4px; width: 100%; height: 100%; }
.bars .pair .bar { max-width: 18px; }
.bars .bar.exp { background: var(--faint); }
.comp { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--rule); gap: 2px; }
.comp i { display: block; height: 100%; }
.grid-kpi.g5 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.files { display: inline-flex; gap: 10px; }
.strike { text-decoration: line-through; color: var(--muted); }
.cc-hint { font-size: 12px; color: var(--muted); }
/* O rótulo oculto da coluna de ações (position: absolute) fica dentro da rolagem da tabela. */
.table-wrap { position: relative; }
@media (max-width: 960px) {
  .bars, .axis { gap: 6px; }
  .card-head { flex-wrap: wrap; }
}

/* Tecnologia */
.dep .card-head { padding-bottom: 14px; }
.dep .kv { padding: 10px 20px; font-size: 13px; }
.dep .kv > span:first-child { color: var(--text-2); }
.dep.crit { border-color: var(--crit-line); }
.ref { display: block; font-size: 12.5px; color: var(--text); margin-top: 6px; word-break: break-word; }
.urgent { border: 1px solid var(--crit-line); background: var(--crit-bg); border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.urgent .txt { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 4px; }
.urgent .txt b { color: var(--white); font-size: 16px; }
.urgent .days { font-size: 30px; font-weight: 700; color: var(--crit); font-variant-numeric: tabular-nums; line-height: 1; text-align: center; }
.urgent .days small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin-top: 4px; }
.alert-step { padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.alert-step .n { font-size: 22px; font-weight: 700; color: var(--white); font-variant-numeric: tabular-nums; }
.table tr.late td:first-child { box-shadow: inset 3px 0 0 var(--crit-dot); }

/* Produtos */
.prod { display: flex; flex-direction: column; }
.prod .card-head { align-items: flex-start; }
.prod .desc { padding: 0 20px 4px; margin: 0; color: var(--text-2); }
.prod .dl { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.prod .dl .v { font-size: 17px; font-weight: 700; color: var(--white); font-variant-numeric: tabular-nums; }
.prod .card-foot { margin-top: auto; }
.bars.stacked .col { gap: 0; }
.bars.stacked .lbl { margin-bottom: 6px; }
.bars.stacked .bar + .bar { border-radius: 0; }
@media (max-width: 960px) { .prod .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Gestão */
.kpi .h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.def { width: 24px; height: 24px; border-radius: 50%; border: 0; background: transparent; color: var(--faint); display: inline-flex; align-items: center; justify-content: center; cursor: help; padding: 0; flex: none; }
.def:hover, .def:focus-visible { color: var(--cyan); }
.kpi .d { font-size: 12px; color: var(--faint); line-height: 1.45; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--rule); }
.kpi.ind { min-height: 172px; }
.kpi.ind .v { white-space: normal; }
.mbar { display: flex; height: 28px; border-radius: 8px; overflow: hidden; background: var(--rule); }
.mbar > i { display: block; height: 100%; }
.mcell { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.mcell .progress { width: 72px; flex: none; }
.big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; color: var(--white); font-variant-numeric: tabular-nums; line-height: 1.1; }
.cost { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 20px; border-top: 1px solid var(--rule); font-size: 14px; }
.cost b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.cost .cell-sub { grid-column: 1 / -1; margin: 0; }
.rep { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-height: 132px; }
.rep h3 { margin: 0; }
.rep p { margin: 0; font-size: 13px; color: var(--muted); flex: 1; }
.rep .r { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rep.cur { border-color: var(--cyan-line); box-shadow: inset 0 0 0 1px var(--cyan-line); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 0 20px 18px; }
.filters .field { min-width: 150px; }
.rep-chart .hbar { grid-template-columns: 140px minmax(0, 1fr) 64px; }
@media (max-width: 600px) { .filters .field { min-width: 0; flex: 1 1 140px; } }
.hbar.wide { grid-template-columns: 96px minmax(0, 1fr) 56px; }
.table tfoot .num { white-space: nowrap; }
.show-m { display: none; }
@media (max-width: 600px) {
  .catalog-hide-m { display: none; }
  .show-m { display: inline-flex; }
}
.note > svg { flex: none; margin-top: 1px; }
