/*
 * Belt Sistemas — tema para Redmine 4.2
 * Identidade de https://beltsistemas.com.br/ : navy #0B3861, azul #1358BF,
 * ciano #009FBF, violeta #3906F9, Poppins.
 *
 * IMPORTANTE: o application.css de um tema SUBSTITUI o do Redmine,
 * por isso o CSS base é importado primeiro e este arquivo só sobrescreve.
 * Ajustes de layout ficam em @media (min-width: 900px) para não brigar
 * com o responsive.css (carregado depois deste arquivo) no mobile.
 * javascripts/theme.js transforma o "Tipo" em badge (.belt-tracker).
 */

@import url("../../../stylesheets/application.css");
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");
@import url("dark.css");

/* ==========================================================================
   1. Tokens
   ========================================================================== */
:root {
  --belt-navy-900: #082b4a;
  --belt-navy-800: #0b3861;
  --belt-navy-700: #0d4777;
  --belt-petrol:   #025684;
  --belt-blue:     #1358bf;
  --belt-cyan:     #009fbf;
  --belt-sky:      #44b6d0;
  --belt-violet:   #3906f9;

  --bg:            #eef2f7;
  --surface:       #ffffff;
  --surface-2:     #f7f9fc;
  --surface-3:     #eaf0f7;
  --row-hover:     #e8f2fb;
  --border:        #dde5ee;
  --border-strong: #c5d2e0;
  --text:          #1f2d3d;
  --text-muted:    #5b6b7d;
  --text-faint:    #8796a7;

  /* Cores de texto semânticas (o modo escuro troca estes valores; ver dark.css) */
  --heading:       var(--belt-navy-800);
  --btn-text:      var(--belt-navy-700);
  --link:          var(--belt-blue);

  --ok:   #12734f; --ok-bg:   #e8f6ef; --ok-bd:   #12a06b;
  --warn: #8f5300; --warn-bg: #fff6e6; --warn-bd: #e0a100;
  --err:  #b4232f; --err-bg:  #fdeef0; --err-bd:  #d6404d;

  /* Prioridades (Baixa → Imediata) */
  --p-baixa:    #9aa8b8;
  --p-normal:   #3b82d6;
  --p-alta:     #e0a100;
  --p-urgente:  #e8590c;
  --p-imediata: #c62d3b;

  --grad-brand:  linear-gradient(48deg, #082b4a 0%, #0b3861 40%, #025684 75%, #0079a4 100%);
  --grad-accent: linear-gradient(90deg, #009fbf 0%, #1358bf 55%, #3906f9 100%);

  --r-xs: 4px;   /* campos, badges */
  --r-sm: 6px;   /* botões, abas */
  --r-md: 8px;   /* painéis */
  --r-lg: 10px;  /* área de conteúdo */
  --shadow-1: 0 1px 2px rgba(11, 56, 97, .06);
  --shadow-2: 0 1px 3px rgba(11, 56, 97, .08), 0 4px 12px rgba(11, 56, 97, .05);
  --shadow-3: 0 12px 32px rgba(8, 43, 74, .18);
  --ring: 0 0 0 3px rgba(0, 159, 191, .22);

  --font: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

/* ==========================================================================
   2. Base
   ========================================================================== */
body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
#wrapper { background: var(--bg); }

h1, h2, h3, h4, h5, h6 { font-family: var(--font); }
#content h1, h2, h3, h4, h5, h6 { color: var(--heading); }
h2 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 14.5px; font-weight: 600; }
h4 { border-bottom-color: var(--border); }

a, a:link, a:visited { color: var(--link); }
a:hover, a:active { color: var(--belt-cyan); text-decoration: none; }
::selection { background: rgba(0, 159, 191, .22); }
hr { background: var(--border); }

/* ==========================================================================
   3. Barra superior e cabeçalho
   ========================================================================== */
#top-menu { background: var(--belt-navy-900); color: #9fbad3; }
#top-menu a { color: #d4e4f2; font-weight: 500; }
#top-menu a:hover { color: #fff; }
#top-menu #loggedas { color: #9fbad3; }
#top-menu #loggedas a { color: #fff; }

#header {
  background-color: var(--belt-navy-800);
  background-image: var(--grad-brand);
  color: #fff;
}
#header a, #header a:visited { color: #fff; }
#header h1 { font-weight: 600; letter-spacing: -.02em; }
#header h1 .breadcrumbs, #header h1 .breadcrumbs a { color: #b4cfe8; }
#header h1 .breadcrumbs a:hover { color: #fff; }

#quick-search label a { color: #cfe0f0; font-size: 12px; }
#quick-search #q {
  border: 1px solid rgba(255, 255, 255, .22);
  background-color: rgba(255, 255, 255, .1);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 0 10px;
}
#quick-search #q::placeholder { color: #a9c3dc; }
#quick-search #q:focus { background-color: rgba(255, 255, 255, .18); border-color: var(--belt-sky); box-shadow: var(--ring); }

