/* Admin & data tables — extends style.css without changing existing UI */

/* Admin content card spacing */
body[data-portal="admin"] .content-card {
  padding: 24px 28px 32px;
}

body[data-portal="admin"] .content-card--dashboard {
  padding: 0;
}

body[data-portal="admin"] .content-card--dashboard .admin-stats-row {
  padding: 20px 24px 4px;
}

/* Admin sidebar — matches website nav header (kbHeader__nav) */
body[data-portal="admin"] {
  --admin-sidebar-bg: linear-gradient(105deg, #142a5c 0%, #0d4a3a 52%, #0a6847 100%);
}

body[data-portal="admin"] .sidebar {
  background: var(--admin-sidebar-bg);
  border-right-color: rgba(0, 0, 0, 0.15);
}

body[data-portal="admin"] .sidebar-header {
  border-bottom-color: rgba(255, 255, 255, 0.12);
  gap: 8px;
}

body[data-portal="admin"] .sidebar-brand {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-decoration: none;
}

body[data-portal="admin"] .sidebar-brand__img {
  display: block;
  height: 40px;
  width: auto;
  max-width: 100%;
  border-radius: 6px;
  transition: height var(--transition), opacity var(--transition);
}

body[data-portal="admin"] .sidebar.collapsed .sidebar-brand__img {
  height: 28px;
  max-width: 40px;
  object-fit: contain;
}

body[data-portal="admin"] .sidebar.collapsed .sidebar-header {
  flex-direction: column;
  align-items: center;
  padding: 14px 8px 12px;
}

body[data-portal="admin"] .sidebar.collapsed .nav-submenu {
  display: none !important;
}

body[data-portal="admin"] .sidebar-toggle {
  color: rgba(255, 255, 255, 0.92);
}

body[data-portal="admin"] .sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

body[data-portal="admin"] .sidebar-nav {
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

body[data-portal="admin"] .sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
}

body[data-portal="admin"] .nav-group + .nav-group {
  border-top-color: rgba(255, 255, 255, 0.14);
}

body[data-portal="admin"] .sidebar.collapsed .nav-group + .nav-group {
  border-top-color: transparent;
}

body[data-portal="admin"] .nav-group__title {
  color: rgba(255, 255, 255, 0.58);
}

body[data-portal="admin"] .nav-link {
  color: rgba(255, 255, 255, 0.9);
}

body[data-portal="admin"] .nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

body[data-portal="admin"] .nav-link.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}

body[data-portal="admin"] .nav-link.active::before {
  background: #fff;
}

body[data-portal="admin"] .nav-chevron {
  opacity: 0.75;
  color: rgba(255, 255, 255, 0.85);
}

body[data-portal="admin"] .nav-submenu {
  border-left-color: rgba(255, 255, 255, 0.22);
}

body[data-portal="admin"] .nav-sub-link {
  color: rgba(255, 255, 255, 0.72);
}

body[data-portal="admin"] .nav-sub-link:hover,
body[data-portal="admin"] .nav-sub-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

body[data-portal="admin"] .nav-sub-icon {
  opacity: 0.85;
  color: rgba(255, 255, 255, 0.85);
}

body[data-portal="admin"] .sidebar-footer {
  border-top-color: rgba(255, 255, 255, 0.14);
}

body[data-portal="admin"] .sidebar-footer .nav-link {
  color: rgba(255, 255, 255, 0.78);
}

body[data-portal="admin"] .sidebar-footer .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.admin-page-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.admin-section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.admin-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-dark);
}
.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
}

.data-table-wrap + .admin-hint,
.admin-hint + .data-table-wrap {
  margin-top: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 20px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 20px;
}

.data-table th {
  background: var(--bg-page);
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: #fafbfc;
}

/* Agents table — single-line rows */
.data-table--agents {
  min-width: 980px;
}

