/* ================================================
   RMA V4 — Stage-Wise-Joy Design
   Dark sidebar, orange primary, Space Grotesk display,
   JetBrains Mono for data, warm earthy palette
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap');

:root {
  /* Brand — warm orange like stage-wise-joy */
  --brand: hsl(20, 90%, 48%);
  --brand-dark: hsl(20, 90%, 40%);
  --brand-light: hsl(27, 95%, 60%);
  --brand-bg: hsl(47, 100%, 96%);
  --brand-10: hsla(20, 90%, 48%, 0.1);

  /* Surfaces — warm gray #f5f5f3 */
  --bg-body: hsl(0, 0%, 96%);
  --bg-white: hsl(0, 0%, 98%);
  --bg-card: hsl(0, 0%, 98%);
  --bg-sidebar: hsl(220, 20%, 8%);
  --bg-sidebar-hover: hsl(220, 16%, 14%);
  --bg-sidebar-active: hsl(0, 0%, 32%);
  --bg-input: hsl(0, 0%, 96%);
  --bg-table-head: hsl(0, 0%, 96%);
  --bg-table-hover: hsl(0, 0%, 97%);
  --surface: var(--bg-white);
  --surface-alt: hsl(0, 0%, 95%);
  --bg-selected-row: hsl(0, 0%, 94%);

  /* Stage colors — matching stage-wise-joy */
  --s-entrada: hsl(210, 80%, 55%);
  --s-laudo: hsl(45, 85%, 55%);
  --s-m1: hsl(0, 72%, 55%);
  --s-producao: hsl(280, 65%, 55%);
  --s-nf: hsl(130, 55%, 45%);
  --s-filiais: hsl(174, 72%, 50%);
  --s-pendencia: hsl(25, 90%, 55%);
  --s-financeiro: hsl(45, 85%, 55%);
  --s-concluido: hsl(145, 60%, 45%);

  /* Text */
  --text-primary: hsl(0, 0%, 9%);
  --text-secondary: hsl(0, 0%, 32%);
  --text-muted: hsl(0, 0%, 45%);
  --text-inverse: hsl(0, 0%, 98%);
  --text-placeholder: hsl(0, 0%, 63%);

  /* Borders */
  --border: hsl(0, 0%, 83%);
  --border-light: hsl(0, 0%, 90%);
  --border-active: var(--brand);

  /* Radius — 0.75rem like stage-wise-joy */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Shadows */
  --shadow-xs: 0 1px 3px 0px hsla(0, 0%, 0%, 0.05);
  --shadow-sm: 0 1px 3px 0px hsla(0, 0%, 0%, 0.1), 0 1px 2px -1px hsla(0, 0%, 0%, 0.1);
  --shadow-md: 0 1px 3px 0px hsla(0, 0%, 0%, 0.1), 0 2px 4px -1px hsla(0, 0%, 0%, 0.1);
  --shadow-lg: 0 1px 3px 0px hsla(0, 0%, 0%, 0.1), 0 4px 6px -1px hsla(0, 0%, 0%, 0.1);

  /* Typography — Space Grotesk + JetBrains Mono */
  --font: 'Space Grotesk', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --t-fast: 120ms;
  --t-normal: 200ms;
}

/* ================================================
   Reset
   ================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Material Symbols */
.material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

/* ================================================
   Layout
   ================================================ */
.app {
  display: flex;
  min-height: 100vh;
}