#project-jump .drdn-trigger {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat calc(100% - 10px) 50%;
  padding-left: 10px;
  padding-right: 26px;
}
#project-jump.expanded .drdn-trigger { background-color: rgba(255, 255, 255, .18); }
#project-jump .drdn-items > a:hover { background-color: var(--belt-blue); }

/* Menu principal (é um div.tabs posicionado no rodapé do cabeçalho) */
#main-menu { z-index: 2; }
#main-menu li a { color: #cfe3f5; font-weight: 500; }
#main-menu li a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
#main-menu li a.selected, #main-menu li a.selected:hover {
  background: var(--bg);
  color: var(--heading);
  font-weight: 600;
}
#main-menu li a.new-object { background-color: rgba(255, 255, 255, .12); }
#main-menu .menu-children {
  border: 1px solid var(--border);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
#main-menu .menu-children li a { color: var(--text); }
#main-menu .menu-children li a:hover { color: #fff; background-color: var(--belt-blue); }
#main-menu .tabs-buttons { background: transparent; border: 0; }
#main-menu button.tab-left, #main-menu button.tab-right {
  background-color: rgba(255, 255, 255, .15); border-color: transparent; border-radius: var(--r-xs);
}

/* ==========================================================================
   4. Área principal, sidebar, rodapé
   ========================================================================== */
#main { background: var(--bg); }

#content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

/* Cabeçalho da página: título + ações na mesma linha, com divisor */
#content > h2:not(.inline-flex) {
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
/* Página da tarefa: h2 é inline-flex (com o badge "aberta" ao lado) */
#content > h2.inline-flex { margin-bottom: 14px; }
#content > .contextual { margin-top: 4px; }

#sidebar { background: transparent; border-left: 0; color: var(--text-muted); }
#sidebar h3 {
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  margin: 16px 0 6px;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
}
#sidebar > h3:first-child, #sidebar > :first-child > h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
#sidebar ul li { padding: 2px 0; }
#sidebar a, #sidebar a:visited { color: var(--text); }
#sidebar a:hover { color: var(--belt-blue); }
#sidebar a.selected {
  display: inline-block;
  background-color: var(--surface-3);
  color: var(--heading);
  font-weight: 600;
  border-radius: var(--r-xs);
  padding: 1px 8px;
  margin-left: -8px;
  line-height: 1.6;
}
#sidebar hr { background: var(--border); }
#sidebar #watchers > .contextual { margin: 15px 0 0; font-size: 12px; }

#footer {
  background: transparent;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 11.5px;
}
#footer a { color: var(--text-muted); }

/* ==========================================================================
   5. Formulários
   ========================================================================== */
input, select, textarea, button {
  font-family: var(--font);
  color: var(--text);
  border-color: var(--border-strong);
  border-radius: var(--r-xs);
}
input[type="text"], input[type="password"], input[type="date"], input[type="number"],
input[type="email"], input[type="url"], select:not([multiple]) { height: 28px; }
input[type="text"]:hover, input[type="password"]:hover, input[type="date"]:hover, input[type="number"]:hover,
input[type="email"]:hover, select:hover, textarea:hover { border-color: var(--text-faint); }
input[type="text"]:focus, input[type="text"]:active,
input[type="password"]:focus, input[type="password"]:active,
input[type="date"]:focus, input[type="date"]:active,
input[type="number"]:focus, input[type="number"]:active,
input[type="email"]:focus, input[type="email"]:active,
select:focus, select:active,
textarea:focus, textarea:active {
  border: 1px solid var(--belt-cyan);
  box-shadow: var(--ring);
  outline: none;
}
textarea { padding: 6px 8px; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--belt-blue); }

