:root {
  --bg: #f3f6ff;
  --bg-2: #e8efff;
  --ink: #0f172a;
  --muted: #4b5563;
  --accent: #2a77fd;
  --accent-dark: #1e3a8a;
  --accent-soft: #eaf1ff;
  --accent-2: #375cfb;
  --accent-rgb: 42, 119, 253;
  --accent-2-rgb: 55, 92, 251;
  --accent-dark-rgb: 30, 58, 138;
  --paper: #ffffff;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  --radius: 18px;
  --success: #1f7a5b;
  --warning: #c27c2c;
  --danger: #b42318;
  --info: #2a77fd;
  --ring: rgba(42, 119, 253, 0.35);
}

* {
  box-sizing: border-box;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fdfdff 0%, var(--bg) 55%, var(--bg-2) 100%);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  gap: 28px;
  align-items: stretch;
}

.auth-copy {
  padding: 40px 16px;
}

.auth-copy h1 {
  font-family: "Source Serif 4", serif;
  font-size: clamp(36px, 5vw, 56px);
  margin: 0 0 16px;
}

.auth-note {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  box-shadow: var(--shadow);
}

.auth-form {
  align-self: center;
}

.auth-form h2 {
  margin: 0 0 12px;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(var(--accent-rgb), 0.14), transparent 45%),
    radial-gradient(circle at 80% 15%, rgba(var(--accent-2-rgb), 0.12), transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(var(--accent-dark-rgb), 0.14), transparent 45%);
  pointer-events: none;
  z-index: -1;
}

.hero {
  max-width: none;
  margin: 0 0 40px;
  padding: 0;
  display: flex;
  gap: 32px;
  align-items: center;
  justify-content: space-between;
}

.hero-session {
  min-width: 260px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.hero-session-label {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-session strong {
  display: block;
  word-break: break-word;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--accent-dark);
  margin: 0 0 12px;
}

.hero h1 {
  font-family: "Source Serif 4", serif;
  font-size: clamp(32px, 4vw, 48px);
  margin: 0 0 12px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 520px;
}

.hero-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px 28px;
  min-width: 240px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(var(--accent-rgb), 0.12);
}

.hero-card-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero-card-value {
  font-size: 22px;
  margin: 12px 0 4px;
}

.hero-card-note {
  font-size: 12px;
  color: var(--muted);
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 40px;
  align-items: stretch;
  min-height: 100vh;
}

.app-sidebar {
  align-self: stretch;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 1px 0 40px rgba(0, 0, 0, 0.03);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(var(--accent-rgb), 0.2);
}

.logo-text {
  font-size: 18px;
  color: var(--ink);
}

.logo-text strong {
  font-weight: 800;
  color: var(--accent-dark);
}

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

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-button:hover {
  background: rgba(var(--accent-rgb), 0.05);
  color: var(--ink);
  transform: translateX(4px);
}

.tab-button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: none;
  transform: translateX(4px);
}

main.main-content {
  max-width: 1000px;
  margin: 0;
  padding: 40px 0 80px;
  width: 100%;
}

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

.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
}

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

.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(var(--accent-rgb), 0.08);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.card h2 {
  margin-top: 0;
}

.form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

label.file-input {
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.05);
}

label.file-input:focus-within {
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

input,
select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  font-size: 15px;
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid var(--ring);
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(var(--accent-rgb), 0.3);
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

button.secondary {
  background: #fff;
  color: var(--accent-dark);
  border-color: rgba(var(--accent-rgb), 0.35);
  box-shadow: none;
}

button.secondary:hover {
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: none;
  transform: none;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.table-wrapper {
  overflow-x: auto;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow);
}

.company-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.company-table th,
.company-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
  font-size: 14px;
}

.company-table td:last-child,
.company-table th:last-child {
  text-align: right;
  width: 320px;
}

.company-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.company-actions button {
  padding: 8px 12px;
  font-size: 13px;
}

.company-table th {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: #edf3ff;
}

.company-table tr.is-selected td {
  background: rgba(var(--accent-rgb), 0.08);
}

.company-table tr:last-child td {
  border-bottom: none;
}

.empty-state {
  padding: 18px;
  border-radius: 14px;
  border: 1px dashed rgba(var(--accent-rgb), 0.3);
  background: rgba(var(--accent-rgb), 0.05);
  color: var(--muted);
  font-size: 14px;
}

.table-wrapper .empty-state {
  margin: 16px;
}

.list-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  background: var(--accent-soft);
}

.list-item strong {
  font-size: 16px;
}

