/* ================================================================
   DJOHNPAO ARTISAN TEAM & ACCOUNTS MANAGEMENT SYSTEM (TEAM.CSS)
   Menyelaraskan halaman kelola akun staf (users.php) dengan sistem
   tema resmi DJOHNPAO (Light Mode Artisan Cream & Dark Mode Espresso).
   ================================================================ */

/* --- 1. Canvas & Layout Utama --- */
body.team-body {
  margin: 0;
  background-color: var(--canvas-bg, #faf5f0) !important;
  color: var(--text-main, #2b1810) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  padding: clamp(16px, 3vw, 48px) 16px;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.team-page-wrapper {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

.team-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(22px, 3.5vw, 42px);
  background: var(--card-bg, #ffffff);
  border: 1.5px solid var(--card-border, #ebdcd0);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(65, 42, 25, 0.06);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* --- 2. Header & Top Navigasi --- */
.team-header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  border-bottom: 1.5px solid var(--card-border, #ebdcd0);
  margin-bottom: 24px;
}

.team-brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.team-brand {
  display: block;
  width: 190px;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}

.eyebrow-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fbf5ee;
  border: 1px solid #ebdcd0;
  color: #9c5a3c;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.team-title-section {
  margin-bottom: 24px;
}

.team-title-section h1 {
  font-family: var(--font-serif, "Playfair Display", Georgia, serif);
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
  font-weight: 750;
  color: var(--text-main, #2b1810);
  letter-spacing: -0.03em;
  margin: 0 0 6px 0;
}

.team-title-section p {
  color: var(--text-muted, #78716c);
  font-size: 0.88rem;
  margin: 0;
  line-height: 1.6;
  max-width: 760px;
}

/* --- 3. Tombol-Tombol Navigasi Artisan --- */
.team-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  border-radius: 12px !important;
  border: 1px solid transparent !important;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-sizing: border-box;
}

.btn-back-dashboard {
  background: #fdf8f4 !important;
  color: #71472d !important;
  border-color: #ebdcd0 !important;
}

.btn-back-dashboard:hover {
  background: #f3e5d7 !important;
  border-color: #dabfa8 !important;
  transform: translateY(-1px);
}

.btn-team-logout {
  background: #fef2f2 !important;
  color: #991b1b !important;
  border-color: #fecaca !important;
}

.btn-team-logout:hover {
  background: #fee2e2 !important;
  border-color: #f87171 !important;
  transform: translateY(-1px);
}

/* --- 4. Alert & Notices --- */
.team-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 22px;
  line-height: 1.5;
}

.team-alert.success {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  color: #166534;
}

.team-alert.error {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #991b1b;
}

.team-alert.info {
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
  color: #0369a1;
}

/* --- 5. Toolbar Pencarian & Filter --- */
.staff-toolbar-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  background: #fcf9f6;
  border: 1.5px solid var(--card-border, #ebdcd0);
  border-radius: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.staff-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
}

.staff-search-icon {
  position: absolute;
  left: 14px;
  color: #9c8a7c;
  pointer-events: none;
}

.staff-search-wrapper input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border-radius: 12px;
  border: 1.5px solid #dfd3c5;
  background: #ffffff;
  color: var(--text-main, #2b1810);
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.staff-search-wrapper input:focus {
  border-color: #9c5a3c;
  box-shadow: 0 0 0 3px rgba(156, 90, 60, 0.15);
}

.staff-filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.staff-select-wrap select {
  padding: 9px 14px;
  border-radius: 12px;
  border: 1.5px solid #dfd3c5;
  background: #ffffff;
  color: var(--text-main, #2b1810);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.staff-select-wrap select:focus {
  border-color: #9c5a3c;
}

.staff-count-pill {
  padding: 7px 14px;
  border-radius: 999px;
  background: #f2e7dc;
  color: #71472d;
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

/* --- 6. Tabel Akun Staf --- */
.team-table-wrapper {
  overflow-x: auto;
  border: 1.5px solid var(--card-border, #ebdcd0);
  border-radius: 18px;
  background: #ffffff;
  margin-bottom: 28px;
  box-shadow: 0 2px 10px rgba(65, 42, 25, 0.03);
}

.team-custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.team-custom-table th {
  background: #fbf6f0;
  color: #6b5545;
  font-weight: 750;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 18px;
  border-bottom: 1.5px solid #ebdcd0;
  white-space: nowrap;
}

.team-custom-table td {
  padding: 16px 18px;
  border-bottom: 1px solid #f4eae0;
  vertical-align: middle;
}

.team-custom-table tbody tr:last-child td {
  border-bottom: none;
}

.team-custom-table tbody tr:hover td {
  background-color: #fdfaf6;
}

/* Cell Nama & User */
.staff-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.staff-avatar-mini {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.staff-avatar-mini.role-owner {
  background: #f5eedf;
  color: #8f6027;
  border: 1px solid #dfc79b;
}

.staff-avatar-mini.role-admin {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.staff-avatar-mini.role-kasir {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.staff-avatar-mini.role-gudang {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.staff-user-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.staff-user-name strong {
  color: var(--text-main, #2b1810);
  font-size: 0.92rem;
}

.staff-user-sub {
  color: var(--text-muted, #857568);
  font-size: 0.76rem;
  font-family: monospace;
}

.badge-must-reset {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 750;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  white-space: nowrap;
}

/* Badge Peran */
.staff-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 750;
  white-space: nowrap;
}

.staff-role-badge.role-owner {
  background: #fef3c7;
  color: #854d0e;
  border: 1px solid #fde047;
}

.staff-role-badge.role-admin {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.staff-role-badge.role-kasir {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.staff-role-badge.role-gudang {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

/* Badge Status */
.staff-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
  white-space: nowrap;
}

.staff-status-pill.is-active {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.staff-status-pill.is-inactive {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

/* Tombol Aksi Tabel */
.staff-actions-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-staff-action-edit {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px;
  padding: 6px 12px !important;
  border-radius: 10px !important;
  background: #fdf5ec !important;
  border: 1px solid #ebdcd0 !important;
  color: #8c532b !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-staff-action-edit:hover {
  background: #faebd9 !important;
  border-color: #dfc1a4 !important;
  transform: translateY(-1px);
}

.btn-staff-action-delete {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px;
  padding: 6px 12px !important;
  border-radius: 10px !important;
  background: #fff5f5 !important;
  border: 1px solid #fed7d7 !important;
  color: #c53030 !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-staff-action-delete:hover {
  background: #fed7d7 !important;
  border-color: #feb2b2 !important;
  transform: translateY(-1px);
}

.owner-protected {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #f7f3ee;
  border: 1px solid #e8decb;
  color: #826e5d;
  font-size: 0.74rem;
  font-weight: 650;
  white-space: nowrap;
}

/* --- 7. Formulir Tambah & Edit Staf --- */
.team-form-card {
  background: var(--card-bg, #ffffff);
  border: 1.5px solid var(--card-border, #ebdcd0);
  border-radius: 20px;
  padding: clamp(20px, 2.5vw, 28px);
  margin-top: 28px;
  box-shadow: 0 4px 16px rgba(65, 42, 25, 0.04);
  transition: all 0.3s ease;
}

.team-form-card.is-active-edit {
  border-color: #d97706 !important;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15) !important;
}

.team-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid #f0e6dc;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.team-form-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #9c5a3c;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.team-form-icon.edit-icon {
  background: #d97706;
}

.team-form-header h2 {
  font-family: var(--font-serif, "Playfair Display", Georgia, serif);
  font-size: 1.18rem;
  margin: 0;
  color: var(--text-main, #2b1810);
}

.team-form-header p {
  font-size: 0.8rem;
  color: var(--text-muted, #78716c);
  margin: 2px 0 0;
}

.team-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px 22px;
}

.team-form-grid label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main, #374151);
  margin-bottom: 5px;
}

.team-form-grid input:not([type="checkbox"]),
.team-form-grid select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid #dcd1c4;
  background: #ffffff;
  color: var(--text-main, #2b1810);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.team-form-grid input:focus,
.team-form-grid select:focus {
  border-color: #9c5a3c;
  box-shadow: 0 0 0 3px rgba(156, 90, 60, 0.15);
}

.team-status-checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid #dcd1c4;
  background: #faf6f1;
  min-height: 42px;
  box-sizing: border-box;
}

.team-status-checkbox-row input {
  width: 20px;
  height: 20px;
  accent-color: #9c5a3c;
  cursor: pointer;
}

.team-form-footer {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1.5px solid #f0e6dc;
}

.btn-submit-team {
  background: #9c5a3c !important;
  color: #ffffff !important;
  border-color: #9c5a3c !important;
  padding: 10px 22px !important;
  font-size: 0.86rem !important;
}

.btn-submit-team:hover {
  background: #844a30 !important;
  transform: translateY(-1px);
}

/* --- 8. Riwayat Audit & Dialog Hapus --- */
.team-history-card {
  background: var(--card-bg, #ffffff);
  border: 1.5px solid var(--card-border, #ebdcd0);
  border-radius: 20px;
  padding: clamp(20px, 2.5vw, 28px);
  margin-top: 32px;
}

.staff-dialog {
  width: min(500px, calc(100% - 32px));
  border: 1.5px solid #fecaca;
  border-radius: 20px;
  padding: 26px;
  background: #ffffff;
  color: #1f2937;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.staff-dialog::backdrop {
  background: rgba(20, 15, 10, 0.7);
  backdrop-filter: blur(4px);
}

.staff-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.staff-dialog-heading h2 {
  font-family: var(--font-serif, "Playfair Display", Georgia, serif);
  font-size: 1.3rem;
  color: #991b1b;
  margin: 0;
}

.staff-dialog-heading button {
  border: none;
  background: #fee2e2;
  color: #991b1b;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 9. MODE GELAP (DARK ROAST ESPRESSO) --- */
html[data-djp-theme="dark"] body.team-body {
  background-color: #141414 !important;
  color: #f4f4f4 !important;
}

html[data-djp-theme="dark"] .team-page {
  background: #1c1c1c !important;
  border-color: #383838 !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45) !important;
}

html[data-djp-theme="dark"] .team-header-nav,
html[data-djp-theme="dark"] .team-form-header,
html[data-djp-theme="dark"] .team-form-footer {
  border-color: #333333 !important;
}

html[data-djp-theme="dark"] .eyebrow-badge {
  background: #25201a !important;
  border-color: #443729 !important;
  color: #e5b378 !important;
}

html[data-djp-theme="dark"] .team-title-section h1,
html[data-djp-theme="dark"] .team-form-header h2 {
  color: #f4f4f4 !important;
}

html[data-djp-theme="dark"] .team-title-section p,
html[data-djp-theme="dark"] .team-form-header p {
  color: #c8c8c8 !important;
}

html[data-djp-theme="dark"] .btn-back-dashboard {
  background: #282420 !important;
  color: #e5b378 !important;
  border-color: #4a3b2b !important;
}

html[data-djp-theme="dark"] .btn-team-logout {
  background: #331f1f !important;
  color: #fca5a5 !important;
  border-color: #5c2b2b !important;
}

html[data-djp-theme="dark"] .staff-toolbar-card {
  background: #242424 !important;
  border-color: #3d3d3d !important;
}

html[data-djp-theme="dark"] .staff-search-wrapper input,
html[data-djp-theme="dark"] .staff-select-wrap select {
  background: #1e1e1e !important;
  border-color: #444444 !important;
  color: #f5f5f5 !important;
}

html[data-djp-theme="dark"] .staff-count-pill {
  background: #332b22 !important;
  color: #f5c88c !important;
}

html[data-djp-theme="dark"] .team-table-wrapper {
  background: #1e1e1e !important;
  border-color: #383838 !important;
}

html[data-djp-theme="dark"] .team-custom-table th {
  background: #282828 !important;
  color: #d1d5db !important;
  border-color: #3d3d3d !important;
}

html[data-djp-theme="dark"] .team-custom-table td {
  border-color: #2e2e2e !important;
  color: #f4f4f4 !important;
}

html[data-djp-theme="dark"] .team-custom-table tbody tr:hover td {
  background-color: #262626 !important;
}

html[data-djp-theme="dark"] .staff-user-name strong {
  color: #ffffff !important;
}

html[data-djp-theme="dark"] .staff-user-sub {
  color: #a3a3a3 !important;
}

html[data-djp-theme="dark"] .btn-staff-action-edit {
  background: #2d2620 !important;
  border-color: #503d2e !important;
  color: #f5c88c !important;
}

html[data-djp-theme="dark"] .btn-staff-action-delete {
  background: #351c1c !important;
  border-color: #592929 !important;
  color: #fca5a5 !important;
}

html[data-djp-theme="dark"] .owner-protected {
  background: #252525 !important;
  border-color: #3d3d3d !important;
  color: #9e9e9e !important;
}

html[data-djp-theme="dark"] .team-form-card,
html[data-djp-theme="dark"] .team-history-card {
  background: #1f1f1f !important;
  border-color: #383838 !important;
}

html[data-djp-theme="dark"] .team-form-grid label {
  color: #e5e7eb !important;
}

html[data-djp-theme="dark"] .team-form-grid input:not([type="checkbox"]),
html[data-djp-theme="dark"] .team-form-grid select {
  background: #181818 !important;
  border-color: #444444 !important;
  color: #f5f5f5 !important;
}

html[data-djp-theme="dark"] .team-status-checkbox-row {
  background: #252525 !important;
  border-color: #444444 !important;
  color: #f5f5f5 !important;
}

html[data-djp-theme="dark"] .staff-dialog {
  background: #1c1c1c !important;
  border-color: #4d2b2b !important;
  color: #f4f4f4 !important;
}

/* --- 10. Responsivitas Layar Sempit (HP / Mobile) --- */
@media (max-width: 768px) {
  body.team-body {
    padding: 10px;
  }
  .team-page {
    padding: 18px 14px;
    border-radius: 18px;
  }
  .team-header-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .team-top-actions {
    justify-content: flex-start;
  }
  .staff-toolbar-card {
    flex-direction: column;
    align-items: stretch;
  }
  .staff-filters-row {
    flex-direction: column;
    align-items: stretch;
  }
  .staff-select-wrap select {
    width: 100%;
  }
  .team-form-grid {
    grid-template-columns: 1fr;
  }
  .team-form-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-submit-team {
    width: 100%;
  }
}