.data-table--agents th,
.data-table--agents td {
  padding: 10px 12px;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table--agents th:first-child,
.data-table--agents td:first-child {
  padding-left: 16px;
}

.data-table--agents th:last-child,
.data-table--agents td:last-child {
  padding-right: 16px;
}

.data-table--agents td:nth-child(2) {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table--agents .agent-balance,
.data-table--agents .agent-credit {
  font-variant-numeric: tabular-nums;
}

.data-table--agents .btn-group {
  flex-wrap: nowrap;
  gap: 4px;
}

.data-table--agents .btn-group .btn-sm {
  padding: 5px 9px;
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: nowrap;
}

/* Credit bank accounts table: balanced spacing */
.credit-bank-table {
  table-layout: fixed;
}

.credit-bank-table th,
.credit-bank-table td {
  padding: 12px 14px;
  vertical-align: middle;
}

.credit-bank-table th:nth-child(1),
.credit-bank-table td:nth-child(1) {
  width: 72px;
  text-align: center;
}

.credit-bank-table th:nth-child(2),
.credit-bank-table td:nth-child(2) {
  width: 34%;
}

.credit-bank-table th:nth-child(3),
.credit-bank-table td:nth-child(3),
.credit-bank-table th:nth-child(4),
.credit-bank-table td:nth-child(4) {
  width: 24%;
}

.credit-bank-table th:nth-child(5),
.credit-bank-table td:nth-child(5) {
  width: 92px;
  text-align: center;
}

.credit-bank-table td:nth-child(3),
.credit-bank-table td:nth-child(4) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.credit-bank-table .btn-danger.btn-sm {
  min-width: 56px;
}

/* Allow bank dropdown to escape the card (global .content-card uses overflow:hidden) */
.content-card--bank-accounts {
  overflow: visible;
}

.credit-bank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.credit-bank-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.credit-bank-badge__fallback {
  width: 100%;
  height: 100%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 0.72rem;
}

.credit-bank-select {
  position: relative;
  width: 100%;
}

.credit-bank-select__trigger {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  box-sizing: border-box;
}

.credit-bank-select__trigger:hover {
  border-color: #94a3b8;
}

.credit-bank-select.is-open .credit-bank-select__trigger {
  border-color: var(--accent-green, #16a34a);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.credit-bank-select__preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.credit-bank-select__placeholder {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.credit-bank-select__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.25;
}

.credit-bank-select__text strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
}

.credit-bank-select__text span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.credit-bank-select__chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.credit-bank-select__menu {
  position: absolute;
  z-index: 80;
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(320px, 50vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.12);
}

.credit-bank-select__option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}

.credit-bank-select__option:hover {
  background: #f8fafc;
}

.credit-bank-select__option.is-selected {
  background: #f0fdf4;
}

.credit-bank-select__option-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.25;
}

.credit-bank-select__option-text strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
}

.credit-bank-select__option-text span {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.credit-bank-add-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px 14px;
}

.credit-bank-add-grid__bank {
  grid-column: 1 / 2;
}

.credit-bank-add-grid__account {
  grid-column: 2 / 4;
}

@media (max-width: 900px) {
  .credit-bank-add-grid {
    grid-template-columns: 1fr;
  }

  .credit-bank-add-grid__bank,
  .credit-bank-add-grid__account {
    grid-column: 1;
  }
}

.credit-gauge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.credit-gauge__limit {
  font-size: 0.84rem;
  color: var(--text-dark);
  font-variant-numeric: tabular-nums;
}

.credit-gauge__bar {
  display: block;
  width: 72px;
  height: 6px;
  background: #e8eaed;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.credit-gauge__bar .credit-limit-fill {
  display: block;
  height: 100%;
}

.credit-gauge__pct {
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 2.2em;
  text-align: right;
}

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pill.active {
  background: var(--accent-green-soft);
  color: var(--accent-green);
}

.status-pill.inactive {
  background: #f3f4f6;
  color: var(--text-muted);
}

.status-pill.pending {
  background: #fef3c7;
  color: #b45309;
}

.status-pill.paid {
  background: #dcfce7;
  color: #166534;
}