/* Botões */
input[type="submit"], input[type="button"], input[type="reset"], button[type="submit"] {
  height: 32px;
  padding: 0 16px;
  font-weight: 500;
  color: var(--btn-text);
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-1);
  transition: background-color .15s, color .15s, border-color .15s;
}
input[type="submit"]:hover, input[type="button"]:hover, input[type="reset"]:hover, button[type="submit"]:hover {
  background-color: var(--surface-3);
  border-color: var(--belt-navy-700);
  color: var(--heading);
}
input[type="submit"]:focus-visible, input[type="button"]:focus-visible, button[type="submit"]:focus-visible { box-shadow: var(--ring); outline: none; }
/* Ação principal (Salvar / Criar / Enviar / Entrar) */
input[type="submit"][name="commit"], input#login-submit {
  color: #fff;
  background-color: var(--belt-blue);
  border-color: var(--belt-blue);
}
input[type="submit"][name="commit"]:hover, input#login-submit:hover {
  background-color: var(--belt-navy-800);
  border-color: var(--belt-navy-800);
  color: #fff;
}

fieldset { border-color: var(--border); border-radius: var(--r-md); }
fieldset.collapsible { border-radius: 0; }
legend { color: var(--heading); font-weight: 500; }

.box {
  background-color: var(--surface-2);
  border-color: var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  padding: 12px 16px;
}
.tabular label { color: var(--text-muted); font-weight: 500; }
.tabular label.block, .tabular label.floating { font-weight: normal; color: var(--text); }
span.required, label span.required { color: var(--err); }

.drdn-content { border-color: var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow-3); }
div + .drdn-items { border-top-color: var(--border); }
.contextual .drdn-items > a:hover { color: var(--belt-blue); border-color: var(--border); background-color: var(--surface-3); border-radius: var(--r-xs); }

/* Painel de filtros das consultas (Tarefas, Tempo gasto, Projetos...) */
#query_form_with_buttons {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px 14px 0;
  margin-bottom: 16px;
}
#query_form_with_buttons fieldset.collapsible { border-top-color: var(--border); }
#query_form_with_buttons fieldset.collapsible:first-child { border-top: 0; }
#query_form_with_buttons legend { color: var(--heading); font-weight: 600; }
#query_form_with_buttons p.buttons {
  margin: 4px -14px 0;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}
p.buttons a.icon {
  /* texto centralizado na vertical (e ícone alinhado) em todos os botões de ação */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  box-sizing: border-box;
  line-height: 1.2;
  text-align: center;
  padding: 0 14px 0 28px;
  margin-right: 4px;
  background-position: 8px 50%;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  font-weight: 500;
}
p.buttons a.icon:hover { border-color: var(--belt-blue); color: var(--belt-blue); }
p.buttons a.icon-checked { border-color: var(--belt-blue); color: var(--belt-blue); }

/* ==========================================================================
   6. Badges de tipo (tracker) — ver javascripts/theme.js
   ========================================================================== */
/* Fundo sólido, matizes bem separados (vermelho, azul, roxo, verde, âmbar);
   todos com contraste AA para texto branco. Tipo desconhecido = cinza. */
