/*
 * Listagens (projetos, coordenadores, unidades, departamentos), página inicial e página do projeto.
 * Tudo dentro de .pl; as cores vêm dos tokens --ui-* (theme.css), que mudam no tema escuro.
 * O DataTables vem com CSS próprio e Skeleton/Bootstrap mexem em tabelas, inputs e botões:
 * por isso os seletores abaixo são mais específicos e, onde o DataTables usa !important, também usam.
 */

.pl { max-width: 1120px; margin: 40px auto 0; padding: 0 16px 24px; text-align: left; font-size: 15px; line-height: 1.5; color: var(--ui-fg); }
.pl *, .pl *::before, .pl *::after { box-sizing: border-box; }
.pl p { margin: 0; }
.pl-narrow { max-width: 760px; }

/* Título */
.pl-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 18px; }
.pl-head > div { min-width: 0; }
.pl .pl-title { margin: 0 0 4px; font-family: var(--ui-font-display); font-size: clamp(26px, 4vw, 34px); line-height: 1.2; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--ui-fg); }
.pl-head p { color: var(--ui-muted); max-width: 62ch; }
.pl-crumbs { margin-bottom: 6px; color: var(--ui-muted); font-size: 13px; }
.pl-crumbs a { color: inherit !important; text-decoration: underline !important; }
.pl-head-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Cartão da listagem */
.pl-card { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); overflow: hidden; }

/* DataTables: barra de busca/filtros */
.pl .dataTables_wrapper { text-align: left; color: var(--ui-fg); }
.pl .pl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--ui-line); }
.pl .dataTables_filter { flex: 1 1 260px; min-width: 0; margin: 0; float: none; text-align: left; }
.pl .dataTables_filter label { display: block; margin: 0; font-size: 0; }
.pl .dataTables_filter input[type=search] {
  display: block; width: 100%; height: auto; min-height: 42px; margin: 0; padding: 9px 12px 9px 38px; font: inherit; font-size: 15px;
  color: var(--ui-fg); background-color: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 8px; box-shadow: none; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238a98a9' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='9' cy='9' r='5.5'/%3E%3Cpath d='M13.5 13.5L17 17'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center; background-size: 18px; }
.pl .dataTables_filter input[type=search]::placeholder { color: var(--ui-muted); opacity: .8; }
.pl .dataTables_filter input[type=search]:focus { border-color: var(--ui-accent); outline: 2px solid var(--ui-accent); outline-offset: 1px; }
.pl .pl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; }
.pl .pl-filters[hidden] { display: none; }
.pl .pl-select { display: block; width: auto; max-width: 100%; height: auto; min-height: 42px; margin: 0; padding: 9px 32px 9px 12px; font: inherit; font-size: 15px;
  color: var(--ui-fg); background-color: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 8px; box-shadow: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%238a98a9' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }
.pl .pl-clear { height: auto; margin: 0; padding: 6px; border: 0; background: none; font: inherit; font-weight: 500; letter-spacing: 0; text-transform: none; line-height: 1.4; color: var(--ui-accent); cursor: pointer; }

/* Controle segmentado (Situação) */
.pl .pl-seg { display: inline-flex; margin: 0; border: 1px solid var(--ui-line); border-radius: 8px; overflow: hidden; background: var(--ui-surface); }
.pl .pl-seg button { height: auto; margin: 0; padding: 9px 14px; border: 0; border-radius: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 500;
  letter-spacing: 0; text-transform: none; line-height: 1.4; color: var(--ui-muted); cursor: pointer; }
.pl .pl-seg button + button { border-left: 1px solid var(--ui-line); }
.pl .pl-seg button[aria-pressed="true"] { background: var(--ui-accent); color: var(--ui-accent-fg); }

/* Tabela */
.pl .pl-table { overflow-x: auto; }
.pl table.dataTable { width: 100% !important; margin: 0; border-collapse: collapse; border-spacing: 0; clear: none; background: transparent; }
.pl table.dataTable.no-footer { border-bottom: 0; }
.pl table.dataTable thead th { position: relative; padding: 10px 16px; border-bottom: 1px solid var(--ui-line); background: var(--ui-row-hover); color: var(--ui-muted);
  font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.pl table.dataTable tbody td { padding: 13px 16px; border: 0; border-bottom: 1px solid var(--ui-line); vertical-align: top; text-align: left; color: var(--ui-fg); }
.pl table.dataTable tbody tr { background: transparent; }
.pl table.dataTable tbody tr:hover { background: var(--ui-row-hover); }
.pl table.dataTable tbody tr:last-child td { border-bottom: 0; }
.pl table.dataTable th.num, .pl table.dataTable td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl table.dataTable td.act, .pl table.dataTable th.act { text-align: right; white-space: nowrap; }
.pl table.dataTable td.pl-strong { font-weight: 600; }
.pl table.dataTable td.pl-mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl table.dataTable td.dataTables_empty { padding: 40px 16px; text-align: center; color: var(--ui-muted); }
.pl table.dataTable tbody td a.pl-link { font-weight: 500; }
.pl .pl-sub { display: block; color: var(--ui-muted); font-size: 13.5px; }
.pl abbr { text-decoration: none; font-weight: 600; letter-spacing: .02em; border: 0; cursor: default; }

/* Ordenação: setas no lugar das imagens do DataTables */
.pl table.dataTable thead th.sorting, .pl table.dataTable thead th.sorting_asc, .pl table.dataTable thead th.sorting_desc {
  background-image: none; padding-right: 28px; cursor: pointer; }
.pl table.dataTable thead th.sorting::after, .pl table.dataTable thead th.sorting_asc::after, .pl table.dataTable thead th.sorting_desc::after {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 10px; }
.pl table.dataTable thead th.sorting::after { content: "\25B2"; opacity: .3; }
.pl table.dataTable thead th.sorting_asc::after { content: "\25B2"; color: var(--ui-accent); }
.pl table.dataTable thead th.sorting_desc::after { content: "\25BC"; color: var(--ui-accent); }
.pl table.dataTable thead th.sorting_asc, .pl table.dataTable thead th.sorting_desc { color: var(--ui-fg); }
.pl table.dataTable thead th.act.sorting_disabled { padding-right: 16px; }
.pl .dataTables_wrapper .dataTables_processing { top: 56px; left: 50%; width: auto; height: auto; margin: 0; padding: 8px 16px; transform: translateX(-50%);
  border: 1px solid var(--ui-line); border-radius: 8px; background: var(--ui-surface); color: var(--ui-muted); font-size: 13.5px; z-index: 2; }

/* Situação e ações */
.pl .pl-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--ui-ok-soft); color: var(--ui-ok);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pl .pl-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pl .pl-pill.off { background: var(--ui-row-hover); color: var(--ui-muted); border: 1px solid var(--ui-line); }
.pl-acts { display: inline-flex; gap: 6px; }

/* Rodapé: informação, quantidade por página e paginação */
.pl .pl-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 12px 16px; border-top: 1px solid var(--ui-line); color: var(--ui-muted); font-size: 13.5px; }
.pl .dataTables_info { padding: 0; float: none; color: var(--ui-muted); }
.pl .pl-pg { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pl .dataTables_length { float: none; margin: 0; }
.pl .dataTables_length label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; color: var(--ui-muted); }
.pl .dataTables_length select { display: inline-block; width: auto; height: auto; min-height: 36px; margin: 0; padding: 5px 28px 5px 10px; font: inherit; font-size: 14px; color: var(--ui-fg);
  background-color: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 8px; box-shadow: none; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%238a98a9' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 12px; }
.pl .dataTables_paginate { float: none; padding: 0; text-align: left; display: flex; flex-wrap: wrap; gap: 4px; }
.pl .dataTables_wrapper .dataTables_paginate .paginate_button {
  min-width: 36px; height: 36px; margin: 0; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--ui-line) !important; border-radius: 8px; background: var(--ui-surface) !important; background-image: none !important; box-shadow: none;
  color: var(--ui-fg) !important; font-weight: 500; cursor: pointer; }
