/*
  Lida de Obras — Design System
  Tokens e componentes compartilhados por todas as telas. Cada template ainda
  pode ter seu <style> proprio para casos especificos, mas cores, tipografia,
  raios, sombras e componentes base (botao, card, badge, input, nav) vem daqui
  para o site inteiro ter a mesma cara.
*/

:root {
  /* Paleta base — mesma do layout v2 (static/css/app.css): cinza frio + azul da marca */
  --bg: #f3f7fb;
  --bg-soft: #f8fafb;
  --panel: #ffffff;
  --panel-soft: #f8fafb;
  --line: #e2e7eb;
  --line-soft: #edf0f2;

  --text: #17212b;
  --muted: #5f6b76;
  --muted-soft: #8b959e;

  --primary: #0b2e59;
  --primary-dark: #071f3d;
  --primary-soft: #e3f0fc;

  --accent: #1b5fa8;
  --accent-soft: #e3f0fc;

  --warn: #fff3d6;
  --warn-text: #8a5a09;
  --warn-line: #ecd09d;

  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --danger-line: #f0c4bf;

  --dark: #0b2e59;

  /* Escala de espaco */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* Raios */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(23, 33, 43, .06), 0 4px 12px rgba(23, 33, 43, .04);
  --shadow-md: 0 1px 2px rgba(23, 33, 43, .06), 0 8px 20px rgba(23, 33, 43, .06);
  --shadow-lg: 0 12px 32px rgba(23, 33, 43, .12);

  /* Tipografia */
  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* Aliases de compatibilidade — templates legados usam nomes diferentes para
   os mesmos tokens (--card, --surface, --green, --soft...). Isso permite que
   paginas antigas herdem a paleta nova sem precisar reescrever cada regra. */
:root {
  --card: var(--panel);
  --surface: var(--panel-soft);
  --soft: var(--panel-soft);
  --green: var(--primary);
  --green-soft: var(--primary-soft);
  --blue-soft: var(--accent-soft);
  --warn-bg: var(--warn);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: linear-gradient(180deg, #fbf8f1 0%, var(--bg) 100%);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-body);
  color: var(--text);
  font-weight: 700;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

a {
  color: var(--primary);
}

::selection {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* Scrollbar discreta (Chrome/Edge/Safari) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted-soft);
}

/* Foco visivel e acessivel, sem contorno feio do navegador */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- Paineis / cards ---------- */

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card {
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

a.card:hover,
.card.is-interactive:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ---------- Navegacao por pilulas ---------- */

.module-bar,
.nav-bar,
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.module-bar a,
.nav-bar a,
.tab-button,
.mini-link,
.quick-chip,
.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.module-bar a:hover,
.nav-bar a:hover,
.tab-button:hover,
.mini-link:hover,
.quick-chip:hover,
.tool-button:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.module-bar a.active,
.nav-bar a.active,
.tab-button.active {
  background: var(--primary-soft);
  border-color: #abc7e7;
  color: var(--primary-dark);
  font-weight: 700;
}

/* ---------- Badges / status ---------- */

.badge,
.status-pill,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.eyebrow {
  background: var(--primary-soft);
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-pill.rascunho,
.badge.info {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-pill.fechado,
.status-pill.completo,
.badge.success {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.status-pill.revisado,
.badge.neutral {
  background: #efe9fb;
  color: #5c3fa3;
}

.status-pill.warning,
.status-pill.parcial,
.badge.warning {
  background: var(--warn);
  color: var(--warn-text);
}

.status-pill.travado,
.badge.dark {
  background: var(--dark);
  color: #fff;
}

.status-pill.problema,
.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- Formularios ---------- */

textarea,
input,
select,
button {
  font-family: var(--font-body);
  font-size: 14px;
  border-radius: var(--radius-md);
}

textarea,
input,
select {
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--panel);
  color: var(--text);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Botoes ---------- */

button,
.btn {
  border: none;
  padding: 12px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

button:hover,
.btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

button:active,
.btn:active {
  transform: translateY(1px);
}

button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

button.secondary,
.btn.secondary {
  background: var(--dark);
}

button.secondary:hover,
.btn.secondary:hover {
  background: #1a2b3d;
}

button.ghost,
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button.ghost:hover,
.btn.ghost:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-soft);
}

button.danger,
.btn.danger {
  background: var(--danger);
}

button.danger:hover,
.btn.danger:hover {
  background: #8f1e18;
}

/* ---------- Tabelas ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
}

table tbody tr:hover {
  background: var(--bg-soft);
}

/* ---------- Utilitarios ---------- */

.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.full {
  grid-column: 1 / -1;
}

[hidden] {
  display: none !important;
}