.belt-tracker {
  --trk: #64748b;
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--r-xs);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  color: #fff;
  background: var(--trk);
}
.belt-tracker--correcao     { --trk: #d02f3c; }
.belt-tracker--melhoria     { --trk: #1a6ad9; }
.belt-tracker--customizacao { --trk: #7c3aed; }
.belt-tracker--projeto      { --trk: #0b8a5f; }
.belt-tracker--suporte      { --trk: #b45309; }
div.issue div.subject .belt-tracker { margin-bottom: 6px; }

/* ==========================================================================
   7. Tabelas
   ========================================================================== */
table.list, .table-list { border-color: var(--border); border-radius: var(--r-md); }
table.list th, .table-list-header {
  background-color: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-strong);
}
table.list th a, table.list th a:visited { color: var(--text-muted); }
table.list th a:hover, table.list th a.sort { color: var(--heading); }
table.list td { padding-top: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
table.list tbody tr:last-child td { border-bottom: 0; }

table.list:not(.odd-even) tbody tr:nth-child(odd), .odd, #issue-changesets div.changeset:nth-child(odd) { background-color: var(--surface); }
table.list:not(.odd-even) tbody tr:nth-child(even), .even, #issue-changesets div.changeset:nth-child(even) { background-color: var(--surface); }
table.list:not(.odd-even) tbody tr:nth-child(odd):hover, .odd:hover, #issue-changesets div.changeset:nth-child(odd):hover,
table.list:not(.odd-even) tbody tr:nth-child(even):hover, .even:hover, #issue-changesets div.changeset:nth-child(even):hover { background-color: var(--row-hover); }
table.list tbody tr.group, table.list tbody tr.group:hover { background-color: var(--surface-3); }
table.list tbody tr.group td { color: var(--heading); padding-top: 6px; padding-bottom: 6px; }
table.list tbody tr.group span.count { background: var(--belt-navy-700); color: #fff; border-radius: var(--r-xs); padding: 0 6px; font-weight: 600; }

table.list td.id, table.list td.due_date, table.list td.start_date, table.list td.created_on,
table.list td.updated_on, table.list td.estimated_hours, table.list td.spent_hours, table.list td.hours { font-variant-numeric: tabular-nums; }
tr.issue td.id a { font-weight: 600; }
tr.issue td.subject a { color: var(--text); font-weight: 500; }
tr.issue td.subject a:hover { color: var(--belt-blue); }
tr.issue.closed td.subject a { color: var(--text-faint); font-weight: 400; }
table.list tr.overdue td.due_date, div.issue.overdue .due-date .value { color: var(--err); font-weight: 600; }

/* Prioridade: faixa lateral + ponto na coluna Prioridade, em TODAS as prioridades.
   Classes reais do Redmine: priority-lowest | priority-default | priority-lowN |
   priority-highN | priority-highest (N maior = mais longe do extremo). */
tr.issue, div.issue { --prio: var(--p-normal); }
tr.issue[class*="priority-low"],  div.issue[class*="priority-low"]  { --prio: var(--p-baixa); }
tr.issue.priority-default,        div.issue.priority-default        { --prio: var(--p-normal); }
tr.issue[class*="priority-high"], div.issue[class*="priority-high"] { --prio: var(--p-alta); }
tr.issue.priority-high2,          div.issue.priority-high2          { --prio: var(--p-urgente); }
tr.issue.priority-highest,        div.issue.priority-highest        { --prio: var(--p-imediata); }

tr.issue > td:first-child { box-shadow: inset 3px 0 0 var(--prio); }
tr.issue > td.priority { white-space: nowrap; }
tr.issue > td.priority::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--prio);
  vertical-align: 1px;
}
tr.issue.priority-highest td.priority, tr.issue.priority-high2 td.priority { color: var(--prio); font-weight: 600; }

table.progress { border-radius: 2px; overflow: hidden; }
table.progress td.closed { background: var(--belt-cyan); }
table.progress td.done { background: #8fd3e3; }
table.progress td.todo { background: var(--surface-3); }
p.percent { color: var(--text-muted); }

/* ==========================================================================
   8. Abas de conteúdo (exceto o menu principal)
   ========================================================================== */
#content .tabs ul { border-bottom-color: var(--border); }
#content .tabs ul li a {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  padding: 7px 12px;
  color: var(--text-muted);
  font-weight: 500;
}
#content .tabs ul li a:hover { color: var(--belt-blue); background-color: var(--surface-2); }
#content .tabs ul li a.selected, #content .tabs ul li a.selected:hover {
  border: 0;
  border-bottom: 2px solid var(--belt-cyan);
  background-color: transparent;
  color: var(--heading);
  font-weight: 600;
}
#content div.tabs-buttons { background: var(--surface); border-bottom-color: var(--border); }
#content button.tab-left, #content button.tab-right { border-color: var(--border); }

/* ==========================================================================
   9. Mensagens
   ========================================================================== */
#errorExplanation, div.flash, .nodata, .warning, .conflict { border-radius: var(--r-sm); font-size: 1em; }
div.flash.error, #errorExplanation { background-color: var(--err-bg); border-color: transparent; border-left: 3px solid var(--err-bd); color: var(--err); }
div.flash.notice { background-color: var(--ok-bg); border-color: transparent; border-left: 3px solid var(--ok-bd); color: var(--ok); }
div.flash.warning, .conflict { background-color: var(--warn-bg); border-color: transparent; border-left: 3px solid var(--warn-bd); color: var(--warn); }
.nodata { background-color: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-muted); }
.warning { background-color: var(--warn-bg); border-color: transparent; border-left: 3px solid var(--warn-bd); color: var(--warn); }

/* ==========================================================================
   10. Página da tarefa
   ========================================================================== */
div.issue {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--prio);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  padding: 20px 24px 22px;
  margin-bottom: 24px;
}
div.issue div.subject h3 { color: var(--heading); font-size: 19px; line-height: 1.35; margin-bottom: 4px; }
div.issue div.subject div div { padding-left: 0; }
div.issue p.author { color: var(--text-faint); font-size: 12px; margin: 0; }
div.issue p.author a { color: var(--text-muted); }
div.issue .next-prev-links { font-size: 12px; }

/* Seções do card (Descrição, Arquivos, Subtarefas, Relações):
   divisor de ponta a ponta + título com marcador */
div.issue hr { width: auto; height: 1px; background: var(--border); margin: 22px -24px 20px; }
div.issue div.description > p:first-of-type,
div.issue > p:has(> strong:only-child),
#issue_tree > p, #relations > p { margin: 0 0 12px; }
div.issue div.description > p > strong:only-child,
div.issue > p > strong:only-child,
#issue_tree > p > strong, #relations > p > strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--heading);
}
div.issue div.description > p > strong:only-child::before,
div.issue > p > strong:only-child::before,
#issue_tree > p > strong::before, #relations > p > strong::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--belt-cyan);
}
div.issue div.description div.wiki { color: var(--text); line-height: 1.65; }
div.issue div.wiki img { border: 1px solid var(--border); border-radius: var(--r-xs); }

