:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #d9dee7;
  --line-soft: #e8ecf2;
  --ink: #1f2937;
  --muted: #667085;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --success: #157347;
  --error: #b42318;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

.app-body {
  min-height: 100vh;
  overflow-x: hidden;
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 28%),
    linear-gradient(135deg, #f5f7fb 0%, #eef4ff 100%);
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: 100%;
  margin: 0;
  padding: 32px 0 48px;
}

.app-layout {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}

.content-shell {
  min-width: 0;
  padding: 0 20px 0 16px;
}

.sidebar {
  position: sticky;
  top: 0;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 26%),
    linear-gradient(180deg, #111827 0%, #172235 100%);
  color: #f8fbff;
  border: 0;
  border-right: 1px solid rgba(217, 222, 231, 0.16);
  border-radius: 0;
  padding: 20px 14px;
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  box-shadow: none;
  overflow-y: auto;
}

.sidebar .section-title,
.sidebar-copy,
.sidebar-link-subtitle,
.sidebar-user-card span,
.sidebar-user-card p {
  color: rgba(232, 238, 248, 0.74);
}

.sidebar-brand h2 {
  color: #fff;
  margin-bottom: 8px;
}

.sidebar-brand {
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-copy {
  margin: 0;
  line-height: 1.55;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.sidebar-nav-label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(232, 238, 248, 0.56);
}

.sidebar-link {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  border-radius: 14px;
  padding: 13px 14px;
  text-align: left;
  text-decoration: none;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.sidebar-link-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sidebar-link-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 251, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.sidebar-link-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar-link:hover:not(.is-disabled) {
  transform: translateX(2px);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-link-title {
  font-weight: 700;
}

.sidebar-link.is-active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.88), rgba(59, 130, 246, 0.72));
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 10px 24px rgba(37, 99, 235, 0.22);
}

.sidebar-link.is-active .sidebar-link-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.sidebar-link.is-disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.sidebar-footer {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px;
}

.sidebar-user-card span {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.sidebar-user-card strong {
  display: block;
  font-size: 1.08rem;
}

.sidebar-user-card p {
  margin: 6px 0 0;
  font-size: 0.88rem;
}

.sidebar-logout {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 14px;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.sidebar-logout:hover {
  transform: translateY(-1px);
  border-color: rgba(248, 113, 113, 0.32);
  background: rgba(248, 113, 113, 0.12);
}

.sidebar-logout-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
  font-weight: 800;
}

.sidebar-logout-copy {
  display: grid;
  gap: 2px;
}

.sidebar-logout-copy strong {
  color: #fff;
  font-size: 0.95rem;
}

.sidebar-logout-copy span {
  color: rgba(232, 238, 248, 0.72);
  font-size: 0.82rem;
}

.login-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
}

.login-panel {
  width: 100%;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(217, 222, 231, 0.9);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.login-copy,
.login-form {
  padding: 32px;
}

.login-copy {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.03));
}

.login-notes {
  margin-top: 24px;
  display: grid;
  gap: 14px;
}

.login-notes div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.88);
}

