:root {
  --bg: #f2f5f8;
  --panel: #fff;
  --ink: #172b40;
  --muted: #61758a;
  --line: #dce4ec;
  --brand: #126b61;
  --soft: #e4f3ef;
  --danger: #b43c3c;
  color-scheme: light;
}
body.dark {
  --bg: #101a24;
  --panel: #192735;
  --ink: #e2ebf3;
  --muted: #a0b0c0;
  --line: #324556;
  --brand: #4ec7b1;
  --soft: #1b443d;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.5 system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 13px;
  white-space: nowrap;
}
button:hover {
  border-color: var(--brand);
  color: var(--brand);
}
button.primary {
  background: var(--brand);
  color: var(--panel);
  border-color: var(--brand);
}
button.danger {
  color: var(--danger);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
input,
select,
textarea {
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
textarea {
  min-height: 86px;
  resize: vertical;
}
input[readonly] {
  background: var(--bg);
}
label {
  display: block;
  font-weight: 600;
  font-size: 12px;
}
label > input,
label > select,
label > textarea {
  margin-top: 5px;
  font-weight: 400;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 27px;
  letter-spacing: -0.7px;
  margin-bottom: 4px;
}
h2 {
  font-size: 20px;
}
h3 {
  font-size: 15px;
}
small,
.muted {
  color: var(--muted);
}
a {
  color: var(--brand);
}
.layout {
  display: grid;
  grid-template-columns: 226px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #142f3a;
  color: #e7f2f2;
  padding: 27px 17px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand {
  font-size: 29px;
  font-weight: 850;
  letter-spacing: 2px;
}
.brand span {
  color: #6ed3ba;
}
.tagline {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #a1c0c7;
  margin-bottom: 30px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav button {
  border: 0;
  text-align: left;
  background: transparent;
  color: #b9cdd3;
  padding: 10px 12px;
}
.nav button.active {
  background: #27505a;
  color: #fff;
}
.user-box {
  margin-top: 30px;
  border-top: 1px solid #41616a;
  padding-top: 20px;
  font-size: 12px;
}
.main {
  min-width: 0;
  padding: 27px 30px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 27px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 17px 0;
}
.toolbar input {
  max-width: 320px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 23px;
  margin-bottom: 18px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 15px;
}
.metric {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1.5;
}
.metric small {
  font-size: 12px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  max-height: 70vh;
}
table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  font-size: 12px;
}
th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  max-width: 280px;
  min-width: 110px;
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
  white-space: nowrap;
}
th button {
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: 700;
}
th input,
th select {
  font-size: 11px;
  min-width: 100px;
  margin-top: 7px;
  padding: 5px;
}
th .range {
  display: flex;
  gap: 3px;
}
th .range input {
  min-width: 75px;
  width: 90px;
}
td .actions {
  display: flex;
  gap: 4px;
}
td button {
  font-size: 11px;
  padding: 5px 8px;
}
tr:hover td {
  background: var(--soft);
}
.badge {
  display: inline-block;
  border-radius: 5px;
  padding: 3px 7px;
  background: var(--soft);
  color: var(--brand);
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
}
.empty {
  padding: 50px;
  text-align: center;
  color: var(--muted);
}
.login {
  max-width: 440px;
  margin: 10vh auto;
  padding: 38px;
}
.login label {
  margin-bottom: 18px;
}
.login .brand {
  color: var(--brand);
}
.login button {
  width: 100%;
  margin-top: 15px;
}
dialog {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 26px;
  width: min(960px, 94vw);
  max-height: 90vh;
  overflow: auto;
}
dialog::backdrop {
  background: #0c233c99;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.form-grid h3 {
  grid-column: 1/-1;
  margin: 12px 0 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
  color: var(--brand);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 25px;
  position: sticky;
  bottom: -26px;
  padding: 15px 0;
  background: var(--panel);
}
.autocomplete {
  position: relative;
}
.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  z-index: 30;
  box-shadow: 0 10px 20px #0002;
}
.suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  white-space: normal;
}
.suggestions button.selected {
  background: var(--soft);
}
.chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.chips button {
  font-size: 11px;
  padding: 3px 7px;
}
.error {
  color: var(--danger);
  white-space: pre-wrap;
}
.note {
  border-left: 3px solid var(--brand);
  padding: 12px 15px;
  background: var(--soft);
  margin-bottom: 18px;
}
.checklist {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checklist input {
  width: auto;
}
.checklist select {
  width: 130px;
  margin-left: auto;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 20px 0;
}
.tabs button.active {
  background: var(--soft);
  color: var(--brand);
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: #18383b;
  color: #fff;
  z-index: 100;
  padding: 12px 25px;
  border-radius: 10px;
  display: none;
  max-width: 85vw;
}
#assistant {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  width: 430px;
  max-width: 94vw;
  box-shadow: 0 10px 40px #0004;
}
#assistant header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}
#ai-output {
  white-space: pre-wrap;
  max-height: 48vh;
  overflow: auto;
  margin: 15px 0;
  font-size: 13px;
}
.ai-launch {
  position: fixed;
  bottom: 22px;
  right: 24px;
  background: var(--brand);
  color: var(--panel);
  border-radius: 30px;
  padding: 12px 20px;
  z-index: 9;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
}
.saved {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
footer {
  color: var(--muted);
  font-size: 11px;
  margin-top: 28px;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 850px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 15px;
  }
  .tagline,
  .user-box {
    display: none;
  }
  .nav {
    flex-direction: row;
    overflow: auto;
  }
  .main {
    padding: 20px 12px;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .topbar {
    gap: 10px;
  }
  .split {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 500px) {
  .form-grid,
  .checklist {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
  }
  .toolbar {
    gap: 5px;
  }
}
.avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--brand);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
}
/* RCA Transportes: azul e laranja da identidade enviada. */
:root {
  --brand: #292d88;
  --accent: #ff8b00;
  --soft: #eef0ff;
  --line: #dce0f0;
  --zebra: #f0f3ff;
  --row-hover: #fff2df;
}
body.dark {
  --bg: #101426;
  --panel: #1b2038;
  --ink: #edf0ff;
  --muted: #a8b2d0;
  --line: #343d62;
  --brand: #acb5ff;
  --accent: #ffad48;
  --soft: #2a3154;
  --zebra: #222940;
  --row-hover: #363146;
}
.layout {
  grid-template-columns: 230px minmax(0, 1fr);
  transition: grid-template-columns 0.2s ease;
}
.sidebar {
  background: #242875;
  color: #fff;
  padding: 22px 14px;
  overflow-x: hidden;
}
.brand-logo {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
  object-fit: contain;
  border-radius: 9px;
  background: #f2f5f8;
  margin: 0 auto;
}
.tagline {
  color: #ffb563;
  margin: 14px 0 24px;
  text-align: center;
  letter-spacing: 1.1px;
}
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e3e7ff;
  border-left: 3px solid transparent;
  min-height: 42px;
  width: 100%;
  overflow: hidden;
}
.nav button:hover {
  color: #fff;
  background: #ffffff12;
}
.nav button.active {
  background: #ffffff1b;
  color: #fff;
  border-left-color: var(--accent);
}
.nav-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  font-size: 12px;
  font-weight: 800;
  color: #ffb665;
}
.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-box {
  border-top-color: #5d62a1;
  color: #fff;
}
.user-box small {
  color: #c5ccee;
}
.page-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
#toggle-sidebar {
  font-size: 20px;
  line-height: 1;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-color: var(--line);
}
.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}
.sidebar-collapsed .sidebar {
  padding: 22px 8px;
}
.sidebar-collapsed .tagline,
.sidebar-collapsed .user-box,
.sidebar-collapsed .nav-label {
  display: none;
}
.sidebar-collapsed .nav {
  margin-top: 24px;
}
.sidebar-collapsed .nav button {
  justify-content: center;
  padding: 8px 4px;
}
.sidebar-collapsed .brand-logo {
  border-radius: 5px;
}
button.primary {
  background: #292d88;
  color: #fff;
  border-color: #292d88;
}
button.primary:hover {
  background: #363ba1;
  border-color: var(--accent);
  color: #fff;
}
body.dark button.primary {
  background: #626ed5;
  border-color: #626ed5;
}
.ai-launch {
  background: #292d88;
  color: #fff;
  border: 2px solid var(--accent);
}
#toast {
  background: #292d88;
  border-left: 4px solid var(--accent);
  color: #fff;
}
.login .brand {
  margin-bottom: 20px;
}
.login .brand-logo {
  max-width: 210px;
}
.table-wrap {
  isolation: isolate;
}
tbody tr:nth-child(even) > td {
  background: var(--zebra);
}
tbody tr:nth-child(odd) > td {
  background: var(--panel);
}
tbody tr:hover > td {
  background: var(--row-hover);
}
.freight-table {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
}
.freight-table th,
.freight-table td {
  min-width: 0;
  max-width: none;
  padding: 11px 12px;
  box-sizing: border-box;
  border-right: 1px solid var(--line);
  overflow-wrap: anywhere;
  text-align: left;
}
.freight-table th {
  vertical-align: top;
  white-space: normal;
  z-index: 4;
}
.column-head {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 74px;
}
.freight-table .column-title {
  display: block;
  flex: 0 0 30px;
  height: 30px;
  line-height: 15px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  white-space: normal;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: none;
}
.column-filter {
  height: 34px;
  min-width: 0;
  position: relative;
}
.freight-table th input,
.freight-table th select {
  display: block;
  margin: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 34px;
  padding: 6px;
  font-size: 11px;
  font-weight: 400;
}
.freight-table th .range {
  display: flex;
  gap: 5px;
  width: 100%;
  height: 34px;
}
.freight-table th .range input {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  height: 34px;
}
.freight-table .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.editable-row {
  cursor: default;
}
.tracking-summary {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}
.tracking-summary strong {
  color: var(--ink);
}
.map-link {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  align-self: flex-start;
}
.history-timeline {
  display: grid;
  gap: 18px;
}
.history-event {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 16px;
}
.history-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.history-heading strong {
  color: var(--brand);
}
.history-event dl {
  margin: 0;
}
.history-change {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding: 9px 0;
}
.history-change dt {
  font-weight: 600;
}
.history-change dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.history-change .before {
  color: var(--muted);
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-label input {
  width: auto;
}
.floating-suggestions {
  position: fixed;
  z-index: 100;
  max-height: 220px;
}
@media (max-width: 850px) {
  .layout {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .layout.sidebar-collapsed {
    grid-template-columns: 68px minmax(0, 1fr);
  }
  .sidebar {
    position: sticky;
    height: 100vh;
    padding: 16px 10px;
    top: 0;
  }
  .nav {
    flex-direction: column;
    overflow: visible;
  }
  .tagline,
  .user-box {
    display: block;
  }
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .page-heading h1 {
    font-size: 23px;
  }
  .history-change {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .layout {
    transition: none;
  }
}
/* Operação 3.1: linhas únicas e redimensionamento individual. */
.sidebar {
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
}
.freight-table th,
.freight-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  vertical-align: middle;
}
.freight-table th {
  position: sticky;
  top: 0;
  overflow: visible;
}
.freight-table .column-title {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  flex-basis: 25px;
  height: 25px;
  padding-right: 6px;
}
.freight-table .column-head {
  min-height: 66px;
}
.freight-table .actions {
  display: flex;
  flex-wrap: nowrap;
  width: max-content;
}
.freight-table .tracking-summary {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}
.freight-table .tracking-summary span,
.freight-table .tracking-summary strong {
  display: inline;
  margin-right: 8px;
}
.freight-table .tracking-summary .map-link {
  display: inline-block;
}
.column-resizer {
  position: absolute;
  right: -4px;
  top: 0;
  bottom: 0;
  width: 9px;
  cursor: col-resize;
  z-index: 9;
  touch-action: none;
}
.column-resizer:hover,
.column-resizer:focus {
  background: var(--accent);
  opacity: 0.7;
  outline: none;
}
.resizing-columns,
.resizing-columns * {
  cursor: col-resize !important;
  user-select: none !important;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-yes {
  background: #d9f4e7;
  color: #176546;
}
.badge-no {
  background: #e9edf5;
  color: #59657c;
}
.badge-alert {
  background: #ffebc9;
  color: #885300;
}
body.dark .badge-yes {
  background: #1d463c;
  color: #a2ebc8;
}
body.dark .badge-no {
  background: #303851;
  color: #d4daf0;
}
body.dark .badge-alert {
  background: #594026;
  color: #ffce8a;
}
.client-icon {
  margin-right: 6px;
}
.whatsapp-link {
  display: inline-flex;
  vertical-align: middle;
  color: #139e57;
  margin-right: 8px;
}
.whatsapp-link:hover {
  color: #0e703e;
}
.approval-link {
  display: inline-block;
  margin-top: 4px;
  padding: 5px 9px;
  border: 1px solid #efb86d;
  border-radius: 7px;
  background: #fff1da;
  color: #744300;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}
body.dark .approval-link {
  background: #4d3828;
  color: #ffd398;
}
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 18px;
}
.portal-card,
.note-card,
.hr-card {
  margin: 0;
  overflow-wrap: anywhere;
}
.portal-card h2,
.note-card h2,
.hr-card h2 {
  margin: 10px 0;
}
.portal-card p {
  min-height: 50px;
}
.portal-card button,
.note-card button {
  margin: 5px;
}
.eyebrow {
  color: var(--brand);
  font-size: 12px;
  letter-spacing: 0.7px;
  font-weight: 800;
  text-transform: uppercase;
}
.preserve-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.button-link {
  display: inline-block;
  padding: 8px 14px;
  color: #fff;
  background: #292d88;
  border-radius: 7px;
  text-decoration: none;
  margin-right: 8px;
}
.button-link:hover {
  background: #4146a2;
  color: #fff;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.kpi {
  margin: 0;
}
.kpi strong {
  display: block;
  font-size: 25px;
  color: var(--brand);
  margin-top: 8px;
}
.kpi small {
  color: var(--muted);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.chart-row {
  margin-bottom: 15px;
}
.chart-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.chart-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-track {
  height: 9px;
  background: var(--soft);
  border-radius: 8px;
  margin-top: 5px;
  overflow: hidden;
}
.chart-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 8px;
}
.toolbar label {
  font-size: 12px;
  color: var(--muted);
}
.toolbar label input {
  display: block;
  margin-top: 4px;
}
.card-maker {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(260px, 410px);
  gap: 26px;
  align-items: start;
}
.card-maker .card {
  margin: 0;
}
.card-preview {
  background: var(--line);
  padding: 14px;
  border-radius: 15px;
  position: sticky;
  top: 15px;
}
.card-preview canvas {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 8px 25px #0003;
}
@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-grid,
  .card-maker {
    grid-template-columns: 1fr;
  }
  .card-preview {
    max-width: 430px;
    position: static;
  }
  .sidebar:not(.sidebar-collapsed) {
    overflow-y: auto;
  }
}
@media (max-width: 600px) {
  .portal-grid {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .kpi strong {
    font-size: 23px;
  }
}
.freight-table .tracking-summary {
  display: inline;
  margin: 0 0 0 8px;
  overflow: visible;
}
.freight-table td .approval-link {
  margin-top: 0;
}
.cost-extra-field {
  grid-column: span 2;
}
.cost-extra-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cost-extra-controls select {
  width: 105px;
  flex: 0 0 105px;
}
.cost-extra-controls .approval-link {
  margin-top: 0;
  padding: 9px 12px;
}
@media (max-width: 650px) {
  .cost-extra-field {
    grid-column: 1/-1;
  }
  .cost-extra-controls {
    flex-wrap: wrap;
  }
}

/* v3.1.1: dados e botões sempre na mesma linha; filtros seguem abaixo do título. */
.freight-table tbody td {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}
.freight-table tbody td .tracking-summary,
.freight-table tbody td .actions {
  display: inline-flex;
  flex-wrap: nowrap;
  vertical-align: middle;
  margin: 0 0 0 8px;
}
.freight-table tbody td .tracking-summary > * {
  white-space: nowrap;
}
.freight-table tbody td br {
  display: none;
}
.risk-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.risk-detail-table th,
.risk-detail-table td {
  white-space: nowrap;
}

/* 3.1.2: inline-flex também herda flex-direction: column; definir o eixo é obrigatório. */
.freight-table tbody td .tracking-summary,
.freight-table tbody td .actions,
.freight-table tbody td .risk-inline {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  vertical-align: middle;
}
.freight-table tbody td .tracking-summary > *,
.freight-table tbody td .actions > *,
.freight-table tbody td .risk-inline > * {
  flex: 0 0 auto;
  white-space: nowrap;
  align-self: center;
  margin-top: 0;
  margin-bottom: 0;
}
.api-test-result {
  margin-top: 16px;
}
.api-test-result p {
  overflow-wrap: anywhere;
}

/* RCA 3.2 — superfície neutra, destaque laranja e densidade operacional. */
:root {
  --bg: #f5f5f4;
  --panel: #fff;
  --ink: #23252b;
  --muted: #687078;
  --line: #e3e3e1;
  --brand: #bd4e00;
  --accent: #f58320;
  --soft: #fff2e5;
  --zebra: #fafaf9;
}
body.dark {
  --bg: #141516;
  --panel: #202224;
  --ink: #f1f1ef;
  --muted: #afb3b7;
  --line: #3a3c3f;
  --brand: #ffab63;
  --accent: #f58320;
  --soft: #35291e;
  --zebra: #252729;
}
.layout {
  grid-template-columns: 224px minmax(0, 1fr);
}
.sidebar {
  background: var(--panel);
  color: var(--ink);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  box-shadow: 3px 0 18px #17171704;
}
.brand-logo {
  width: 150px;
  max-height: 76px;
  background: #fff;
  border-radius: 8px;
}
.tagline {
  color: var(--muted);
  margin: 8px 0 16px;
  font-size: 10px;
}
.nav {
  gap: 3px;
}
.nav button {
  min-height: 35px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  overflow: visible;
}
.nav button:hover {
  color: var(--ink);
  background: var(--soft);
  border-color: #f5832040;
  box-shadow: 0 0 14px #f583201a;
}
.nav button.active {
  color: var(--brand);
  background: var(--soft);
  border: 1px solid #f5832038;
  box-shadow: inset 3px 0 var(--accent);
  font-weight: 700;
}
.nav-label {
  overflow: visible;
  text-overflow: clip;
}
.user-box {
  color: var(--ink);
  border-top-color: var(--line);
  margin-top: 18px;
  padding-top: 12px;
}
.user-box small {
  color: var(--muted);
  word-break: break-word;
}
.layout.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}
.sidebar-collapsed .sidebar {
  display: none;
}
.main {
  padding: 14px 20px;
}
.topbar {
  margin-bottom: 12px;
  gap: 10px;
}
.topbar h1 {
  font-size: 22px;
  margin: 0;
}
.page-heading {
  gap: 10px;
}
button,
.button-link,
.approval-link {
  border-radius: 9px;
  transition:
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}
button:not(:disabled):hover,
.button-link:hover {
  border-color: #f583207a;
  box-shadow:
    0 0 0 3px #f5832010,
    0 5px 15px #f5832020;
  color: var(--brand);
}
button:not(:disabled):active {
  transform: translateY(1px);
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button.primary {
  background: linear-gradient(135deg, #f89232, #ee7314);
  border-color: #e87a1f;
  color: #231407;
  font-weight: 700;
  box-shadow: 0 3px 8px #f583201c;
}
button.primary:hover {
  background: linear-gradient(135deg, #ffa64d, #f58320);
  border-color: #f58320;
  color: #231407;
  box-shadow:
    0 0 0 3px #f5832015,
    0 5px 20px #f5832045;
}
button.danger:hover {
  color: var(--danger);
  box-shadow: 0 0 12px #dc262624;
}
button:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.ai-launch {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--brand);
  box-shadow: 0 4px 18px #00000015;
}
.toolbar {
  margin: 10px 0;
  gap: 6px;
}
.toolbar button,
.freight-filterbar button {
  padding: 7px 10px;
  font-size: 12px;
}
.freight-filterbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--panel);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.freight-filterbar > input {
  width: 330px;
  max-width: 100%;
  padding: 7px 10px;
}
.freight-filterbar .saved {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 0;
}
.saved:empty {
  display: none;
}
.freight-toolbar {
  margin: 7px 0;
}
.column-head {
  gap: 4px;
}
.column-filter input,
.column-filter select {
  padding: 5px 6px;
  font-size: 11px;
}
.pagination {
  margin: 8px 0;
  font-size: 12px;
}
.freight-wrap {
  max-height: calc(100vh - 212px);
}
.table-wrap th,
.table-wrap td {
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}
.freight-table tbody tr:nth-child(even) {
  background: var(--zebra);
}
.freight-table tbody tr:hover {
  background: var(--soft);
}
.badge-yes,
body.dark .badge-yes {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.badge-no,
body.dark .badge-no {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.status-badge {
  border: 0;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.approval-link {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.approval-link:hover {
  color: #14532d;
  box-shadow: 0 0 12px #16a34a33;
}
dialog {
  width: min(1280px, 96vw);
  padding: 20px;
  max-height: 94vh;
  border-radius: 15px;
  box-shadow: 0 20px 80px #00000035;
}
dialog::backdrop {
  background: #15161988;
  backdrop-filter: blur(3px);
}
.modal-head {
  margin: -20px -20px 18px;
  padding: 13px 20px;
  background: linear-gradient(115deg, #ff9c3c, #f17b17);
  color: #251608;
  border-radius: 14px 14px 0 0;
  gap: 12px;
}
.modal-head h2 {
  margin: 0;
  font-size: 19px;
}
.modal-head button {
  background: #ffffffb0;
  border-color: #ffffff70;
  color: #3b210c;
  font-size: 18px;
  padding: 3px 12px;
}
.freight-sections {
  display: grid;
  gap: 12px;
}
.field-section {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  margin: 0;
  padding: 10px 13px 13px;
}
.field-section legend {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 7px;
  color: var(--brand);
}
.field-section .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 13px;
}
.field-section input,
.field-section select,
.field-section textarea {
  padding: 7px 9px;
  margin-top: 4px;
}
.field-section textarea {
  min-height: 54px;
}
.field-section label.wide {
  grid-column: span 3;
}
.cost-extra-field {
  grid-column: span 2;
}
.form-actions {
  margin-top: 12px;
  padding: 10px 0;
  bottom: -20px;
}
input[type="color"] {
  padding: 3px;
  min-height: 38px;
  width: 100px;
}
.workforce-toolbar input[type="checkbox"],
.leave-table input[type="checkbox"] {
  width: auto;
}
.workforce-toolbar input[type="date"] {
  width: 145px;
}
.workforce-toolbar > input {
  max-width: 260px;
}
.availability-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  align-items: start;
}
.availability-lane {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--zebra);
  min-height: 240px;
  padding: 10px;
}
.lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 3px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.lane-head h2 {
  font-size: 14px;
  margin: 0;
}
.lane-cards {
  display: grid;
  gap: 10px;
}
.availability-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
  box-shadow: 0 2px 5px #00000005;
}
.availability-card[draggable="true"] {
  cursor: grab;
}
.availability-card:hover {
  border-color: #f5832066;
  box-shadow: 0 4px 14px #0000000a;
}
.availability-card.dragging {
  opacity: 0.45;
}
.availability-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.availability-card-head strong {
  font-size: 13px;
}
.availability-card p {
  font-size: 12px;
  margin: 10px 0;
}
.card-notes {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.card-actions {
  display: flex;
  gap: 5px;
}
.card-actions button {
  padding: 4px 9px;
  font-size: 11px;
}
.leave-legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.leave-legend button {
  font-size: 11px;
  padding: 3px 8px;
}
.leave-wrap {
  max-height: calc(100vh - 245px);
}
.leave-table th,
.leave-table td {
  padding: 4px 6px;
}
.leave-table tbody tr:nth-child(even) {
  background: var(--zebra);
}
.leave-table thead th {
  top: 0;
  position: sticky;
  z-index: 2;
  background: var(--panel);
}
.leave-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--panel);
  min-width: 200px;
}
.leave-table tbody th:first-child {
  z-index: 1;
}
.leave-cell {
  border: 0;
  background: transparent;
  min-width: 55px;
  padding: 3px;
  min-height: 34px;
}
.leave-cell:disabled {
  opacity: 1;
}
.leave-table td {
  text-align: center;
}
#workforce-refresh-note {
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1050px) {
  .field-section .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .field-section label.wide {
    grid-column: 1/-1;
  }
}
@media (max-width: 700px) {
  .layout {
    grid-template-columns: 178px minmax(0, 1fr);
  }
  .main {
    padding: 12px;
  }
  .sidebar {
    padding: 12px 8px;
  }
  .nav button {
    font-size: 11px;
    padding: 7px 8px;
  }
  .topbar h1 {
    font-size: 18px;
  }
  .topbar {
    flex-wrap: wrap;
  }
  .field-section .form-grid {
    grid-template-columns: 1fr;
  }
  .field-section label.wide,
  .cost-extra-field {
    grid-column: 1;
  }
  .freight-wrap {
    max-height: 65vh;
  }
  .brand-logo {
    width: 130px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
body {
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}
body.dark button.primary {
  background: linear-gradient(135deg, #f89232, #ee7314);
  border-color: #e87a1f;
  color: #231407;
}
body.dark button.primary:hover {
  background: linear-gradient(135deg, #ffa64d, #f58320);
  border-color: #f58320;
  color: #231407;
}
@media (min-width: 1051px) {
  #freight-form.expedition-form .field-section:nth-child(2) .form-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  #freight-form.expedition-form .field-section:nth-child(2) label:nth-child(1),
  #freight-form.expedition-form .field-section:nth-child(2) label:nth-child(3) {
    grid-column: span 2;
  }
  #freight-form.expedition-form .field-section:nth-child(2) label:nth-child(5),
  #freight-form.expedition-form .field-section:nth-child(2) label:nth-child(6) {
    grid-column: span 3;
  }
  #freight-form.expedition-form .field-section:nth-child(4) .form-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.queue-position { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 6px; background: var(--soft); color: var(--brand); font-size: 11px; margin-right: 4px; }
