/* ===========================================================
   DBL Team & KPI styles – optimized & scoped
   File: css/dbl-team.css (legacy mirror of assets/css/dbl-team.css)

   NOTE: This stylesheet intentionally mirrors the asset copy so cached
   requests to the historic css/dbl-team.css path still receive the full
   ruleset. Keep both files in sync when making changes.
   =========================================================== */

:root {
  --ph-gold: #D4AF37;
  --ph-bg: #1f2430;
  --ph-panel: #262c39;
  --ph-panel-2: #202633;
  --ph-stroke: rgba(212, 175, 55, .22);
  --ph-stroke-2: rgba(212, 175, 55, .14);
  --ph-text: #e9edf5;
  --ph-shadow: 0 10px 26px rgba(7, 9, 12, .28), 0 2px 8px rgba(7, 9, 12, .2);
  --ph-inner: inset 0 1px 0 rgba(255, 255, 255, .06);
}

/* ===== Base Shell ===== */
.dbl-portal {
  color: var(--ph-text);
}

.dbl-card {
  background: var(--ph-panel);
  border: 1px solid var(--ph-stroke);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--ph-shadow);
}

.dbl-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== Form Controls ===== */
.dbl-team-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.dbl-inline-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.dbl-input,
.dbl-select,
.dbl-btn {
  height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: var(--ph-bg);
  color: var(--ph-text);
  font-size: 14px;
  line-height: 20px;
}

.dbl-select {
  padding-right: 28px;
}

.dbl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  border-color: var(--ph-stroke);
  box-shadow: var(--ph-inner);
  cursor: pointer;
}

.dbl-btn.danger {
  border-color: rgba(255, 77, 77, .4);
}

.dbl-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ===== Team Table Base ===== */
.dbl-team-table,
.team-wrap .dbl-table,
.team-wrap table {
  background: var(--ph-panel);
  border: 1px solid var(--ph-stroke);
  border-radius: 12px;
  overflow: hidden;
}

.dbl-team-table table,
.team-wrap .dbl-table,
.team-wrap table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.dbl-team-table thead th,
.team-wrap .dbl-table thead th,
.team-wrap table thead th {
  text-align: left;
  font-size: 13px;
  letter-spacing: .02em;
  padding: 12px 14px;
  background: var(--ph-panel-2);
  border-bottom: 1px solid var(--ph-stroke-2);
}

.dbl-team-table tbody td,
.team-wrap .dbl-table tbody td,
.team-wrap table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.dbl-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Prevent layout breaking from long values */
.dbl-team-table td,
.dbl-team-table th,
.team-wrap .dbl-table td,
.team-wrap .dbl-table th,
.team-wrap table td,
.team-wrap table th,
.dbl-input,
.dbl-select,
.dbl-btn,
.dbl-actions a,
.dbl-actions button {
  overflow-wrap: anywhere;
}

/* ===== KPIs ===== */
.dbl-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.dbl-kpi {
  padding: 12px;
  background: var(--ph-bg);
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, .18);
}

.dbl-kpi__label {
  font-size: 12px;
  opacity: .85;
  margin-bottom: 6px;
}

.dbl-kpi__value {
  font-size: 22px;
  font-weight: 700;
}

