@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --r: 10px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --bg: hsl(224 50% 4.5%);
  --bg2: hsl(223 46% 6%);
  --surface: hsl(222 42% 8%);
  --surface2: hsl(220 34% 14%);
  --card2: hsl(221 38% 11%);
  --border: hsl(219 30% 19%);
  --border2: hsl(219 30% 15%);
  --ink: hsl(213 32% 93%);
  --muted: hsl(214 22% 72%);
  --faint: hsl(217 16% 60%);
  --gold: #e0b15e;
  --red: #e06b63;
  --teal: #5fba93;
  --blue: #60a5fa;
  --purple: #a48fd8;
  --azul: hsl(217 91% 60%);
}

body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}

input, select, textarea { accent-color: var(--azul); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: hsl(220 25% 18%); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
}

.ic {
  width: 16px;
  height: 16px;
  flex: none;
}

.crumb-sep { width: 13px; height: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface2);
  border: 1px solid transparent;
  color: var(--ink);
  transition: color .15s var(--ease), background .15s var(--ease), opacity .15s var(--ease);
}

.btn:hover { background: hsl(219 34% 18%); border-color: transparent; transform: none; }
.btn:active { transform: none; }
.btn:disabled { opacity: .55; }

.btn.primary {
  font-weight: 600;
  background: var(--azul);
  color: #fff;
}

.btn.primary:hover { background: hsl(217 91% 66%); box-shadow: none; }

.btn.danger { background: transparent; color: var(--red); }
.btn.danger:hover { background: hsla(3, 68%, 63%, .12); }

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition: color .15s var(--ease), background .15s var(--ease);
}

.icon:hover { background: var(--surface2); color: var(--ink); }

.input, .select, .textarea {
  padding: 9px 12px;
  border-radius: var(--r);
  background: var(--surface2);
  border: 1px solid transparent;
  color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}

.input::placeholder, .textarea::placeholder { color: var(--faint); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--azul);
  box-shadow: 0 0 0 3px hsla(217, 91%, 60%, .25);
}

.projects-form {
  background: hsl(220 42% 10%);
  border-color: hsl(217 35% 24%);
}

.projects-form .input {
  background: hsl(220 42% 14%);
  border-color: hsl(217 35% 25%);
  box-shadow: inset 0 1px 0 hsla(214, 70%, 80%, .04);
}

.projects-form .input:hover {
  border-color: hsl(217 45% 34%);
}

:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }

.field { font-size: 12.5px; color: var(--muted); }
.form-grid { gap: 14px; }

.sidebar {
  width: 264px;
  flex: 0 0 264px;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 0;
  border-right: 1px solid var(--border2);
  background: var(--bg2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  margin-bottom: 8px;
  padding: 0 4px 4px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex: none;
  background: var(--azul);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -.5px;
}

.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -.2px; color: var(--ink); }
.brand-sub { font-size: 11px; color: var(--faint); }

.nav-title {
  margin: 14px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
}

.sidebar .nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 34px;
  padding: 7px 12px;
  margin-bottom: 2px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: hsl(213 20% 78%);
  transition: color .15s var(--ease), background .15s var(--ease);
}

.sidebar .nav .ic { color: var(--faint); transition: color .15s var(--ease); }

.sidebar .nav .nav-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar .nav:hover { background: hsl(219 34% 15%); color: var(--ink); }

.sidebar .nav.active {
  background: hsl(219 38% 17%);
  color: var(--ink);
}

.sidebar .nav.active .ic { color: var(--blue); }

.sidebar .count {
  flex: none;
  padding: 1px 8px;
  background: var(--surface2);
  border-radius: 999px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: color .15s var(--ease), background .15s var(--ease);
}

.sidebar .nav.active .count { background: hsl(217 60% 26%); color: var(--blue); }

/* Barra "Ver mais" da lista de periodos: so aparece com mais de 5 periodos. */
.sidebar .nav-mais {
  margin-top: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--border2);
  border-radius: 0 0 10px 10px;
  font-size: 12px;
  font-weight: 600;
}

.sidebar .nav-mais .ic { color: var(--blue); }

.sidebar .nav-mais:hover { background: hsl(219 34% 15%); }

.side-foot {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  border-top: 1px solid var(--border2);
  background: var(--bg2);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  flex: none;
  background: var(--surface2);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.side-foot .who { flex: 1; min-width: 0; }

.side-foot .who b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-foot .who span { font-size: 11px; color: var(--faint); }

.side-logout {
  width: 32px;
  height: 32px;
  flex: none;
  background: none;
  border: 0;
  color: var(--faint);
  cursor: pointer;
}

.main { padding: 0; display: flex; flex-direction: column; }

.header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 20px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border2);
}

.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--faint);
  white-space: nowrap;
}

