:root {
  --brand: #1693a5;
  --brand-dark: #0f7382;
  --brand-soft: #e7f6f8;
  --ink: #1c2b33;
  --muted: #5c6b73;
  --line: #d5e2e6;
  --bg: #f3f6f7;
  --card: #ffffff;
  --danger: #9f1239;
  --danger-bg: #fff1f2;
  --shadow: 0 12px 40px rgba(22, 40, 48, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--brand-dark); }

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at top, rgba(22, 147, 165, 0.16), transparent 42%),
    var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px 28px 24px;
}

.logo-panel {
  width: 168px;
  height: 112px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.logo-panel img {
  max-width: 140px;
  max-height: 84px;
  object-fit: contain;
}

.auth-card h1,
.panel h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  text-align: center;
}

.lede {
  margin: 0 0 22px;
  text-align: center;
  color: var(--muted);
}

.form-group { margin-bottom: 16px; }

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  font-weight: 650;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="file"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus {
  outline: 3px solid rgba(22, 147, 165, 0.2);
  border-color: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { background: var(--brand-dark); }

.header-actions .btn:not(.btn-ghost) {
  background: #fff;
  color: var(--brand-dark);
}

.header-actions .btn:not(.btn-ghost):hover {
  background: var(--brand-soft);
}

.btn-ghost {
  width: auto;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
}

.support-link {
  margin: 18px 0 0;
  text-align: center;
}

.site-footer {
  width: min(1100px, 100%);
  margin: 18px auto 0;
  padding: 8px 12px 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 115, 130, 0.18);
}

.header-bar,
.toolbar,
.summary-bar {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 52px;
  height: 52px;
  padding: 6px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
}

.brand p,
.brand h1 {
  margin: 0;
  text-align: left;
}

.brand p {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.brand h1 {
  font-size: 1.15rem;
  line-height: 1.3;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.toolbar {
  padding-bottom: 16px;
}

.filters {
  display: grid;
  grid-template-columns: 1.4fr auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  background: #fff;
  color: var(--ink);
  border-radius: 16px;
}

.filters .fields {
  display: grid;
  grid-template-columns: 1.4fr 160px 160px auto;
  gap: 10px;
  align-items: end;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  text-decoration: none;
  font-size: 0.92rem;
}

.chip.is-active,
.chip:hover {
  background: #fff;
  color: var(--brand-dark);
}

.summary-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 2px 14px;
  color: #fff;
  font-size: 0.92rem;
}

.pager { display: flex; flex-wrap: wrap; gap: 6px; }

.pager a {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  text-decoration: none;
}

.pager a:hover { background: #fff; color: var(--brand-dark); }

.content {
  width: min(1100px, calc(100% - 32px));
  margin: 20px auto 32px;
}

.aviso {
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fbfb;
}

th a { color: var(--muted); text-decoration: none; }

tbody tr:hover { background: var(--brand-soft); }

.badge {
  display: inline-flex;
  min-width: 64px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.badge-pdf { background: #fee2e2; color: #991b1b; }
.badge-xml { background: #e0f2fe; color: #075985; }
.badge-boleto { background: #fef3c7; color: #92400e; }
.badge-file { background: #e8eef0; color: #334155; }

.file-name { font-weight: 650; word-break: break-word; }

.btn-small {
  width: auto;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.check { width: 18px; height: 18px; accent-color: var(--brand); }

@media (max-width: 860px) {
  .header-bar,
  .filters .fields,
  .summary-bar { display: block; }
  .header-actions { margin-top: 12px; }
  .header-actions .btn { width: auto; }
  .filters .fields { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .summary-bar .pager { margin-top: 8px; }

  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  .table-wrap { background: transparent; border: 0; box-shadow: none; }
  tbody tr {
    margin-bottom: 12px;
    padding: 8px 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }
  td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 0;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.82rem;
  }
  td.actions .btn { width: 100%; }
}
