:root {
  --background: #f5f7fb;
  --surface: #fff;
  --text: #17243a;
  --muted: #6d7b91;
  --border: #e6ebf3;
  --primary: #4169e1;
  --accent: #f58220;
  --accent-text: #a64b0c;
  --accent-soft: #fff1e6;
  --primary-soft: #edf2ff;
  --shadow: 0 4px 20px #17243a04;
  color-scheme: light
}

[data-theme=dark] {
  --background: #111724;
  --surface: #1a2232;
  --text: #edf2fa;
  --muted: #a4b0c4;
  --border: #2a3549;
  --primary-soft: #252f50;
  --shadow: none;
  --accent: #ff963f;
  --accent-text: #ffb77c;
  --accent-soft: #38281e;
  color-scheme: dark
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 14px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif
}

a {
  color: var(--primary);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

button,
input,
select,
textarea {
  font: inherit
}

button,
.button-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  min-height: 43px;
  text-decoration: none;
  white-space: nowrap
}

button:hover,
.button-link:hover {
  filter: brightness(.95);
  text-decoration: none
}

.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 5px;
  display: inline-block
}

button:focus-visible,
a:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #4169e160;
  outline-offset: 2px
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 246px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 32px 22px;
  display: flex;
  flex-direction: column;
  overflow-y: auto
}

body.sidebar-open {
  overflow: hidden;
}

.menu-toggle,
.sidebar-close,
.sidebar-backdrop {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -1px;
  margin-bottom: 35px
}

.brand-symbol {
  display: block;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  object-fit: contain
}

.login .brand-symbol {
  width: 52px;
  height: 52px
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--muted);
  margin: 14px 0 6px
}

small {
  display: block;
  color: var(--muted);
  font-size: 12px
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 24px
}

.sidebar nav>a {
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 550;
  border-radius: 5px
}

.sidebar nav>a:hover,
.sidebar nav>a[aria-current] {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none
}

.account {
  margin-top: auto;
  padding-top: 30px;
  display: grid;
  gap: 7px
}

.account a {
  font-size: 12px
}

.account button {
  width: 100%
}

main {
  margin-left: 246px;
  padding: 0 40px;
  max-width: 1900px
}

.topbar {
  height: 76px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted)
}

.page-header {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 24px
}

.page-header p {
  margin: 4px 0
}

.page-header .eyebrow {
  margin-top: 0
}

h1 {
  font-size: 29px;
  letter-spacing: -.7px;
  line-height: 1.3;
  margin: 0 0 8px
}

h2 {
  font-size: 16px;
  margin: 0 0 16px;
  font-weight: 650
}

.muted {
  color: var(--muted)
}

.small {
  font-size: 12px
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 22px
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px
}

.stats .card {
  display: flex;
  flex-direction: column;
  gap: 12px
}

.stats strong {
  font-size: 29px;
  letter-spacing: -1px
}

.featured {
  background: var(--primary);
  color: #fff;
  border-color: transparent
}

.featured small {
  color: #e2e9ff
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 22px
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}

.section-heading a {
  font-size: 12px
}

.table-scroll {
  overflow-x: auto
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  text-align: left
}

th {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border)
}

td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle
}

tbody tr:last-child td {
  border-bottom: 0
}

td a {
  font-size: 12px
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600
}

.empty-state {
  text-align: center;
  padding: 38px;
  color: var(--muted);
  white-space: normal
}

.note {
  padding: 16px 0;
  border-bottom: 1px solid var(--border)
}

.note:last-child {
  border: 0
}

.note p {
  margin: 8px 0;
  overflow-wrap: anywhere
}

.note .badge {
  margin-left: 6px
}

input,
select,
textarea {
  display: block;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 10px 12px;
  min-height: 42px
}

textarea {
  resize: vertical
}

input[type=checkbox] {
  width: 19px;
  min-height: 19px;
  display: inline-block;
  vertical-align: middle
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px
}

form p {
  margin-top: 0;
  margin-bottom: 20px
}

.helptext {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0
}

.helptext ul {
  padding-left: 18px
}

.form-container {
  max-width: 720px
}

.payment-balance {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  border-left: 4px solid var(--accent);
  background: var(--primary-soft);
}

.payment-balance p {
  margin: 0;
}

.payment-balance-label {
  font-weight: 600;
}

.payment-balance-value {
  font-size: clamp(32px, 6vw, 44px);
  line-height: 1.2;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  color: var(--text);
}

.errorlist {
  color: #c43a39;
  padding: 10px 15px 10px 28px;
  background: #c43a3910;
  border-radius: 5px
}

.filters {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap
}

.filters p,
.filters label {
  margin-bottom: 0;
  flex: 1;
  min-width: 130px
}

.filters p label {
  margin-bottom: 5px
}

.filters p .helptext {
  display: none
}

.filters .errorlist {
  flex-basis: 100%
}

.pagination {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  margin: 20px
}

.alert {
  background: #fff3d8;
  color: #84520b;
  border: 1px solid #f0d89b;
  padding: 16px;
  border-radius: 5px;
  margin-top: 20px
}

.message {
  background: var(--primary-soft);
  padding: 14px 18px;
  margin-top: 20px;
  border-radius: 5px
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 14px 0
}

