/* 
  CRR CSS Stylesheet - Visual Redesign
  Premium Agricultural Style - Light Theme Default
*/

:root {
  /* Premium Light Theme */
  --bg: #f0f4f1;
  --shell: #ffffff;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f3f4f6;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #e6f7f0;
  --primary-text: #047857;
  --accent: #d97706;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-text: #991b1b;
  --warn: #f59e0b;
  --warn-light: #fffbeb;
  --warn-text: #78350f;
  --info: #3b82f6;
  --info-light: #eff6ff;
  --info-text: #1d4ed8;
  --shadow: 0 4px 20px -2px rgba(5, 150, 105, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  /* Navigation Hover */
  --nav-hover-bg: #f3fdf9;
  --nav-hover-text: var(--primary);
}

/* Base resets & Core styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

h3 {
  font-size: 16px;
}

p {
  color: var(--muted);
}

.muted {
  color: var(--muted) !important;
}

.text-sm {
  font-size: 13px;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.block {
  display: block;
}

.py-3 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.text-center {
  text-align: center;
}

/* Forms & Inputs */
input,
select,
textarea,
button {
  font-family: var(--font);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--shell);
  color: var(--text);
  transition: var(--transition);
}

option {
  background-color: var(--shell);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

textarea {
  resize: vertical;
}

.form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* Shell & Navigation */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  background: var(--bg);
}

/* Mobile-only elements base states */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  cursor: pointer;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-bottom-nav {
  display: none;
}

.mobile-top-bar {
  display: none;
}

@media (min-width: 961px) {

  .mobile-top-bar,
  .mobile-bottom-nav,
  .sidebar-backdrop {
    display: none !important;
  }

  .sidebar-drawer {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    width: auto !important;
    height: 100vh !important;
    transition: none !important;
    box-shadow: none !important;
  }
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--shell);
  border-right: 1px solid var(--line);
  padding: 16px 0;
  z-index: 100;
  box-sizing: border-box;
}

.brand {
  min-height: 80px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  transition: var(--transition);
}

.brand-mark {
  background: linear-gradient(135deg, var(--primary), #10b981);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.brand-icon {
  width: 22px;
  height: 22px;
  stroke-width: 2.5;
  color: white;
}

.brand-text strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-text small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

/* Sidebar Links */
.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 16px;
  overflow-y: auto;
}

.nav-title {
  margin: 14px 16px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
}

.nav a svg {
  width: 20px;
  height: 20px;
  opacity: 0.8;
  transition: var(--transition);
}

.nav a.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25);
}

.nav a.active svg {
  opacity: 1;
  stroke: #ffffff;
}

.nav a:hover:not(.active) {
  background: var(--nav-hover-bg);
  color: var(--nav-hover-text);
}

.nav a:hover:not(.active) svg {
  opacity: 1;
  stroke: var(--nav-hover-text);
}

/* Sidebar User Footer */
.user-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  cursor: default;
  transition: var(--transition);
  border-bottom: none;
  box-sizing: border-box;
}

.user-card:hover {
  background: var(--surface-3);
}

.user-profile-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.user-profile-link:hover .user-meta strong {
  color: var(--primary);
}

.logout-form {
  margin: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  background: var(--primary-light);
  color: var(--primary-text);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
}

.user-meta strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.user-meta small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.logout-btn {
  padding: 0 !important;
  min-height: 0 !important;
  width: auto !important;
  height: auto !important;
  background: transparent !important;
  border: none !important;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.logout-btn:hover {
  color: var(--danger);
}

/* Header & Tab Bar Layout */
.content-shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px 32px 14px;
  background: transparent;
  border-bottom: none;
}