/* ===== Desktop Layout (901px+) ===== */
@media (min-width: 901px) {
  /* Force table to display as a real table */
  body.dbl-team-scope .team-wrap table,
  body.dbl-team-scope .team-wrap table thead,
  body.dbl-team-scope .team-wrap table tbody,
  body.dbl-team-scope .team-wrap table tr,
  body.dbl-team-scope .team-wrap table th,
  body.dbl-team-scope .team-wrap table td {
    display: table !important;
  }

  body.dbl-team-scope .team-wrap table thead {
    display: table-header-group !important;
  }

  body.dbl-team-scope .team-wrap table tbody {
    display: table-row-group !important;
  }

  body.dbl-team-scope .team-wrap table tr {
    display: table-row !important;
  }

  body.dbl-team-scope .team-wrap table th,
  body.dbl-team-scope .team-wrap table td {
    display: table-cell !important;
  }

  /* Set column widths: Name (30%) | Email (35%) | Role (20%) | Actions (auto) */
  body.dbl-team-scope .team-wrap table th:nth-child(1),
  body.dbl-team-scope .team-wrap table td:nth-child(1) {
    width: 30% !important;
  }

  body.dbl-team-scope .team-wrap table th:nth-child(2),
  body.dbl-team-scope .team-wrap table td:nth-child(2) {
    width: 35% !important;
  }

  body.dbl-team-scope .team-wrap table th:nth-child(3),
  body.dbl-team-scope .team-wrap table td:nth-child(3) {
    width: 20% !important;
  }

  body.dbl-team-scope .team-wrap table th:nth-child(4),
  body.dbl-team-scope .team-wrap table td:nth-child(4) {
    width: auto !important;
  }

  /* Forms inside table cells */
  body.dbl-team-scope .team-wrap table td form {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
  }

  /* Text/Email inputs */
  body.dbl-team-scope .team-wrap table td input[type="text"],
  body.dbl-team-scope .team-wrap table td input[type="email"] {
    flex: 1 1 180px;
    min-width: 160px;
    max-width: 100%;
    height: 40px;
    padding: 8px 12px;
    font-size: 14px;
  }

  /* Role select dropdown */
  body.dbl-team-scope .team-wrap table td select[name="new_role"] {
    flex: 1 1 140px;
    min-width: 130px !important;
    max-width: 180px;
    height: 40px;
    padding: 8px 32px 8px 12px;
  }

  /* Buttons */
  body.dbl-team-scope .team-wrap table td form .dbl-btn {
    flex: 0 0 auto;
    height: 40px;
    padding: 8px 14px;
    min-width: 80px;
  }

  /* Actions column wraps naturally */
  body.dbl-team-scope .team-wrap table td:nth-child(4) {
    white-space: normal !important;
    vertical-align: top !important;
  }

  body.dbl-team-scope .team-wrap table td:nth-child(4) .actions-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  body.dbl-team-scope .team-wrap table td:nth-child(4) .action-item {
    width: 100%;
  }

  body.dbl-team-scope .team-wrap table td:nth-child(4) .action-item form {
    width: 100%;
  }

  body.dbl-team-scope .team-wrap table td:nth-child(4) .action-item .dbl-btn {
    width: auto;
    display: inline-flex;
  }

  /* Kill any before content on desktop */
  body.dbl-team-scope .team-wrap table td::before {
    content: none !important;
    display: none !important;
  }
}

