/* Gestão Comercial · Contrato de equipamentos. Reuso os tokens do app.css; a escala de urgência é a única cor nova e vale para a tela toda. */
.ct, #ctFicha { --u-venc: #b42318; --u-j1: #c2410c; --u-j2: #d97706; --u-j3: #ca8a04; --u-vig: #059669; --u-sem: #94a3b8 }
.ct { display: flex; flex-direction: column; gap: 14px }
.ct button { font: inherit }
.ct :focus-visible { outline: 2px solid var(--steel); outline-offset: 2px }

/* barra de filtros */
.ct-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px }
.ct-busca { position: relative; flex: 1 1 260px; max-width: 360px }
.ct-busca svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none }
.ct-busca input { width: 100%; height: 34px; padding: 0 10px 0 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: .8125rem }
.ct-busca input:focus, .ct-sel:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(37,99,235,.12) }
.ct-seg { display: inline-flex; background: var(--surface2); border-radius: 8px; padding: 3px; gap: 2px }
.ct-seg button { white-space: nowrap; height: 28px; padding: 0 12px; border-radius: 6px; font-size: .75rem; font-weight: 600; color: var(--muted) }
.ct-seg button[aria-pressed="true"] { background: var(--surface); color: var(--vault); box-shadow: 0 1px 2px rgba(15,23,42,.12) }
.ct-sel { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: .78rem; max-width: 190px; color: var(--txt) }
.ct-lido { margin-left: auto; font-size: .7188rem; color: var(--faint) }

/* régua da carteira: o parque dividido em estágios de urgência */
.ct-carteira { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px 16px }
.ct-cab { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-bottom: 14px }
.ct-tot { font-family: var(--disp); font-size: 2rem; font-weight: 600; color: var(--vault); line-height: 1; letter-spacing: -.02em }
.ct-tot small { font-family: var(--ui); font-size: .8125rem; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px }
.ct-receita { font-size: .8125rem; color: var(--muted) }
.ct-receita b { font-family: var(--disp); font-size: 1rem; color: var(--vault) }
.ct-regua { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--surface2) }
.ct-regua i { display: block; min-width: 4px; cursor: pointer; transition: opacity .15s, filter .15s }
.ct-regua i:hover { filter: brightness(1.1) }
.ct-regua.filtrada i:not(.on) { opacity: .25 }
.ct-estagios { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin-top: 12px }
.ct-est { position: relative; text-align: left; padding: 8px 12px 8px 14px; border-left: 1px solid var(--line); border-radius: 0; transition: background .15s }
.ct-est:first-child { border-left: none }
.ct-est::before { content: ""; position: absolute; left: 4px; top: 12px; width: 6px; height: 6px; border-radius: 50% ; background: var(--c) }
.ct-est:hover { background: var(--surface2) }
.ct-est[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 9%, transparent) }
.ct-est .n { display: block; font-family: var(--disp); font-size: 1.5rem; font-weight: 600; line-height: 1.15; color: var(--c) }
.ct-est .r { display: block; font-size: .75rem; color: var(--txt); font-weight: 500 }
.ct-est .s { display: block; font-size: .6875rem; color: var(--faint); margin-top: 2px; font-variant-numeric: tabular-nums }
.ct-est.zero .n { color: var(--faint) }
.ct-est.zero { opacity: .65 }