.crumb b { color: var(--ink); font-weight: 600; }

.header-spacer { flex: 1; }

.header .search {
  position: relative;
  flex: none;
  width: 340px;
  max-width: 34vw;
  min-width: 200px;
}

.header .search span {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--faint);
  pointer-events: none;
}

.header .search .ic { width: 15px; height: 15px; }

.header .search .input {
  width: 100%;
  padding: 8px 12px 8px 33px;
  font-size: 13px;
}

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

.eyebrow {
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 0;
}

.page-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.page-sub { margin: 2px 0 0; font-size: 13px; color: var(--faint); }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  padding: 16px 20px 0;
  margin: 0;
}

.kpi {
  text-align: left;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  color: var(--ink);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}

.kpi .label {
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: 0;
  text-transform: none;
}

.kpi .value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-hint {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--faint);
  opacity: 1;
  transform: none;
}

button.kpi-link { cursor: pointer; }

button.kpi-link:hover {
  border-color: hsl(217 45% 30%);
  background: var(--card2);
  transform: none;
  box-shadow: none;
}

button.kpi-link:hover .kpi-hint { opacity: 1; transform: none; }

.kpi-vencimento .value { color: var(--gold); }

.toolbar { gap: 20px; padding: 0 20px; margin: 0; }

.board {
  gap: 12px;
  padding: 16px 20px 20px;
  scroll-snap-type: x proximity;
}

.column {
  width: 296px;
  flex: 0 0 296px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 250px);
  min-height: 320px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  transition: border-color .15s var(--ease);
}

.column:hover { border-color: var(--border); }

.column-head {
  flex: none;
  padding: 12px 12px 10px;
  border-bottom: 0;
}

.column-scroll-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.column-body {
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 8px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.column-body > * { flex: none; }

.column-body > .card,
.column-body > .card-select-wrap { margin-bottom: 0; }

.column-scrollbar { display: none; }

.column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.column-title b {
  flex: none;
  min-width: 0;
  max-width: 55%;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.column-title .qty {
  flex: none;
  margin-left: 0;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--faint) !important;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.column-total {
  flex: none;
  margin-left: auto;
  margin-top: 0;
  padding-left: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.column-filter { margin-top: 10px; position: relative; }

.column-filter span {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--faint);
  pointer-events: none;
}

.column-filter .ic { width: 13px; height: 13px; }

.column-filter input {
  width: 100%;
  padding: 6px 10px 6px 28px;
  font-size: 12px;
  border-radius: 8px;
  background: var(--surface2);
}

.bulk-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 10px;
}

.bulk-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}

.bulk-count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

.column-foot { flex: none; padding: 8px; }

.column-foot .bulk-next,
.column-foot .documento-bulk-next {
  width: 100%;
  padding: 7px 13px;
  font-size: 12px;
}

.card {
  display: block;
  width: 100%;
  min-height: 0;
  height: auto;
  padding: 10px 12px;
  text-align: left;
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}

.card:hover {
  background: hsl(220 36% 13%);
  border-color: hsl(217 45% 32%);
  transform: none;
  box-shadow: none;
}

.card:active { transform: none; }

.card-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-line + .card-line { margin-top: 5px; }

