:root {
  --bg: #071A33;
  --card: #021927;
  --primary: #E8A020;
  --primary-hover: #F29A1F;
  --text: #F8FAFC;
  --muted: #667085;
  --border: #667085;
  --link: #165DFF;
  --secondary-bg: #0B2A45;
  --secondary-bg-hover: #103A5E;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 48px;
  max-height: 48px;
  width: auto;
  display: block;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}

.topbar h1 span {
  color: var(--muted);
  font-weight: 400;
}

.container {
  padding: 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #071A33;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--text);
}

.btn-secondary:hover { background: var(--secondary-bg-hover); }

.btn-small {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 5px;
  margin-right: 6px;
  margin-bottom: 4px;
}

.toolbar-lista {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.toggle-arquivados {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.toggle-arquivados input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.btn-perigo {
  background: #dc2626;
  color: #fff;
}

.btn-perigo:hover { background: #b91c1c; }

.tabela {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.tabela th, .tabela td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.tabela th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tabela tbody tr:last-child td { border-bottom: none; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-aguardando { background: #3a3a3a; color: #ccc; }
.badge-preenchimento { background: #4d3a00; color: #ffcf40; }
.badge-completo { background: #0f3d1c; color: #4ade80; }
.badge-arquivado { background: #2a2a2a; color: #9aa0a6; }

.actions-cell { white-space: nowrap; }

.linha-arquivada td { opacity: 0.55; }

.link-nome {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--link);
  cursor: pointer;
  text-align: left;
}

.link-nome:hover { text-decoration: underline; }

.resumo-linha {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.resumo-linha.resumo-ok { color: #4ade80; }
.resumo-linha.resumo-alerta { color: #ffcf40; }

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.25s ease;
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
}

.modal h2 {
  margin-top: 0;
  font-size: 18px;
}

.modal form label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.modal form input {
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.modal form input:focus {
  outline: none;
  border-color: var(--primary);
}

.modal p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 14px;
}

.modal > input[type="text"] {
  width: 100%;
  margin-bottom: 16px;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.modal > input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.modal-timeline { max-width: 460px; }

.timeline-lista {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.timeline-dot {
  font-size: 16px;
  line-height: 1;
}

.timeline-item.done .timeline-dot { color: var(--primary); }
.timeline-item.pending .timeline-dot { color: var(--muted); }

.timeline-label {
  font-size: 14px;
  font-weight: 600;
  min-width: 150px;
}

.timeline-item.pending .timeline-label {
  font-weight: 500;
  color: var(--muted);
}

.timeline-data {
  font-size: 13px;
  color: var(--muted);
}

.timeline-item.done .timeline-data { color: var(--text); }

.timeline-loading {
  list-style: none;
  text-align: center;
  color: var(--muted);
  padding: 10px 0;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo {
  height: 56px;
  width: auto;
  margin: 0 auto 20px;
  display: block;
}

.login-card h1 {
  font-size: 18px;
  margin: 0 0 24px;
}

.login-card form label {
  display: block;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.login-card form input {
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.login-card form input:focus {
  outline: none;
  border-color: var(--primary);
}

.login-erro {
  text-align: left;
  font-size: 13px;
  color: #f87171;
  margin: -4px 0 14px;
}

.btn-login {
  width: 100%;
}

@media (max-width: 640px) {
  .tabela thead { display: none; }
  .tabela, .tabela tbody, .tabela tr, .tabela td { display: block; width: 100%; }
  .tabela tr { border-bottom: 1px solid var(--border); padding: 10px 0; }
  .tabela td { border-bottom: none; padding: 4px 0; }
  .tabela td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
  }
}