.app-header h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.app-header p {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

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

/* Sub Navigation Tab Pills */
.sub-nav-bar {
  display: flex;
  gap: 8px;
  padding: 0 32px 20px;
  background: transparent;
  border-bottom: none;
  overflow-x: auto;
}

.sub-nav-tab {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  transition: var(--transition);
}

.sub-nav-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.sub-nav-tab:hover:not(.active) {
  border-color: var(--muted);
  color: var(--text);
}

/* Page Layout wrapper */
.page {
  width: min(1500px, calc(100% - 24px));
  margin: 14px auto 56px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

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

.panel-header-wrap h2 {
  margin: 0;
}

.narrow {
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Buttons */
button,
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

button:hover,
.button:hover {
  background: var(--primary-dark);
  color: #ffffff;
}

.button.secondary,
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.button.secondary:hover,
button.ghost:hover {
  background: var(--surface-2);
  border-color: var(--muted);
}

.button.danger,
button.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.button.danger:hover,
button.danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.button.tiny,
button.tiny {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.button.full,
button.full {
  width: 100%;
}

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

/* CRR Grid Two layout */
.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

/* Filters & Forms Grids */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  align-items: flex-end;
}

.filters label {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.filters label input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.filters button {
  min-height: 38px;
}

.batch-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) 160px auto;
  gap: 10px;
  margin-bottom: 14px;
  align-items: end;
}

.batch-note {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.batch-attachment {
  grid-template-columns: 180px minmax(220px, 1fr) auto;
}

.email-body-sheet {
  min-height: 380px;
  overflow-x: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
  tab-size: 4;
}

.email-attachment-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  font-size: 13px;
}

.email-attachment-summary strong {
  color: var(--primary-dark);
}

.email-document-warning,
.email-document-ready {
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 8px;
  font-size: 13px;
}

.email-document-warning {
  border-color: #e7bd68;
  background: #fff8e6;
  color: #754400;
}

.email-document-warning p {
  margin: 4px 0 10px;
}

.email-document-ready {
  border-color: #a9d9bf;
  background: #edf9f2;
  color: #17643a;
}

.missing-document-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.missing-document-list span {
  padding: 4px 7px;
  border: 1px solid #e7bd68;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
}

.document-type-control {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6f4;
}

.document-type-control label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.document-type-control input {
  width: auto;
  min-height: auto;
}

.bulk-file-picker {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-width: 680px;
  font-weight: 600;
}

.bulk-file-picker span,
.bulk-preview-file small,
.section-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.bulk-attachment-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.bulk-attachment-preview.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.bulk-preview-header,
.bulk-preview-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(360px, 1.4fr) minmax(170px, 0.6fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
}

.bulk-preview-header {
  background: #f3f6f4;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.bulk-preview-row + .bulk-preview-row {
  border-top: 1px solid var(--line);
}

.bulk-preview-file {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bulk-preview-file strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.match-status {
  font-size: 12px;
  font-weight: 700;
}

.match-status.matched {
  color: var(--primary-dark);
}

.match-status.review {
  color: #9a5b00;
}

.bulk-preview-row.ignored {
  background: #f3f4f6;
  opacity: 0.72;
}

.match-status.ignored {
  color: #5f6872;
}

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

.bulk-result-list {
  display: grid;
  gap: 6px;
}

.bulk-result {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  gap: 12px;
  padding: 9px 11px;
  border-left: 3px solid var(--line);
  background: #f7faf8;
  font-size: 13px;
}

.bulk-result.success { border-left-color: var(--primary); }
.bulk-result.skipped { border-left-color: #7b8794; background: #f3f4f6; }
.bulk-result.error { border-left-color: #dc2626; }

@media (max-width: 800px) {
  .bulk-preview-header { display: none; }
  .bulk-preview-row,
  .bulk-result { grid-template-columns: 1fr; }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 16px;
}

.form-grid .wide {
  grid-column: span 2;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

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

.quick-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

/* Metrics Grid System */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.metric:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon.green {
  background: var(--primary-light);
  color: var(--primary);
}

.metric-icon.orange {
  background: var(--warn-light);
  color: var(--warn-text);
}

.metric-icon.blue {
  background: var(--info-light);
  color: var(--info-text);
}

.metric-icon.red {
  background: var(--danger-light);
  color: var(--danger-text);
}

.metric-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.metric-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.metric-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* Badges & CRR Status Badges */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 8px;
  width: fit-content;
}

.status-finalizado,
.status-regularizado,
.status-area_confirmou_retorno {
  background: #dcfce7 !important;
  color: var(--primary-text) !important;
}

.status-aguardando_nf_retorno,
.status-aguardando_confirmacao_area,
.status-enviado_fiscal,
.status-fiscal_em_analise {
  background: #fef3c7 !important;
  color: var(--warn-text) !important;
}

.status-area_nao_confirmou_retorno,
.status-material_nao_retornou,
.status-cancelado {
  background: #fee2e2 !important;
  color: var(--danger-text) !important;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.table-panel {
  overflow: hidden;
}

.remessas-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: visible;
  overflow-y: visible;
  padding-bottom: 4px;
}

.remessas-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.remessas-table th,
.remessas-table td {
  padding: 10px 7px;
  font-size: 12px;
  line-height: 1.3;
}

.remessas-table th:nth-child(1),
.remessas-table td:nth-child(1) { width: 32px; }
.remessas-table th:nth-child(2),
.remessas-table td:nth-child(2) { width: 165px; }
.remessas-table th:nth-child(3),
.remessas-table td:nth-child(3) { width: 58px; }
.remessas-table th:nth-child(4),
.remessas-table td:nth-child(4) { width: 48px; }
.remessas-table th:nth-child(5),
.remessas-table td:nth-child(5) { width: 42px; }
.remessas-table th:nth-child(6),
.remessas-table td:nth-child(6) { width: 82px; }
.remessas-table th:nth-child(7),
.remessas-table td:nth-child(7) { width: 56px; }
.remessas-table th:nth-child(8),
.remessas-table td:nth-child(8),
.remessas-table th:nth-child(9),
.remessas-table td:nth-child(9) { width: 72px; }
.remessas-table th:nth-child(10),
.remessas-table td:nth-child(10),
.remessas-table th:nth-child(11),
.remessas-table td:nth-child(11) { width: 96px; }
.remessas-table th:nth-child(12),
.remessas-table td:nth-child(12) { width: 92px; }
.remessas-table th:nth-child(13),
.remessas-table td:nth-child(13) { width: 92px; }
.remessas-table th:nth-child(14),
.remessas-table td:nth-child(14) { width: 78px; }
.remessas-table th:nth-child(15),
.remessas-table td:nth-child(15) { width: 64px; }
.remessas-table th:nth-child(16),
.remessas-table td:nth-child(16) { width: 58px; }

.remessas-table td:nth-child(2),
.remessas-table td:nth-child(12),
.remessas-table td:nth-child(13) {
  overflow-wrap: anywhere;
}

.remessas-table .badge {
  max-width: 86px;
  padding: 4px 6px;
  font-size: 10px;
  line-height: 1.25;
  white-space: normal;
}

.remessas-table .button.tiny {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 11px;
}

.group-row td {
  padding: 7px 10px;
  background: #f7faf8;
  color: #1f4f3a;
  font-size: 12px;
  border-top: 1px solid #dbe7df;
  border-bottom: 1px solid #e6eee9;
}

.nf-group {
  display: none;
}

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

.supplier-name {
  overflow-wrap: anywhere;
}

.supplier-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  max-width: 85%;
}

.supplier-total {
  flex: 0 0 auto;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.nf-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

button.table-action {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

button.table-action:hover {
  background: transparent;
  color: var(--primary-dark);
  text-decoration: underline;
}

button.table-action.subtle {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.current-row {
  background: #ecfdf3;
}

.reports-summary .metric-value.money {
  font-size: 22px;
  line-height: 1.35;
}

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

.report-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 180px;
}

.report-card p {
  color: var(--muted);
  line-height: 1.5;
  margin-top: 8px;
}

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

.report-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.report-hero h1 {
  font-size: 28px;
  margin: 4px 0 6px;
}

.report-hero p,
.report-date,
.report-kicker {
  color: var(--muted);
}

.report-kicker {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.report-section {
  margin-bottom: 20px;
}

.report-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.report-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.report-tabs a.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.chart-heading,
.chart-legend,
.composition-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.chart-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend {
  justify-content: flex-end;
  font-size: 12px;
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 2px;
}

.chart-legend .pending::before,
.monthly-bar-line .bar.pending,
.composition-bar .pending { background: #d99a21; }

.chart-legend .returned::before,
.monthly-bar-line .bar.returned,
.composition-bar .returned { background: #079667; }

.monthly-chart {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.monthly-chart-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.monthly-chart-row > strong {
  font-size: 11px;
}

.monthly-bars {
  display: grid;
  gap: 3px;
}

.monthly-bar-line {
  position: relative;
  height: 15px;
  background: #f0f2f1;
  overflow: hidden;
}

.monthly-bar-line .bar {
  display: block;
  height: 100%;
  min-width: 2px;
}

.monthly-bar-line small {
  position: absolute;
  inset: 1px 5px auto auto;
  color: #17231d;
  font-size: 9px;
  font-weight: 700;
}

.composition-bar {
  display: flex;
  width: 100%;
  height: 28px;
  margin: 14px 0 9px;
  overflow: hidden;
  border-radius: 5px;
  background: #eef1ef;
}

.composition-labels {
  font-size: 12px;
}

.channel-badge {
  display: inline-block;
  padding: 4px 6px;
  border-radius: 5px;
  background: #eef3f8;
  color: #284f73;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.print-body {
  background: #ffffff;
}

.print-page {
  width: min(1120px, calc(100% - 48px));
  margin: 24px auto;
}

.print-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 18px;
}

@media print {
  .print-actions {
    display: none;
  }

  .print-page {
    width: 100%;
    margin: 0;
  }

  .panel,
  .metric {
    box-shadow: none !important;
    break-inside: avoid;
  }

  body {
    background: #ffffff !important;
  }

  .monthly-chart-panel,
  .composition-chart-panel,
  .monthly-bar-line .bar,
  .composition-bar span {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

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

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.profile-link img,
.profile-preview img {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.profile-preview {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-text);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
}

.profile-preview img {
  width: 72px;
  height: 72px;
}

.signature-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.signature-preview img {
  max-width: 520px;
  max-height: 180px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.inline-check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}

.inline-check input[type="checkbox"] {
  width: auto;
}

.related-remessas-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.4fr);
  gap: 16px;
  align-items: center;
}

.related-remessas-panel h2 {
  margin-bottom: 4px;
}

.related-remessas-panel p {
  font-size: 13px;
}

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

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

th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

td {
  font-size: 13.5px;
}

.clickable-row {
  cursor: pointer;
  transition: var(--transition);
}

.clickable-row:hover {
  background: var(--surface-2);
}

tr.late {
  background: #fff7ed !important;
}

/* Details and Lists */
dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 14px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
}

dd {
  margin: 0;
  color: var(--text);
  font-size: 13.5px;
}

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

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.4;
}

.timeline li strong {
  color: var(--text);
}

/* Alert Boxes & Flash */
.alert {
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}

.alert.success,
.alert.sucesso {
  background: var(--primary-light);
  color: var(--primary-text);
}

.alert.error,
.alert.erro {
  background: var(--danger-light);
  color: var(--danger-text);
}

.flash {
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.flash.success {
  background: var(--primary-light);
  color: var(--primary-text);
}

.flash.error {
  background: var(--danger-light);
  color: var(--danger-text);
}

/* Command Palette (Busca Global) */
.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--surface-2);
  border-color: var(--line);
}

.search-result-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 6px;
}

.badge-product {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.badge-os {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.badge-almox {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

/* Modal overlay & Confirm Modal */
.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.confirm-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.confirm-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  min-width: 360px;
  max-width: 440px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-modal-overlay.active .confirm-modal {
  transform: scale(1) translateY(0);
}

.confirm-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  background: var(--danger-light);
  color: var(--danger);
}

.confirm-modal-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
}

.confirm-modal h3 {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text);
}

.confirm-modal p {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

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

.confirm-modal-actions .button {
  min-height: 38px;
  padding: 0 16px;
  font-size: 12.5px;
  border-radius: 8px;
}

/* Login Page Styles (Split Glassmorphic) */
.login-split-body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  background: #f4f6f8;
  overflow: hidden;
  font-family: var(--font);
}

.login-left-pane {
  width: 30%;
  min-width: 370px;
  height: 100%;
  background: var(--shell);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 36px;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.02);
  z-index: 10;
  position: relative;
}

.login-left-content {
  margin-top: auto;
  margin-bottom: auto;
  width: 100%;
}

.login-welcome-text {
  text-align: center;
  margin-bottom: 28px;
}

.login-welcome-text h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-welcome-text p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  font-weight: 500;
}

.login-left-pane label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.login-left-pane input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  transition: var(--transition);
}

.login-left-pane input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.login-left-footer {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 20px;
}

.login-right-pane {
  flex: 1;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 8%;
  padding-right: 8%;
}

.login-right-pane .login-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/img/login-bg.png');
  background-size: cover;
  background-position: center;
  filter: blur(1px) brightness(0.65);
  transform: scale(1.02);
  z-index: 0;
  pointer-events: none;
}

.login-right-pane .login-bg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.75) 100%);
  z-index: 1;
  pointer-events: none;
}

