:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface2: #f0f1f4;
  --border: #dde1e8;
  --border2: #c8cdd7;
  --text: #1a1f2e;
  --text2: #4a5162;
  --text3: #8a8f9e;
  --accent: #2563a8;
  --accent-light: #e8f0fb;
  --green: #1a7a3a;
  --green-bg: #eaf4ee;
  --green-border: #b5d9c2;
  --amber: #7a5c00;
  --amber-bg: #fef9e8;
  --amber-border: #e8d48a;
  --red: #c0392b;
  --red-bg: #fdecea;
  --red-border: #f5b7b1;
  --blue-bg: #e8f0fb;
  --blue-text: #2563a8;
  --radius: 5px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --sidebar-w: 56px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'IBM Plex Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 13px; display: flex; flex-direction: column; }

/* ===== HEADER ===== */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 200;
  box-shadow: var(--shadow);
  gap: 16px;
}
.header-left { display: flex; align-items: center; gap: 20px; flex: 1; min-width: 0; }
.logo { font-family: 'IBM Plex Mono', monospace; font-size: 15px; font-weight: 600; color: var(--accent); letter-spacing: -0.3px; white-space: nowrap; flex-shrink: 0; }
.logo span { color: var(--text3); font-weight: 400; font-size: 12px; margin-left: 8px; }
.header-nav { display: flex; align-items: center; gap: 2px; }
.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  position: relative;
  white-space: nowrap;
}
.nav-tab:hover { background: var(--surface2); color: var(--text); }
.nav-tab.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-tab-badge {
  background: rgba(255,255,255,0.25);
  color: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}
.clock { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--text2); background: var(--surface2); padding: 4px 10px; border-radius: var(--radius); border: 1px solid var(--border); }
.header-right { display: flex; align-items: center; gap: 10px; }
.badge-aguardando { background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.btn-novo { background: var(--accent); color: #fff; border: none; padding: 7px 16px; border-radius: var(--radius); font-weight: 600; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: background 0.15s; }
.btn-novo:hover { background: #1a4e8a; }

/* ===== USER CHIP ===== */
.user-chip {
  display: flex;
  align-items: center;
}
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; gap: 0px; line-height: 1.2; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text); }
.user-role { font-size: 10px; color: var(--text3); font-weight: 400; }

/* ===== LAYOUT WRAPPER ===== */
.layout { display: flex; flex: 1; overflow: hidden; }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; overflow-y: auto; min-width: 0; }

/* ===== PAGE PANELS ===== */
.page-panel { display: none; }
.page-panel.active { display: block; }

/* ==========================================
   ABA 1 — PORTALOG (design original)
   ========================================== */