.status-pill.approved {
  background: #dcfce7;
  color: #166534;
}

.status-pill.rejected {
  background: #fee2e2;
  color: #b91c1c;
}

.status-pill.wht50-printed {
  background: #dcfce7;
  color: #166534;
}

.status-pill.wht50-unprinted {
  background: #ffedd5;
  color: #c2410c;
}

.status-pill.wht50-waiting {
  background: #fef3c7;
  color: #b45309;
}

.status-pill.wht50-none {
  background: #f3f4f6;
  color: var(--text-muted);
}

.admin-wht50-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-agent-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-agent-cell__code {
  font-weight: 700;
  color: var(--text-primary, #111827);
}

.admin-agent-cell__name {
  font-size: 0.82rem;
  color: var(--text-muted, #6b7280);
  line-height: 1.25;
}

.agent-team-members {
  margin: 0;
  padding: 10px 12px 10px 28px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  line-height: 1.7;
}

.agent-team-members li strong {
  margin-right: 6px;
}

.agent-team-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agent-team-chips li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #065f46;
}

.agent-team-chips em {
  font-style: normal;
  font-weight: 500;
  color: #047857;
}

.status-pill.failed {
  background: #fee2e2;
  color: #b91c1c;
}

.status-pill.cancelled {
  background: #f3f4f6;
  color: var(--text-muted);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.admin-toolbar__head {
  min-width: 0;
  flex: 1 1 240px;
}

.admin-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  flex: 0 0 auto;
}

.admin-toolbar-filters__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.admin-toolbar-filters__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.2;
}

.admin-toolbar > .admin-page-title {
  margin-bottom: 0;
}

.admin-toolbar > div .admin-page-title,
.admin-toolbar__head .admin-page-title {
  margin-bottom: 6px;
}

.admin-toolbar .admin-hint {
  margin-bottom: 0;
}

.admin-toolbar .admin-filter-bar {
  margin-bottom: 0;
  align-items: flex-end;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 640px;
}

.admin-form-grid .form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(61, 184, 138, 0.15);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--brand-green-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--brand-green-shadow);
}

