:root {
  --bg: #f4f7f5;
  --bg-soft: #ecf3f0;
  --surface: #ffffff;
  --surface-strong: #f8fbf9;
  --text: #1f2a24;
  --muted: #5c6f65;
  --line: #d9e5de;
  --brand: #2d7f5e;
  --brand-strong: #25694e;
  --accent: #f2a65a;
  --danger: #c94f4f;
  --warning: #d5901a;
  --success: #2e8b57;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 8px rgba(17, 40, 30, 0.08);
  --shadow-md: 0 10px 28px rgba(17, 40, 30, 0.1);
}

body.theme-dark {
  --bg: #101614;
  --bg-soft: #15201c;
  --surface: #17211d;
  --surface-strong: #1d2a25;
  --text: #edf6f1;
  --muted: #a7b9b1;
  --line: #2d3b35;
  --brand: #53af88;
  --brand-strong: #67c59d;
  --accent: #f3b372;
  --danger: #db6a6a;
  --warning: #f0b03e;
  --success: #5cbf8d;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Nunito Sans", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at 95% 8%, rgba(242, 166, 90, 0.16) 0%, rgba(242, 166, 90, 0) 36%),
    radial-gradient(circle at 8% 92%, rgba(45, 127, 94, 0.15) 0%, rgba(45, 127, 94, 0) 40%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-top: 76px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Merriweather", Georgia, serif;
  color: var(--text);
  letter-spacing: 0.2px;
}

a {
  color: var(--brand-strong);
}

a:hover {
  color: var(--brand);
}

.container {
  position: relative;
}

.navbar-proativa {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(120deg, #214f3d 0%, #2d7f5e 55%, #67a588 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 24px rgba(17, 40, 30, 0.2);
  backdrop-filter: blur(6px);
  z-index: 3000;
}

.navbar-brand img {
  height: 40px;
  margin-right: 10px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.navbar .nav-link,
.navbar .navbar-brand,
.navbar .navbar-text {
  color: #eff8f3 !important;
  font-weight: 700;
}

.navbar .nav-link {
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.active {
  color: #143123 !important;
  background: rgba(255, 255, 255, 0.84);
}

.navbar .dropdown-menu {
  border: 1px solid rgba(32, 77, 60, 0.15);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 3100;
}

.navbar-proativa .dropdown,
.navbar-proativa .dropdown-menu {
  position: relative;
}

.navbar .dropdown-menu.show {
  z-index: 3100;
}

.navbar .dropdown-item {
  font-weight: 700;
  color: #2a3d34;
  padding: 0.6rem 0.9rem;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
  background: #edf7f2;
  color: #1c5a41;
}

.btn,
.form-control,
.form-select,
.input-group-text,
.page-link,
.alert,
.badge,
.dropdown-menu,
.card,
.modal-content,
table {
  border-radius: var(--radius-sm);
}

.btn {
  border: 0;
  font-weight: 800;
  letter-spacing: 0.2px;
  padding: 0.55rem 0.95rem;
  transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17, 40, 30, 0.14);
  filter: saturate(1.04);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary,
.btn-success {
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
}

.btn-warning {
  color: #3d2a0e;
  background: linear-gradient(145deg, #f6c26a, #e8a846);
}

.btn-danger {
  background: linear-gradient(145deg, #d86161, #b64444);
}

.btn-secondary {
  background: #6f8078;
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-secondary,
.btn-outline-warning,
.btn-outline-danger,
.btn-outline-info {
  border: 1px solid var(--line);
}

.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-header {
  border-bottom: 1px solid var(--line);
}

.table-responsive {
  margin-top: 16px;
}

.table {
  border-color: var(--line);
  color: var(--text);
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--line);
}

.table thead th {
  background: #ebf3ef;
  color: #1f4434;
  font-weight: 800;
  border-bottom-width: 1px;
}

body.theme-dark .table thead th {
  background: #23332d;
  color: #dcebe4;
}

.table-hover tbody tr:hover {
  background: #f0f7f3;
}

body.theme-dark .table-hover tbody tr:hover {
  background: #1c2924;
}

.actions-column {
  width: 150px;
}

.search-form {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.form-control,
.form-select,
.input-group-text {
  border: 1px solid #cfded6;
  background: #fff;
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(45, 127, 94, 0.18);
}

.btn-group-sm {
  gap: 5px;
}

.pagination {
  margin-top: 18px;
  justify-content: center;
}

.page-link {
  border: 1px solid var(--line);
  color: var(--brand-strong);
  font-weight: 800;
}

.page-item.active .page-link,
.page-link:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.empresa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.form-container {
  max-width: 860px;
  margin: 0 auto;
}

.alert {
  margin-top: 14px;
  border: 1px solid transparent;
}

.alert-info {
  background: #e8f4ff;
  border-color: #c9e4ff;
  color: #144a72;
}

.alert-success {
  background: #e8f6ef;
  border-color: #c9ebd8;
  color: #1f5f43;
}

.alert-warning {
  background: #fff5df;
  border-color: #fde6b4;
  color: #6e4a12;
}

.alert-danger {
  background: #ffeaea;
  border-color: #ffc8c8;
  color: #7b2323;
}

.table-sm th,
.table-sm td {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  vertical-align: middle;
}

.table-sm thead th,
.cargo-card .table-sm thead th {
  height: 46px;
  min-height: 46px;
  max-height: 46px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cargo-card {
  background: linear-gradient(180deg, #f8fbf9, #eff5f2);
  border: 1px solid #d6e6de;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.cargo-card:nth-child(even) {
  background: linear-gradient(180deg, #f4f8f6, #edf3f0);
}

.cargo-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #b7d7c8;
  transform: translateY(-2px);
}

.cargo-card h5 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #245f46;
  margin-bottom: 0.4rem;
}

.cargo-card .cargo-actions {
  margin-left: 1rem;
  margin-bottom: 0.75rem;
}

.cargo-card .cargo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 0.5rem;
}

.cargo-card .cargo-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cargo-card .cargo-table-title {
  margin-top: 1.1rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 800;
  color: #2e4f42;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.cargo-card .table-sm,
.cargo-card .table-sm th,
.cargo-card .table-sm td {
  font-size: 0.85rem;
}

.setor-bg-1,
.setor-bg-2,
.setor-bg-3,
.setor-bg-4,
.setor-bg-5 {
  background: transparent;
}

.badge {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.dashboard-cards-row .card {
  overflow: hidden;
}

.dashboard-cards-row .card .display-5 {
  color: #204d39;
}

body.theme-dark .dashboard-cards-row .card .display-5 {
  color: #aee3ca;
}

@media (max-width: 999.98px) {
  .cargo-card .cargo-actions .btn span.btn-text {
    display: none !important;
  }

  .cargo-card .cargo-actions .btn i {
    font-size: 1.2rem !important;
  }

  .cargo-card .cargo-actions .btn {
    min-width: 42px;
    min-height: 42px;
    padding: 0.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .cargo-card .cargo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
}

@media (max-width: 991.98px) {
  body {
    padding-top: 94px;
  }

  .empresa-header {
    flex-direction: column;
    align-items: stretch;
  }

  .navbar .nav-link {
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 767.98px) {
  .cargo-card .cargo-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .cargo-card .cargo-table-title {
    font-size: 0.94rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
  }

  .table thead th,
  .table td {
    font-size: 0.9rem;
  }
}

@media (min-width: 960px) {
  .dashboard-cards-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 22px;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .dashboard-cards-row > [class^="col-"],
  .dashboard-cards-row > [class*=" col-"] {
    flex: 1 1 0;
    max-width: 100%;
  }

  .dashboard-cards-row .card {
    height: 100%;
    margin-bottom: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .card,
  .alert {
    animation: fadeUp 0.28s ease-out;
  }

  @keyframes fadeUp {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