.chart-row span {
  width: 80px;
  color: var(--muted);
  font-size: 12px
}

.chart-row strong {
  min-width: 130px;
  text-align: right;
  font-size: 12px
}

progress {
  flex: 1;
  height: 16px;
  accent-color: var(--primary);
  border: 0;
  border-radius: 5px;
  overflow: hidden
}

progress::-webkit-progress-bar {
  background: var(--background)
}

progress::-webkit-progress-value {
  background: var(--primary)
}

footer {
  color: var(--muted);
  font-size: 11px;
  padding: 30px 0
}

.standalone {
  margin: 0 auto;
  max-width: 1100px
}

.login {
  max-width: 470px;
  margin: 70px auto;
  padding: 35px
}

.login h1 {
  font-size: 25px;
  margin-top: 22px
}

.login button {
  width: 100%
}

.signature {
  margin-top: 70px
}

.document p {
  line-height: 1.9
}

.document {
  padding: 35px
}

@media(max-width:1100px) {
  main {
    padding: 0 24px
  }

  .sidebar {
    width: 210px;
    padding: 24px 16px
  }

  main {
    margin-left: 210px
  }

  .dashboard-grid {
    grid-template-columns: 1fr
  }

  .standalone {
    margin: 0 auto
  }
}

@media(max-width:720px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1001;
    width: min(300px, calc(100vw - 48px));
    padding: 20px;
    border-right: 1px solid var(--border);
    height: 100%;
    height: 100dvh;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 180ms ease, visibility 180ms ease;
    overscroll-behavior: contain;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    visibility: visible;
  }

  .sidebar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #10182799;
  }

  .sidebar-close {
    display: inline-flex;
    align-self: flex-end;
    margin-bottom: 20px;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .topbar {
    gap: 12px;
  }

  .topbar>span {
    flex: 1;
    min-width: 0;
  }

  .sidebar .brand {
    margin-bottom: 20px;
    font-size: 24px;
  }

  .sidebar nav {
    flex-direction: column;
    gap: 6px;
  }

  main {
    margin: 0;
    padding: 0 15px
  }

  .topbar {
    height: 60px;
    font-size: 12px
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    margin-top: 24px
  }

  h1 {
    font-size: 25px
  }

  .card {
    padding: 18px
  }

  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px
  }

  .stats strong {
    font-size: 24px
  }

  .stats .card {
    gap: 6px
  }

  .stats span {
    font-size: 12px
  }

  .login {
    margin: 35px auto
  }

  .chart-row {
    gap: 8px
  }

  .chart-row strong {
    min-width: 95px
  }

  .document {
    padding: 15px
  }
}

@media print {

  .sidebar,
  .topbar,
  footer,
  .page-header button,
  .page-header a,
  .filters,
  .message,
  .alert,
  .pagination,
  .actions {
    display: none !important
  }

  main {
    margin: 0;
    padding: 0;
    max-width: none
  }

  body {
    background: white;
    color: black;
    font-size: 11px
  }

  .card {
    background: white;
    border: 0;
    box-shadow: none;
    padding: 0;
    color: black
  }

  .featured {
    color: black;
    background: white
  }

  .featured small {
    color: black
  }

  th,
  td {
    white-space: normal;
    padding: 8px;
    color: black
  }

  tr {
    break-inside: avoid
  }

  thead {
    display: table-header-group
  }

  .signature {
    break-inside: avoid
  }

  .page-header {
    margin: 20px 0
  }

  a {
    color: black
  }

  .stats {
    display: flex;
    gap: 40px
  }

  .stats strong {
    font-size: 20px
  }
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 40px));
  max-height: 85vh;
  overflow: auto
}

.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 5px;
  padding: 16px;
  box-shadow: 0 8px 30px #0003;
  display: flex;
  gap: 14px;
  align-items: start
}

.toast.error {
  border-left-color: #c43a39
}

.toast.warning {
  border-left-color: #c38b16
}

.toast.success {
  border-left-color: #218451
}

.toast button {
  padding: 0 7px;
  min-height: 28px;
  margin-left: auto
}

.toast p {
  margin: 0
}

@media print {
  .toast-container {
    display: none !important
  }
}

/* Laranja reservado a pequenos acentos e situações que pedem atenção. */
.sidebar nav>a[aria-current] {
  box-shadow: inset 3px 0 0 var(--accent)
}

.page-header h1::after {
  content: "";
  display: block;
  width: 30px;
  height: 3px;
  margin-top: 12px;
  background: var(--accent);
  border-radius: 2px
}

.activity-stat {
  border-top: 3px solid var(--accent)
}

.activity-stat>strong {
  color: var(--accent-text)
}

.badge[data-status="Em andamento"],
.badge[data-status="Pendente"],
.badge[data-status="Parcial"],
.badge[data-category="advertencia"] {
  background: var(--accent-soft);
  color: var(--accent-text)
}

.toast.warning {
  border-left-color: var(--accent)
}

@media print {
  .page-header h1::after {
    display: none
  }

  .activity-stat {
    border-top: 0
  }

  .activity-stat>strong,
  .badge[data-status],
  .badge[data-category] {
    color: black;
    background: transparent
  }
}