/* ===== Tablet Layout (641px - 900px) ===== */
@media (max-width: 900px) and (min-width: 641px) {
  .dbl-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Mobile Layout (max 640px) ===== */
@media (max-width: 640px) {
  .dbl-kpis {
    grid-template-columns: 1fr;
  }

  .dbl-team-controls {
    grid-template-columns: 1fr;
  }
}

/* ===== Mobile Table Cards (max 900px) ===== */
@media (max-width: 900px) {
  /* Force table display modes off */
  body.dbl-team-scope .team-wrap table thead,
  .team-wrap table thead {
    display: none !important;
  }

  body.dbl-team-scope .team-wrap table,
  body.dbl-team-scope .team-wrap table tbody,
  body.dbl-team-scope .team-wrap table tr,
  body.dbl-team-scope .team-wrap table td,
  .team-wrap table,
  .team-wrap table tbody,
  .team-wrap table tr,
  .team-wrap table td {
    display: block !important;
    width: 100%;
  }

  /* Card-style rows */
  body.dbl-team-scope .team-wrap table tbody tr,
  .team-wrap table tbody tr {
    background: #2a3040;
    border: 1px solid var(--ph-stroke-2);
    border-radius: 12px;
    padding: 16px;
    margin: 0 0 16px;
  }

  /* Block layout for cells */
  body.dbl-team-scope .team-wrap table tbody td,
  .team-wrap table tbody td {
    border: 0;
    padding: 12px 0;
    display: block !important;
  }

  /* Labels via data attributes */
  body.dbl-team-scope .team-wrap table td::before,
  .team-wrap table tbody td::before {
    content: attr(data-label) !important;
    display: block !important;
    font-weight: 700;
    color: var(--ph-gold);
    margin-bottom: 8px;
    font-size: 13px;
    letter-spacing: 0.5px;
  }

  /* Forms inside mobile cells */
  body.dbl-team-scope .team-wrap td form,
  .team-wrap td form {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  /* Full width inputs on mobile */
  body.dbl-team-scope .team-wrap input[type="text"],
  body.dbl-team-scope .team-wrap input[type="email"],
  body.dbl-team-scope .team-wrap select,
  .team-wrap input[type="text"],
  .team-wrap input[type="email"],
  .team-wrap select {
    width: 100% !important;
    min-width: 0 !important;
    height: 48px !important;
    padding: 12px 14px !important;
    font-size: 16px !important;
  }

  body.dbl-team-scope .team-wrap .dbl-btn,
  .team-wrap .dbl-btn {
    width: 100% !important;
    height: 48px !important;
    justify-content: center;
  }

  /* Actions row stacks nicely */
  body.dbl-team-scope .team-wrap table tbody td[data-label="Actions"],
  .team-wrap table tbody td[data-label="Actions"] {
    display: block !important;
  }

  body.dbl-team-scope .team-wrap table tbody td[data-label="Actions"] > *,
  .team-wrap table tbody td[data-label="Actions"] > * {
    display: block;
    margin: 8px 0;
    width: 100%;
  }

  body.dbl-team-scope .team-wrap table tbody td[data-label="Actions"] form,
  .team-wrap table tbody td[data-label="Actions"] form {
    width: 100%;
  }

  body.dbl-team-scope .team-wrap table tbody td[data-label="Actions"] details,
  .team-wrap table tbody td[data-label="Actions"] details {
    margin-top: 12px;
  }
}
/* Actions Row Styling */
.team-wrap table tr.actions-row {
  background: rgba(0, 0, 0, 0.15) !important;
  border-top: 2px solid rgba(212, 175, 55, 0.3) !important;
}

.team-wrap table td.actions-cell {
  padding: 0 !important;
}

.team-wrap .actions-section {
  padding: 18px;
}

.team-wrap .actions-title {
  color: #F3D37A;
  font-weight: 800;
  font-size: 16px;
  margin: 0 0 14px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.24);
}

.team-wrap .actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.team-wrap .actions-grid .action-item {
  display: block;
  width: 100%;
}

/* Profile Editor Styling */
.team-wrap .profile-editor {
  background: rgba(0, 0, 0, 0.08);
  border: 1px dashed rgba(212, 175, 55, 0.28);
  border-radius: 10px;
  margin: 0;
}

.team-wrap .profile-editor summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
  color: #e9edf5;
  list-style: none;
}

.team-wrap .profile-editor summary::-webkit-details-marker {
  display: none;
}

.team-wrap .profile-editor-body {
  padding: 14px;
}

.team-wrap .profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.team-wrap .profile-section-title {
  grid-column: 1 / -1;
  font-weight: 800;
  color: #F3D37A;
  margin-top: 10px;
  font-size: 14px;
}

.team-wrap .profile-section-title:first-child {
  margin-top: 0;
}

.team-wrap .profile-section-full {
  grid-column: 1 / -1;
}

.team-wrap .profile-actions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(212, 175, 55, 0.14);
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .team-wrap .actions-grid {
    grid-template-columns: 1fr;
  }
  
  .team-wrap .profile-grid {
    grid-template-columns: 1fr;
  }
}
/* =========================================
   IMPROVED ACTIONS SECTION STYLING
   ========================================= */

/* Actions Row Styling */
.team-wrap table tr.actions-row {
  background: linear-gradient(180deg, rgba(38, 44, 57, 0.6), rgba(32, 38, 51, 0.6)) !important;
  border-top: 2px solid rgba(212, 175, 55, 0.35) !important;
}

.team-wrap table td.actions-cell {
  padding: 0 !important;
}

.team-wrap .actions-section {
  padding: 20px;
}

.team-wrap .actions-title {
  color: #F3D37A;
  font-weight: 800;
  font-size: 18px;
  margin: 0 0 18px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(212, 175, 55, 0.3);
  text-align: center;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.team-wrap .actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}

.team-wrap .actions-grid .action-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
}

/* Center delete button and style it */
.team-wrap .actions-grid .action-item > em {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  color: #c7cfdd !important;
  font-style: normal;
  min-height: 48px;
}

.team-wrap .actions-grid .action-item form.dbl-inline-form {
  display: flex;
  justify-content: center;
  width: 100%;
}

.team-wrap .actions-grid .dbl-btn.danger {
  width: 100%;
  justify-content: center;
  min-height: 48px;
}