.main-wrapper {
  margin-left: 256px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

body[data-theme='ocean'] {
  --brand: hsl(199, 84%, 42%);
  --brand-dark: hsl(199, 84%, 34%);
  --brand-light: hsl(196, 89%, 56%);
  --brand-bg: hsl(198, 100%, 96%);
  --brand-10: hsla(199, 84%, 42%, 0.12);
  --bg-sidebar: hsl(212, 38%, 11%);
  --bg-sidebar-hover: hsl(212, 32%, 17%);
  --bg-sidebar-active: hsl(212, 24%, 26%);
}

body[data-theme='forest'] {
  --brand: hsl(153, 70%, 35%);
  --brand-dark: hsl(153, 70%, 28%);
  --brand-light: hsl(150, 62%, 48%);
  --brand-bg: hsl(142, 52%, 95%);
  --brand-10: hsla(153, 70%, 35%, 0.12);
  --bg-sidebar: hsl(156, 28%, 10%);
  --bg-sidebar-hover: hsl(156, 22%, 16%);
  --bg-sidebar-active: hsl(156, 16%, 24%);
}

body[data-theme='graphite'] {
  --brand: hsl(358, 78%, 54%);
  --brand-dark: hsl(358, 78%, 44%);
  --brand-light: hsl(358, 86%, 64%);
  --brand-bg: hsl(0, 0%, 96%);
  --brand-10: hsla(358, 78%, 54%, 0.1);
  --bg-sidebar: hsl(225, 15%, 12%);
  --bg-sidebar-hover: hsl(225, 12%, 18%);
  --bg-sidebar-active: hsl(225, 10%, 27%);
}

body[data-theme='dark'] {
  --brand: hsl(210, 90%, 60%);
  --brand-dark: hsl(210, 90%, 50%);
  --brand-light: hsl(210, 95%, 70%);
  --brand-bg: hsl(217, 28%, 16%);
  --brand-10: hsla(210, 90%, 60%, 0.16);
  --bg-body: hsl(222, 18%, 10%);
  --bg-white: hsl(220, 16%, 14%);
  --bg-card: hsl(220, 16%, 16%);
  --bg-input: hsl(220, 14%, 18%);
  --bg-table-head: hsl(220, 14%, 20%);
  --bg-table-hover: hsl(220, 14%, 22%);
  --surface: hsl(220, 16%, 16%);
  --surface-alt: hsl(220, 14%, 20%);
  --bg-selected-row: hsl(220, 14%, 24%);
  --text-primary: hsl(215, 20%, 92%);
  --text-secondary: hsl(215, 14%, 78%);
  --text-muted: hsl(215, 10%, 66%);
  --border: hsl(220, 12%, 28%);
  --border-light: hsl(220, 10%, 24%);
  --bg-sidebar: hsl(224, 26%, 8%);
  --bg-sidebar-hover: hsl(224, 22%, 14%);
  --bg-sidebar-active: hsl(224, 16%, 22%);
}

body[data-theme='dark'] {
  color-scheme: dark;
}

body[data-theme='dark'] th:hover {
  background: hsla(0, 0%, 100%, 0.05);
}

body[data-theme='dark'] .btn-secondary:hover {
  border-color: var(--border);
}

body[data-theme='dark'] .form-input,
body[data-theme='dark'] .form-select,
body[data-theme='dark'] .card,
body[data-theme='dark'] .modal,
body[data-theme='dark'] td,
body[data-theme='dark'] .card-title,
body[data-theme='dark'] .kpi-value,
body[data-theme='dark'] .dashboard-strip-title {
  color: var(--text-primary);
}

body[data-theme='dark'] .section-note,
body[data-theme='dark'] .kpi-sub,
body[data-theme='dark'] .cell-meta {
  color: var(--text-secondary);
}

body[data-theme='lilac'] {
  --brand: hsl(264, 64%, 56%);
  --brand-dark: hsl(264, 64%, 46%);
  --brand-light: hsl(266, 72%, 66%);
  --brand-bg: hsl(264, 72%, 96%);
  --brand-10: hsla(264, 64%, 56%, 0.14);
  --bg-sidebar: hsl(266, 34%, 14%);
  --bg-sidebar-hover: hsl(266, 30%, 20%);
  --bg-sidebar-active: hsl(266, 24%, 28%);
}

body[data-theme='rose'] {
  --brand: hsl(336, 78%, 52%);
  --brand-dark: hsl(336, 78%, 42%);
  --brand-light: hsl(336, 88%, 62%);
  --brand-bg: hsl(340, 100%, 97%);
  --brand-10: hsla(336, 78%, 52%, 0.12);
  --bg-sidebar: hsl(335, 36%, 13%);
  --bg-sidebar-hover: hsl(335, 32%, 19%);
  --bg-sidebar-active: hsl(335, 26%, 27%);
}

/* ================================================
   Sidebar — Dark, like stage-wise-joy
   ================================================ */
.sidebar {
  width: 256px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--t-normal) ease;
}