.login-notes span {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.login-form {
  display: grid;
  align-content: center;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 8px;
}

.login-form span {
  font-size: 0.9rem;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.login-form input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.login-submit {
  margin-top: 8px;
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  font-size: 1rem;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 48%, #3b82f6 100%);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(37, 99, 235, 0.28);
  filter: brightness(1.02);
}

.login-submit:active {
  transform: translateY(0);
}

.login-submit::after {
  content: ' ->';
  margin-left: 6px;
}

.topbar,
.upload-card,
.audit-shell,
.summary article,
.filters,
.table-shell,
.warnings {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

h1,
h2 {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

h2 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
}

.lead {
  max-width: 60ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.topbar {
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

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

.export-mode-control {
  min-width: 240px;
  display: grid;
  gap: 6px;
}

.export-mode-control span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.export-mode-control select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 11px 12px;
  color: var(--ink);
}

.section-title {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.upload-card {
  margin-top: 16px;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.upload-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.upload-panel {
  display: grid;
  gap: 10px;
}

.dropzone {
  width: 100%;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  background: #fafbfc;
  color: var(--ink);
  padding: 18px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease;
}

.dropzone:hover,
.dropzone[data-drag='on'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-title {
  font-size: 1rem;
  font-weight: 700;
}

.dropzone-subtitle,
.status,
.table-note {
  color: var(--muted);
}

.file-row {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.status {
  margin: 0;
}

.status[data-tone='success'] {
  color: var(--success);
}

.status[data-tone='error'] {
  color: var(--error);
}

.topbar-actions button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
}

.topbar-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.ghost {
  background: #eef2f7;
  color: var(--ink);
}

.summary {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.audit-shell {
  margin-top: 16px;
  padding: 18px;
}

.audit-headline {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 14px;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.audit-grid article {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px;
  background: #fbfcfe;
}

.audit-grid span {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.audit-grid strong {
  font-size: 1.4rem;
}

.audit-details {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.audit-list {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.audit-list h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.audit-list ul {
  margin: 0;
  padding-left: 18px;
}

.audit-list li {
  margin: 8px 0;
  color: var(--muted);
}

.audit-totals {
  margin-top: 14px;
}

.audit-totals-headline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 12px;
}

.audit-totals-headline h3 {
  margin: 0;
  font-size: 1rem;
}

.audit-totals-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.audit-total-card {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.audit-total-card h4 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  line-height: 1.35;
}

.audit-total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.audit-total-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.audit-total-row strong {
  font-size: 0.96rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.audit-total-card .check-status {
  margin-top: 12px;
}

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

.check-item span:first-child {
  color: var(--ink);
}

.check-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.check-status.ok,
.badge.badge-ok {
  background: #eaf7ef;
  color: var(--success);
}

.check-status.alert,
.badge.badge-alert {
  background: #fff4e5;
  color: #9a6700;
}

.badge.badge-credit {
  background: #eaf7ef;
  color: var(--success);
}

.badge.badge-debit {
  background: #fff1f3;
  color: var(--error);
}

.summary article {
  padding: 16px;
}

.summary span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.summary strong {
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
}

.filters {
  margin-top: 16px;
  padding: 18px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
}

.filters-title {
  grid-column: 1 / -1;
  margin-bottom: -2px;
}

.filters label {
  display: grid;
  gap: 8px;
}

.filters span {
  font-size: 0.88rem;
  color: var(--muted);
}

.filters input,
.filters select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 11px 12px;
  color: var(--ink);
}

.warnings {
  margin-top: 16px;
  padding: 14px 16px;
  color: #8a4b12;
  background: #fff7ed;
}

.warnings p {
  margin: 6px 0;
}

.table-shell {
  margin-top: 16px;
  padding: 18px 20px;
}

.table-headline {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 12px;
}

.table-note {
  max-width: 38ch;
  line-height: 1.5;
  margin: 0;
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1440px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th.col-number,
td.col-number {
  text-align: right;
}

.col-status {
  min-width: 180px;
}

.col-item {
  min-width: 70px;
}

.col-date {
  min-width: 110px;
}

.col-account {
  min-width: 220px;
}

.col-description {
  min-width: 340px;
}

.col-supplier {
  min-width: 220px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.row-alert {
  background: #fffaf5 !important;
}

.cell-stack {
  display: grid;
  gap: 4px;
}

.cell-main {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
}

.cell-sub {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.cell-main.cell-alert,
.cell-number.cell-alert {
  color: var(--error);
  font-weight: 700;
}

.cell-sub.cell-alert {
  color: var(--error);
  font-weight: 700;
  display: inline-flex;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff1f3;
}

.cell-number {
  display: block;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cell-code {
  font-variant-numeric: tabular-nums;
}

.repasse-overview {
  margin-top: 16px;
}

.repasse-overview .audit-grid {
  grid-template-columns: repeat(3, 1fr);
}

.repasse-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.repasse-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.82rem;
}

.repasse-pill strong {
  color: var(--ink);
}

.repasse-table table {
  min-width: 820px;
  table-layout: fixed;
}

.repasse-table th,
.repasse-table td {
  padding: 8px 8px;
}

.repasse-table thead th {
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}

.repasse-table .cell-main {
  line-height: 1.28;
  white-space: normal;
}

.repasse-table .cell-sub {
  font-size: 0.72rem;
  line-height: 1.22;
}

.repasse-table .badge {
  padding: 3px 7px;
  font-size: 0.7rem;
}

.repasse-table .col-date {
  width: 74px;
  min-width: 74px;
}

.repasse-table .col-description {
  width: 112px;
  min-width: 112px;
}

.repasse-table .col-number {
  width: 82px;
  min-width: 82px;
}

.repasse-table .col-status {
  width: 86px;
  min-width: 86px;
}

.repasse-table .col-account {
  width: 110px;
  min-width: 110px;
}

.repasse-table .col-supplier {
  width: 94px;
  min-width: 94px;
}

.repasse-table .col-num {
  width: 32px;
  min-width: 32px;
  text-align: center;
}

/* Oculta colunas conforme filtro Tipo */
.repasse-table.hide-debito-valor th:nth-child(5),
.repasse-table.hide-debito-valor td:nth-child(5),
.repasse-table.hide-debito-valor th:nth-child(6),
.repasse-table.hide-debito-valor td:nth-child(6) {
  display: none;
}

.repasse-table.hide-credito-valor th:nth-child(4),
.repasse-table.hide-credito-valor td:nth-child(4),
.repasse-table.hide-credito-valor th:nth-child(6),
.repasse-table.hide-credito-valor td:nth-child(6) {
  display: none;
}

.repasse-table .col-description .cell-main,
.repasse-table .col-account .cell-main,
.repasse-table .col-account .cell-sub,
.repasse-table .col-supplier .cell-main,
.repasse-table .col-supplier .cell-sub {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.repasse-table .col-description .cell-stack {
  max-width: 100%;
}

tbody tr:nth-child(odd) {
  background: #fcfcfd;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr.row-alert:hover {
  background: #fff1df !important;
}

@media (max-width: 760px) {
  .login-panel,
  .upload-card,
  .audit-grid,
  .audit-details,
  .audit-totals-grid,
  .summary,
  .filters {
    grid-template-columns: 1fr;
  }

  .repasse-overview .audit-grid {
    grid-template-columns: 1fr;
  }

  .login-copy,
  .login-form {
    padding: 24px;
  }

  .topbar {
    flex-direction: column;
    align-items: start;
  }

  .audit-headline,
  .audit-totals-headline,
  .table-headline {
    flex-direction: column;
    align-items: start;
  }
}

@media (max-width: 680px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    min-height: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(217, 222, 231, 0.16);
  }

  .content-shell {
    padding: 0 20px 0;
  }
}