.card .supplier {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  min-width: 0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .money {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}

.card-meta {
  min-width: 0;
  color: var(--faint);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .due {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cartao-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border: 0;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  vertical-align: 1px;
}

.documento-card .documento-meta {
  margin-top: 5px;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-select-wrap { position: relative; display: block; }

.card-select {
  position: absolute;
  top: -6px;
  left: -6px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--card2);
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

.card-select input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.card-select .ic {
  width: 12px;
  height: 12px;
  color: #fff;
  opacity: 0;
}

.card-select:has(input:checked) {
  background: var(--azul);
  border-color: var(--azul);
}

.card-select:has(input:checked) .ic { opacity: 1; }

.card-select-wrap:has(input:checked) .card {
  border-color: hsla(217, 91%, 60%, .55);
  background: hsl(219 45% 14%);
}

.card.is-selectable { padding-left: 12px; }

.empty {
  padding: 18px 8px;
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
  border: 1px dashed var(--border2);
  border-radius: 12px;
}

.overlay { background: rgba(3, 6, 12, .72); }

.modal {
  border-radius: 18px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border2);
  box-shadow: 0 26px 64px rgba(0, 0, 0, .55);
}

.modal-head { gap: 16px; margin-bottom: 20px; }

.modal-head h2 {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -.015em;
}

.details { gap: 10px; border-radius: 0; overflow: visible; }

.detail {
  padding: 8px 11px;
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: 12px;
}

.detail .label {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.detail .value {
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  font-size: 12.5px;
}

/* O "Desfazer" do aviso. Discreto: e uma saida, nao o caminho principal. */
.notice-acao {
  flex: none;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
}

.modal-actions { gap: 8px; justify-content: flex-end; margin-top: 22px; }

/* Formulario de remessa: leitura por etapas, com rolagem no corpo e acoes
   sempre alcancaveis no rodape. */
.remessa-form-modal {
  width: min(920px, 94vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.remessa-form-modal .modal-head {
  flex: none;
  margin: 0;
  padding: 24px 26px 18px;
}

.remessa-form-modal > .notice {
  flex: none;
  margin: 0 26px 16px;
  padding: 12px 14px;
  background: hsl(220 38% 11%);
  border-color: hsl(217 34% 23%);
  color: var(--muted);
}

.remessa-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.remessa-form-grid {
  min-height: 0;
  overflow-y: auto;
  padding: 0 26px 8px;
  scrollbar-color: hsl(220 25% 22%) transparent;
}

.remessa-form-grid .field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  line-height: 1.2;
}

.remessa-form-grid .input,
.remessa-form-grid .select,
.remessa-form-grid .textarea {
  min-height: 42px;
  background: var(--card2);
  border-color: var(--border2);
}

.remessa-form-grid .input:hover,
.remessa-form-grid .select:hover,
.remessa-form-grid .textarea:hover {
  border-color: hsl(217 38% 27%);
}

.remessa-form-grid .form-secao {
  margin-top: 12px;
  padding: 20px 0 3px;
  border-top-color: hsl(219 30% 19%);
  color: var(--ink);
  font-size: 13px;
  letter-spacing: .01em;
}

.remessa-form-grid .form-secao:first-child {
  margin-top: 0;
  padding-top: 3px;
}

.remessa-form-grid .campo-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border2);
  border-radius: 10px;
  background: hsl(220 38% 10%);
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}

.remessa-form-grid .campo-check:hover {
  border-color: hsl(217 38% 27%);
  background: var(--card2);
}

.remessa-form-grid .campo-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
}

.remessa-form-grid .campo-check:has(input:checked) {
  border-color: hsl(217 70% 48%);
  background: hsl(220 38% 14%);
  color: var(--ink);
}

.remessa-form-modal .materiais-remessa {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  background: hsl(220 38% 10%);
}

.remessa-form-modal .materiais-remessa .preview {
  margin: 0;
  background: var(--surface);
}

.remessa-form-modal #add-item-remessa {
  justify-self: start;
}

.remessa-form-modal .remover-item {
  min-width: 34px;
  padding: 6px 9px;
}

.remessa-form-modal > .remessa-form > .modal-actions {
  flex: none;
  margin: 0;
  padding: 16px 26px;
  border-top: 1px solid var(--border2);
  background: var(--surface);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  background: color-mix(in srgb, currentColor 14%, transparent);
  white-space: nowrap;
}

.badge-neutra {
  margin-left: 8px;
  color: var(--faint);
  background: var(--surface2);
}

.confirm-icon { font-size: 26px; }

.sheet-overlay {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}

.sheet {
  width: 440px;
  max-width: 94vw;
  height: 100%;
  max-height: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border2);
  box-shadow: -16px 0 50px rgba(0, 0, 0, .5);
}

.sheet-head {
  flex: none;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border2);
}

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sheet-title {
  display: flex;
  align-items: center;
  margin-top: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.2px;
}

.sheet-sub { margin-top: 2px; font-size: 12.5px; color: var(--faint); }

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
}

.sheet-body .details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sheet-foot {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border2);
}

.sheet-foot .btn { flex: 1; padding-left: 10px; padding-right: 10px; }

.project-row,
.vencimento-item {
  padding: 11px 12px;
  border-radius: 12px;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}

.vencimento-item:hover { background: var(--card2); border-color: hsl(217 45% 32%); }

.pill {
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
}

.preview { border-radius: 12px; }

.preview th {
  padding: 9px 11px;
  color: var(--faint);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.preview td { padding: 9px 11px; font-variant-numeric: tabular-nums; }
.preview tbody tr { transition: background .14s var(--ease); }
.preview tbody tr:hover td { background: var(--card2); }

.anexo-acoes {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  white-space: nowrap;
}

.anexo-acoes .btn {
  min-height: 32px;
  line-height: 1;
  margin: 0;
}

.import-textarea { border-radius: var(--r); line-height: 1.6; }

.import-methods { grid-template-columns: 1fr; }
.import-box-full { grid-column: 1 / -1; }

.modal.import-modal {
  width: min(1200px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}

.import-modal .import-textarea { min-height: 180px; }

.import-box {
  border-style: solid;
  border-color: var(--border2);
  border-radius: 12px;
  padding: 16px;
  background: var(--card2);
}

.import-box h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.import-help { margin-top: 8px; font-size: 12px; color: var(--faint); }

.vencimentos-modal { width: min(720px, 96vw); }

.vencimentos-resumo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  background: var(--card2);
  font-variant-numeric: tabular-nums;
}

.vencimentos-lista {
  display: grid;
  gap: 8px;
  max-height: min(56vh, 520px);
  margin-top: 12px;
  padding-right: 4px;
  overflow-y: auto;
}

.vencimento-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  background: var(--card2);
  color: var(--ink);
  text-align: left;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}