.login-features-wrap {
  z-index: 3;
  position: relative;
  max-width: 680px;
  color: #ffffff;
}

.features-main-title {
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 30%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}

.features-subtitle {
  font-size: 15px;
  color: #f3f4f6;
  line-height: 1.6;
  margin-bottom: 36px;
  max-width: 580px;
}

.features-grid-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px 32px;
}

.feature-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.feature-icon {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feature-text h3 {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.feature-text p {
  font-size: 12.5px;
  color: #e5e7eb;
  line-height: 1.45;
  font-weight: 400;
}

.password-field-wrapper {
  position: relative;
  width: 100%;
}

.password-field-wrapper input {
  padding-right: 48px;
}

.toggle-password-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  transition: color 0.2s;
  border-radius: 50%;
}

.toggle-password-btn:hover {
  color: var(--primary);
}

.toggle-password-btn .eye-icon {
  width: 18px;
  height: 18px;
}

/* RESPONSIVE MOBILE OVERRIDES */
@media (max-width: 960px) {
  .sidebar {
    display: none;
  }

  .mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--shell);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 150;
  }

  .mobile-top-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mobile-top-bar-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }

  .mobile-top-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .mobile-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    text-decoration: none;
  }

  .mobile-icon-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
  }

  .mobile-icon-btn.primary-action {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
  }

  .mobile-icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .sidebar-backdrop {
    display: block;
  }

  .sidebar-drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--shell);
    border-right: 1px solid var(--line);
    z-index: 200;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: grid !important;
    grid-template-rows: auto 1fr auto;
  }

  .sidebar-drawer.open {
    left: 0;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.15);
  }

  .nav {
    flex-direction: column;
    overflow-x: visible;
    padding: 16px 12px;
    gap: 4px;
  }

  .nav a {
    white-space: normal;
    padding: 12px 16px;
    border-radius: 12px;
  }

  .app-header {
    display: none;
  }

  .sub-nav-bar {
    padding: 10px 16px;
    gap: 6px;
  }

  .sub-nav-tab {
    font-size: 12px;
    padding: 5px 12px;
    white-space: nowrap;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }

  .content-shell {
    padding-bottom: 80px;
  }

  .page {
    width: calc(100% - 24px);
    margin: 16px auto 40px;
  }

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

  .batch-bar {
    grid-template-columns: 1fr;
  }

  .related-remessas-panel {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .grid.two {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-grid .wide {
    grid-column: auto;
  }

  .page-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 64px;
    background: var(--shell);
    border-top: 1px solid var(--line);
    z-index: 150;
    padding: 0 4px;
    align-items: stretch;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
  }

  .mobile-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    margin: 6px 2px;
    transition: var(--transition);
    letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-bottom-nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
  }

  .mobile-bottom-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
  }

  .mobile-bottom-nav-item.cta {
    background: var(--primary);
    color: #ffffff;
    border-radius: 14px;
    margin: 8px 4px;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
  }

  .mobile-bottom-nav-item.cta svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
  }
}