/* horizonte de vencimentos + painéis laterais */
.ct-palco { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 10px }
.ct-g { padding: 16px 18px; min-width: 0 }
.ct-g + .ct-g { border-left: 1px solid var(--line) }
.ct-g h4 { font-family: var(--disp); font-size: .9375rem; font-weight: 600; color: var(--vault); margin-bottom: 2px }
.ct-g p.d { font-size: .7188rem; color: var(--faint); margin-bottom: 12px }
.ct-svg { display: block; width: 100%; height: auto }
.ct-svg .b { cursor: pointer; outline: none }
.ct-svg .b .hit { fill: transparent }
.ct-svg .b:hover .hit, .ct-svg .b:focus-visible .hit { fill: var(--surface2) }
.ct-svg .b.off rect:not(.hit) { opacity: .22 }
.ct-svg .v { font: 600 11px var(--disp); fill: var(--vault); text-anchor: middle }
.ct-svg .x { font: 500 10px var(--ui); fill: var(--muted); text-anchor: middle }
.ct-svg .x.ano { font-weight: 700; fill: var(--txt) }
.ct-svg .b.on .x { fill: var(--steel); font-weight: 700 }
.ct-svg .hoje { stroke: var(--vault); stroke-width: 1.5; stroke-dasharray: 3 3 }
.ct-svg .hoje-t { font: 600 10px var(--ui); fill: var(--vault) }
.ct-svg .base { stroke: var(--line) }
.ct-leg { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .6875rem; color: var(--muted); margin-top: 6px }
.ct-leg span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; background: var(--c) }

.ct-lista { display: flex; flex-direction: column; gap: 2px }
.ct-li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; text-align: left; padding: 7px 8px; border-radius: 6px }
.ct-li:hover { background: var(--surface2) }
.ct-li[aria-pressed="true"] { background: rgba(37,99,235,.08) }
.ct-li .t { font-size: .78rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.ct-li .q { font-family: var(--disp); font-weight: 600; font-size: .875rem; color: var(--vault); font-variant-numeric: tabular-nums }
.ct-li .ct-mb { grid-column: 1 / -1; display: flex; gap: 1px; height: 5px; margin: 2px 0; border-radius: 3px; overflow: hidden; background: var(--surface2) }
.ct-li .ct-mb i { display: block; height: 100% }
.ct-li .m { grid-column: 1 / -1; font-size: .6875rem; color: var(--muted) }
.ct-vazio { padding: 22px 8px; text-align: center; font-size: .78rem; color: var(--faint) }

/* chips de filtro */
.ct-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 0 }
.ct-chips:empty { display: none }
.ct-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px 0 10px; border-radius: 13px; background: rgba(37,99,235,.08); color: var(--steel); font-size: .75rem; font-weight: 600 }
.ct-chip button { width: 18px; height: 18px; border-radius: 50%; line-height: 1; color: var(--steel) }
.ct-chip button:hover { background: rgba(37,99,235,.18) }
.ct-limpar { font-size: .75rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px }

/* tabela */
.ct-tab { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden }
.ct-tab header { display: flex; align-items: baseline; gap: 10px; padding: 14px 18px 10px }
.ct-tab header h4 { font-family: var(--disp); font-size: .9375rem; font-weight: 600; color: var(--vault) }
.ct-tab header small { font-size: .75rem; color: var(--muted) }
.ct-scroll { overflow: auto; max-height: 68vh }
.ct-tab table { font-size: .78rem }
.ct-tab th { position: sticky; top: 0; z-index: 2; background: #f8fafc; white-space: nowrap; cursor: pointer; user-select: none; padding: 9px 10px }
.ct-tab th:hover { color: var(--vault) }
.ct-tab th[aria-sort] { color: var(--steel) }
.ct-tab th[aria-sort="ascending"]::after { content: " ▲"; font-size: .55rem }
.ct-tab th[aria-sort="descending"]::after { content: " ▼"; font-size: .55rem }
.ct-tab td { padding: 8px 10px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis }
.ct-tab tbody tr { cursor: pointer }
.ct-tab tbody tr:hover td { background: #f8fafc }
.ct-tab .fix { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line) }
.ct-tab th.fix { z-index: 3; background: #f8fafc }
.ct-serie { font-family: var(--disp); font-weight: 600; color: var(--vault); text-decoration: underline dotted; text-underline-offset: 3px }
.ct-serie:hover { color: var(--steel) }
.ct-num { text-align: right; font-variant-numeric: tabular-nums }
.ct-mais { display: block; width: 100%; padding: 12px; font-size: .78rem; font-weight: 600; color: var(--steel); border-top: 1px solid var(--line) }
.ct-mais:hover { background: var(--surface2) }

/* selo de situação */
.ct-selo { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 11px; font-size: .7188rem; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); white-space: nowrap }
.ct-selo::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c) }
.ct-arq { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; font-size: .625rem; font-weight: 600; color: var(--muted); background: var(--surface2) }