.vencimento-item:hover,
.vencimento-item:focus-visible {
  border-color: hsl(217 45% 32%);
  background: var(--surface2);
  transform: none;
}

.vencimento-item-topo,
.vencimento-item-rodape {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.vencimento-item-topo strong { font-size: 13.5px; font-weight: 600; }

.vencimento-prazo {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.vencimento-fornecedor { padding-right: 0; font-size: 13.5px; font-weight: 500; line-height: 1.35; }

.vencimento-item-rodape {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.vencimento-item-rodape strong { color: var(--ink); font-size: 13.5px; font-weight: 600; }

.vencimento-status {
  position: static;
  justify-self: start;
  max-width: none;
  padding: 2px 9px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.app { height: 100vh; overflow: hidden; }

.main { height: 100vh; overflow-y: auto; }

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
}

.kpis {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
  justify-content: stretch !important;
  align-items: stretch;
  gap: 12px !important;
  margin: 0 !important;
}

.sidebar .nav,
.sidebar .nav span { color: hsl(213 20% 78%) !important; }

.sidebar .nav:hover,
.sidebar .nav:hover span,
.sidebar .nav.active,
.sidebar .nav.active span { color: var(--ink) !important; }

.sidebar .nav span.count { color: var(--faint) !important; }
.sidebar .nav.active span.count { color: var(--blue) !important; }
.sidebar .nav-title { color: var(--faint) !important; font-weight: 600; }

.brand-logo {
  width: 176px;
  height: auto;
  max-height: 60px;
  object-fit: contain;
  flex-shrink: 0;
}

.bulk-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between;
  gap: 8px !important;
  margin-top: 10px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none;
}

.bulk-bar > label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: var(--muted);
  font-size: 12px !important;
  font-weight: 500;
  cursor: pointer !important;
}

.bulk-select-all:hover,
.documento-bulk-select-all:hover { border-color: var(--azul); }

.bulk-select-all:checked,
.documento-bulk-select-all:checked {
  border-color: var(--azul);
  background-color: var(--azul);
  box-shadow: none;
}

.bulk-select-all:focus-visible,
.documento-bulk-select-all:focus-visible,
.note-bulk-select:focus-visible,
.documento-bulk-select:focus-visible,
.bulk-next:focus-visible,
.documento-bulk-next:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 2px;
}

.column-foot .bulk-next,
.column-foot .documento-bulk-next {
  width: 100%;
  min-height: 0;
  margin: 0 !important;
  padding: 7px 13px;
  border: 0;
  background: var(--azul);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: none;
}

.column-foot .bulk-next:not(:disabled):hover,
.column-foot .documento-bulk-next:not(:disabled):hover {
  filter: none;
  transform: none;
  box-shadow: none;
  background: hsl(217 91% 66%);
}

.column-foot .bulk-next:disabled,
.column-foot .documento-bulk-next:disabled {
  border: 0;
  background: var(--surface2);
  color: var(--faint);
  box-shadow: none;
}

.card-select-wrap { margin-bottom: 0; }

