@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* =============================================
   SAMG Design System — Semen Module (Standalone)
   Sin main.css — control total de estilos
   ============================================= */

/* Base Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #F1F5F9;
  color: #1E293B;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a:hover {
  text-decoration: none;
}

/* Variables CSS */
:root {
  --samg-primary: #2A7F62;
  --samg-primary-light: #34996F;
  --samg-primary-dark: #1E5C47;
  --samg-primary-bg: rgba(42, 127, 98, 0.08);
  --samg-amber: #D4A843;
  --samg-amber-bg: rgba(212, 168, 67, 0.10);
  --samg-slate: #1E293B;
  --samg-slate-light: #475569;
  --samg-slate-bg: rgba(30, 41, 59, 0.06);
  --samg-bg: #F1F5F9;
  --samg-white: #FFFFFF;
  --samg-danger: #DC3545;
  --samg-danger-bg: rgba(220, 53, 69, 0.08);
  --samg-border: #E2E8F0;
  --samg-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --samg-shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --samg-radius: 10px;
  --samg-radius-sm: 6px;
  --samg-transition: all 0.25s ease;
}

/* Layout wrapper — content-w handled by layout.css */

/* =============================================
   Field Help Tooltips
   ============================================= */
.samg-field-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  font-size: 12px;
  color: #94A3B8;
  cursor: help;
  position: relative;
  vertical-align: middle;
}
.samg-field-help:hover {
  color: var(--samg-primary);
}
.samg-field-help[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  transform: none;
  background: #1E293B;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  white-space: normal;
  max-width: 220px;
  width: max-content;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.samg-field-help[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 6px;
  transform: none;
  border: 5px solid transparent;
  border-top-color: #1E293B;
  z-index: 1000;
}

/* Fieldset Sections */
.samg-form-card fieldset {
  border: none;
  padding: 0;
  margin: 0 0 16px 0;
}
.samg-form-card fieldset legend {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--samg-primary);
  text-transform: none;
  letter-spacing: 0.5px;
  border-bottom: none;
  padding-bottom: 8px;
  margin-bottom: 16px;
  width: 100%;
}

/* =============================================
   Page Header — Diagonal Split
   ============================================= */
.samg-page-header {
  background: var(--samg-white);
  color: var(--samg-slate);
  padding: 0;
  border-radius: var(--samg-radius);
  margin-bottom: 20px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  overflow: hidden;
  box-shadow: var(--samg-shadow-md);
  min-height: 64px;
  position: relative;
}
.samg-page-header .samg-ph-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 28px;
  flex: 1;
  z-index: 1;
}
.samg-page-header h5 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--samg-slate);
  display: flex;
  align-items: center;
  gap: 10px;
}
.samg-page-header h5 i {
  font-size: 1.1rem;
  color: var(--samg-primary);
}
.samg-page-header .samg-ph-action {
  display: flex;
  align-items: center;
  padding: 18px 28px 18px 68px;
  background: linear-gradient(135deg, var(--samg-primary) 0%, var(--samg-primary-dark) 100%);
  clip-path: polygon(20% 0, 100% 0, 100% 100%, 0% 100%);
  min-width: 220px;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: opacity 0.2s ease;
}
.samg-page-header .samg-ph-action:hover {
  opacity: 0.9;
  color: #fff;
  text-decoration: none;
}

/* =============================================
   Stat Cards
   ============================================= */
.samg-stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.samg-stat-card {
  flex: 1;
  min-width: 140px;
  background: var(--samg-white);
  border-radius: var(--samg-radius);
  padding: 18px 20px;
  box-shadow: var(--samg-shadow);
  border-left: 4px solid var(--samg-primary);
  transition: var(--samg-transition);
}
.samg-stat-card:hover {
  box-shadow: var(--samg-shadow-md);
  transform: translateY(-2px);
}
.samg-stat-card.amber {
  border-left-color: var(--samg-amber);
}
.samg-stat-card.slate {
  border-left-color: var(--samg-slate-light);
}
.samg-stat-card .samg-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--samg-slate-light);
  margin-bottom: 4px;
  font-weight: 600;
}
.samg-stat-card .samg-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--samg-slate);
  line-height: 1.2;
}