.list-item button {
  align-self: flex-start;
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  box-shadow: none;
}

.list-item button:hover {
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: none;
  transform: none;
}

.status {
  margin-top: 16px;
  font-size: 14px;
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  max-width: 100%;
  flex-wrap: wrap;
}

.status.success {
  color: var(--success);
  background: rgba(31, 122, 91, 0.12);
  border-color: rgba(31, 122, 91, 0.3);
}

.status.error {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
  border-color: rgba(180, 35, 24, 0.3);
}

.status.loading {
  color: var(--accent-dark);
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.3);
}

.status:empty {
  display: none;
}

.receipts-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.search-bar {
  margin-top: 16px;
  max-width: 420px;
}

.bulk-receipts {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  background: rgba(var(--accent-rgb), 0.06);
}

.bulk-receipts-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.text-link {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.text-link:hover {
  color: var(--accent);
}

.bulk-receipts .form {
  margin-top: 12px;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
}

.invoice-list {
  margin-top: 24px;
  display: grid;
  gap: 20px;
}

.invoice-table-wrapper {
  overflow-x: auto;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow);
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.invoice-table th,
.invoice-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

.invoice-table th {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: #edf3ff;
}

.invoice-row:nth-child(4n + 1) {
  background: #f8fbff;
}

.invoice-row {
  cursor: pointer;
  transition: background 0.2s ease;
}

.invoice-row:hover {
  background: #edf5ff;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-integral {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent-dark);
}

.status-parcial {
  background: rgba(194, 124, 44, 0.2);
  color: #8a4b1f;
}

.status-nao-recebida {
  background: rgba(31, 31, 31, 0.08);
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 20;
  max-width: min(360px, 92vw);
}

.toast {
  --toast-accent: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-left: 4px solid var(--toast-accent);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
  color: var(--ink);
  font-size: 14px;
  animation: toast-in 0.2s ease;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast.toast-success {
  --toast-accent: var(--success);
}

.toast.toast-error {
  --toast-accent: var(--danger);
}

.toast.toast-info {
  --toast-accent: var(--info);
}

.toast.toast-loading {
  --toast-accent: var(--accent);
}

.toast-icon {
  display: inline-flex;
  color: var(--toast-accent);
}

.toast-message {
  flex: 1;
}

.toast-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(var(--accent-rgb), 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px;
  cursor: pointer;
  box-shadow: none;
}

.toast-close:hover {
  color: var(--accent-dark);
  box-shadow: none;
  transform: none;
}

.toast-exit {
  opacity: 0;
  transform: translateY(-6px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 15, 0.4);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius);
  width: min(920px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  padding: 24px 28px 28px;
  z-index: 1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-body {
  display: grid;
  gap: 20px;
}

.modal-close {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  box-shadow: none;
}

.modal-close:hover {
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: none;
  transform: none;
}

.modal-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: #edf4ff;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
}

.modal-section h3 {
  margin: 0;
}

.modal-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  font-size: 14px;
  color: var(--muted);
}

.modal-grid strong {
  color: var(--ink);
}

.currency-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  background: #fff;
}