/* Atributos: grade com linhas; campos personalizados em bloco próprio */
div.issue .attributes { margin-top: 18px; }
div.issue .attributes .splitcontent { gap: 0 36px; }
div.issue .attributes .splitcontentleft { margin: 0; }
div.issue .attributes .splitcontent + .splitcontent {
  margin-top: 14px;
  padding: 4px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
div.issue .attributes .attribute {
  min-height: 20px;
  padding-top: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  line-height: 20px;
}
div.issue .attributes .splitcontentleft .attribute:last-child { border-bottom: 0; }
div.issue .attributes .splitcontent:first-child .splitcontentleft .attribute:last-child { border-bottom: 1px solid var(--border); }
div.issue .attributes .attribute .label,
div.issue .attributes .attribute .label a,
div.issue .attributes .attribute .label span { color: var(--text-muted); font-weight: 500; }
div.issue .attributes .attribute .value { color: var(--text); font-weight: 500; }
div.issue .attributes span.field-description[title] { border-bottom: 1px dotted var(--border-strong); }
div.issue .attributes .attribute .value:empty::before { content: "—"; color: var(--text-faint); font-weight: 400; }
div.issue .attributes .priority .value::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px;
  border-radius: 50%; background: var(--prio); vertical-align: 1px;
}
div.issue .attributes .progress .value table.progress { margin-top: 6px; }