.sidebar-header {
  padding: 1.25rem 1.15rem;
  border-bottom: 1px solid hsla(0, 0%, 100%, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  border: 1px solid hsla(0, 0%, 100%, 0.18);
  background: hsla(0, 0%, 100%, 0.08);
  color: var(--text-inverse);
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-collapse-btn .material-symbols-outlined {
  font-size: 18px;
}

.sidebar-collapse-btn:hover {
  background: hsla(0, 0%, 100%, 0.14);
}

.sidebar-expand-indicator {
  display: none;
  position: fixed;
  top: 4.2rem;
  left: 0.8rem;
  z-index: 190;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-primary);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-expand-indicator .material-symbols-outlined {
  font-size: 18px;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

body.sidebar-collapsed .main-wrapper {
  margin-left: 0;
}

body.sidebar-collapsed .sidebar-expand-indicator {
  display: inline-flex;
}

.sidebar-logo .icon {
  width: 34px;
  height: 34px;
  background: var(--brand);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.sidebar-logo .icon .material-symbols-outlined {
  font-size: 20px;
}

.logo-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-inverse);
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.logo-sub {
  font-size: 0.68rem;
  color: hsla(0, 0%, 100%, 0.45);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  margin-bottom: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: hsla(0, 0%, 100%, 0.2) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 9px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: hsla(0, 0%, 100%, 0.2);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: hsla(0, 0%, 100%, 0.35);
  background-clip: content-box;
}

.nav-section {
  margin-bottom: 0.75rem;
}

.nav-section-title {
  font-size: 0.6rem;
  font-weight: 600;
  color: hsla(0, 0%, 100%, 0.35);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0.35rem 0.65rem;
  margin-bottom: 0.15rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--r-md);
  color: hsla(0, 0%, 100%, 0.6);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--t-fast);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2px;
}

.nav-item .material-symbols-outlined {
  font-size: 20px;
  color: hsla(0, 0%, 100%, 0.4);
  transition: color var(--t-fast);
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: hsla(0, 0%, 100%, 0.9);
}

.nav-item:hover .material-symbols-outlined {
  color: hsla(0, 0%, 100%, 0.7);
}

.nav-item.active {
  background: var(--brand-10);
  color: var(--brand-light);
  font-weight: 600;
}

.nav-item.active .material-symbols-outlined {
  color: var(--brand-light);
}

.nav-item-btn {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
}

.nav-parent {
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
}

.config-chevron {
  margin-left: auto;
  font-size: 18px !important;
  transition: transform var(--t-fast);
}

.nav-parent.open .config-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  display: none;
  margin-top: 0.2rem;
  padding-left: 0.35rem;
  border-left: 1px dashed hsla(0, 0%, 100%, 0.2);
}

.nav-submenu.open {
  display: block;
}

.nav-item .badge {
  margin-left: auto;
  font-family: var(--font-mono);
  background: hsla(0, 0%, 100%, 0.08);
  color: hsla(0, 0%, 100%, 0.45);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.05rem 0.4rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  line-height: 1.6;
}

.nav-item.active .badge {
  background: var(--brand-10);
  color: var(--brand-light);
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid hsla(0, 0%, 100%, 0.08);
}