.currency-input:focus-within {
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.currency-input span {
  font-weight: 600;
  color: var(--muted);
}

.currency-input input {
  border: none;
  padding: 12px 0;
  width: 100%;
  font-size: 15px;
  background: transparent;
}

.currency-input input:focus {
  outline: none;
}

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

.form-actions .secondary {
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  box-shadow: none;
}

.invoice-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid rgba(31, 31, 31, 0.08);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.invoice-title {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.invoice-title h3 {
  margin: 0;
  font-size: 18px;
}

.invoice-meta {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  color: var(--muted);
  font-size: 14px;
}

.retencoes-grid,
.receipt-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.modal-section .retencoes-grid,
.modal-section .receipt-grid {
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.invoice-edit-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
}

.section-divider {
  height: 1px;
  background: rgba(31, 31, 31, 0.08);
}

.retencoes-edit {
  display: none;
  padding: 16px;
  border-radius: 16px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
}

.retencoes-edit.active {
  display: grid;
  gap: 12px;
}

.receipt-form {
  display: none;
  padding: 16px;
  border-radius: 16px;
  background: rgba(var(--accent-rgb), 0.06);
  border: 1px solid rgba(var(--accent-rgb), 0.16);
}

.receipt-form.active {
  display: grid;
  gap: 12px;
}

.history {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.history-item {
  padding: 8px 12px;
  border-radius: 10px;
  background: #f6f8ff;
  border: 1px solid rgba(31, 31, 31, 0.08);
}

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

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

.history-actions button {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  padding: 6px 12px;
  box-shadow: none;
}

.history-actions button:hover {
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: none;
  transform: none;
}

.status-block {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.memory-report {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.memory-toggle {
  display: flex;
  gap: 12px;
  margin: 24px 0 12px;
  flex-wrap: wrap;
}

.memory-toggle-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  background: transparent;
  color: var(--accent-dark);
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

.memory-toggle-button:hover {
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: none;
  transform: none;
}

.memory-toggle-button.active {
  background: var(--accent-dark);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.25);
}

.memory-toggle-button.secondary {
  background: #fff;
  border-color: rgba(var(--accent-rgb), 0.35);
  box-shadow: none;
}

.memory-sheet {
  background: #fff;
  border: 1px solid rgba(31, 31, 31, 0.12);
  border-radius: 16px;
  padding: 20px 24px;
  display: grid;
  gap: 16px;
}

.memory-sheet-header {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.memory-sheet-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
}

.memory-sheet-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(38, 99, 235, 0.22);
  background: rgba(38, 99, 235, 0.08);
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.invoice-link {
  color: #1d4ed8;
  text-decoration: none;
  border-bottom: 1px solid rgba(29, 78, 216, 0.25);
  font-weight: 600;
}

.invoice-link:hover {
  border-bottom-color: rgba(29, 78, 216, 0.6);
}

.memory-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  border-bottom: 1px solid rgba(31, 31, 31, 0.08);
  padding: 6px 0;
}

.memory-line:last-child {
  border-bottom: none;
}

.memory-small {
  font-size: 12px;
  color: var(--muted);
}

.memory-breakdown {
  margin-top: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px dashed rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.06);
  border-radius: 10px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #22304d;
}

.memory-section-integral {
  border: 1px solid rgba(38, 99, 235, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.62), rgba(255, 255, 255, 0.96));
}

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

.memory-pdf-table th,
.memory-pdf-table td {
  padding: 8px 10px;
  border: 1px solid rgba(31, 31, 31, 0.12);
  text-align: left;
}

.memory-pdf-table th {
  background: #eef2f9;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rateio-group {
  background: #f6f8ff;
}
.rateio-cnpj {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

.rateio-item td:first-child {
  color: var(--muted);
}

.rateio-indent {
  display: inline-block;
  width: 16px;
  margin-right: 4px;
  color: var(--muted);
}

.rateio-item td {
  font-size: 12.5px;
}

.rateio-item-consorcio td {
  background: rgba(var(--accent-rgb), 0.20);
}

.origin-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
}

.origin-pill-propria {
  color: #1e3a8a;
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
}

.origin-pill-consorcio {
  color: #8a3a00;
  background: rgba(255, 166, 0, 0.16);
  border: 1px solid rgba(199, 124, 44, 0.45);
}

@media print {
  body {
    background: #fff;
  }

  .bg-blobs,
  header,
  .tabs,
  .card,
  .memory-toggle,
  .status,
  #tab-companies,
  #tab-import,
  #tab-receipts,
  #memoryStatus,
  .modal,
  .toast-container,
  .app-sidebar,
  .memory-header:not(.rateio-header),
  .no-print {
    display: none !important;
  }

  .tab-section {
    display: none !important;
  }

  #tab-memory {
    display: block !important;
  }

  body.print-memory #memoryCalcReport,
  body.print-memory-month #memoryCalcReport,
  body.print-memory-quarter #memoryCalcReport {
    display: block !important;
  }

  body.print-memory #memoryRateioReport,
  body.print-memory-month #memoryRateioReport,
  body.print-memory-quarter #memoryRateioReport {
    display: none !important;
  }

  body.print-memory-month #memoryCalcReport .memory-section-quarter {
    display: none !important;
  }

  body.print-memory-quarter #memoryCalcReport .memory-section-month {
    display: none !important;
  }

  body.print-memory-month #memoryCalcReport .memory-quarter-summary {
    display: none !important;
  }

  body.print-memory #memoryCalcReport > * + *,
  body.print-memory-month #memoryCalcReport > * + *,
  body.print-memory-quarter #memoryCalcReport > * + *,
  body.print-rateio #memoryRateioReport > * + *,
  body.print-rateio-month #memoryRateioReport > * + *,
  body.print-rateio-quarter #memoryRateioReport > * + * {
    margin-top: 16px;
  }

  body.print-rateio,
  body.print-rateio-month,
  body.print-rateio-quarter,
  body.print-memory,
  body.print-memory-month,
  body.print-memory-quarter {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body.print-rateio #memoryRateioReport,
  body.print-rateio-month #memoryRateioReport,
  body.print-rateio-quarter #memoryRateioReport {
    display: block !important;
  }

  body.print-rateio #memoryCalcReport,
  body.print-rateio-month #memoryCalcReport,
  body.print-rateio-quarter #memoryCalcReport {
    display: none !important;
  }

  body.print-rateio #memoryRateioReport .rateio-section-quarter,
  body.print-rateio-month #memoryRateioReport .rateio-section-quarter {
    display: none !important;
  }

  body.print-rateio-quarter #memoryRateioReport .rateio-section-month {
    display: none !important;
  }

  body.print-rateio-quarter #memoryRateioReport .rateio-section-quarter {
    display: grid !important;
  }

  .app-shell {
    max-width: none;
    padding: 0;
    display: block;
    grid-template-columns: 1fr !important;
  }

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

  .memory-sheet {
    box-shadow: none;
    border-color: #111;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 0;
    background: #fff !important;
  }

  .memory-sheet:first-child {
    margin-top: 0;
  }