/* Arquivos: lista tabular com rolagem quando for longa */
div.issue div.attachments {
  margin: 0;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
div.issue div.attachments > .contextual { position: sticky; top: 0; z-index: 1; margin: 0; padding: 6px 10px; background: var(--surface); border-bottom-left-radius: var(--r-xs); }
div.issue div.attachments table { width: 100%; border-collapse: collapse; }
div.issue div.attachments table td { padding: 6px 12px; border-bottom: 1px solid var(--surface-3); vertical-align: middle; }
div.issue div.attachments table tr:last-child td { border-bottom: 0; }
div.issue div.attachments table tr:hover td { background: var(--row-hover); }
div.issue div.attachments .size, div.issue div.attachments .author { color: var(--text-faint); font-size: 12px; }
div.issue div.thumbnails { margin-top: 12px; }

/* Subtarefas e relações */
#issue_tree table.list, #relations table.list { margin-top: 0; }
#issue_tree table.list td.subject, #relations table.list td.subject { text-align: left; }
#issue_tree table.list td.assigned_to, #relations table.list td.assigned_to,
#issue_tree table.list td.status, #relations table.list td.status { white-space: nowrap; }
#new-relation-form { margin-top: 10px; }

/* Histórico: cada entrada é um card (cabeçalho + alterações + nota) */
#history { margin-top: 8px; }
#history > h3 { margin-top: 8px; }
#history .tab-content { border: 0; padding: 0; }
div.journal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  padding-bottom: 4px;
}
div.journal.has-notes { box-shadow: var(--shadow-1); }
div.journal.private-notes { border-left: 3px solid var(--p-urgente); }
div.journal h4.note-header, div.journal h4 {
  margin: 0;
  padding: 9px 14px;
  background: var(--surface-2);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-md) var(--r-md) 0 0;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-muted);
}
div.journal h4 a.user { font-weight: 600; }
div.journal .contextual { margin: 8px 12px 0 0; }
div.journal ul.details { margin: 10px 14px 8px; padding-left: 18px; font-size: 12.5px; }
div.journal ul.details li { padding: 1px 0; }
div.journal ul.details, ul.revision-info { color: var(--text-muted); }
div.journal ul.details strong { color: var(--text); font-weight: 500; }
div.journal ul.details a, ul.revision-info a { color: var(--belt-blue); }
div.journal ul.details a:hover, ul.revision-info a:hover { color: var(--belt-cyan); }
div.journal div.thumbnails { margin: 0 14px 8px; }
div.journal div.wiki { padding: 6px 14px 4px; }
div.journal ul.details + div.wiki { margin: 0 14px; padding: 10px 0 4px; border-top: 1px dashed var(--border); }
div.journal div.wiki img { max-width: 100%; }
div.journal.private-notes .wiki { border-left: 0; margin-left: 0; }
#history div:target h4.note-header { background-color: var(--row-hover); }
#history div:target { border-color: var(--belt-sky); }
img.gravatar { border-radius: 50%; }

/* ==========================================================================
   11. Wiki e código
   ========================================================================== */
