* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
}

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

a:hover {
  opacity: 0.8;
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  position: fixed;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.sidebar-logo {
  max-height: 44px;
  width: auto;
}

.sidebar-header h2 {
  font-size: 16px;
  color: var(--primary);
  letter-spacing: 1px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-inverse);
  font-size: 24px;
  cursor: pointer;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.sidebar-user {
  padding: 0 0 12px;
}

.sidebar-user .user-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-inverse);
}

.sidebar-user .user-role {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
}

.sidebar-menu {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}

.sidebar-menu-bottom {
  flex: 0 0 auto;
  overflow: visible;
  padding: 4px 10px 8px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  color: var(--sidebar-text);
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  margin-bottom: 1px;
}

.sidebar-menu li a .material-symbols-outlined {
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-menu li a:hover {
  background: var(--sidebar-hover);
  color: var(--text-inverse);
}

.sidebar-menu li a.active {
  background: var(--primary);
  color: var(--text-main);
  font-weight: 600;
}

.sidebar-group {
  margin-bottom: 2px;
}

.sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 14px;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.sidebar-group-toggle .material-symbols-outlined {
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-group-label {
  flex: 1;
}

.sidebar-group-chevron {
  transition: transform 0.2s;
}

.sidebar-group-toggle[aria-expanded="true"] .sidebar-group-chevron {
  transform: rotate(180deg);
}

.sidebar-group-toggle:hover {
  background: var(--sidebar-hover);
  color: var(--text-inverse);
}

.sidebar-group.has-active-child > .sidebar-group-toggle {
  color: var(--text-inverse);
}

.sidebar-group-list {
  list-style: none;
  padding: 0 0 0 14px;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}

.sidebar-group-toggle[aria-expanded="true"] + .sidebar-group-list {
  max-height: 600px;
  opacity: 1;
  padding: 2px 0 4px 14px;
}

.sidebar-group-list li a {
  font-size: 12.5px;
  padding: 5px 12px;
}

.sidebar-group-list li a .material-symbols-outlined {
  font-size: 18px;
}

.menu-section {
  padding: 12px 14px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--sidebar-section);
}

.settings-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.settings-hub-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-hub-group-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 4px;
}

.settings-hub-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-hub-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}

.settings-hub-card:hover {
  background: var(--bg-card);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  text-decoration: none;
}

.settings-hub-card-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  flex-shrink: 0;
  position: relative;
}

.settings-hub-card-icon::before {
  content: attr(data-icon);
  font-family: 'Material Symbols Outlined';
  font-size: 22px;
  line-height: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.settings-hub-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-hub-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.settings-hub-card-desc {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.4;
}

.sidebar-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--sidebar-border);
}

.logout-link {
  color: var(--sidebar-text-muted);
  font-size: 13px;
}

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

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  background: var(--bg-card);
  padding: 0 32px;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-main);
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}

.location-filter select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text-main);
}

.topbar-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-main);
  font-family: var(--font);
  white-space: nowrap;
  line-height: 1.1;
}