/* =============================================
   Buttons
   ============================================= */
.samg-btn-primary {
  background: linear-gradient(135deg, var(--samg-primary) 0%, var(--samg-primary-light) 100%);
  color: var(--samg-white) !important;
  border: none;
  padding: 10px 22px;
  border-radius: var(--samg-radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--samg-transition);
  box-shadow: 0 2px 4px rgba(42, 127, 98, 0.3);
  cursor: pointer;
}
.samg-btn-primary:hover {
  background: linear-gradient(135deg, var(--samg-primary-light) 0%, var(--samg-primary) 100%);
  box-shadow: 0 4px 8px rgba(42, 127, 98, 0.35);
  transform: translateY(-1px);
  color: var(--samg-white) !important;
}
.samg-btn-primary:active {
  transform: translateY(0);
}

.samg-btn-outline {
  background: transparent;
  color: var(--samg-slate-light) !important;
  border: 1.5px solid var(--samg-border);
  padding: 10px 22px;
  border-radius: var(--samg-radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--samg-transition);
  cursor: pointer;
}
.samg-btn-outline:hover {
  border-color: var(--samg-slate-light);
  background: var(--samg-slate-bg);
  color: var(--samg-slate) !important;
}

.samg-btn-danger-outline {
  background: transparent;
  color: var(--samg-danger) !important;
  border: 1.5px solid var(--samg-danger);
  padding: 10px 22px;
  border-radius: var(--samg-radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--samg-transition);
  cursor: pointer;
}
.samg-btn-danger-outline:hover {
  background: var(--samg-danger-bg);
}

/* =============================================
   Table
   ============================================= */
.samg-table-wrapper {
  background: var(--samg-white);
  border-radius: var(--samg-radius);
  box-shadow: var(--samg-shadow);
  padding: 0;
  overflow: hidden;
}
.samg-table-wrapper .table {
  margin-bottom: 0;
  border-collapse: collapse;
}
.samg-table-wrapper .table thead th {
  background: var(--samg-bg);
  color: var(--samg-slate);
  font-size: 0.73rem;
  text-transform: none;
  font-weight: 700;
  border-bottom: 1px solid var(--samg-border);
  border-top: none;
  padding: 12px 18px;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
}
.samg-table-wrapper .table>:not(:last-child)>:last-child>* {
  border-bottom-color: rgb(49 145 107);
}
/* DataTables sorting icons */
.samg-table-wrapper .table thead th.sorting,
.samg-table-wrapper .table thead th.sorting_asc,
.samg-table-wrapper .table thead th.sorting_desc {
  padding-right: 32px;
  background-image: none !important;
}
.samg-table-wrapper .table thead th.sorting::after,
.samg-table-wrapper .table thead th.sorting_asc::after,
.samg-table-wrapper .table thead th.sorting_desc::after {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  transition: all 0.2s ease;
}
.samg-table-wrapper .table thead th.sorting::after {
  content: '\f0dc';
  color: #94A3B8;
  opacity: 0.5;
}
.samg-table-wrapper .table thead th.sorting:hover::after {
  opacity: 0.8;
  background: #E2E8F0;
  color: #475569;
}
.samg-table-wrapper .table thead th.sorting_asc::after {
  content: '\f0de';
  color: var(--samg-primary);
  background: rgba(42, 127, 98, 0.1);
  opacity: 1;
}
.samg-table-wrapper .table thead th.sorting_desc::after {
  content: '\f0dd';
  color: var(--samg-primary);
  background: rgba(42, 127, 98, 0.1);
  opacity: 1;
}
.samg-table-wrapper .table thead th:first-child {
  padding-left: 24px;
  width: 50px;
}
.samg-table-wrapper .table tbody td {
  padding: 0 18px;
  height: 50px;
  vertical-align: middle;
  color: var(--samg-slate);
  font-size: 0.855rem;
  border-bottom: 1px solid #f0f3f7;
  border-top: none;
  line-height: 1.3;
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.samg-table-wrapper .table tbody td:first-child {
  padding-left: 24px;
  color: var(--samg-slate-light);
  font-size: 0.8rem;
  width: 50px;
  max-width: none;
  overflow: visible;
}
.samg-table-wrapper .table tbody td:last-child {
  white-space: nowrap;
  max-width: none;
  overflow: visible;
  text-overflow: unset;
}
.samg-table-wrapper .table tbody tr {
  transition: background 0.15s ease;
}
.samg-table-wrapper .table tbody tr:nth-child(even) {
  background: #fafbfc;
}
.samg-table-wrapper .table tbody tr:hover {
  background: #eef6f3;
}
.samg-table-wrapper .table tbody tr:last-child td {
  border-bottom: none;
}

/* DataTables Responsive — Child Rows */
.samg-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before,
.samg-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
  background-color: var(--samg-primary) !important;
  border: none !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.samg-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control::before,
.samg-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control::before {
  background-color: var(--samg-danger) !important;
}
.samg-table-wrapper table.dataTable > tbody > tr.child ul.dtr-details {
  width: 100%;
}
.samg-table-wrapper table.dataTable > tbody > tr.child ul.dtr-details > li {
  padding: 6px 12px;
  border-bottom: 1px solid #f0f3f7;
}
.samg-table-wrapper table.dataTable > tbody > tr.child span.dtr-title {
  font-weight: 600;
  color: var(--samg-slate);
  min-width: 80px;
}
.samg-table-wrapper table.dataTable > tbody > tr.child span.dtr-data {
  color: var(--samg-slate-light);
}

/* =============================================
   DataTables Controls — Custom DOM Layout
   ============================================= */
.samg-table-wrapper .dataTables_wrapper {
  padding: 0;
}

/* Top toolbar */
.samg-dt-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--samg-border);
  background: var(--samg-white);
}
.samg-dt-toolbar .dataTables_filter {
  margin-left: auto;
}