/* =========================================
   CARRIER DOCUMENTS SECTION IMPROVEMENTS
   ========================================= */

.team-wrap .carrier-docvault {
  width: 100%;
}

.team-wrap .carrier-docvault details {
  background: #262c39;
  border: 1px solid rgba(212, 175, 55, 0.30);
  border-radius: 12px;
  margin: 0;
  box-shadow: 0 4px 12px rgba(7, 9, 12, 0.28);
}

.team-wrap .carrier-docvault summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.35px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.24);
  background: linear-gradient(180deg, rgba(42, 48, 64, 0.8), rgba(37, 43, 59, 0.8));
}

.team-wrap .carrier-docvault summary::-webkit-details-marker {
  display: none;
}

.team-wrap .carrier-docvault summary .title {
  font-size: 16px;
  color: #F3D37A;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.team-wrap .carrier-docvault .section-body {
  padding: 16px;
}

/* =========================================
   PROFILE EDITOR IMPROVEMENTS
   ========================================= */

.team-wrap .profile-editor {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 12px;
  margin: 0;
  box-shadow: 0 4px 12px rgba(7, 9, 12, 0.28);
}

.team-wrap .profile-editor summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
  color: #F3D37A;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, rgba(42, 48, 64, 0.6), rgba(37, 43, 59, 0.6));
  border-radius: 12px 12px 0 0;
  transition: background 0.2s ease;
  font-size: 15px;
  letter-spacing: 0.3px;
}

.team-wrap .profile-editor summary::-webkit-details-marker {
  display: none;
}

.team-wrap .profile-editor summary:hover {
  background: linear-gradient(180deg, rgba(42, 48, 64, 0.8), rgba(37, 43, 59, 0.8));
}

.team-wrap .profile-editor[open] summary {
  border-bottom: 1px solid rgba(212, 175, 55, 0.24);
  border-radius: 12px 12px 0 0;
}

.team-wrap .profile-editor-body {
  padding: 16px;
  background: linear-gradient(180deg, #262c39, #202633);
}

.team-wrap .profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.team-wrap .profile-section-title {
  grid-column: 1 / -1;
  font-weight: 800;
  color: #F3D37A;
  margin-top: 14px;
  padding: 8px 0;
  font-size: 15px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  letter-spacing: 0.5px;
}

.team-wrap .profile-section-title:first-child {
  margin-top: 0;
}

.team-wrap .profile-section-full {
  grid-column: 1 / -1;
}

.team-wrap .profile-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid rgba(212, 175, 55, 0.2);
  display: flex;
  justify-content: center;
}

.team-wrap .profile-actions .dbl-btn {
  min-width: 200px;
  justify-content: center;
}

/* =========================================
   DOCUMENTS LIST STYLING
   ========================================= */

.team-wrap .carrier-docvault h5 {
  text-align: center;
  color: #F3D37A;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 12px 0 10px;
  font-size: 14px;
  text-transform: uppercase;
}

.team-wrap .carrier-docvault .doc-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.team-wrap .carrier-docvault .doc-list li {
  margin: 8px 0;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 8px;
}

.team-wrap .carrier-docvault .dbl-btn {
  flex: 1;
  min-width: 150px;
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */

@media (max-width: 900px) {
  .team-wrap .actions-grid {
    grid-template-columns: 1fr;
  }
  
  .team-wrap .profile-grid {
    grid-template-columns: 1fr;
  }
  
  .team-wrap .actions-title {
    font-size: 16px;
  }
  
  .team-wrap .profile-editor summary,
  .team-wrap .carrier-docvault summary .title {
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .team-wrap .actions-section {
    padding: 14px;
  }
  
  .team-wrap .profile-editor-body {
    padding: 12px;
  }
  
  .team-wrap .actions-grid {
    gap: 12px;
  }
}
.team-wrap .profile-section-title {
  grid-column: 1 / -1;
  font-weight: 800;
  color: #F3D37A;
  margin-top: 14px;
  padding: 8px 0;
  font-size: 15px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  letter-spacing: 0.5px;
  text-align: center; /* Add this line */
}
.team-wrap .profile-section-title {
  grid-column: 1 / -1;
  font-weight: 800;
  color: #F3D37A;
  margin-top: 14px;
  padding: 8px 0;
  font-size: 15px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  letter-spacing: 0.5px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.team-wrap .profile-section-title .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}