.btn-primary:hover {
  background: var(--brand-green-gradient-hover);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #fff;
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-spinner {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  flex-shrink: 0;
  animation: btn-spin 0.65s linear infinite;
  vertical-align: -0.1em;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

button.is-loading,
.btn-primary.is-loading,
.btn-secondary.is-loading,
.btn-success.is-loading,
.btn-danger.is-loading,
.btn-success-outline.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0.85;
  cursor: wait;
  pointer-events: none;
}

.admin-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.admin-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-green);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-logo-icon {
  width: 44px;
  height: 44px;
  background: var(--brand-green-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.login-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
}

.login-title.brand-stacked br {
  display: block;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-error {
  background: var(--accent-red-soft);
  color: var(--accent-red);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

.login-error.visible {
  display: block;
}

.login-demo {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.login-card--wide {
  max-width: 420px;
}

.login-success {
  background: var(--accent-green-soft);
  color: var(--accent-green);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

.login-success.visible {
  display: block;
}

.login-success a {
  color: inherit;
  font-weight: 600;
}

.login-terms label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  cursor: pointer;
}

.login-terms input {
  margin-top: 3px;
  flex-shrink: 0;
}

.login-terms a {
  color: var(--accent-green);
  text-decoration: underline;
}

.login-demo code {
  background: var(--bg-page);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Modal */
body.modal-open {
  overflow: hidden;
}

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.admin-modal {
  background: #fff;
  border-radius: 22px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15, 31, 77, 0.18);
}

.admin-modal.wide {
  max-width: 560px;
}

.admin-modal.form {
  max-width: 640px;
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.admin-modal-close {
  background: #f1f5f9;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-modal-close:hover {
  background: #e2e8f0;
  color: var(--text-dark);
}

.admin-modal-body {
  padding: 20px 22px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.admin-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px 18px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  flex-shrink: 0;
}

.admin-modal-footer .btn-primary,
.admin-modal-footer .btn-secondary {
  border-radius: 14px;
  min-height: 44px;
  padding: 10px 20px;
}

.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 18px;
  align-items: flex-end;
  --admin-control-h: 40px;
}

.admin-filter-bar .form-field {
  min-width: 160px;
  flex: 0 1 auto;
  max-width: 280px;
}

.admin-filter-bar .form-field label {
  margin-bottom: 6px;
}

.admin-filter-bar .form-field input,
.admin-filter-bar .form-field select,
.admin-filter-bar > .btn-secondary,
.admin-filter-bar > .btn-primary,
.admin-filter-bar > a.btn-secondary {
  height: var(--admin-control-h);
  min-height: var(--admin-control-h);
  box-sizing: border-box;
  font-size: 0.875rem;
  line-height: 1.2;
}

.admin-filter-bar .form-field input,
.admin-filter-bar .form-field select {
  padding: 0 12px;
}

.admin-filter-bar > .btn-secondary,
.admin-filter-bar > .btn-primary,
.admin-filter-bar > a.btn-secondary {
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-filter-bar .btn-sm {
  padding: 0 14px;
  font-size: 0.875rem;
}

.admin-toolbar a.btn-secondary {
  text-decoration: none;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 0.8rem;
  background: var(--accent-red-soft);
  color: var(--accent-red);
  border: 1px solid #f5c6c6;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}

.btn-success-outline {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 0.8rem;
  background: var(--accent-green-soft);
  color: var(--accent-green);
  border: 1px solid #b8e6d0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}

.amount-positive {
  color: var(--accent-green);
  font-weight: 600;
}

.amount-negative {
  color: var(--accent-red);
  font-weight: 600;
}

.data-table tbody tr.clickable {
  cursor: pointer;
}

.detail-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 16px;
  font-size: 0.9rem;
}

.detail-grid dt {
  color: var(--text-muted);
  font-weight: 500;
}

.detail-grid dd {
  margin: 0;
  color: var(--text-dark);
}

.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.admin-stat-mini {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.admin-stat-mini .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.admin-stat-mini .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
}

@media (max-width: 1100px) {
  .admin-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body[data-portal="admin"] .content-card {
    padding: 20px 16px 24px;
  }

  body[data-portal="admin"] .content-card--dashboard .admin-stats-row {
    padding: 16px 16px 0;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    padding-left: 14px;
  }

  .data-table th:last-child,
  .data-table td:last-child {
    padding-right: 14px;
  }

  .admin-stats-row {
    grid-template-columns: 1fr;
  }

  .admin-toolbar-filters {
    width: 100%;
  }

  .admin-toolbar-filters__field,
  .admin-select--toolbar {
    width: 100%;
    min-width: 0;
  }
}

.admin-select {
  height: 40px;
  min-height: 40px;
  min-width: 180px;
  padding: 0 36px 0 12px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.admin-select:hover {
  border-color: #cbd5e1;
  background-color: #f8fafc;
}

.admin-select:focus {
  outline: none;
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
  background-color: #fff;
}

.admin-select--toolbar {
  min-width: 200px;
}

.admin-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px 0;
}

.admin-quick-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.875rem;
  color: var(--primary, #2563eb);
  background: rgba(37, 99, 235, 0.06);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
}

.admin-quick-link:hover {
  background: rgba(37, 99, 235, 0.12);
}

body[data-portal="admin"] .content-card--team {
  padding-bottom: 20px;
}

.team-org-search {
  height: 40px;
  min-width: 220px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-dark);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}

.team-org-search:focus {
  outline: none;
  border-color: #1a7d58;
  box-shadow: 0 0 0 3px rgba(26, 125, 88, 0.12);
}

.team-org__kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.team-org__kpis > div {
  padding: 14px 18px;
  border-right: 1px solid var(--border-color, #e2e8f0);
}

.team-org__kpis > div:last-child {
  border-right: 0;
}

.team-org__kpis dt {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted, #64748b);
}

.team-org__kpis dd {
  margin: 4px 0 0;
  font-size: 1.22rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.team-org__workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0;
  min-height: 520px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.team-org__list {
  border-right: 1px solid var(--border-color, #e2e8f0);
  background: #f8fafc;
  min-height: 0;
  max-height: min(72vh, 760px);
  overflow: auto;
}

.team-org__listHead {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.team-org__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.15s ease;
}

.team-org__item:hover {
  background: #eef6f2;
}

.team-org__item.is-active {
  background: #fff;
  box-shadow: inset 3px 0 0 #1a7d58;
}

.team-org__avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #143d32;
  color: #ecfdf5;
  flex-shrink: 0;
}

.team-org__avatar svg {
  width: 18px;
  height: 18px;
}

.team-org__avatar--lg {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.team-org__avatar--lg svg {
  width: 22px;
  height: 22px;
}

.team-org__itemMeta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-org__itemMeta strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-org__itemMeta em {
  font-style: normal;
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-org__itemSales {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1a7d58;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.team-org__bar {
  display: block;
  width: 72px;
  height: 4px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
}

.team-org__bar::after {
  content: '';
  display: block;
  width: var(--pct, 0%);
  height: 100%;
  background: #1a7d58;
  border-radius: inherit;
  transition: width 0.25s ease;
}

.team-org__bar--wide {
  width: 100%;
  height: 6px;
  margin-top: 8px;
}

.team-org__detail {
  min-width: 0;
  padding: 18px 20px 16px;
  background: #fff;
}

.team-org__detailHead {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.team-org__detailHead h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.team-org__detailHead p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 4px 0 0;
  font-size: 0.84rem;
  color: #64748b;
}

.team-org__detailHead a {
  color: #1a7d58;
  text-decoration: none;
}

.team-org__detailHead .btn-secondary {
  margin-left: auto;
}

.team-org__metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.team-org__metric {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin: 0;
  padding: 12px 12px 12px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  min-width: 0;
}

.team-org__metricIcon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.team-org__metricIcon svg {
  width: 18px;
  height: 18px;
}

.team-org__metricBody {
  min-width: 0;
}

.team-org__metrics dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.team-org__metrics dd {
  margin: 2px 0 0;
  font-size: 1.12rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-org__metrics small {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-org__metric--members {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.team-org__metric--members .team-org__metricIcon {
  background: #059669;
  color: #ecfdf5;
}

.team-org__metric--members dt,
.team-org__metric--members small {
  color: #047857;
}

.team-org__metric--members dd {
  color: #064e3b;
}

.team-org__metric--policies {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.team-org__metric--policies .team-org__metricIcon {
  background: #1d4ed8;
  color: #eff6ff;
}

.team-org__metric--policies dt,
.team-org__metric--policies small {
  color: #1d4ed8;
}

.team-org__metric--policies dd {
  color: #1e3a8a;
}

.team-org__metric--sales {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.team-org__metric--sales .team-org__metricIcon {
  background: #d97706;
  color: #fffbeb;
}

.team-org__metric--sales dt,
.team-org__metric--sales small {
  color: #b45309;
}

.team-org__metric--sales dd {
  color: #78350f;
}

.team-org__metric--share {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #5b21b6;
}

.team-org__metric--share .team-org__metricIcon {
  background: #7c3aed;
  color: #f5f3ff;
}

.team-org__metric--share dt,
.team-org__metric--share small {
  color: #6d28d9;
}

.team-org__metric--share dd {
  color: #4c1d95;
}

.team-org__table {
  margin: 0;
}

.team-org__table .data-table {
  min-width: 820px;
}

.team-org__table th,
.team-org__table td {
  white-space: nowrap;
  vertical-align: middle;
  padding: 10px 12px;
}

.team-org__agent {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.team-org__agent strong {
  font-weight: 700;
  color: #0f172a;
}

.team-org__agent span {
  color: #64748b;
}

.team-org__role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.team-org__star {
  width: 14px;
  height: 14px;
  color: #eab308;
  fill: #eab308;
  flex-shrink: 0;
}

.team-org__none,
.team-org-empty {
  margin: 0;
  padding: 28px 18px;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

.team-org-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.team-total-row td {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.team-total-row--all td {
  background: #ecfdf5;
}

@media (max-width: 1080px) {
  .team-org__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .team-org__kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .team-org__kpis > div:nth-child(2) {
    border-right: 0;
  }

  .team-org__kpis > div:nth-child(1),
  .team-org__kpis > div:nth-child(2) {
    border-bottom: 1px solid var(--border-color, #e2e8f0);
  }

  .team-org__workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .team-org__list {
    border-right: 0;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    max-height: 280px;
  }

  .team-org__detailHead {
    flex-wrap: wrap;
  }

  .team-org__detailHead .btn-secondary {
    margin-left: 0;
  }
}

.admin-hint--demo {
  margin-top: 6px;
  padding: 10px 12px;
  background: #f0fdf4;
  border: 1px solid rgba(61, 184, 138, 0.25);
  border-radius: var(--radius-sm);
}

.admin-hint--demo code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.82em;
}

/* Agent feature permissions (admin) */
.admin-modal.wide {
  max-width: 760px;
}

/* Agent create / edit form */
.agent-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.agent-form__intro {
  margin: 0;
  padding: 14px 16px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.agent-form__intro strong {
  color: var(--text-dark);
  font-weight: 600;
}

.agent-form__section {
  margin: 0;
  padding: 16px 16px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
}

.agent-form__sectionHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.agent-form__sectionTitle {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--text-dark);
  display: inline-flex;
  align-items: center;
}

.agent-form__sectionBadge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #047c5d;
  background: #ecfdf5;
  border-radius: 999px;
}

.agent-form__sectionBadge--muted {
  color: #64748b;
  background: #f1f5f9;
}

.agent-form__sectionHint {
  margin: -4px 0 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.agent-commission-rates {
  display: grid;
  gap: 10px;
}

.agent-commission-rates__howto {
  margin: -4px 0 14px;
  padding: 0 0 0 18px;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #475569;
}

.agent-commission-rates__howto li + li {
  margin-top: 4px;
}

.agent-commission-rates__override .wht50-settings__option {
  margin-top: 0;
}

.agent-commission-rates__group {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.agent-commission-rates__category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: #f8fafc;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}

.agent-commission-rates__category:hover {
  background: #f1f5f9;
}

.agent-commission-rates__category-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.agent-commission-rates__category-left em {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
}

.agent-commission-rates__cat-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #1a7d58;
}

.agent-commission-rates__chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #94a3b8;
  transition: transform 0.18s ease;
}

.agent-commission-rates__group.is-open .agent-commission-rates__chevron {
  transform: rotate(180deg);
}

.agent-commission-rates__panel {
  display: grid;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid #eef2f7;
  background: #fff;
}

.agent-commission-rates__panel[hidden] {
  display: none;
}

.agent-commission-rates__bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  font-size: 0.8rem;
  color: #166534;
}

.agent-commission-rates__bulk > span {
  font-weight: 700;
}

.agent-commission-rates__bulk label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 600;
}

.agent-commission-rates__bulk input[type="number"] {
  width: 64px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #86efac;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  text-align: right;
}

.agent-commission-rates__bulkTax {
  padding: 4px 8px;
  border-radius: 8px;
  background: #fff;
}

.agent-commission-rates__cols,
.agent-commission-rates__row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) 110px minmax(160px, 1fr) minmax(120px, 0.9fr);
  gap: 10px;
  align-items: center;
}

.agent-commission-rates__cols {
  padding: 4px 10px 2px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
}

.agent-commission-rates__row {
  padding: 8px 10px;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  background: #f8fafc;
  min-height: 52px;
}

.agent-commission-rates__cell {
  min-width: 0;
}

.agent-commission-rates__field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-commission-rates__field.is-disabled {
  opacity: 0.45;
}

.agent-commission-rates__tax-block {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.agent-commission-rates__tax-block.is-off .agent-commission-rates__input {
  opacity: 0.4;
}

.agent-commission-rates__tax-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #b45309;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.agent-commission-rates__tax-block.is-off .agent-commission-rates__tax-toggle {
  color: #64748b;
}

.agent-commission-rates__tax-toggle input {
  width: auto;
  margin: 0;
  accent-color: #d97706;
}

.agent-commission-rates__result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  background: #fffbeb;
  color: #92400e;
}

.agent-commission-rates__result.is-wht50 {
  background: #ecfdf5;
  color: #047857;
}

.agent-commission-rates__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.agent-commission-rates__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.agent-commission-rates__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.agent-commission-rates__logo--fallback {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
}

.agent-commission-rates__label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
}

.agent-commission-rates__input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.agent-commission-rates__input {
  width: 64px;
  height: 34px;
  padding: 0 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  color: var(--text-dark);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}

.agent-commission-rates__input:focus {
  outline: none;
  border-color: #1a7d58;
  box-shadow: 0 0 0 3px rgba(26, 125, 88, 0.12);
}

.agent-commission-rates__suffix {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .agent-commission-rates__cols {
    display: none;
  }

  .agent-commission-rates__row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .agent-commission-rates__brand {
    grid-column: 1 / -1;
  }

  .agent-commission-rates__result {
    grid-column: 1 / -1;
  }
}

.agent-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.agent-form__grid .form-field.full {
  grid-column: 1 / -1;
}

.agent-form .form-field label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 0.84rem;
  font-weight: 600;
}

.form-req {
  color: #dc2626;
  font-weight: 700;
}

.form-field__hint {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.agent-form .form-field input {
  padding: 11px 14px;
  font-size: 0.92rem;
  border-radius: 12px;
}

.agent-form .form-field select {
  padding: 11px 14px;
  font-size: 0.92rem;
  border-radius: 12px;
  min-height: 54px;
  height: 54px;
  box-sizing: border-box;
}

.agent-form__readonly {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-dark);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

@media (max-width: 640px) {
  .agent-form__grid {
    grid-template-columns: 1fr;
  }

  .admin-modal.form {
    max-width: 100%;
  }
}

.agent-perm__tableWrap {
  max-height: 58vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.agent-perm__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.agent-perm__table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.agent-perm__table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.agent-perm__zoneHead td {
  background: #eef2ff;
  border-bottom: 1px solid #dbe3f8;
}

.agent-perm__zoneToggle {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #1f379d;
  cursor: pointer;
}

.agent-perm__zoneToggle:hover {
  text-decoration: underline;
}

.agent-perm__zone {
  width: 150px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.agent-perm__check {
  width: 120px;
  text-align: center;
}

.agent-perm__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.agent-perm__checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-green);
}

.agent-perm__status {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

.agent-perm__status--success {
  color: var(--accent-green);
  background: var(--accent-green-soft);
  border: 1px solid rgba(61, 184, 138, 0.35);
}

.admin-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 11000;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.admin-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.admin-toast--success {
  color: #166534;
  background: #ecfdf3;
  border: 1px solid #86efac;
}

.admin-toast--error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.credit-pay-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credit-pay-cell strong {
  font-size: 0.84rem;
}

.credit-pay-cell span {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.btn-text {
  border: 0;
  background: none;
  color: #1f379d;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #16a34a;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.btn-success:hover {
  background: #15803d;
}

.credit-review__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.credit-review__card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fafbfc;
}

.credit-review__card h3 {
  margin: 0 0 12px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
}

.credit-review__dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.credit-review__dl > div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  align-items: start;
}

.credit-review__dl dt {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.credit-review__dl dd {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-dark);
  font-weight: 600;
}

.credit-review__amount {
  color: #1f379d !important;
  font-size: 1.05rem !important;
}

.credit-review__slip {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.credit-review__slip img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.credit-review__slip--pdf {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #fff;
}

.credit-slip-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.credit-slip-modal img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #fff;
}

.credit-slip-modal--pdf {
  display: block;
}

@media (max-width: 640px) {
  .credit-review__grid {
    grid-template-columns: 1fr;
  }

  .credit-review__dl > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ── WHT50 settings (admin) ── */
.wht50-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 20px;
  align-items: start;
}

.wht50-settings__form {
  min-width: 0;
}

.wht50-settings__titleIcon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -2px;
  color: #047c5d;
}

.wht50-settings__signRow {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(200px, 0.9fr);
  gap: 14px;
  align-items: stretch;
}

.wht50-settings__dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 180px;
  padding: 20px 16px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.wht50-settings__dropzone:hover {
  border-color: #34d399;
  background: #f0fdf9;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.wht50-settings__dropzoneIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 12px;
  background: #ecfdf5;
  color: #047c5d;
}

.wht50-settings__dropzoneIcon i,
.wht50-settings__dropzoneIcon svg {
  width: 22px;
  height: 22px;
}

.wht50-settings__dropzoneTitle {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--text-dark);
}

.wht50-settings__dropzoneMeta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.wht50-settings__dropzoneBtn {
  display: inline-flex;
  margin-top: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #047c5d;
  background: #fff;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
}

.wht50-settings__signPreviewCard {
  display: flex;
  flex-direction: column;
  min-height: 180px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.wht50-settings__signPreviewHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.wht50-settings__signaturePreview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #fff;
}

.wht50-settings__signaturePreview img {
  max-width: 100%;
  max-height: 110px;
  object-fit: contain;
}

.wht50-settings__signaturePreview--stamp img {
  max-height: 120px;
}

.wht50-settings__previewEmpty {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.wht50-settings__option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #a7f3d0;
  border-radius: 14px;
  background: #f0fdf9;
  cursor: pointer;
}

.wht50-settings__option input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: #059669;
}

.wht50-settings__optionBody {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wht50-settings__optionTitle {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text-dark);
  line-height: 1.4;
}

.wht50-settings__optionDesc {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.wht50-settings__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.wht50-settings__actions .btn-primary,
.wht50-settings__actions .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wht50-settings__actions .btn-primary i,
.wht50-settings__actions .btn-secondary i,
.wht50-settings__actions .btn-primary svg,
.wht50-settings__actions .btn-secondary svg {
  width: 15px;
  height: 15px;
}

.wht50-settings__actionsRight {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.wht50-settings__aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 16px;
}

.wht50-settings__asideCard {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.wht50-settings__asideCard--muted {
  background: #f8fafc;
}

.wht50-settings__asideIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: #ecfdf5;
  color: #047c5d;
}

.wht50-settings__asideIcon i,
.wht50-settings__asideIcon svg {
  width: 20px;
  height: 20px;
}

.wht50-settings__asideTitle {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text-dark);
}

.wht50-settings__asideList {
  margin: 0;
  padding-left: 18px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.wht50-settings__asideText {
  margin: 0 0 8px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.wht50-settings__asideText:last-child {
  margin-bottom: 0;
}

@media (max-width: 960px) {
  .wht50-settings {
    grid-template-columns: 1fr;
  }

  .wht50-settings__aside {
    position: static;
  }
}

@media (max-width: 720px) {
  .wht50-settings__signRow {
    grid-template-columns: 1fr;
  }

  .wht50-settings__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .wht50-settings__actionsRight {
    margin-left: 0;
  }

  .wht50-settings__actions .btn-primary,
  .wht50-settings__actions .btn-secondary {
    justify-content: center;
  }
}

/* ── Adjust balance slip upload ── */
.req {
  color: #dc2626;
}

.adjust-slip-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 12px 14px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.adjust-slip-upload:hover,
.adjust-slip-upload.has-file {
  border-color: #1f379d;
  background: #f5f7ff;
  color: #1f379d;
}

.adjust-slip-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.adjust-slip-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

.adjust-slip-preview__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 0.85rem;
}