/* Bottom footer */
.samg-dt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid var(--samg-border);
  background: var(--samg-white);
}
.samg-dt-footer .dataTables_paginate {
  margin-left: auto !important;
  flex-shrink: 0;
}

/* Length Selector */
.samg-table-wrapper .dataTables_length label {
  font-size: 0;
  margin: 0;
  display: flex;
  align-items: center;
}
.samg-table-wrapper .dataTables_length select {
  border: 1.5px solid var(--samg-border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.82rem;
  color: var(--samg-slate);
  background: var(--samg-white);
  outline: none;
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: auto;
  min-width: 58px;
  font-family: inherit;
}
.samg-table-wrapper .dataTables_length select:focus {
  border-color: var(--samg-primary);
  box-shadow: 0 0 0 2px rgba(42, 127, 98, 0.12);
}

/* Export Buttons */
.samg-table-wrapper .dt-buttons {
  display: flex;
  gap: 0;
}
.samg-table-wrapper .dt-buttons .btn {
  background: var(--samg-white);
  color: var(--samg-slate-light);
  border: 1.5px solid var(--samg-border);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  transition: var(--samg-transition);
  line-height: 1.4;
  border-radius: 0;
  font-family: inherit;
}
.samg-table-wrapper .dt-buttons .btn:hover {
  background: var(--samg-primary);
  color: var(--samg-white);
  border-color: var(--samg-primary);
}
.samg-table-wrapper .dt-buttons .btn:first-child {
  border-radius: 6px 0 0 6px;
}
.samg-table-wrapper .dt-buttons .btn:last-child {
  border-radius: 0 6px 6px 0;
}
.samg-table-wrapper .dt-buttons .btn + .btn {
  border-left: none;
}

/* Search Input */
.samg-table-wrapper .dataTables_filter label {
  font-size: 0;
  margin: 0;
  display: flex;
}
.samg-table-wrapper .dataTables_filter input {
  border: 1.5px solid var(--samg-border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.82rem;
  transition: var(--samg-transition);
  outline: none;
  min-width: 180px;
  background: var(--samg-bg);
  font-family: inherit;
}
.samg-table-wrapper .dataTables_filter input:focus {
  border-color: var(--samg-primary);
  box-shadow: 0 0 0 2px rgba(42, 127, 98, 0.12);
  background: var(--samg-white);
}
.samg-table-wrapper .dataTables_filter input::placeholder {
  color: var(--samg-slate-light);
  opacity: 0.6;
}

/* Info Text */
.samg-table-wrapper .dataTables_info {
  font-size: 0.78rem;
  color: var(--samg-slate-light);
  padding: 0;
  margin: 0;
  white-space: nowrap;
}

/* Pagination — Bootstrap 5 DataTables */
.samg-table-wrapper .dataTables_paginate {
  margin: 0;
  padding: 0;
}
.samg-table-wrapper .dataTables_paginate .pagination {
  margin: 0;
  gap: 4px;
  justify-content: flex-end;
}
.samg-table-wrapper .dataTables_paginate .page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: #475569;
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px !important;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1;
  box-shadow: none;
}
.samg-table-wrapper .dataTables_paginate .page-item .page-link:hover {
  background: rgba(42, 127, 98, 0.08);
  border-color: #2A7F62;
  color: #2A7F62;
  z-index: 1;
}
.samg-table-wrapper .dataTables_paginate .page-item .page-link:focus {
  box-shadow: none;
  outline: none;
}
.samg-table-wrapper .dataTables_paginate .page-item.active .page-link {
  background: #2A7F62;
  border-color: #2A7F62;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(42, 127, 98, 0.35);
  z-index: 2;
}
.samg-table-wrapper .dataTables_paginate .page-item.active .page-link:hover {
  background: #1E5C47;
  border-color: #1E5C47;
  color: #fff;
}
.samg-table-wrapper .dataTables_paginate .page-item.disabled .page-link {
  opacity: 0.35;
  cursor: default;
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #94A3B8;
}
.samg-table-wrapper .dataTables_paginate .page-item.previous .page-link,
.samg-table-wrapper .dataTables_paginate .page-item.next .page-link {
  border: none;
  background: transparent;
  color: #94A3B8;
  font-size: 1rem;
}
.samg-table-wrapper .dataTables_paginate .page-item.previous .page-link:hover,
.samg-table-wrapper .dataTables_paginate .page-item.next .page-link:hover {
  background: rgba(42, 127, 98, 0.08);
  color: #2A7F62;
  border: none;
}

/* Scrollbar visible & drag-to-scroll */
.samg-table-wrapper .table-responsive {
  cursor: grab;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.samg-table-wrapper .table-responsive.grabbing {
  cursor: grabbing;
  user-select: none;
}
.samg-table-wrapper .table-responsive::-webkit-scrollbar {
  height: 8px;
}
.samg-table-wrapper .table-responsive::-webkit-scrollbar-track {
  background: #F1F5F9;
  border-radius: 4px;
}
.samg-table-wrapper .table-responsive::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
  transition: background 0.2s;
}
.samg-table-wrapper .table-responsive::-webkit-scrollbar-thumb:hover {
  background: #2A7F62;
}
/* Firefox */
.samg-table-wrapper .table-responsive {
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 #F1F5F9;
}

/* =============================================
   Action Icons
   ============================================= */
.samg-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--samg-slate-light);
  transition: var(--samg-transition);
  text-decoration: none !important;
  font-size: 0.85rem;
}
.samg-action-icon:hover {
  background: var(--samg-primary-bg);
  color: var(--samg-primary);
}
.samg-action-icon.danger:hover {
  background: var(--samg-danger-bg);
  color: var(--samg-danger);
}