/* TOOLBAR */
.toolbar { padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 300px; }
.search-box input { width: 100%; background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 6px 10px; border-radius: var(--radius); font-size: 13px; outline: none; }
.search-box input:focus { border-color: var(--accent); background: #fff; }
.filter-date { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 6px 10px; border-radius: var(--radius); font-size: 13px; cursor: pointer; font-family: inherit; }
.filter-date:focus { outline: none; border-color: var(--accent); background: #fff; }
select.filter-date { padding-right: 24px; }

/* TABLE */
.table-wrap { overflow-x: auto; padding: 0 20px 24px; }
table { width: 100%; border-collapse: collapse; min-width: 1200px; margin-top: 14px; background: var(--surface); border-radius: 6px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow); }
thead th {
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text2);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; cursor: pointer; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f0f4fb; }
tbody tr.aguardando { background: #fffef5; }
tbody tr.aguardando:hover { background: #fef8dc; }
tbody tr.liberado { background: var(--surface); }
td { padding: 8px 10px; white-space: nowrap; font-size: 12px; color: var(--text); }
td.placa { font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 12px; color: var(--text); }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 4px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; border: 1px solid; }
.status-badge.liberado { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.status-badge.aguardando { background: #fffbeb; color: #92400e; border-color: #fde68a; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.status-badge.aguardando[style*="cursor:pointer"]:hover { background: #fef3c7; border-color: #fcd34d; transform: scale(1.04); }
.status-badge.solicitado { background: #faf5ff; color: #6b21a8; border-color: #e9d5ff; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.status-badge.solicitado[style*="cursor:pointer"]:hover { background: #f3e8ff; border-color: #d8b4fe; transform: scale(1.04); }
.status-badge.chamado { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.status-badge.chamado[style*="cursor:pointer"]:hover { background: #dbeafe; border-color: #93c5fd; transform: scale(1.04); }

/* ===== NOTIFICATION POPUP (Portaria) — INDUSTRIAL / LOGISTICS ===== */
#notifContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

/* ---- CARD ---- */
.notif-card {
  background: #ffffff;
  color: #1a1f2e;
  border-radius: 4px;
  padding: 0;
  min-width: 340px;
  max-width: 400px;
  border: 1px solid #c8cdd7;
  border-top: none;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.07);
  pointer-events: auto;
  animation: notifSlideIn 0.35s cubic-bezier(.22,.68,0,1.2);
  overflow: hidden;
}
@keyframes notifSlideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}
.notif-card.notif-hide {
  animation: notifSlideOut 0.25s ease forwards;
}
@keyframes notifSlideOut {
  to { transform: translateX(110%); opacity: 0; }
}

/* ---- STATUS BAR (topo) ---- */
.notif-accent-bar {
  height: 4px;
  background: #c0392b;
  position: relative;
  overflow: hidden;
}
.notif-accent-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 12px,
    rgba(255,255,255,0.18) 12px,
    rgba(255,255,255,0.18) 14px
  );
}

/* ---- HEADER ---- */
.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px 6px;
  background: #1a2540;
  border-bottom: 1px solid #0f1828;
}
.notif-title {
  font-weight: 700;
  font-size: 9.5px;
  color: #8fa8cc;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.notif-title-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e74c3c;
  box-shadow: 0 0 0 2px rgba(231,76,60,0.3);
  animation: pulseDot 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(231,76,60,0.3); }
  50%       { box-shadow: 0 0 0 5px rgba(231,76,60,0.0); }
}
.notif-close {
  background: none;
  border: none;
  color: #4a6080;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
  transition: all 0.12s;
}
.notif-close:hover { background: rgba(255,255,255,0.1); color: #8fa8cc; }

/* ---- HERO: Pager + NF + Info ---- */
.notif-hero {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid #e8eaee;
}

/* Bloco PAGER */
.notif-pager-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #c0392b;
  padding: 14px 16px;
  min-width: 78px;
  flex-shrink: 0;
  border-right: 3px solid #a93226;
  position: relative;
}
.notif-pager-block::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 7px solid #a93226;
  z-index: 2;
}
.notif-pager-label {
  font-size: 8px;
  font-weight: 700;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.notif-pager-number {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 34px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.notif-pager-empty {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  font-style: italic;
}

/* Bloco NF + Info (right side) */
.notif-hero-right {
  display: flex;
  gap: 0;
  flex: 1;
  align-items: stretch;
  min-width: 0;
  padding-left: 6px;
}

/* Bloco NF/PEDIDO */
.notif-pedido-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 12px 14px 12px 12px;
  border-right: 1px solid #e8eaee;
  flex-shrink: 0;
}
.notif-pedido-label {
  font-size: 8px;
  font-weight: 700;
  color: #8a8f9e;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.notif-pedido-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  color: #1a2540;
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.notif-pedido-empty {
  font-size: 13px;
  color: #b0b5c2;
  font-style: italic;
}

/* Divisor vertical */
.notif-divider {
  width: 1px;
  background: #e8eaee;
  flex-shrink: 0;
  align-self: stretch;
}

/* Bloco INFO (setor/motorista/produto) */
.notif-info-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
}
.notif-info-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.notif-info-label {
  font-size: 8px;
  font-weight: 700;
  color: #8a8f9e;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.notif-info-value {
  font-size: 11.5px;
  font-weight: 600;
  color: #1a2540;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.1px;
}

/* ---- ACTIONS ---- */
.notif-actions {
  padding: 9px 12px 10px;
  display: flex;
  gap: 7px;
  background: #f5f6f8;
  border-top: 1px solid #e8eaee;
}
.notif-btn-liberar {
  background: #1a7a3a;
  color: #fff;
  border: 1px solid #156030;
  padding: 8px 14px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  flex: 1;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.notif-btn-liberar:hover {
  background: #155f2e;
  border-color: #0f4a23;
}
.notif-btn-liberar:active { transform: translateY(1px); }
.notif-btn-ignorar {
  background: #ffffff;
  color: #4a5162;
  border: 1px solid #c8cdd7;
  padding: 8px 14px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}
.notif-btn-ignorar:hover {
  background: #f0f1f4;
  border-color: #a0a5b2;
  color: #1a1f2e;
}
.motivo-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; border: 1px solid; }
.motivo-carga { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.motivo-descarga { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.motivo-terceiros { background: #f5f3ff; color: #5b21b6; border-color: #ddd6fe; }
.no-records { text-align:center; color: var(--text3); padding: 40px; font-size:13px; }
.action-btns { display: flex; gap: 4px; }
.btn-sm { background: var(--surface2); border: 1px solid var(--border); color: var(--text2); padding: 3px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.btn-sm:hover { border-color: var(--accent); color: var(--accent); background: var(--blue-bg); }
.btn-sm-del { color: var(--red); border-color: var(--red-border); background: var(--red-bg); }
.btn-sm-del:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-secondary { background: var(--surface2); color: var(--text2); border: 1px solid var(--border2); padding: 7px 16px; border-radius: var(--radius); font-weight: 500; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.15s; font-family: inherit; }
.btn-secondary:hover { background: var(--surface); border-color: var(--text3); color: var(--text); }
.motivo-truck { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.motivo-carreta { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }


/* MODAL OVERLAY */
.overlay { position: fixed; inset: 0; background: rgba(20,30,50,0.45); z-index: 400; display: flex; align-items: center; justify-content: center; padding: 20px; }
.overlay.hidden { display: none; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; width: 100%; max-width: 820px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 16px 24px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-title { font-size: 14px; font-weight: 600; color: var(--text); }
.modal-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 20px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; position: relative; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.4px; }
input[type=text], input[type=number], input[type=datetime-local], input[type=date], input[type=file], select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,168,0.08); }
input[readonly] { color: var(--text3); cursor: default; background: var(--surface2); }
input.placa-field { font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; }
.placa-autocomplete { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); z-index: 999; max-height: 220px; overflow-y: auto; box-shadow: var(--shadow-lg); display: none; }
.placa-autocomplete.show { display: block; }
.placa-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 12px; display: flex; flex-direction: column; gap: 2px; transition: background 0.1s; }
.placa-item:last-child { border-bottom: none; }
.placa-item:hover, .placa-item.active { background: var(--blue-bg); }
.placa-item .pi-placa { font-family: 'IBM Plex Mono', monospace; font-weight: 700; font-size: 13px; color: var(--accent); }
.placa-item .pi-info { color: var(--text2); font-size: 11px; }
select option { background: var(--surface); }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface2); border-radius: 0 0 8px 8px; }
.btn-cancel { background: var(--surface); border: 1px solid var(--border2); color: var(--text2); padding: 8px 16px; border-radius: var(--radius); cursor: pointer; font-family: inherit; font-size: 13px; }
.btn-cancel:hover { border-color: var(--text2); color: var(--text); }
.btn-save { background: var(--accent); color: #fff; border: none; padding: 8px 20px; border-radius: var(--radius); font-weight: 600; font-size: 13px; cursor: pointer; }
.btn-save:hover { background: #1a4e8a; }

.veh-modal { max-width: 480px; }
.veh-grid { display: grid; gap: 8px; margin-top: 6px; }
.veh-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; cursor: pointer; transition: all 0.15s; display: flex; justify-content: space-between; align-items: center; }
.veh-card:hover { border-color: var(--accent); background: var(--blue-bg); }
.veh-card .plates { font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 13px; color: var(--text); }
.veh-card .plates span { color: var(--text2); font-weight: 400; font-size: 11px; display: block; margin-top: 2px; }
.veh-card .tipo { font-size: 11px; color: var(--text2); background: var(--surface); border: 1px solid var(--border); padding: 3px 8px; border-radius: 10px; }
.confirm-modal { max-width: 380px; }
.confirm-msg { color: var(--text); margin: 8px 0 16px; line-height: 1.5; }
.btn-confirm-ok { background: var(--green); color: #fff; border: none; padding: 8px 20px; border-radius: var(--radius); font-weight: 600; cursor: pointer; font-family: inherit; }
.autofill-hint { font-size: 10px; color: var(--accent); margin-top: 2px; display: none; }
select.autofilled, input.autofilled { border-color: var(--accent) !important; background: var(--accent-light) !important; }

/* ===== VALIDAÇÃO DE CAMPOS OBRIGATÓRIOS ===== */
.field-error input,
.field-error select {
  border-color: var(--red) !important;
  background: var(--red-bg) !important;
  box-shadow: 0 0 0 3px rgba(192,57,43,0.10) !important;
}
.field-error-msg {
  font-size: 10px;
  color: var(--red);
  margin-top: 3px;
  display: none;
  font-weight: 600;
}
.field-error .field-error-msg { display: block; }
label .req-star { color: var(--red); margin-left: 2px; }

.hidden-el { display: none !important; }



/* ===== MOTORISTAS PAGE ===== */
.mot-toolbar { padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Inline editing */
tr.mot-editing { background: #f0f4fb !important; }
tr.mot-editing td { padding: 4px 6px !important; }
tr.mot-editing input, tr.mot-editing select {
  padding: 4px 7px; font-size: 12px; border-radius: 4px;
  border: 1px solid var(--accent); background: #fff;
  font-family: inherit; color: var(--text); outline: none;
  width: 100%; box-sizing: border-box;
}
tr.mot-editing input.placa-edit { font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; width: 100px; }
tr.mot-editing input.nome-edit { width: 180px; font-weight: 500; }
tr.mot-editing input.cpf-edit { width: 120px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
tr.mot-editing input.transp-edit { width: 130px; }
tr.mot-editing select.tipo-edit { width: 100px; }
.btn-sm-save { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); font-weight: 700; }
.btn-sm-save:hover { background: var(--green); color: #fff; border-color: var(--green); }
.btn-sm-cancel { background: var(--surface2); border: 1px solid var(--border2); color: var(--text3); }
.btn-sm-cancel:hover { background: var(--surface); color: var(--text2); }

/* ===== MODAL NOVO MOTORISTA ===== */
.mot-modal { max-width: 560px; }
.mot-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mot-form-grid .form-group.full { grid-column: 1 / -1; }
.mot-field-req { color: var(--red); margin-left: 2px; }
.mot-error { font-size: 11px; color: var(--red); margin-top: 3px; display: none; }
.mot-error.show { display: block; }

/* ===== PAGINAÇÃO MOTORISTAS ===== */
.mot-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 14px;
  font-size: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.mot-pagination-info { color: var(--text2); }
.mot-pagination-controls { display: flex; gap: 6px; align-items: center; }
.mot-page-btn {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 4px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: all 0.15s;
}
.mot-page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--blue-bg); }
.mot-page-btn:disabled { opacity: 0.4; cursor: default; }
.mot-page-indicator { font-weight: 700; color: var(--text2); min-width: 60px; text-align: center; }

/* ===== USER DROPDOWN ===== */
.user-chip {
  position: relative;
}
.user-chip-clickable {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.user-chip-clickable:hover { background: var(--surface); border-color: var(--border2); }
.user-chip-clickable .chevron {
  margin-left: 2px;
  color: var(--text3);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.user-chip-clickable.open .chevron { transform: rotate(180deg); }
.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 500;
  overflow: hidden;
}
.user-dropdown-menu.open { display: block; }
.user-dropdown-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.user-dropdown-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 2px;
}
.btn-logout-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.btn-logout-menu:hover { background: var(--red-bg); }

/* ===== SINO DE HISTÓRICO (Portaria) ===== */
#bellWrapper {
  position: relative;
  display: none; /* visível apenas para Portaria */
}
.bell-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.bell-btn:hover { background: var(--surface); border-color: var(--border2); color: var(--accent); }
.bell-btn.has-unread { color: var(--accent); border-color: var(--accent); background: var(--blue-bg); }
.bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #c0392b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  border: 2px solid var(--surface);
  animation: bellPop 0.3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes bellPop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}
.bell-badge.hidden { display: none; }

/* Painel lateral de histórico */
#histPanel {
  position: fixed;
  top: 52px;
  right: 0;
  width: 420px;
  height: calc(100vh - 52px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.10);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform 0.28s cubic-bezier(.22,.68,0,1.2);
}
#histPanel.open {
  transform: translateX(0);
}
.hist-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.hist-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.hist-panel-title svg { color: var(--accent); }
.hist-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hist-clear-btn {
  font-size: 11px;
  color: var(--text3);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.hist-clear-btn:hover { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.hist-close-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--surface2);
  color: var(--text3);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}