.pl .dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--ui-row-hover) !important; color: var(--ui-fg) !important; border-color: var(--ui-line) !important; }
.pl .dataTables_wrapper .dataTables_paginate .paginate_button.current, .pl .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--ui-accent) !important; border-color: var(--ui-accent) !important; color: var(--ui-accent-fg) !important; }
.pl .dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .pl .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  opacity: .45; cursor: default; background: var(--ui-surface) !important; color: var(--ui-muted) !important; }
.pl .dataTables_paginate span { display: flex; gap: 4px; }

/* Home */
.pl-hero { padding: 32px; text-align: center; }
.pl-hero p { color: var(--ui-muted); max-width: 70ch; margin: 0 auto 22px; text-align: center; }
.pl-hero .pl-title { margin-bottom: 12px; }

/* Página do projeto */
.ps { padding: 24px; }
.ps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 32px; margin: 0; }
.ps-item { min-width: 0; }
.ps-wide { grid-column: 1 / -1; }
.pl .ps-grid dt { margin: 0 0 2px; color: var(--ui-muted); font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.pl .ps-grid dd { margin: 0; overflow-wrap: anywhere; }
.ps-abstract { text-align: justify; }
.ps-abstract p { margin: 0 0 .75em; }
.ps-section { margin: 28px 0 14px; padding-top: 22px; border-top: 1px solid var(--ui-line); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ui-muted); }
.ps-years { margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.ps-years li { display: flex; justify-content: space-between; gap: 16px; max-width: 280px; padding: 4px 0; border-bottom: 1px dashed var(--ui-line); }

/* Celular: a tabela vira uma lista de cartões, com o rótulo de cada campo ao lado do valor */
@media (max-width: 720px) {
  .pl { margin-top: 24px; }
  .ps { padding: 18px 16px; }
  .ps-grid { grid-template-columns: minmax(0, 1fr); }
  .pl-hero { padding: 22px 18px; }
  .pl table.dataTable, .pl table.dataTable tbody, .pl table.dataTable tbody tr, .pl table.dataTable tbody td { display: block; width: 100% !important; }
  .pl table.dataTable thead { display: none; }
  .pl table.dataTable tbody tr { padding: 14px 16px; border-bottom: 1px solid var(--ui-line); }
  .pl table.dataTable tbody tr:last-child { border-bottom: 0; }
  .pl table.dataTable tbody td { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border: 0; text-align: right; }
  .pl table.dataTable tbody td::before { content: attr(data-l); flex: none; color: var(--ui-muted); font-size: 13px; text-align: left; }
  .pl table.dataTable tbody td.main { display: block; text-align: left; padding-bottom: 6px; }
  .pl table.dataTable tbody td.main::before { content: none; }
  .pl table.dataTable tbody td.act { justify-content: flex-end; padding-top: 10px; }
  .pl table.dataTable tbody td.act::before { content: none; }
  .pl table.dataTable tbody td.dataTables_empty { display: block; text-align: center; }
  .pl table.dataTable tbody td.dataTables_empty::before { content: none; }
  .pl .pl-foot { justify-content: center; text-align: center; }
}

/* Telas largas: a descrição do título ocupa a linha inteira; no celular continua quebrando em ~62 caracteres */
@media (min-width: 721px) {
  .pl-head p, .pf-header p { max-width: none; }
  .pl table.dataTable td.pl-nowrap { white-space: nowrap; }
}