/* =============================================
   Modal
   ============================================= */
.samg-modal-header {
  background: linear-gradient(135deg, var(--samg-primary) 0%, var(--samg-primary-dark) 100%);
  color: var(--samg-white);
  border-radius: var(--samg-radius) var(--samg-radius) 0 0;
  padding: 18px 24px;
}
.samg-modal-header .modal-title {
  color: var(--samg-white);
  font-weight: 600;
  font-size: 1rem;
}
.samg-modal-header .close,
.samg-modal-header .btn-close {
  color: var(--samg-white);
  opacity: 0.8;
  filter: brightness(0) invert(1);
}
.modal-content {
  border: none;
  border-radius: var(--samg-radius);
  overflow: hidden;
}
.modal-footer {
  border-top: 1px solid var(--samg-border);
}

/* Nav Tabs — SAMG Theme */
.nav-tabs .nav-link {
  color: var(--samg-slate-light);
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 16px;
  transition: var(--samg-transition);
}
.nav-tabs .nav-link:hover {
  color: var(--samg-primary);
  border-bottom-color: rgba(42, 127, 98, 0.3);
}
.nav-tabs .nav-link.active {
  color: var(--samg-primary);
  border-bottom-color: var(--samg-primary);
  background: transparent;
}

/* =============================================
   Form Card
   ============================================= */