.hist-close-btn:hover { background: var(--border); color: var(--text); }

/* Filtros do histórico */
.hist-filters {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.hist-filter-chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.hist-filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.hist-filter-chip:hover:not(.active) { border-color: var(--border2); background: var(--surface); }

/* Lista do histórico */
.hist-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.hist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  color: var(--text3);
  font-size: 13px;
  padding: 40px 20px;
  text-align: center;
}
.hist-empty svg { opacity: 0.3; }

/* Card de item do histórico */
.hist-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background 0.1s;
  cursor: default;
}
.hist-item:hover { background: var(--surface2); }
.hist-item.unread::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.hist-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.hist-item-nf {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.hist-item-pager {
  font-size: 10px;
  color: var(--text3);
  font-family: 'IBM Plex Mono', monospace;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}
.hist-item-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 10px;
}
.hist-info-tag {
  font-size: 11px;
  color: var(--text2);
}
.hist-info-tag strong { color: var(--text); font-weight: 600; }

/* Timeline de timestamps */
.hist-timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px 12px;
}
.hist-ts-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.hist-ts-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hist-ts-dot.solicitado { background: #a855f7; }
.hist-ts-dot.confirmado { background: var(--accent); }
.hist-ts-dot.liberado   { background: var(--green); }
.hist-ts-dot.pendente   { background: var(--border2); }
.hist-ts-label {
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 9.5px;
  min-width: 80px;
}
.hist-ts-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
}
.hist-ts-value.pending { color: var(--text3); font-style: italic; font-family: inherit; }