.rateio-header {
  display: grid;
  justify-content: flex-start;
    background: #fff !important;
    box-shadow: none !important;
    border: 1px solid #111;
  }

  body.print-rateio #memoryRateioReport > .memory-sheet:first-child,
  body.print-rateio-month #memoryRateioReport > .memory-sheet:first-child,
  body.print-rateio-quarter #memoryRateioReport > .memory-sheet:first-child {
    margin-top: -18px;
  }

  .rateio-header-summary {
    justify-items: start;
    text-align: left;
  }

  .memory-table-wrapper {
    background: #fff !important;
    box-shadow: none !important;
  }

  body.print-memory #memoryCalcReport .memory-table-wrapper,
  body.print-memory-month #memoryCalcReport .memory-table-wrapper,
  body.print-memory-quarter #memoryCalcReport .memory-table-wrapper,
  body.print-rateio #memoryRateioReport .memory-table-wrapper,
  body.print-rateio-month #memoryRateioReport .memory-table-wrapper,
  body.print-rateio-quarter #memoryRateioReport .memory-table-wrapper {
    overflow: visible !important;
  }

  body.print-memory #memoryCalcReport .memory-table,
  body.print-memory-month #memoryCalcReport .memory-table,
  body.print-memory-quarter #memoryCalcReport .memory-table,
  body.print-rateio #memoryRateioReport .memory-table,
  body.print-rateio-month #memoryRateioReport .memory-table,
  body.print-rateio-quarter #memoryRateioReport .memory-table {
    min-width: 0 !important;
  }
}

.memory-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  box-shadow: var(--shadow);
}

.memory-header h3 {
  margin: 0 0 8px;
}

.memory-header-logo {
  max-width: 180px;
  height: auto;
}

.memory-meta {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.memory-table-wrapper {
  overflow-x: auto;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid rgba(31, 31, 31, 0.08);
  box-shadow: var(--shadow);
}

.memory-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.memory-table th,
.memory-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(31, 31, 31, 0.08);
  text-align: left;
  font-size: 14px;
}

.memory-table th {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: #edf3ff;
}

.memory-table tr:last-child td {
  border-bottom: none;
}

.memory-total {
  font-weight: 700;
  background: rgba(var(--accent-rgb), 0.08);
}

.base-total-trigger {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px dashed rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.08);
  cursor: zoom-in;
  user-select: none;
}

.memory-base-hint {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

.base-composition-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.base-composition-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.base-composition-table th,
.base-composition-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(31, 31, 31, 0.1);
  text-align: left;
}

.base-composition-table th {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: #edf3ff;
}

.base-composition-table .origin-pill {
  margin-left: 0;
}

.base-composition-table tr.base-mismatch-row td {
  background: rgba(169, 52, 44, 0.16);
  color: #7f241e;
}

.base-composition-table tr.base-mismatch-row {
  cursor: pointer;
}

.base-composition-table tr.base-mismatch-row:hover td {
  background: rgba(169, 52, 44, 0.24);
}

.base-composition-table .base-total-row td {
  font-weight: 700;
  background: rgba(var(--accent-rgb), 0.08);
}

@media (max-width: 640px) {
  .toast-container {
    top: auto;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

@media (max-width: 820px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    padding: 12px 0 0;
  }

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

  .hero-session {
    width: 100%;
    justify-content: space-between;
  }

  .hero-card {
    width: 100%;
  }

  .bulk-receipts .form {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .tab-button {
    width: auto;
    justify-content: center;
  }

}