.samg-form-card {
  border: none;
  border-radius: var(--samg-radius);
  box-shadow: var(--samg-shadow);
  overflow: visible;
}
.samg-form-card .card-body {
  padding: 24px;
}

/* Labels */
.samg-form-card label {
  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: 0.2px;
  font-weight: 600;
  color: #64748B;
  margin-bottom: 6px;
  display: block;
}

/* Inputs & Selects */
.samg-form-card .form-control,
.samg-form-card select.form-control {
  border: 1.5px solid var(--samg-border);
  border-radius: var(--samg-radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  color: var(--samg-slate);
  background: #FAFBFC;
  transition: var(--samg-transition);
  font-family: inherit;
  height: auto;
}
.samg-form-card .form-control:focus {
  border-color: var(--samg-primary);
  box-shadow: 0 0 0 3px rgba(42, 127, 98, 0.12);
  background: #fff;
  color: #1E293B;
}
.samg-form-card .form-control::placeholder {
  color: #94A3B8;
}

/* Textarea */
.samg-form-card textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* Fieldset */
.samg-form-card fieldset {
  border: none;
  padding: 0;
  margin: 20px 0 8px;
}
.samg-form-card fieldset legend {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--samg-primary);
  text-transform: none;
  letter-spacing: 0.3px;
  padding: 0;
  margin-bottom: 12px;
  width: auto;
  float: none;
  border-bottom: none;
}
.samg-form-card fieldset legend span {
  display: inline-block;
}

/* Separator */
.samg-form-card ~ hr,
.samg-form-card + hr {
  border: none;
  border-top: 1px solid var(--samg-border);
  margin: 24px 0 20px;
}

/* Form action buttons row */
.samg-form-card ~ .row,
.samg-form-card + hr + .row {
  gap: 12px;
}

/* Select2 Bootstrap 5 overrides */
.select2-container--bootstrap-5 .select2-selection {
  border: 1.5px solid var(--samg-border) !important;
  border-radius: var(--samg-radius-sm) !important;
  padding: 6px 10px !important;
  min-height: 42px !important;
  font-size: 0.88rem !important;
  background: #FAFBFC !important;
  transition: var(--samg-transition);
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--samg-primary) !important;
  box-shadow: 0 0 0 3px rgba(42, 127, 98, 0.12) !important;
  background: #fff !important;
}
.select2-container--bootstrap-5 .select2-dropdown {
  border: 1.5px solid var(--samg-border);
  border-radius: var(--samg-radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
  background-color: rgba(42, 127, 98, 0.1) !important;
  color: var(--samg-primary) !important;
}
.select2-container--bootstrap-5 .select2-results__option--selected {
  background-color: var(--samg-primary) !important;
  color: #fff !important;
}

/* Validation feedback */
.samg-form-card .was-validated .form-control:invalid,
.samg-form-card .form-control.is-invalid {
  border-color: var(--samg-danger);
}
.samg-form-card .was-validated .form-control:invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.samg-form-card .invalid-feedback {
  font-size: 0.75rem;
  color: var(--samg-danger);
  margin-top: 4px;
}

/* =============================================
   Badge
   ============================================= */
.samg-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
}
.samg-badge.teal {
  background: var(--samg-primary-bg);
  color: var(--samg-primary);
}
.samg-badge.amber {
  background: var(--samg-amber-bg);
  color: #9A7B30;
}

/* =============================================
   Mobile Cards
   ============================================= */