/* Status badge no histórico */
.hist-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid;
  flex-shrink: 0;
}
.hist-status-badge.solicitado { background: #faf5ff; color: #6b21a8; border-color: #e9d5ff; }
.hist-status-badge.chamado    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.hist-status-badge.liberado   { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.hist-status-badge.ignorado   { background: var(--surface2); color: var(--text3); border-color: var(--border); }

/* ===== SELEÇÃO DE MOTORISTAS ===== */
.mot-checkbox-cell {
  width: 36px;
  text-align: center;
  padding: 8px 6px !important;
}
.mot-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  border-radius: 3px;
  margin: 0;
  vertical-align: middle;
}
tbody tr.mot-selected {
  background: var(--accent-light) !important;
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

/* ===== BARRA FLUTUANTE DE SELEÇÃO ===== */
#motSelectionBar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a1f2e;
  color: #fff;
  border-radius: 40px;
  padding: 10px 18px 10px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.18);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}
#regSelectionBar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a1f2e;
  color: #fff;
  border-radius: 40px;
  padding: 10px 18px 10px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.18);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}
#motSelectionBar.visible, #regSelectionBar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
#motSelectionBar .sel-count {
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
}
#motSelectionBar .sel-label {
  color: #c8cdd7;
  font-size: 12px;
  margin-right: 6px;
}
.sel-bar-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.15);
  margin: 0 4px;
}
.btn-sel-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 24px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
  letter-spacing: 0;
}
.btn-sel-action:active { transform: scale(0.96); }
.btn-sel-edit {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.btn-sel-edit:hover { background: rgba(255,255,255,0.22); }
.btn-sel-delete {
  background: #c0392b;
  color: #fff;
}
.btn-sel-delete:hover { background: #a93226; }
.btn-sel-clear {
  background: none;
  border: none;
  color: #8a8f9e;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
  font-size: 16px;
  line-height: 1;
}
.btn-sel-clear:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* ===== CÉLULAS COPIÁVEIS ===== */
.copiavel {
  cursor: pointer;
  position: relative;
}
.copiavel.copiado {
  background: var(--green-bg) !important;
  color: var(--green) !important;
}
.copiavel.copiado::after {
  content: '✓' !important;
  color: var(--green) !important;
  opacity: 1 !important;
}

/* ===== PRINT ===== */
@media print {
  body { background: white; }
  header, .toolbar { display: none !important; }
  .layout { display: block; }
  .main-content { overflow: visible; }
  .page-panel { display: block !important; }
}
