:root {
  --sysa-primary: #0d3b66;
  --sysa-primary-dark: #082c4a;
  --sysa-accent: #0d9488;
  --sysa-page: #f4f7fb;
  --sysa-border: #dce4ee;
}

body { background: var(--sysa-page); }
.content-wrapper { min-height: calc(100vh - 57px); }
.content-header h4 { color: var(--sysa-primary); font-weight: 650; }
.card { border: 1px solid var(--sysa-border); box-shadow: 0 2px 10px rgba(20, 48, 76, .06); }
.card-header { align-items: center; }
.btn:focus, .form-control:focus, .custom-file-input:focus ~ .custom-file-label, .custom-select:focus {
  box-shadow: 0 0 0 .2rem rgba(13, 59, 102, .22);
}
.btn-primary { background-color: var(--sysa-primary); border-color: var(--sysa-primary); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--sysa-primary-dark); border-color: var(--sysa-primary-dark); }
.sysa-toolbar { gap: .5rem; align-items: center; }
.sysa-toolbar .btn-app { min-width: 7.75rem; margin: 0; }
.table-responsive { border-radius: .25rem; }
.table thead th { background: #edf3f8; border-top: 0; color: #31465a; font-size: .8rem; letter-spacing: .01em; white-space: nowrap; }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }
.action-icon { min-width: 2.25rem; }
.empresa-table th:last-child,
.empresa-table td:last-child { min-width: 9.25rem; }
.empresa-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: .35rem;
  white-space: nowrap;
}
.empresa-actions .btn { flex: 0 0 auto; margin: 0; }

/* Configurações da empresa. */
.empresa-config-grid > [class*="col-"] { margin-bottom: 0; }
.empresa-detalhes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem 1.5rem;
  font-size: .9rem;
}
.empresa-detalhe-endereco { grid-column: span 2; }
.empresa-card-embarcacoes .card-body {
  max-height: 28rem;
  overflow: auto;
}
.empresa-card-embarcacoes .table { margin-bottom: 0; }
.empresa-card-embarcacoes thead th,
.empresa-card-embarcacoes tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Configurações da empresa: mantém editar e excluir juntos, mesmo em tabelas largas. */
#tabelaEmbarcacoes th:last-child,
#tabelaProdutos th:last-child,
#tabelaTerminais th:last-child {
  width: 5.5rem;
  min-width: 5.5rem;
  white-space: nowrap;
  text-align: center;
}
#tabelaEmbarcacoes td:last-child,
#tabelaProdutos td:last-child,
#tabelaTerminais td:last-child {
  min-width: 5.5rem;
  white-space: nowrap;
  text-align: center;
}
#tabelaEmbarcacoes td:last-child .btn,
#tabelaProdutos td:last-child .btn,
#tabelaTerminais td:last-child .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0 .1rem;
  padding: .25rem;
  vertical-align: middle;
}
.form-group > label, label { font-weight: 600; color: #31465a; }
.modal-header { border-bottom-color: var(--sysa-border); }
.modal-footer { border-top-color: var(--sysa-border); }
.empty-state { padding: 2.5rem 1rem; text-align: center; color: #607285; }
.status-pill { border-radius: 1rem; font-size: .75rem; font-weight: 600; padding: .25rem .55rem; }

@media (max-width: 767.98px) {
  .content-header .breadcrumb { float: none !important; margin-top: .5rem; padding-left: 0; }
  .sysa-toolbar { flex-wrap: wrap; }
  .sysa-toolbar .btn-app { flex: 1 1 42%; min-width: 0; }
  .modal-dialog { margin: .5rem; }
  .card-tools .input-group { width: 100% !important; }
  .empresa-detalhes-grid { grid-template-columns: 1fr; }
  .empresa-detalhe-endereco { grid-column: auto; }

  /* Lista de empresas: cartões legíveis em vez de uma tabela cortada. */
  .empresa-table-wrapper { overflow-x: visible; padding: .75rem; }
  .empresa-table,
  .empresa-table tbody,
  .empresa-table tr,
  .empresa-table td { display: block; width: 100%; }
  .empresa-table thead { display: none; }
  .empresa-table.table-bordered { border: 0; }
  .empresa-table tbody tr {
    margin: 0 0 .9rem;
    border: 1px solid var(--sysa-border);
    border-radius: .35rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(20, 48, 76, .05);
  }
  .empresa-table tbody tr:nth-of-type(odd) { background: #fff; }
  .empresa-table tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    min-height: 2.7rem;
    padding: .6rem .75rem;
    border: 0;
    border-bottom: 1px solid #edf1f5;
    overflow-wrap: anywhere;
    text-align: right !important;
  }
  .empresa-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    color: #526579;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .01em;
    text-align: left;
  }
  .empresa-table tbody td:last-child { border-bottom: 0; }
  .empresa-table tbody td[data-label="Ações"] { align-items: center; }
  .empresa-actions {
    display: flex;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: .35rem;
  }
  .empresa-actions .btn { margin: 0; min-width: 2.35rem; }
}