.samg-mobile-list {
  display: none;
}
.samg-mobile-card {
  background: var(--samg-white);
  border-radius: var(--samg-radius);
  box-shadow: var(--samg-shadow);
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid var(--samg-primary);
  transition: var(--samg-transition);
}
.samg-mobile-card:active {
  box-shadow: var(--samg-shadow-md);
}
.samg-mobile-card .samg-mc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.samg-mobile-card .samg-mc-title {
  font-weight: 600;
  color: var(--samg-slate);
  font-size: 0.95rem;
}
.samg-mobile-card .samg-mc-subtitle {
  font-size: 0.8rem;
  color: var(--samg-slate-light);
  margin-top: 2px;
}
.samg-mobile-card .samg-mc-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.samg-mobile-card .samg-mc-actions {
  display: flex;
  gap: 6px;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
  /* Constrain parent containers so DataTables Responsive can detect overflow */
  .content-w,
  .content-i,
  .content-box {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .samg-page-header {
    flex-direction: column;
  }
  .samg-page-header .samg-ph-title {
    padding: 16px 20px;
  }
  .samg-page-header .samg-ph-action {
    clip-path: none;
    min-width: auto;
    width: 100%;
    padding: 14px 20px;
    justify-content: center;
  }

  /* Section header */
  .section-header {
    padding: 1rem 1.2rem !important;
    border-radius: 8px !important;
    margin-bottom: 1rem !important;
  }
  .section-header h4 {
    font-size: 1rem !important;
  }

  /* Stat cards */
  .stat-cards {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .stat-cards .samg-stat-card,
  .samg-stats-row {
    flex-direction: column;
    gap: 10px;
  }
  .samg-stat-card {
    min-width: auto;
  }

  /* SAMG cards */
  .samg-card {
    padding: 12px !important;
    border-radius: 8px !important;
    margin-bottom: 1rem !important;
  }

  /* Desktop/Mobile list toggle */
  .samg-desktop-table {
    display: none !important;
  }
  .samg-mobile-list {
    display: block;
  }

  /* Table wrapper — let DataTables Responsive handle column collapsing */
  .samg-table-wrapper {
    overflow: hidden;
  }
  .samg-table-wrapper .table tbody td {
    padding: 8px 10px;
    font-size: 0.78rem;
  }
  .samg-table-wrapper .table thead th {
    padding: 8px 10px;
    font-size: 0.68rem;
  }

  /* Hide per-column search inputs on mobile */
  .samg-table-wrapper .table thead th input[type="text"],
  .samg-table-wrapper .table thead th label {
    display: none;
  }

  /* DataTables toolbar — stack vertically */
  .samg-dt-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }
  .samg-dt-toolbar .dataTables_length {
    order: 1;
  }
  .samg-dt-toolbar .dataTables_filter {
    margin-left: 0;
    order: 2;
  }
  .samg-dt-toolbar .dataTables_filter input {
    width: 100%;
    min-width: auto;
  }
  .samg-dt-toolbar .dt-buttons {
    order: 3;
    flex-wrap: wrap;
    gap: 0;
  }
  .samg-dt-toolbar .dt-buttons .btn {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 0.7rem;
    padding: 6px 8px;
  }

  /* DataTables footer — stack vertically */
  .samg-dt-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 14px;
  }
  .samg-dt-footer .dataTables_info {
    text-align: center;
    font-size: 0.75rem;
  }
  .samg-dt-footer .dataTables_paginate {
    margin-left: 0 !important;
    display: flex;
    justify-content: center;
  }
  .samg-dt-footer .dataTables_paginate .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }
  .samg-dt-footer .dataTables_paginate .page-item .page-link {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
  }

  /* Select2 full width */
  .samg-select-wrapper .select2-container,
  .samg-select-wrapper .form-control {
    width: 100% !important;
  }

  /* Primary button */
  .samg-btn-primary {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .section-header {
    padding: 0.8rem 1rem !important;
  }
  .section-header h4 {
    font-size: 0.9rem !important;
  }
  .samg-dt-toolbar .dt-buttons .btn {
    font-size: 0.65rem;
    padding: 5px 6px;
  }
  .samg-dt-footer .dataTables_paginate .page-item .page-link {
    width: 28px;
    height: 28px;
    font-size: 0.68rem;
  }
  .samg-card {
    padding: 10px !important;
  }
}