.user-area {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.user-stack {
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: hsla(0, 0%, 100%, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar .material-symbols-outlined {
  font-size: 18px;
  color: hsla(0, 0%, 100%, 0.45);
}

.user-select {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  background: hsla(0, 0%, 100%, 0.06);
  border: 1px solid hsla(0, 0%, 100%, 0.12);
  border-radius: var(--r-sm);
  color: var(--text-inverse);
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--t-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

.user-select:focus {
  border-color: var(--brand-light);
}

.user-select option {
  background: var(--bg-sidebar);
  color: var(--text-inverse);
}

.user-name {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.55rem;
  background: hsla(0, 0%, 100%, 0.06);
  border: 1px solid hsla(0, 0%, 100%, 0.12);
  border-radius: var(--r-sm);
  color: var(--text-inverse);
  font-family: var(--font);
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-controls {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.logout-btn {
  width: 100%;
  border: 1px solid hsla(0, 0%, 100%, 0.18);
  background: hsla(0, 0%, 100%, 0.06);
  color: var(--text-inverse);
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

.logout-btn:hover {
  background: hsla(0, 0%, 100%, 0.12);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.55rem;
}

.theme-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-white);
  padding: 0.7rem;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.theme-card:hover {
  border-color: var(--brand);
  background: var(--brand-bg);
}

.theme-card.active {
  border-color: var(--brand);
  background: var(--brand-bg);
}

.theme-card-name {
  display: block;
  font-weight: 700;
}

.theme-card-desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

body.auth-screen .top-header,
body.auth-screen .menu-toggle {
  display: none !important;
}

body.auth-screen .sidebar-expand-indicator {
  display: none !important;
}

body.auth-screen .main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.25rem;
}

.login-screen {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-white) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.35rem;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.login-brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-title {
  font-size: 1.45rem;
  margin-bottom: 0.2rem;
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ================================================
   Top Header Bar
   ================================================ */
.top-header {
  height: 56px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.4rem 0.75rem;
  max-width: 400px;
  flex: 1;
  transition: border-color var(--t-fast);
}

.search-box:focus-within {
  border-color: var(--brand);
}

.search-box .material-symbols-outlined {
  font-size: 18px;
  color: var(--text-muted);
}

.search-box input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.85rem;
  outline: none;
  flex: 1;
}

.search-box input::placeholder {
  color: var(--text-placeholder);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sse-indicator {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--r-sm);
  background: hsla(145, 60%, 45%, 0.08);
  border: 1px solid hsla(145, 60%, 45%, 0.15);
}

.sse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: hsl(145, 60%, 45%);
  animation: ssePulse 2s ease-in-out infinite;
}

.sse-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: hsl(145, 60%, 45%);
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

@keyframes ssePulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ================================================
   Toolbar / Search inputs
   ================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar-stretch {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.toolbar-end {
  justify-content: flex-end;
}

.search-input {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0.85rem;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px hsla(20, 90%, 48%, 0.1);
}

.search-input::placeholder {
  color: var(--text-placeholder);
}

/* ================================================
   Main Content
   ================================================ */
.main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  min-width: 0;
}

.loading-state {
  display: flex;
  justify-content: center;
  padding: 3rem;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.pagination-main {
  margin-top: 1.5rem;
  padding-bottom: 2rem;
}

.pagination-compact {
  margin-top: 1rem;
}

.pagination-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pagination-label-sm {
  font-size: 0.8rem;
}

.modal-meta {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.modal-actions-tight {
  margin-top: 0.85rem;
}

/* ================================================
   Page Header
   ================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.15rem;
  font-weight: 400;
}

/* ================================================
   Cards — stage-wise-joy style with left border
   ================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.card-flash {
  animation: cardFlash 520ms ease-out;
}

@keyframes cardFlash {
  0% {
    transform: translateY(-1px) scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.28);
    background: rgba(37, 99, 235, 0.06);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: none;
    background: var(--bg-card);
  }
}

/* ================================================
   Historico Cards
   ================================================ */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-lg);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-xs);
}

.history-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.history-ticket {
  font-weight: 700;
  color: var(--text-primary);
}

.history-serial {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.history-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.history-step {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  font-size: 0.77rem;
  color: var(--text-primary);
}

.history-step-btn {
  cursor: pointer;
  border: none;
  transition: transform var(--t-fast), filter var(--t-fast), opacity var(--t-fast);
}

.history-step-btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
}

.history-step-btn.disabled {
  cursor: default;
  opacity: 0.65;
}

.history-step-edit {
  border-color: hsla(210, 80%, 55%, 0.28);
  background: hsla(210, 80%, 55%, 0.1);
  color: hsl(210, 80%, 40%);
}

.history-edit-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: hsla(210, 80%, 55%, 0.12);
  color: hsl(210, 80%, 40%);
  margin-right: 0.4rem;
}

.history-edit-details {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.history-step.muted {
  color: var(--text-muted);
}

.history-arrow {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ================================================
   Dashboard Stats — Left-border cards like stage-wise-joy
   ================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--stat-color, var(--brand));
  border-radius: var(--r-lg);
  padding: 1rem;
  cursor: pointer;
  transition: background var(--t-fast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.stat-card:hover {
  background: hsla(0, 0%, 32%, 0.05);
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-top .material-symbols-outlined {
  color: var(--text-muted);
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon .material-symbols-outlined {
  font-size: 18px;
  color: var(--text-muted);
}

.stat-card-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.stat-number {
  font-size: 1.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1;
}

/* Alert state for pendências */
.stat-card.alert {
  border-left-color: hsl(25, 90%, 55%);
}

.stat-card.alert .stat-label {
  color: hsl(25, 90%, 55%);
}

.stat-card.alert .stat-number {
  color: hsl(25, 90%, 55%);
}

/* ================================================
   Tables
   ================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}

.stage-buckets {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.14rem;
}

.stage-bucket-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.stage-bucket-pill {
  font-size: 0.72rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
}

.stage-bucket-pill.alert {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.08);
}

.stage-bucket-pill.ok {
  color: #166534;
  background: rgba(22, 101, 52, 0.08);
}

.dashboard-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dashboard-strip {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.65rem;
}

.dashboard-strip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-strip-title {
  font-size: 0.85rem;
}

.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 0.85rem;
  margin-bottom: 0.95rem;
}

.dashboard-grid-main {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.dashboard-grid-split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.dashboard-grid-left {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.dashboard-span-2 {
  grid-column: 1 / -1;
}

.dashboard-grid-half {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.dashboard-hourly-list {
  display: grid;
  gap: 0.24rem;
  max-height: 220px;
  overflow: auto;
}

.pareto-list {
  display: grid;
  gap: 0.36rem;
}

.pareto-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-white);
}

.pareto-item-label {
  font-size: 0.78rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 0.7rem;
}

.kpi-card {
  padding: 0.75rem 0.85rem;
  position: relative;
}

.metric-info-badge {
  position: absolute;
  top: 0.36rem;
  right: 0.36rem;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  user-select: none;
}

.metric-info-badge::after {
  content: attr(data-tip);
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  max-width: 260px;
  padding: 0.45rem 0.55rem;
  border-radius: var(--r-sm);
  background: hsl(220, 16%, 14%);
  color: hsl(0, 0%, 98%);
  font-size: 0.7rem;
  line-height: 1.3;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-3px);
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
  z-index: 30;
}

.metric-info-badge:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.card-title .metric-info-badge {
  position: relative;
  top: auto;
  right: auto;
  margin-left: 0.1rem;
}

.card-title .metric-info-badge::after {
  left: 0;
  right: auto;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.kpi-value {
  font-size: 1.2rem;
  font-weight: 700;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.kpi-good {
  color: #166534;
}

.kpi-warn {
  color: #b45309;
}

.card-header-start {
  align-items: flex-start;
}

.activity-user {
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .dashboard-grid-main,
  .dashboard-grid-split,
  .dashboard-grid-2,
  .dashboard-grid-half {
    grid-template-columns: 1fr;
  }

  .dashboard-grid-left,
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.table-wrapper-flat {
  border: none;
  box-shadow: none;
}

.matriz-wrapper {
  overflow-x: hidden !important;
}

.matriz-wrapper-grid {
  border-width: 1px;
  border-color: var(--border);
}

.matriz-table-grid {
  width: 100%;
  table-layout: fixed;
  background-image:
    linear-gradient(to right, transparent calc(100% - 1px), var(--border-light) 1px),
    linear-gradient(to bottom, transparent calc(100% - 1px), var(--border-light) 1px);
  background-size: 100% 100%;
}

.matriz-toolbar {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: nowrap;
}

.matriz-toolbar .search-input {
  flex: 1;
  min-width: 280px;
}

.matriz-filter-status {
  width: 180px;
}

.matriz-filter-tempo {
  width: 170px;
}

@media (max-width: 980px) {
  .matriz-toolbar {
    flex-wrap: wrap;
  }

  .matriz-toolbar .search-input {
    min-width: 220px;
  }
}

.matriz-table th,
.matriz-table td {
  font-size: 0.76rem;
  padding: 0.36rem 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matriz-table th {
  line-height: 1.15;
}

.matriz-table .col-recebimento { width: 13%; }
.matriz-table .col-transportadora { width: 10%; }
.matriz-table .col-data { width: 10%; }
.matriz-table .col-itens { width: 6%; }
.matriz-table .col-stage { width: 5%; }
.matriz-table .col-status { width: 8%; }
.matriz-table .col-tempo { width: 8%; }

.matriz-table .status-badge {
  max-width: 100%;
  display: inline-block;
}

.matriz-th-center,
.matriz-td-center {
  text-align: center;
}

.matriz-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.matriz-count-total {
  font-weight: 700;
}

.matriz-count-progress {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.matriz-status-neutral {
  background: hsla(220, 10%, 50%, 0.12);
  color: hsl(220, 10%, 40%);
}

.matriz-tempo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.laudo-wrapper {
  overflow-x: hidden !important;
}

.laudo-table {
  width: 100%;
  table-layout: fixed;
}

.laudo-table th,
.laudo-table td {
  font-size: 0.76rem;
  padding: 0.36rem 0.3rem;
}

.laudo-table .col-check { width: 3%; text-align: center; }
.laudo-table .col-ticket { width: 8%; }
.laudo-table .col-serial { width: 10%; }
.laudo-table .col-lote { width: 7%; }
.laudo-table .col-modelo { width: 11%; }
.laudo-table .col-filial { width: 7%; }
.laudo-table .col-caixa { width: 7%; }
.laudo-table .col-codigo { width: 7%; }
.laudo-table .col-desc { width: 14%; white-space: normal; }
.laudo-table .col-usuario { width: 8%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.laudo-table .col-data { width: 9%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.laudo-table .col-acoes { width: 9%; white-space: nowrap; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead {
  background: var(--bg-table-head);
}

th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background var(--t-fast);
}

th:hover {
  background: hsla(0, 0%, 0%, 0.03);
  color: var(--text-primary);
}

.sort-icon {
  display: inline-block;
  margin-left: 0.4rem;
  opacity: 0.3;
  font-size: 0.8rem;
  transition: all var(--t-fast);
}

.sort-icon.active {
  opacity: 1;
  color: var(--brand);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* Mono font for ticket/serial data */
td .mono,
td.mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

tbody tr {
  transition: background var(--t-fast);
}

tbody tr:hover {
  background: var(--bg-table-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ================================================
   Status Badges — rounded pill like stage-wise-joy
   ================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success {
  background: hsla(145, 60%, 45%, 0.1);
  color: hsl(145, 60%, 33%);
}

.badge-danger {
  background: hsla(0, 72%, 50%, 0.1);
  color: hsl(0, 72%, 40%);
}

.badge-info {
  background: hsla(210, 80%, 55%, 0.12);
  color: hsl(210, 80%, 40%);
}

.badge-warning {
  background: hsla(25, 90%, 55%, 0.14);
  color: hsl(25, 90%, 38%);
}

.status-ENTRADA {
  background: hsla(210, 80%, 55%, 0.12);
  color: hsl(210, 80%, 44%);
}

.status-LAUDO {
  background: hsla(45, 85%, 55%, 0.15);
  color: hsl(45, 85%, 38%);
}

.status-M1 {
  background: hsla(0, 72%, 55%, 0.1);
  color: hsl(0, 72%, 45%);
}

.status-PRODUCAO {
  background: hsla(280, 65%, 55%, 0.1);
  color: hsl(280, 65%, 42%);
}

.status-NF_ENTRADA {
  background: hsla(130, 55%, 45%, 0.1);
  color: hsl(130, 55%, 35%);
}

.status-FILIAIS {
  background: hsla(174, 72%, 50%, 0.1);
  color: hsl(174, 72%, 35%);
}

.status-PENDENCIA {
  background: hsla(25, 90%, 55%, 0.1);
  color: hsl(25, 90%, 42%);
}

.status-FINANCEIRO {
  background: hsla(45, 85%, 55%, 0.15);
  color: hsl(45, 85%, 38%);
}

.status-CONCLUIDO {
  background: hsla(145, 60%, 45%, 0.1);
  color: hsl(145, 60%, 33%);
}

/* ================================================
   Buttons — orange primary like stage-wise-joy
   ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: hsl(33, 100%, 96%);
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-secondary {
  background: var(--bg-white);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-table-head);
  border-color: hsl(0, 0%, 75%);
}

.btn-danger {
  background: hsla(0, 72%, 50%, 0.06);
  color: hsl(0, 72%, 50%);
  border-color: hsla(0, 72%, 50%, 0.2);
}

.btn-danger:hover {
  background: hsla(0, 72%, 50%, 0.12);
}

.btn-success {
  background: hsla(145, 60%, 45%, 0.06);
  color: hsl(145, 60%, 40%);
  border-color: hsla(145, 60%, 45%, 0.2);
}

.btn-success:hover {
  background: hsla(145, 60%, 45%, 0.12);
}

.btn-warning {
  background: hsla(35, 90%, 52%, 0.1);
  color: hsl(28, 88%, 42%);
  border-color: hsla(35, 90%, 52%, 0.24);
}

.btn-warning:hover {
  background: hsla(35, 90%, 52%, 0.18);
}

.btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
}

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
}

.icon-btn .material-symbols-outlined {
  font-size: 16px;
}

/* ================================================
   Forms
   ================================================ */
.form-group {
  margin-bottom: 0.85rem;
}

.form-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0.3rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px hsla(20, 90%, 48%, 0.1);
}

.form-input::placeholder {
  color: var(--text-placeholder);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}

/* ================================================
   Modal
   ================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: hsla(0, 0%, 0%, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-normal);
}

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

.modal {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.5rem;
  width: 90%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.96) translateY(10px);
  transition: transform var(--t-normal) ease;
  box-shadow: var(--shadow-lg);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-table-head);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.15rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.edit-item-actions {
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .edit-item-actions .btn {
    flex: 1 1 calc(50% - 0.25rem);
    justify-content: center;
  }
}

.section-note {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cell-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.icon-14 {
  font-size: 14px;
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.bulk-toolbar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-alt);
  border-radius: var(--r-md);
  border: 1px dashed var(--border);
  margin-bottom: 1rem;
}

.bulk-toolbar.active {
  display: flex;
}

.bulk-count {
  font-size: 0.8rem;
  font-weight: 600;
}

.bulk-toolbar-m1 {
  border-color: var(--s-m1);
}

.bulk-toolbar-nf {
  border-color: var(--s-nf);
}

.bulk-toolbar-pendencia {
  border-color: var(--s-pendencia);
}

/* ================================================
   Toasts
   ================================================ */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.toast {
  padding: 0.6rem 1rem;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 600;
  animation: toastIn 0.2s ease, toastOut 0.25s ease 3.5s forwards;
  box-shadow: var(--shadow-md);
  max-width: 380px;
  border-left: 4px solid;
  background: var(--bg-white);
}

.toast-success {
  border-left-color: hsl(145, 60%, 45%);
  color: hsl(145, 60%, 33%);
}

.toast-error {
  border-left-color: hsl(0, 72%, 50%);
  color: hsl(0, 72%, 40%);
}

.toast-info {
  border-left-color: var(--brand);
  color: var(--brand-dark);
}

@keyframes toastIn {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* ================================================
   Scanner
   ================================================ */
.scanner-container {
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
}

.scanner-input {
  width: 100%;
  padding: 0.85rem;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  background: var(--bg-white);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  letter-spacing: 1.5px;
}

.scanner-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px hsla(20, 90%, 48%, 0.12);
}

.scanner-input::placeholder {
  color: var(--text-placeholder);
  letter-spacing: 0.5px;
}

.scanner-status {
  margin-top: 0.75rem;
  padding: 0.65rem;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 0.88rem;
}

.scanner-status.success {
  background: hsla(145, 60%, 45%, 0.08);
  color: hsl(145, 60%, 33%);
  border: 1px solid hsla(145, 60%, 45%, 0.2);
}

.scanner-status.error {
  background: hsla(0, 72%, 50%, 0.06);
  color: hsl(0, 72%, 40%);
  border: 1px solid hsla(0, 72%, 50%, 0.2);
}

.scanner-status.idle {
  background: var(--bg-table-head);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.scanner-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.82rem;
}

.scanner-log-time {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.scanner-hint {
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.scanner-log-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.scanner-log-wrap {
  margin-top: 1rem;
}

.scanner-log-box {
  max-height: 220px;
  overflow-y: auto;
}

.scan-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-right: 0.4rem;
}

.scan-tag-rastreio {
  background: #dbeafe;
  color: #1e40af;
}

.scan-tag-transp {
  background: #fef3c7;
  color: #92400e;
}

/* ================================================
   Spinner
   ================================================ */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ================================================
   Empty State
   ================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ================================================
   Mobile
   ================================================ */
.menu-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  background: var(--bg-white);
  border: 1px solid var(--border);
  font-size: 1.2rem;
  padding: 0.3rem 0.55rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .sidebar-collapse-btn,
  .sidebar-expand-indicator {
    display: none !important;
  }

  .top-header {
    padding-left: 3.5rem;
  }
}

.activity-item {
  display: flex;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-top: 0.35rem;
  flex-shrink: 0;
}

.activity-text {
  font-size: 0.84rem;
}

.activity-time {
  margin-top: 0.2rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

@media (max-width: 1200px) {
  .main {
    padding: 1.25rem;
  }

  .top-header {
    padding: 0 1.25rem;
  }

  .search-box {
    max-width: 100%;
    min-width: 0;
  }
}