@media (max-width: 768px) {
  .login-split-body {
    flex-direction: column;
  }

  .login-left-pane {
    width: 100%;
    height: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 40px 24px;
    min-height: auto;
  }

  .login-right-pane {
    display: none;
  }
}

@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .metric {
    padding: 16px;
    gap: 8px;
  }

  .metric-value {
    font-size: 22px;
  }

  .panel {
    padding: 16px;
  }

  .confirm-modal {
    min-width: unset;
    width: calc(100vw - 32px);
    max-width: 100%;
    padding: 24px 20px;
    margin: 16px;
    border-radius: 16px;
  }

  .sub-nav-bar {
    padding: 8px 12px;
  }

  .sub-nav-tab {
    font-size: 11px;
    padding: 5px 10px;
  }

  .mobile-top-bar {
    padding: 10px 12px;
  }

  .mobile-top-bar-title {
    max-width: 120px;
  }

  .mobile-icon-btn {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 360px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .mobile-top-bar-title {
    display: none;
  }
}

.bulk-email-queue { display: grid; gap: 8px; }
.bulk-email-queue > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.bulk-email-queue span { display: flex; flex-direction: column; gap: 2px; }
.bulk-email-queue small { color: var(--muted); }
.return-link-table { display: grid; gap: 8px; }
.return-link-table input[type=number] { min-width: 120px; }
@media (max-width: 700px) { .bulk-email-queue > div { align-items: stretch; flex-direction: column; } }