.card-select-wrap > label {
  position: absolute !important;
  top: -6px !important;
  left: -6px !important;
  z-index: 3 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 18px !important;
  height: 18px !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  background: var(--card2) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

.card-select-wrap > label:hover {
  border-color: var(--azul) !important;
  background: var(--card2) !important;
  transform: none;
}

.card-select-wrap > .card { padding: 10px 12px !important; }

.card-select-wrap:has(.note-bulk-select:checked) > label,
.card-select-wrap:has(.documento-bulk-select:checked) > label {
  background: var(--azul) !important;
  border-color: var(--azul) !important;
}

.card-select-wrap:has(.note-bulk-select:checked) > .card,
.card-select-wrap:has(.documento-bulk-select:checked) > .card {
  border-color: hsla(217, 91%, 60%, .55);
  background: hsl(219 45% 14%);
  box-shadow: none;
}

.card-select .ic { position: relative; z-index: 1; }

.card-select input.note-bulk-select,
.card-select input.documento-bulk-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  flex: none;
  margin: 0;
  opacity: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.column-total { margin-bottom: 0; }
.column-title .qty { margin-left: 0; }

@media (max-width: 900px) {
  .page-head, .kpis, .toolbar, .board { padding-left: 14px; padding-right: 14px; }
  .header { padding-left: 14px; padding-right: 14px; }
  .header .search { max-width: none; flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* ==========================================================================
   Historico do registro (linha do tempo)
   ========================================================================== */

.historico { margin-top: 18px; }

.historico-titulo {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.historico-lista {
  margin: 0;
  padding: 0 0 0 16px;
  list-style: none;
  /* A linha vertical que amarra os eventos numa sequencia so. */
  border-left: 1px solid var(--border2);
}

.historico-item { position: relative; padding-bottom: 14px; }
.historico-item:last-child { padding-bottom: 0; }

.historico-item::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--border);
}

.historico-item:first-child::before { background: var(--azul); }

.historico-quando {
  color: var(--faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.historico-oque {
  margin-top: 2px;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.5;
}

.historico-oque b { font-weight: 600; }

.historico-teto { margin-top: 10px; font-size: 11.5px; }

/* ==========================================================================
   Trilha de auditoria
   ========================================================================== */

.auditoria-modal { width: min(760px, 94vw); }

.auditoria-lista {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  max-height: 60vh;
  overflow-y: auto;
}

.auditoria-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border2);
}

.auditoria-item:last-child { border-bottom: 0; }

.auditoria-linha {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.auditoria-linha .faint { font-size: 12px; font-variant-numeric: tabular-nums; }

.auditoria-ator {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.auditoria-alvo {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-top: 7px;
  color: var(--text);
  font-size: 13px;
}

.auditoria-alvo span {
  color: var(--muted);
}

.auditoria-detalhes {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.auditoria-detalhes span {
  padding: 4px 7px;
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px;
  /* meta vem do servidor e pode ser longa; quebra em vez de esticar o modal */
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Painel "Onde as NFs travam"
   ========================================================================== */

.gargalo-modal { width: min(820px, 94vw); max-height: 88vh; overflow-y: auto; }

.gargalo-secao { margin-top: 22px; }
.gargalo-secao:first-child { margin-top: 14px; }

.gargalo-secao h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}

.gargalo-secao .faint { display: block; margin-bottom: 12px; font-size: 12px; }

.gargalo-barras { display: flex; flex-direction: column; gap: 12px; }

/*
  Nome, barra e numero em colunas fixas: o olho compara as barras na vertical
  sem que um rotulo comprido empurre a barra para o lado.
*/
.gargalo-barra-linha {
  display: grid;
  grid-template-columns: 150px 1fr 92px;
  align-items: center;
  gap: 12px;
}

.gargalo-barra-nome { font-size: 12.5px; color: var(--ink); }

.gargalo-barra-trilho {
  height: 10px;
  border-radius: 999px;
  background: var(--bg2);
  overflow: hidden;
}

.gargalo-barra-preenchida {
  height: 100%;
  border-radius: 999px;
  /* opacidade em vez de cor propria: mantem a cor da etapa do quadro */
  opacity: .85;
}

.gargalo-barra-valor {
  text-align: right;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.gargalo-barra-extra {
  grid-column: 2 / -1;
  margin-top: -4px;
  color: var(--faint);
  font-size: 11.5px;
}

.gargalo-lista { margin: 0; padding: 0; list-style: none; }

.gargalo-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border2);
}

.gargalo-item:last-child { border-bottom: 0; }

.gargalo-clicavel { cursor: pointer; }
.gargalo-clicavel:hover .gargalo-item-topo b { color: var(--azul); }

.gargalo-item-topo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.gargalo-tempo {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.gargalo-item-sub {
  margin-top: 2px;
  color: var(--faint);
  font-size: 12px;
}

@media (max-width: 720px) {
  .gargalo-barra-linha { grid-template-columns: 110px 1fr 78px; }
}

/* ==========================================================================
   Celular e tablet estreito
   --------------------------------------------------------------------------
   O quadro de sete colunas lado a lado e um layout de mesa: numa tela de
   390 px ele vira rolagem horizontal infinita. Aqui as etapas passam a ser
   empilhadas, cada uma com a propria altura, e o menu deixa de ocupar um
   terco da largura.

   O menu abre por checkbox + label, sem JavaScript: o render recria a tela
   inteira a cada mudanca e um estado guardado em JS se perderia junto.
   ========================================================================== */

.menu-mobile-botao { display: none; }

@media (max-width: 860px) {
  .app { flex-direction: column; height: auto; overflow: visible; }
  .main { height: auto; min-height: 100vh; }

  /* --------------------------------------------------------------- menu */
  .menu-mobile-botao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 44 px e o alvo minimo confortavel para o dedo */
    width: 44px;
    height: 44px;
    margin-right: 4px;
    border-radius: 10px;
    color: var(--ink);
    cursor: pointer;
    flex: none;
  }

  .menu-mobile-botao:active { background: var(--surface2); }
  .menu-mobile-alavanca:focus-visible ~ .main .menu-mobile-botao,
  .menu-mobile-botao:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: min(300px, 86vw);
    max-width: none;
    flex: none;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    border-right: 1px solid var(--border2);
    box-shadow: 12px 0 40px rgba(0, 0, 0, .5);
    transform: translateX(-102%);
    transition: transform .22s var(--ease);
  }

  .menu-mobile-alavanca:checked ~ .sidebar { transform: none; }

  /* Fundo clicável: tocar fora do menu também o fecha. */
  .menu-mobile-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, .58);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s var(--ease), visibility .2s;
  }

  .menu-mobile-alavanca:checked ~ .menu-mobile-scrim {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* ---------------------------------------------------------- cabecalho */
  .header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .header .search { order: 3; flex: 1 1 100%; max-width: none; }

  /* O caminho repete o que o titulo da pagina diz na linha seguinte e custa a
     largura inteira do cabecalho num aparelho estreito. */
  .crumb { display: none; }

  /* Nome da etapa + contador + total nem sempre cabem numa linha so; sem o
     wrap, "Pendente de Aprovacao 11 R$ 191.394,52" vaza da coluna. */
  .column-title { flex-wrap: wrap; }
  .column-title .column-total { margin-left: auto; }

  /* Importar e Nova NF sao tarefas de mesa: continuam existindo, mas saem da
     primeira dobra do celular para nao competir com a consulta. */
  .header .btn { padding: 8px 12px; font-size: 12px; }

  /* --------------------------------------------------------- indicadores */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .kpi { padding: 11px 12px; }
  .kpi .value { font-size: 22px; }

  /* --------------------------------------------------- etapas empilhadas */
  .board {
    flex-direction: column;
    gap: 10px;
    overflow-x: visible;
    overflow-y: visible;
    padding-bottom: 24px;
  }

  .column {
    width: 100%;
    flex: none;
    max-height: none;
    min-height: 0;
    scroll-snap-align: none;
  }

  /* Cada etapa mostra uma janela de cartoes e rola por dentro: sem isto, uma
     coluna de 380 itens empurraria as outras para fora da tela. */
  .column-scroll-shell { max-height: 62vh; }

  .column-head { padding: 12px; }
  .column-title b { max-width: none; font-size: 13.5px; }

  .input,
  .select,
  .textarea,
  .column-search,
  .documento-column-search,
  .column-filter input,
  .header .search input,
  input[type="text"],
  input[type="search"],
  input[type="number"],
  input[type="date"],
  input[type="password"] {
    font-size: 16px;
  }

  /* A altura acompanha a fonte maior, senao o texto encosta na borda. */
  .column-filter input { height: 40px; padding-top: 0; padding-bottom: 0; }

  /* Etapa sem nenhum cartao nao precisa de filtro, de "selecionar visiveis"
     nem do botao de lote. Sao ~125 px de rolagem economizados por etapa vazia,
     e num mes com quatro etapas zeradas isso e meia tela de dedo. */
  .column:has(.column-body > .empty) .column-filter,
  .column:has(.column-body > .empty) .bulk-bar,
  .column:has(.column-body > .empty) .column-foot { display: none; }

  .column:has(.column-body > .empty) .column-body { padding: 12px 10px 14px; }
  .column:has(.column-body > .empty) .column-scroll-shell { max-height: none; }

  /* ------------------------------------------------------------ detalhe */
  .sheet {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    border-left: 0;
  }

  .sheet-body { padding-bottom: 24px; }

  /* Acoes do registro sempre alcancaveis pelo polegar */
  .sheet-foot {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border2);
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

  /* ------------------------------------------------------------- modais */
  .modal,
  .gargalo-modal,
  .auditoria-modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
  }

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

  /* Tabela larga (previa de importacao) rola sozinha em vez de esticar */
  .preview { overflow-x: auto; }

  /* --------------------------------------------------------- gargalo */
  .gargalo-barra-linha { grid-template-columns: 1fr auto; }
  .gargalo-barra-nome { grid-column: 1; }
  .gargalo-barra-valor { grid-column: 2; }
  .gargalo-barra-trilho { grid-column: 1 / -1; order: 3; }
  .gargalo-barra-extra { grid-column: 1 / -1; order: 4; margin-top: 0; }
}

/* Telas bem estreitas: os indicadores viram uma coluna so. */
@media (max-width: 374px) {
  .kpis { grid-template-columns: 1fr !important; }
}

@media (max-width: 520px) {
  .page-head h1 { font-size: 18px; }
  .card-line { gap: 6px; }
  .kpi .value { font-size: 20px; }
  .kpi-hint { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* Cabeçalho compacto de remessas, sem rolagem e sem abreviar os nomes. */
.header.header-remessas {
  gap: 6px;
  flex-wrap: wrap;
}

.header-remessas .actions {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 2px 0;
}

.header.header-remessas .actions .btn {
  flex: 0 0 auto;
  padding: 7px 9px;
  gap: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.header-remessas .actions .ic {
  width: 13px;
  height: 13px;
}

@media (min-width: 861px) {
  .header-remessas .header-spacer {
    display: none;
  }

  .header-remessas .crumb {
    font-size: 12px;
    gap: 4px;
  }

  .header.header-remessas .search {
    flex: 0 1 270px;
    width: 270px;
    min-width: 220px;
    margin-left: auto;
  }

  .header-remessas .search .input {
    background: var(--card2);
    border-color: var(--border);
  }

  .header-remessas .actions {
    gap: 6px;
  }

  .header.header-remessas .actions .btn {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-width: 860px) {
  .header-remessas .actions {
    flex: 1 1 0;
  }
}

@media (max-width: 720px) {
  .remessa-form-modal .modal-head {
    padding: 18px 16px 14px;
  }

  .remessa-form-modal > .notice {
    margin-right: 16px;
    margin-left: 16px;
  }

  .remessa-form-grid {
    padding-right: 16px;
    padding-left: 16px;
  }

  .remessa-form-modal > .remessa-form > .modal-actions {
    padding-right: 16px;
    padding-left: 16px;
  }

  .remessa-form-modal > .remessa-form > .modal-actions .btn {
    flex: 1 1 0;
  }
}


/* Para o Fiscal, a pesquisa fica junto de Atualizar e com os campos buscáveis claros. */
@media (min-width: 861px) {
  .header.header-remessas-fiscal .search {
    flex: 0 1 340px;
    width: 340px;
    min-width: 260px;
    max-width: 36vw;
  }

  .header.header-remessas-fiscal .actions {
    margin-left: 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .header.header-remessas-fiscal .search {
    order: 3;
    flex: 1 1 100%;
    width: auto;
    max-width: none;
    margin-left: 0;
  }

  .header.header-remessas-fiscal .actions {
    order: 4;
    flex: 1 1 100%;
    margin-left: 0;
  }
}


/* Revisao mobile: atalhos de etapa, alvos confortaveis e areas seguras. */
.menu-mobile-scrim { display: none; }
.mobile-stage-nav { display: none; }

@media (max-width: 860px) {
  html { scroll-padding-top: calc(96px + env(safe-area-inset-top, 0px)); }
  body { min-width: 320px; overflow-x: hidden; }
  .app { min-height: 100vh; min-height: 100dvh; }
  .main {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow-x: hidden;
  }
  .header {
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
  .header .search { width: 100%; min-width: 0; }
  .header .search .input { width: 100%; min-height: 44px; }
  .header .actions { width: 100%; min-width: 0; justify-content: flex-start; gap: 8px; }
  .header .actions .btn, .header .btn, .menu-mobile-botao { min-height: 44px; }

  .page-head, .kpis, .toolbar, .board, .mobile-stage-nav {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
  .page-head { padding-top: 16px; }
  .page-head h1 { line-height: 1.3; overflow-wrap: anywhere; }

  .mobile-stage-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 4px;
  }
  .mobile-stage-link {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 44px;
    max-width: 100%;
    padding: 0 12px;
    border: 1px solid var(--border2);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    font-size: 12px;
    line-height: 1.2;
    touch-action: manipulation;
  }
  .mobile-stage-link:active { background: var(--surface2); }
  .mobile-stage-link b {
    display: inline-grid;
    min-width: 22px;
    min-height: 22px;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--surface2);
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
  }

  .column { scroll-margin-top: calc(104px + env(safe-area-inset-top, 0px)); }
  .column-scroll-shell {
    max-height: min(58dvh, 460px);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .column-body { overscroll-behavior-y: contain; }
  .column-search, .documento-column-search, .column-filter input { min-height: 44px; }
  .card { min-height: 44px; }
  .card-line { gap: 8px; }
  .card .supplier, .card-meta { white-space: normal; overflow-wrap: anywhere; }

  .kpi-link, .column-foot .btn, .sheet-foot .btn,
  .modal-actions .btn, .modal-head .icon,
  .sheet-head .icon, .column-filter .icon { min-height: 44px; }
  .sheet {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
    border-left: 0;
  }
  .sheet-head { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .sheet-body { padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
  .sheet-foot {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .sheet-foot .btn { min-width: 0; padding-left: 8px; padding-right: 8px; white-space: normal; }
  .sheet-body .details { grid-template-columns: minmax(0, 1fr); }

  .overlay {
    padding:
      max(8px, env(safe-area-inset-top, 0px))
      max(8px, env(safe-area-inset-right, 0px))
      max(8px, env(safe-area-inset-bottom, 0px))
      max(8px, env(safe-area-inset-left, 0px));
  }
  .modal, .gargalo-modal, .auditoria-modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px 16px;
  }
  .modal-head { align-items: flex-start; gap: 10px; }
  .modal-head h2 { font-size: 18px; overflow-wrap: anywhere; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 120px; min-height: 44px; }
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-grid > *, .remessa-form-grid > * { min-width: 0; }
  .input, .select, .textarea,
  input[type="text"], input[type="search"], input[type="number"],
  input[type="date"], input[type="password"], select, textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .remessa-form-modal {
    width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 8px);
    border-radius: 16px;
  }
  .remessa-form-modal .modal-head { padding: 16px 16px 12px; }
  .remessa-form-modal > .notice { margin: 0 16px 12px; }
  .remessa-form-grid {
    padding: 0 16px calc(8px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .remessa-form-grid .input, .remessa-form-grid .select, .remessa-form-grid .textarea { min-height: 44px; }
  .remessa-form-modal > .remessa-form > .modal-actions {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  .remessa-form-modal > .remessa-form > .modal-actions .btn { flex: 1 1 120px; min-height: 44px; }
  .remessa-form-modal .remover-item { min-width: 44px; min-height: 44px; }

  .preview {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
  .preview table { min-width: 680px; }
  .remessa-form-modal .materiais-remessa .preview table { min-width: 680px; }

  .preview.preview-remessas {
    overflow: visible;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .preview-remessas table {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
    border-spacing: 0;
    background: transparent;
  }
  .preview-remessas thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
  }
  .preview-remessas tbody { display: grid; gap: 10px; }
  .preview-remessas tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 12px;
    border: 1px solid var(--border2);
    border-radius: 14px;
    background: var(--surface);
  }
  .preview-remessas td {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 0;
    border: 0;
    color: var(--ink);
    font-size: 12px;
    overflow-wrap: anywhere;
  }
  .preview-remessas td::before {
    content: attr(data-label);
    color: var(--faint);
    font-size: 10px;
    line-height: 1.3;
  }
  .preview-remessas td:first-child { grid-column: 1 / -1; font-size: 14px; }
  .preview-remessas td:nth-child(3) { grid-column: 1 / -1; }
  .preview-remessas td:last-child {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--border2);
  }
  .preview-remessas td:last-child .btn { min-height: 44px; }

  .board.documentos-board { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .column-foot { padding-bottom: 8px; }
}
@media (max-width: 374px) {
  .mobile-stage-link { flex: 1 1 calc(50% - 8px); min-width: 0; padding: 0 9px; font-size: 11px; }
  .mobile-stage-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .preview-remessas tbody tr { gap: 8px; padding: 10px; }
  .preview-remessas td { font-size: 11.5px; }
  .sheet-foot { flex-wrap: wrap; }
  .sheet-foot .btn { flex: 1 1 42%; }
}
@media (max-height: 500px) and (max-width: 860px) {
  .column-scroll-shell { max-height: min(52dvh, 280px); }
  .modal, .gargalo-modal, .auditoria-modal {
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 12px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .menu-mobile-scrim { transition: none; }
}


/* Marca mais clara e legível na navegação lateral. */
.sidebar .brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: min-content min-content;
  align-items: center;
  column-gap: 10px;
  row-gap: 3px;
  min-height: 58px;
  margin: 0 0 12px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--border2);
}
.sidebar .brand-logo {
  grid-column: 1; grid-row: 1 / span 2; width: 48px; height: 48px;
  max-height: none; object-fit: cover; object-position: left center; border-radius: 9px;
}
.sidebar .brand::before {
  grid-column: 2; grid-row: 1; align-self: end; content: "DRILLGEO";
  color: var(--ink); font-size: 14px; font-weight: 750; letter-spacing: .055em; line-height: 1.15;
}
.sidebar .brand::after {
  grid-column: 2; grid-row: 2; align-self: start;
  content: "GEOLOGIA E\A SONDAGENS S/A";
  color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; line-height: 1.2; white-space: pre-line;
}


/* Retorno ao layout original da marca. */
.sidebar .brand { display:flex; grid-template-columns:none; grid-template-rows:none; align-items:center; column-gap:10px; row-gap:normal; min-height:0; margin:0 0 8px; padding:0 4px 4px; border-bottom:0; }
.sidebar .brand-logo { grid-column:auto; grid-row:auto; width:176px; height:auto; max-height:60px; object-fit:contain; object-position:initial; border-radius:0; }
.sidebar .brand::before, .sidebar .brand::after { content:none; }