/* onboarding sem campo de vencimento */
.ct-aviso { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; font-size: .8125rem; color: #78350f }
.ct-aviso b { color: #451a03 }
.ct-aviso button { margin-left: auto; white-space: nowrap; padding: 7px 12px; border-radius: 7px; background: var(--vault); color: #fff; font-size: .75rem; font-weight: 600 }

/* ficha (modal) */
#ctFicha .card { width: min(1180px, calc(100vw - 32px)); max-height: 92vh; padding: 0; display: flex; flex-direction: column; overflow: hidden }
.ct-fh { display: flex; align-items: flex-start; gap: 14px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line) }
.ct-fh .id { font-family: var(--disp); font-size: 1.625rem; font-weight: 600; color: var(--vault); letter-spacing: -.01em; line-height: 1.1 }
.ct-fh .sub { font-size: .78rem; color: var(--muted); margin-top: 4px }
.ct-fh .acoes { margin-left: auto; display: flex; gap: 8px; align-items: center }
.ct-btn { height: 34px; padding: 0 14px; border-radius: 8px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--txt) }
.ct-btn:hover:not(:disabled) { border-color: var(--steel); color: var(--steel) }
.ct-btn.pri { background: var(--steel); border-color: var(--steel); color: #fff }
.ct-btn.pri:hover:not(:disabled) { background: #1d4ed8; color: #fff }
.ct-btn:disabled { opacity: .5; cursor: not-allowed }
.ct-x { width: 34px; height: 34px; border-radius: 50%; font-size: 1.25rem; color: var(--muted) }
.ct-x:hover { background: var(--surface2); color: var(--vault) }
.ct-fb { overflow: auto; padding: 16px 22px 20px; flex: 1 }

.ct-vig { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 14px 16px; border-radius: 10px; background: var(--surface2); margin-bottom: 16px }
.ct-vig .lim { font-size: .7188rem; color: var(--muted) }
.ct-vig .lim b { display: block; font-family: var(--disp); font-size: .9375rem; color: var(--vault) }
.ct-vig .lim.fim { text-align: right }
.ct-trilho { position: relative; height: 8px; border-radius: 4px; background: #dbe3ec }
.ct-trilho i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--c) }
.ct-trilho em { position: absolute; top: -5px; width: 2px; height: 18px; background: var(--vault); border-radius: 1px }
.ct-vig .msg { grid-column: 1 / -1; font-size: .8125rem; color: var(--txt) }
.ct-vig .msg b { color: var(--c) }

.ct-fgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px }
.ct-sec { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; min-width: 0 }
.ct-sec > h5 { display: flex; align-items: center; gap: 8px; font-family: var(--disp); font-size: .875rem; font-weight: 600; color: var(--vault); margin-bottom: 8px }
.ct-sec > h5 small { font-family: var(--ui); font-weight: 500; font-size: .7188rem; color: var(--faint) }
.ct-sec > h5 input { margin-left: auto; height: 28px; width: 180px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; font-size: .75rem; font-family: var(--ui) }
.ct-dl { display: grid; grid-template-columns: minmax(110px, 40%) minmax(0, 1fr); gap: 0 12px }
.ct-dl > div { display: contents }
.ct-dl dt, .ct-dl dd { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .78rem }
.ct-dl dt { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap }
.ct-dl dd { color: var(--txt); font-weight: 500; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px }
.ct-dl > div:last-child dt, .ct-dl > div:last-child dd { border-bottom: none }
.ct-dl dd.vz { color: var(--faint); font-weight: 400 }
.ct-tag { font-size: .625rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: rgba(37,99,235,.08); color: var(--steel) }
.ct-cadeado { color: var(--faint); font-size: .6875rem; font-weight: 400 }
.ct-campos { max-height: 520px; overflow: auto }

/* edição */
.ct-in { width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; font: 500 .78rem var(--ui); background: var(--surface); color: var(--txt) }
textarea.ct-in { height: 64px; padding: 6px 8px; resize: vertical }
.ct-in:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(37,99,235,.12) }
.ct-in.mud { border-color: var(--warn); background: #fffbeb }
.ct-in:disabled { background: var(--surface2); color: var(--muted) }
.ct-ed-nota { font-size: .7188rem; color: var(--muted); margin: -4px 0 12px }
.ct-rodape { display: flex; align-items: center; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--line); background: #f8fafc }
.ct-rodape .t { font-size: .78rem; color: var(--txt); margin-right: auto }
.ct-rodape .t b { color: var(--warn) }
.ct-revisao { border: 1px solid #fde68a; background: #fffbeb; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px }
.ct-revisao h5 { font-family: var(--disp); font-size: .875rem; color: #78350f; margin-bottom: 8px }
.ct-revisao table { font-size: .75rem }
.ct-revisao td, .ct-revisao th { padding: 5px 8px; background: transparent }
.ct-revisao .a { color: var(--muted); text-decoration: line-through }
.ct-revisao .d { color: var(--vault); font-weight: 600 }
.ct-erro { padding: 10px 12px; border-radius: 8px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-size: .78rem; margin-bottom: 12px }
.ct-erro ul { margin: 6px 0 0 18px }
.ct-ok-r { color: var(--ok) } .ct-er-r { color: var(--alert) }
.ct-carregando { padding: 40px; text-align: center; color: var(--muted); font-size: .8125rem }

@media (max-width: 1100px) {
  .ct-palco { grid-template-columns: 1fr 1fr }
  .ct-palco .ct-g:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line) }
  .ct-palco .ct-g:nth-child(2) { border-left: none }
  .ct-estagios { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 8px }
  .ct-est:nth-child(4) { border-left: none }
}
@media (max-width: 760px) {
  .ct-palco, .ct-fgrid { grid-template-columns: 1fr }
  .ct-palco .ct-g + .ct-g { border-left: none; border-top: 1px solid var(--line) }
  .ct-estagios { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .ct-est { border-left: none }
  .ct-lido { margin-left: 0; width: 100% }
}
@media (prefers-reduced-motion: reduce) { .ct * { transition: none !important } }
#ctFicha label.ct-nl { display: block; font-size: .7188rem; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: normal; margin: 0 }

/* legenda dos modelos de contrato (botão "i" no cabeçalho da coluna) */
.ct-i { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; border: 1px solid currentColor;
  font: italic 700 .625rem/1 Georgia, serif; color: var(--muted); vertical-align: middle; text-transform: none; cursor: pointer }
.ct-i:hover, .ct-i:focus-visible { color: var(--steel); border-color: var(--steel); outline: none }
#ctInfoModelo { --u-venc: #b42318; --u-j3: #ca8a04; --u-vig: #059669 }
#ctInfoModelo .card.ct-info { width: min(720px, calc(100vw - 32px)); max-height: 90vh; overflow: auto; padding: 0 }
.ct-info-l { list-style: none; counter-reset: m; padding: 6px 22px 20px; margin: 0 }
.ct-info-l li { counter-increment: m; position: relative; padding: 12px 0 12px 44px; border-bottom: 1px solid var(--line) }
.ct-info-l li:last-child { border-bottom: none }
.ct-info-l li::before { content: counter(m); position: absolute; left: 0; top: 12px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font: 600 .8125rem var(--disp); color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent) }
.ct-info-l b { font-family: var(--disp); font-size: .9375rem; color: var(--c) }
.ct-info-l p { margin-top: 3px; font-size: .8125rem; line-height: 1.5; color: var(--txt); max-width: 62ch }