.topbar-clock-time {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.topbar-clock-date {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.content-area {
  padding: 28px 32px;
  flex: 1;
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

.alert-title-danger {
  color: var(--danger);
}

.alert-title-warning {
  color: var(--warning);
}

.form-card {
  max-width: 800px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text-main);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  gap: 6px;
}

.btn:hover {
  text-decoration: none;
  background: var(--bg-hover);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-main);
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

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

.btn-secondary:hover {
  background: var(--border);
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: var(--text-inverse);
}

.btn-success:hover {
  opacity: 0.9;
}

.btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: var(--text-inverse);
}

.btn-warning:hover {
  opacity: 0.9;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--text-inverse);
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-hover);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.table th {
  background: var(--bg-main);
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

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

.table thead th {
  position: sticky;
  top: var(--topbar-height);
  z-index: 40;
  background: var(--bg-main);
  box-shadow: inset 0 -1px 0 var(--border);
}

.table-no-sticky thead th {
  position: static;
  box-shadow: none;
}

.modal-overlay .table thead th {
  top: 0;
  z-index: 5;
  background: var(--bg-card);
}

.table-compact th,
.table-compact td {
  padding: 6px 10px;
  font-size: 12px;
}

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

.text-danger {
  color: var(--danger);
  font-weight: 600;
}

.text-warning {
  color: var(--warning);
  font-weight: 600;
}

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

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-separado {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-saiu-para-entrega {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-solicitado {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-agendado {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-em-rota {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-concluido {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-cancelado {
  background: var(--bg-hover);
  color: var(--text-soft);
}

.badge-recusado {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-aguardando-fabricante {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-aprovada {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-recusada {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-parcialmente-em-rota-de-entrega {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-em-rota-de-entrega {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-parcialmente-entregue {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-entregue, .badge-totalmente-entregue {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-devolvido {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-active {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-inactive {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-transfer-rascunho {
  background: var(--bg-hover);
  color: var(--text-soft);
}

.badge-transfer-solicitada {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-transfer-aprovada {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-transfer-em-transito {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-transfer-recebida {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-transfer-cancelada {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-transfer-parcialmente-recebida {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-transfer-devolvida {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-mov-entrada {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-mov-saida {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-mov-devolucao {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-mov-transferencia {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-mov-ajuste_manual {
  background: var(--purple-bg);
  color: var(--purple-text);
}

.badge-tipo-venda {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-tipo-consignado {
  background: var(--purple-bg);
  color: var(--purple-text);
}

.badge-tipo-bonificacao {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-tipo-entrega {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-tipo-retirada {
  background: var(--purple-bg);
  color: var(--purple-text);
}

.badge-shipment-em-transito {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-shipment-entregue {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-shipment-parcialmente-entregue {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-shipment-retornada {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-type-devolucao {
  background: var(--purple-bg);
  color: var(--purple-text);
}

.badge-type-entrega {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-type-acerto {
  background: var(--purple-bg);
  color: var(--purple-text);
}

.badge-efetivado,
.badge-totalmente-efetivado {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-parcialmente-efetivado {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-shipment-efetivada {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-vencido {
  background: var(--danger-bg);
  color: var(--danger-text);
  margin-left: 4px;
}

.badge-vencendo {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.batch-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 12px;
  flex-wrap: wrap;
}

.batch-actions-bar .batch-info {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 500;
  margin-right: auto;
}

.table .item-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.table th.col-check,
.table td.col-check {
  width: 40px;
  text-align: center;
  padding: 8px 4px;
}

.shipment-items-list {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.4;
}

.shipment-items-list span {
  display: inline-block;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  margin: 1px 2px;
  font-size: 11px;
}

.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--primary);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 90;
}

@media (max-width: 768px) {
  .bulk-action-bar {
    left: 0;
  }
}

.bulk-action-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.bulk-action-bar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger);
}

.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-form input[type="text"],
.search-form input[type="date"] {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: var(--font);
  min-width: 320px;
  flex: 1;
  background: var(--bg-card);
  color: var(--text-main);
}

.search-form select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: var(--font);
  min-width: 180px;
  background: var(--bg-card);
  color: var(--text-main);
}

.search-form-multi input[type="text"],
.search-form-multi input[type="date"] {
  min-width: 200px;
}

.table td > input[type="text"],
.table td > input[type="number"],
.table td > input[type="date"],
.table td > input[type="email"],
.table td > input[type="tel"],
.table td > select,
.table td > textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text-main);
  transition: border-color 0.2s;
}

.table td > input[type="text"]:focus,
.table td > input[type="number"]:focus,
.table td > input[type="date"]:focus,
.table td > input[type="email"]:focus,
.table td > input[type="tel"]:focus,
.table td > select:focus,
.table td > textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  color: var(--text-main);
  transition: transform 0.2s, box-shadow 0.2s;
  border-left: 4px solid;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.action-entry {
  border-left-color: var(--success);
}

.action-contract {
  border-left-color: var(--primary);
}

.action-transfer {
  border-left-color: var(--warning);
}

.action-icon {
  font-size: 20px;
}

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.detail-header h2 {
  margin-bottom: 8px;
}

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

.detail-item {
  font-size: 14px;
}

.detail-item strong {
  color: var(--text-soft);
}

.detail-full {
  grid-column: 1 / -1;
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

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

.actions-cell-inline {
  flex-wrap: nowrap;
  white-space: nowrap;
  justify-content: flex-end;
}

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

.inline-group {
  margin-bottom: 0;
}

.inline-group input {
  padding: 6px 10px;
  font-size: 13px;
}

.item-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
  padding: 14px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.item-product {
  flex: 3;
  margin-bottom: 0;
}

.item-qty {
  flex: 1;
  margin-bottom: 0;
}

.remove-item {
  margin-bottom: 0;
  align-self: flex-end;
}

.empty-state {
  text-align: center;
  color: var(--text-soft);
  padding: 20px;
  font-style: italic;
}

.row-inactive {
  opacity: 0.5;
}

.file-label {
  cursor: pointer;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-sidebar);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
  text-align: center;
}

.login-card h1 {
  font-size: 24px;
  color: var(--text-main);
  margin-bottom: 4px;
  font-weight: 700;
}

.login-subtitle {
  color: var(--text-soft);
  margin-bottom: 28px;
  font-size: 13px;
}

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

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

  .sidebar-toggle {
    display: block;
  }

  .menu-toggle {
    display: block;
  }

  .main {
    margin-left: 0;
  }


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

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

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .page-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .search-form {
    flex-direction: column;
  }

  .search-form input,
  .search-form select {
    width: 100%;
    min-width: unset;
  }

  .item-row {
    flex-wrap: wrap;
  }

  .table {
    font-size: 12px;
  }

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

  .content-area {
    padding: 16px;
  }

  .top-bar {
    padding: 8px 16px;
    flex-wrap: wrap;
    height: auto;
    min-height: var(--topbar-height);
  }

  .topbar-clock {
    padding: 4px 10px;
  }

  .topbar-clock-time {
    font-size: 13px;
  }

  .topbar-clock-date {
    font-size: 10px;
  }

  .location-filter select {
    max-width: 160px;
  }
}

.topbar-clock {
  flex-shrink: 0;
}

.notif-wrap {
  flex-shrink: 0;
}

.topbar-notif:hover,
.topbar-notif:focus-visible {
  background: var(--border) !important;
  outline: none;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-panel[hidden] {
  display: none;
}

.notif-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.notif-panel-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
}

.notif-panel-list {
  max-height: 60vh;
  overflow-y: auto;
}

.notif-panel-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
}

.notif-panel-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  text-decoration: none;
  cursor: default;
}

a.notif-panel-item {
  cursor: pointer;
}

a.notif-panel-item:hover,
a.notif-panel-item:focus-visible {
  background: var(--bg-hover);
  outline: none;
}

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

.notif-panel-item-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}

.notif-panel-item-wrap:last-child {
  border-bottom: none;
}

.notif-panel-item-wrap .notif-panel-item {
  flex: 1;
  border-bottom: none;
}

.notif-mark-read-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  padding: 0;
  margin-right: 6px;
  border-radius: 4px;
}

.notif-mark-read-btn:hover,
.notif-mark-read-btn:focus-visible {
  background: var(--bg-hover);
  color: var(--info-text);
  outline: none;
}

.notif-panel-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  margin-top: 6px;
  flex-shrink: 0;
}

.notif-panel-item.is-unread .notif-panel-dot {
  background: var(--info-text);
}

.notif-panel-body {
  flex: 1;
  min-width: 0;
}

.notif-panel-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 2px;
  word-break: break-word;
}

.notif-panel-item.is-unread .notif-panel-title {
  font-weight: 700;
}

.notif-panel-msg {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 4px;
  word-break: break-word;
}

.notif-panel-time {
  font-size: 11px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.notif-panel-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-hover);
  text-align: center;
}

.notif-panel-footer a {
  font-size: 13px;
  font-weight: 600;
  color: var(--info-text);
  text-decoration: none;
}

.notif-panel-footer a:hover,
.notif-panel-footer a:focus-visible {
  text-decoration: underline;
  outline: none;
}

@media (max-width: 600px) {
  .notif-panel {
    width: calc(100vw - 24px);
    right: -8px;
  }
}

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

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input[type="checkbox"] {
  display: none;
}

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--bg-hover);
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--primary);
  border-color: var(--primary);
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 14px;
  color: var(--text-main);
}

.form-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.form-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-search-wrapper {
  position: relative;
  width: 100%;
  min-width: 220px;
}

.product-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text-main);
  transition: border-color 0.2s;
}

.product-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.table td .product-search-wrapper {
  min-width: 0;
}

.table td .product-search-input {
  padding: 8px 12px;
  font-size: 13px;
}

.product-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 50;
  display: none;
}

.product-search-results.active {
  display: block;
}

.product-search-item {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.15s;
}

.product-search-item:hover,
.product-search-item.highlighted {
  background: var(--bg-hover);
}

.product-search-item .product-code {
  font-weight: 600;
  margin-right: 4px;
}

.product-search-item .product-brand {
  color: var(--text-soft);
}

.product-search-no-results {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-soft);
  font-style: italic;
}

.items-section {
  margin-bottom: 16px;
}

.items-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.table-clients th,
.table-clients td {
  padding: 8px 6px;
  word-break: break-word;
  white-space: normal;
  vertical-align: top;
}

.table-clients th:nth-child(1),
.table-clients td:nth-child(1) { width: 6%; }
.table-clients th:nth-child(2),
.table-clients td:nth-child(2) { width: 22%; }
.table-clients th:nth-child(3),
.table-clients td:nth-child(3) { width: 25%; }
.table-clients th:nth-child(4),
.table-clients td:nth-child(4) { width: 14%; }
.table-clients th:nth-child(5),
.table-clients td:nth-child(5) { width: 6%; text-align: center; }
.table-clients th:nth-child(6),
.table-clients td:nth-child(6) { width: 7%; text-align: center; }
.table-clients th:nth-child(7),
.table-clients td:nth-child(7) { width: 170px; white-space: nowrap; }

.table-clients th:nth-child(2),
.table-clients td:nth-child(2),
.table-clients th:nth-child(3),
.table-clients td:nth-child(3),
.table-clients th:nth-child(4),
.table-clients td:nth-child(4) {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-clients .actions-cell {
  display: table-cell;
  white-space: nowrap;
  overflow: visible;
  text-align: left;
  vertical-align: middle;
}

.table-clients .actions-cell > * {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 4px;
}

.table-clients .actions-cell > *:last-child {
  margin-right: 0;
}

.table-clients .actions-cell .btn {
  padding: 4px 10px;
  font-size: 12px;
}

@media (max-width: 1200px) {
  .table-clients th,
  .table-clients td {
    padding: 6px 4px;
    font-size: 11px;
  }

  .table-clients .actions-cell .btn {
    padding: 2px 6px;
    font-size: 10px;
  }
}

/* Delivery calendar */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.cal-dow-head {
  background: var(--bg-main);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  text-align: center;
}
.cal-month-cell {
  background: var(--bg-card);
  min-height: 110px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.cal-month-cell.is-out { background: var(--bg-main); opacity: 0.6; }
.cal-month-cell.is-today { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-month-daynum {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 2px;
}
.cal-cell-over {
  background: var(--focus-ring) !important;
}

.cal-week-wrap { overflow-x: auto; }
.cal-week-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
}
.cal-week-table th, .cal-week-table td {
  border: 1px solid var(--border);
  vertical-align: top;
  padding: 6px;
}
.cal-week-corner, .cal-week-period {
  background: var(--bg-main);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  width: 110px;
  text-align: left;
}
.cal-week-day {
  background: var(--bg-main);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
}
.cal-week-day.is-today { background: var(--focus-ring); }
.cal-week-cell { min-height: 80px; min-width: 130px; }

.cal-evt {
  display: block;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
}
.cal-evt + .cal-evt { margin-top: 4px; }
.cal-evt:hover { box-shadow: var(--shadow-sm); }
.cal-evt-line1 { font-weight: 600; }
.cal-evt-line2 { font-size: 11px; color: var(--text-soft); }
.cal-evt-line3 { font-size: 11px; }
.cal-evt-dragging { opacity: 0.5; }
.cal-evt[draggable="true"] { cursor: grab; }

.cal-evt-solicitado { background: var(--info-bg); color: var(--info-text); border-color: var(--info-bg); }
.cal-evt-agendado   { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-bg); }
.cal-evt-em-rota    { background: var(--purple-bg); color: var(--purple-text); border-color: var(--purple-bg); }
.cal-evt-concluido  { background: var(--success-bg); color: var(--success-text); border-color: var(--success-bg); }
.cal-evt-cancelado  { background: var(--bg-hover); color: var(--text-soft); border-color: var(--border); }
.cal-evt-recusado   { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-bg); }

/* =========================================================
   /products page utilities (Task #104 refactor)
   ========================================================= */

.products-toolbar-card { margin-bottom: 1rem; }
.products-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.products-toolbar-row > h3 { margin: 0; }
.products-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.icon-inline { font-size: 18px; vertical-align: middle; }
.icon-inline-back { margin-right: 0.5rem; vertical-align: middle; }
.icon-lg { font-size: 32px; }
.icon-xl { font-size: 48px; color: var(--text-soft); display: block; margin-bottom: 0.5rem; }

.products-filter-pill {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text-main);
}
.products-filter-pill-input { width: 100%; }
.products-filter-brand-wrap { min-width: 200px; }

.page-actions-extra {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.btn-danger-outline { color: var(--danger); border-color: var(--danger); }
.btn-disabled-soft { opacity: 0.5; cursor: not-allowed; }

.products-total-bar {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bulk-banner-cell {
  background: var(--info-bg);
  color: var(--info-text);
  text-align: center;
  padding: 10px;
}
.bulk-banner-link {
  color: var(--info-text);
  font-weight: 600;
  text-decoration: underline;
}

.badge-linked {
  background: var(--primary);
  color: var(--text-inverse);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  margin-left: 4px;
  vertical-align: middle;
}

.col-cb { width: 36px; }
.col-cb-sm { width: 32px; }

.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.pagination-disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-current { pointer-events: none; }
.pagination-ellipsis { color: var(--text-soft); padding: 0 4px; }
.pagination-meta {
  color: var(--text-soft);
  font-size: 12px;
  margin-left: 8px;
}

.modal-card-sm  { max-width: 500px; margin: 80px auto; }
.modal-card-md  { max-width: 520px; margin: 80px auto; }
.modal-card-lg  { max-width: 600px; margin: 40px auto; max-height: 90vh; overflow-y: auto; }
.modal-card-xl  { max-width: 800px; margin: 40px auto; max-height: 90vh; overflow-y: auto; }
.modal-card-tall-md { max-width: 760px; margin: 80px auto; max-height: 80vh; overflow-y: auto; }

.modal-help {
  margin-bottom: 1rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}
.field-help {
  color: var(--text-soft);
  font-size: 12px;
  display: block;
  margin-top: 6px;
}
.field-mb { margin-bottom: 1rem; }

.np-mode-help {
  color: var(--text-soft);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.np-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.np-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  gap: 0.5rem;
  border-radius: var(--radius);
  font-size: 13px;
  min-height: 100px;
}
.np-mode-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.np-link-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-main);
}
.np-link-status {
  text-align: center;
  padding: 1rem;
  color: var(--text-soft);
}
.np-link-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.np-link-search {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
}
.np-link-cb-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.np-link-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.np-link-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.np-link-count {
  font-size: 13px;
  color: var(--text-soft);
}
.np-link-result { margin-top: 0.75rem; }
.np-link-actions { margin-top: 1rem; }

.np-link-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.np-link-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 4px;
}
.np-link-item-row > span { flex: 1; }
.np-link-item-name {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-top: 2px;
}
.alert-tight { margin: 0; }

.np-bulk-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--bg-soft, var(--bg-card));
}
.np-bulk-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.np-bulk-row-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}
.np-bulk-row-error {
  margin-bottom: 8px;
}
.np-bulk-add-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 4px;
  margin-bottom: 4px;
}

.csv-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  margin-bottom: 1rem;
}
.csv-dropzone-text {
  margin: 0 0 0.5rem;
  color: var(--text-soft);
}
.csv-dropzone-meta {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.csv-dropzone-input { margin: 0 auto; }

.modal-actions-end {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.select-inline {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text-main);
  transition: border-color 0.2s;
}
.select-inline:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.file-input {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  max-width: 100%;
}
.file-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.file-input::file-selector-button {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-right: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.file-input::file-selector-button:hover {
  background: var(--bg-hover, var(--bg-main));
  border-color: var(--border-focus);
}

.import-preview-file { margin-bottom: 0.5rem; }

.import-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.import-summary-card {
  padding: 0.75rem;
  text-align: center;
  margin: 0;
}
.import-summary-card-info { border-color: var(--info); }
.import-summary-num {
  font-size: 1.5rem;
  font-weight: 700;
}
.import-summary-num-success { color: var(--success); }
.import-summary-num-warning { color: var(--warning); }
.import-summary-num-danger  { color: var(--danger); }
.import-summary-num-info    { color: var(--info); }
.import-summary-label {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.import-info-banner {
  background: var(--info-bg);
  border: 1px solid var(--info-bg);
  color: var(--info-text);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.import-info-banner p { margin: 0.5rem 0 0; }
.import-info-banner ul { margin: 0.5rem 0 0; padding-left: 1.5rem; }
.import-info-banner-cb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  cursor: pointer;
}
.import-info-banner-meta {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--info-text);
}

.import-section { margin-bottom: 1rem; }
.import-section > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
}
.import-section > .table { margin-top: 0.5rem; }

.badge-new-brand {
  background: var(--info-bg);
  color: var(--info-text);
  font-size: 0.7rem;
}

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

.import-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.import-result-card {
  padding: 0.5rem;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  text-align: center;
}
.import-result-card-info {
  background: var(--info-bg);
  grid-column: span 2;
}
.import-result-num {
  font-size: 1.25rem;
  font-weight: 700;
}
.import-result-mode {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-soft);
}
.text-right { text-align: right; }

/* ---------- Visibility utility (toggled by JS via classList) ---------- */
.is-hidden { display: none !important; }
