:root{
  --bg: #f3f5f7;
  --card: #ffffff;
  --line: rgba(15,23,42,.10);
  --text: #0f172a;
  --muted: #64748b;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  /* CargoFleet-ish (HAR mostra muito #f1b005) */
  --primary: #f1b005;
  --primary2: #e0a200;

  --success:#16a34a;
  --danger: #ef4444;

  --shadow: 0 10px 30px rgba(2,6,23,.06);
  --radius: 16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);

  /* chave: nunca permitir “scroll pro lado” na página */
  overflow-x: hidden;
}

.mono{ font-family: var(--mono); }
.strong{ font-weight:600; }
.subtle{ color: var(--muted); font-size:12px; }

.smallHelp{
  color: var(--muted);
  font-size:12px;
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:8px;
}
.dot{ width:8px; height:8px; border-radius:999px; display:inline-block; }
.dot--warn{ background:#f59e0b; }
.dot--ok{ background:#22c55e; }

/* ===================== TOPBAR ===================== */
.topbar{
  height:64px;
  background:#fff;
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 18px;
}

.logo{ display:flex; align-items:center; gap:12px; }
.logoMark{
  width:44px; height:18px;
  background: var(--primary);
  border-radius: 999px 6px 6px 999px;
  transform: skewX(-16deg);
}
.brand__name{
  font-weight:800;
  letter-spacing:.2px;
  line-height:1;
}
.brand__name span{ color: var(--primary2); }

.topbar__nav{
  display:flex;
  align-items:center;
  gap:14px;
}

.navItem{
  text-decoration:none;
  color: #334155;
  font-weight:600;
  font-size:14px;
  padding:8px 10px;
  border-radius:12px;
  white-space:nowrap;
}
.navItem--active{
  background: rgba(241,176,5,.14);
  color:#0f172a;
}

.navItem--hasDrop .chev{ font-size:12px; opacity:.75; margin-left:6px; }

/* dropdown wrapper */
.navDrop{ position:relative; display:flex; align-items:center; }
.navMenu{
  position:absolute;
  top: 44px;
  left:0;
  min-width: 220px;
  background:#fff;
  border:1px solid rgba(15,23,42,.10);
  border-radius:14px;
  box-shadow: 0 18px 45px rgba(2,6,23,.12);
  padding:8px;
  display:none;
  z-index:50;
}

/* hover desktop */
@media (hover:hover){
  .navDrop:hover .navMenu{ display:block; }
}

/* open state (mobile click) */
.navDrop.isOpen .navMenu{ display:block; }

.navMenuItem{
  display:block;
  text-decoration:none;
  color:#0f172a;
  font-weight:600;
  font-size:13px;
  padding:10px 10px;
  border-radius:12px;
}
.navMenuItem:hover{ background: rgba(2,6,23,.03); }
.navMenuItem--active{
  background: rgba(241,176,5,.12);
  border: 1px solid rgba(241,176,5,.30);
}

.navMenuItem[aria-disabled="true"]{
  opacity:.5;
  pointer-events:none;
}

.topbar__right{
  display:flex;
  gap:10px;
  align-items:center;
}
.iconBtn{
  border:1px solid var(--line);
  background:#fff;
  width:36px; height:36px;
  border-radius:12px;
  cursor:pointer;
}

/* ===================== MAIN LAYOUT ===================== */
.main{
  padding: 16px 18px 26px;
}
.container{
  max-width: 1320px;
  margin: 0 auto;
  /* importantíssimo: permitir encolher itens sem “estourar” */
  min-width: 0;
}

.pageHeader{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:12px;
  margin-bottom:14px;
}
.pageTitleWrap{ display:flex; flex-direction:column; gap:4px; min-width:0; }
.pageTitle{ font-size:18px; font-weight:800; letter-spacing:.2px; }
.breadcrumb{ font-size:13px; color:#334155; }
.sep{ margin:0 8px; color:#94a3b8; }

.pageActions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

/* grid sem overflow: minmax(0,1fr) é obrigatório */
.grid2{
  display:grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap:14px;
  min-width:0;
}

@media (max-width: 980px){
  .grid2{ grid-template-columns: 1fr; }
  .pageHeader{ align-items:flex-start; flex-direction:column; }
  .pageActions{ width:100%; justify-content:flex-start; }
}

/* ===================== COMPONENTES ===================== */
.card{
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
  min-width:0; /* evita overflow em grid */
}

.cardHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:12px;
  gap:10px;
}
.cardTitle{ font-weight:900; letter-spacing:.2px; }

.badge{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(2,6,23,.05);
  color:#334155;
  border:1px solid rgba(2,6,23,.08);
  white-space:nowrap;
}

.stack{ display:flex; flex-direction:column; min-width:0; }
.row{ display:flex; align-items:center; min-width:0; }
.spaceBetween{ justify-content:space-between; }
.gap10{ gap:10px; }
.gap16{ gap:16px; }

.input{
  width:100%;
  border:1px solid var(--line);
  background:#fff;
  padding:10px 12px;
  border-radius:12px;
  font-family: var(--mono);
  font-size:13px;
  outline:none;
  min-width:0;
}
.input:focus{
  border-color: rgba(241,176,5,.85);
  box-shadow: 0 0 0 4px rgba(241,176,5,.18);
}

.btn{
  border:1px solid var(--line);
  background:#fff;
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
  white-space:nowrap;
}
.btn--primary{
  background: var(--primary);
  border-color: rgba(0,0,0,.06);
}
.btn--primary:hover{ filter: brightness(.98); }
.btn--success{
  background: #16a34a;
  color:#fff;
  border-color: rgba(0,0,0,.06);
}
.btn--ghost{ background:#fff; }
.btn--danger{
  background: rgba(239,68,68,.10);
  border-color: rgba(239,68,68,.25);
  color:#b91c1c;
}

/* Fila */
.queue{
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
  max-height: 560px;
  overflow:auto;
  background:#fff;
  min-width:0;
}
.queueItem{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid rgba(15,23,42,.06);
  cursor:pointer;
  min-width:0;
}
.queueItem:hover{ background: rgba(2,6,23,.02); }
.queueItem--active{ background: rgba(241,176,5,.12); }
.queueItem__name{
  font-size:13px;
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.queueItem__meta{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}
.empty{
  padding:18px;
  color:var(--muted);
  text-align:center;
}

/* Painéis */
.panel{
  border:1px solid rgba(15,23,42,.08);
  border-radius:14px;
  padding:12px;
  min-width:0;
}
.panel__title{
  font-weight:900;
  margin-bottom:10px;
}

/* Form grid responsivo */
.formGrid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:10px;
  min-width:0;
}
.field{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.field label{ font-size:12px; color:var(--muted); font-weight:700; }
.span2{ grid-column: span 2; }

@media (max-width: 980px){
  .formGrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2{ grid-column: span 2; }
}
@media (max-width: 520px){
  .formGrid{ grid-template-columns: 1fr; }
  .span2{ grid-column: span 1; }
}

.highlight{
  border: 1px solid rgba(241,176,5,.55);
  padding:10px;
  border-radius:14px;
  background: rgba(241,176,5,.09);
}

/* Tabela: scroll horizontal só aqui (se precisar), nunca na página */
.tableWrap{
  overflow:auto;
  border-radius:14px;
  border:1px solid rgba(15,23,42,.08);
  max-width:100%;
}
.table{
  width:100%;
  border-collapse: collapse;
  font-size:13px;
  min-width: 920px; /* força “scroll” interno em telas menores */
}
.table th{
  text-align:left;
  padding:10px;
  background: rgba(2,6,23,.03);
  border-bottom:1px solid rgba(15,23,42,.08);
  white-space:nowrap;
}
.table td{
  padding:8px 10px;
  border-bottom:1px solid rgba(15,23,42,.06);
  vertical-align:top;
}
.table td .input{ padding:8px 10px; border-radius:12px; }

/* Preview */
.preview{
  margin:0;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(15,23,42,.08);
  background: rgba(2,6,23,.03);
  max-height:140px;
  overflow:auto;
}
/* Logo real (imagem), travado para não esticar */
.logoLink{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
}

.logoImg{
  height: 22px;      /* igual ao “compacto” do CargoFleet */
  width: auto;       /* não estica */
  display:block;
  object-fit: contain;
}

/* opcional: em telas muito pequenas */
@media (max-width: 520px){
  .logoImg{ height: 20px; }
}