div.wiki table, div.wiki td, div.wiki th { border-color: var(--border-strong); }
div.wiki th { background-color: var(--surface-3); }
div.wiki pre {
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
div.wiki *:not(pre) > code, div.wiki > code { background-color: var(--surface-3); border-radius: 3px; }
div.wiki ul.toc { background-color: var(--surface-2); border-color: var(--border); border-radius: var(--r-sm); }
blockquote { border-left-color: var(--belt-sky); color: var(--text-muted); }

/* ==========================================================================
   12. Paginação
   ========================================================================== */
.pagination ul.pages li { border-color: var(--border-strong); background-color: var(--surface); }
.pagination ul.pages li:first-child { border-top-left-radius: var(--r-sm); border-bottom-left-radius: var(--r-sm); }
.pagination ul.pages li:last-child { border-top-right-radius: var(--r-sm); border-bottom-right-radius: var(--r-sm); }
.pagination ul.pages li.current { background-color: var(--belt-navy-800); border-color: var(--belt-navy-800); font-weight: 600; }
.pagination ul.pages li.page:hover { background-color: var(--surface-3); }
.pagination ul.pages li.page a:hover, .pagination ul.pages li.page a:active { color: var(--belt-blue); }
span.pagination { color: var(--text-muted); }

/* ==========================================================================
   13. jQuery UI (autocomplete, diálogos, datepicker)
   ========================================================================== */
.ui-widget, .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: var(--font); }
.ui-dialog { border-radius: var(--r-md); box-shadow: var(--shadow-3); }
.ui-dialog .ui-dialog-titlebar { background: var(--belt-navy-800); border: 0; color: #fff; border-radius: var(--r-sm); }
.ui-widget-overlay { background: rgba(8, 43, 74, .5); opacity: 1; }
.ui-autocomplete, .ui-menu { border-radius: var(--r-sm); box-shadow: var(--shadow-3); }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { background: var(--belt-blue); border-color: var(--belt-blue); }
.ui-datepicker .ui-datepicker-header { background: var(--surface-3); border-color: var(--border); }
.ui-datepicker td .ui-state-highlight { background: var(--surface-3); border-color: var(--belt-sky); color: var(--heading); }

/* ==========================================================================
   14. Login
   ========================================================================== */
body.action-login #content, body.action-lost_password #content, body.action-register #content {
  background: transparent; border: 0; box-shadow: none;
}
#login-form {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--belt-cyan);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  padding: 28px 28px 24px;
}
#login-form label { font-weight: 500; }
#login-form input[type="text"], #login-form input[type="password"] { height: 36px; padding: 0 10px; }
#login-form input#login-submit { height: 38px; margin-top: 4px; }

/* ==========================================================================
   15. Layout (só desktop; o mobile é do responsive.css)
   ========================================================================== */
@media screen and (min-width: 900px) {
  #top-menu { height: auto; min-height: 28px; line-height: 28px; font-size: 12px; padding: 0 24px; }
  #top-menu::after { content: ""; display: table; clear: both; }
  #top-menu a { margin-right: 14px; }

  #header { min-height: 0; padding: 14px 24px 18px; }
  body.has-main-menu #header { padding-bottom: 48px; }
  /* fio da marca na base do cabeçalho */
  #header::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
    background: var(--grad-accent);
  }
  #header h1 { font-size: 21px; line-height: 1.3; margin: 0; padding: 2px 0 0; }
  #header h1 .breadcrumbs { font-size: 12px; margin-bottom: 2px; }
  /* Linha acima do título: busca à esquerda e seletor de projeto no extremo oposto (direita) */
  #header { display: flex; flex-direction: column; align-items: flex-start; }
  #header #quick-search {
    order: -1; float: none; margin: 0 0 12px; width: 100%;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  #header #quick-search form { display: flex; align-items: center; gap: 8px; margin: 0; }
  #header #quick-search label { margin: 0; }
  #header #project-jump.drdn { margin: 0; }
  #header h1 { max-width: 100%; }
  #quick-search #q { height: 30px; width: 240px; }
  #project-jump.drdn { width: 220px; }
  #project-jump .drdn-trigger { height: 30px; line-height: 22px; }

  #main-menu { left: 24px; }
  #main-menu li a { padding: 9px 14px 10px; border-radius: var(--r-sm) var(--r-sm) 0 0; }

  #main { padding: 20px 24px 24px; gap: 20px; }
  #content { padding: 20px 24px 24px; }

  /* Sidebar como painel fixo ao rolar */
  #sidebar {
    align-self: flex-start;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    padding: 16px 18px;
    box-sizing: border-box;
  }
  #sidebar:empty { display: none; }

  #footer { margin: 0 24px; padding: 12px 0 18px; }

  body.action-login #content, body.action-lost_password #content, body.action-register #content { padding: 0; }
  #login-form { width: 380px; margin-top: 4em; }
}

/* ==========================================================================
   16. Mobile: só cores (o layout é do responsive.css)
   ========================================================================== */
@media screen and (max-width: 899px) {
  #header { background-color: var(--belt-navy-800); }
  .flyout-menu { background-color: var(--belt-navy-900); }
  #main { background: var(--bg); }
  #content { border-radius: 0; border-width: 1px 0; }
}

@media print {
  #content { border: 0; box-shadow: none; }
  div.issue { box-shadow: none; }
}
