/* ═══════════════════════════════════════════════════════════════════════
   Organization Profile — Page styles
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Content area ────────────────────────────────────────────────────── */
.content-area {
  max-width: 1200px;
  padding: 28px 40px 28px 16px;
}

/* ── Page header ─────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.page-header-icon svg {
  width: 22px;
  height: 22px;
  color: var(--accent-primary, #7c5cff);
}

.page-header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #f0f0f5);
  margin: 0 0 4px 0;
  line-height: 1.2;
}

.page-header-desc {
  font-size: 13px;
  color: var(--text-secondary, #a0a0b5);
  margin: 0;
}

/* ── Section cards ───────────────────────────────────────────────────── */
.org-section {
  margin-bottom: 24px;
  padding: 24px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(14, 24, 40, 0.98), rgba(12, 21, 35, 0.98));
  border: 1px solid rgba(28, 69, 104, 0.55);
  box-shadow: 0 18px 44px rgba(2, 8, 23, 0.32);
}

/* ── Section headers — mandatory purple-to-teal gradient ─────────────── */
.org-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin: -24px -24px 20px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.18) 0%,
    rgba(124, 92, 255, 0.06) 35%,
    transparent 55%,
    rgba(0, 180, 100, 0.03) 72%,
    rgba(0, 180, 100, 0.07) 100%
  );
  box-shadow: inset 0 1px 0 rgba(124, 92, 255, 0.10),
              inset 0 -1px 0 rgba(124, 92, 255, 0.22);
}

.org-section-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.org-section-desc {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

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

/* ── Profile form grid ───────────────────────────────────────────────── */
.org-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.org-form-group--full {
  grid-column: 1 / -1;
}

.org-form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7f99b6;
}

.org-form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-field-bg, rgba(10, 18, 32, 0.85));
  border: 1px solid var(--color-field-border, rgba(50, 80, 120, 0.4));
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.875rem;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.org-form-control:focus {
  outline: none;
  border-color: var(--accent-primary, #7c5cff);
  box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.2);
}

.org-form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.org-form-control {
  cursor: pointer;
  appearance: auto;
}

textarea.org-form-control {
  resize: vertical;
  min-height: 72px;
}

.org-char-count {
  display: block;
  text-align: right;
  font-size: 0.72rem;
  color: var(--color-text-muted, #6b7f99);
  margin-top: 4px;
}

/* ── Form actions ────────────────────────────────────────────────────── */
.org-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(50, 80, 120, 0.2);
}

.org-dirty-notice {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 170, 0, 0.28);
  background: rgba(255, 170, 0, 0.08);
  color: #ffd78a;
  font-size: 0.82rem;
  font-weight: 600;
}

.org-required {
  color: #ff5566;
}

/* ── Filters row ─────────────────────────────────────────────────────── */
.org-filters-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.org-filter-input,
.org-filter-select {
  padding: 8px 12px;
  background: var(--color-field-bg, rgba(10, 18, 32, 0.85));
  border: 1px solid var(--color-field-border, rgba(50, 80, 120, 0.4));
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.82rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.org-filter-input {
  flex: 1;
  min-width: 0;
  width: auto;
}

.org-filter-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 180px;
}

.org-filter-input:focus,
.org-filter-select:focus {
  outline: none;
  border-color: var(--accent-primary, #7c5cff);
  box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.2);
}

/* ── Personnel table ─────────────────────────────────────────────────── */
.org-table-wrapper {
  overflow-x: auto;
}

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

.org-data-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7f99b6;
  border-bottom: 1px solid rgba(50, 80, 120, 0.3);
  white-space: nowrap;
}

.org-data-table tbody td {
  padding: 12px 14px;
  color: var(--color-text);
  border-bottom: 1px solid rgba(50, 80, 120, 0.15);
  vertical-align: middle;
}

.org-data-table tbody tr:hover {
  background: rgba(124, 92, 255, 0.04);
}

.org-data-table tbody tr.org-row-clickable {
  cursor: pointer;
  user-select: none;
}

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

/* Sortable headers — match DESIGN.md Section 11 pattern */
.org-data-table thead th.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;
}

.org-data-table thead th.sortable-header:hover {
  color: #c4b5fd;
}

.org-data-table thead th.sortable-header::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(127, 153, 182, 0.35);
  transform: translateY(-50%);
  transition: border-color 0.15s, transform 0.15s;
}

.org-data-table thead th.sortable-header.sort-asc::after {
  border-top: 0;
  border-bottom: 5px solid var(--accent-primary, #7c5cff);
}

.org-data-table thead th.sortable-header.sort-desc::after {
  border-top: 5px solid var(--accent-primary, #7c5cff);
}

.org-actions-col {
  width: 100px;
  text-align: center;
}

.org-data-table .org-actions-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.org-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(50, 80, 120, 0.3);
  border-radius: 6px;
  background: transparent;
  color: #7f99b6;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.org-action-btn:hover {
  background: rgba(124, 92, 255, 0.12);
  border-color: rgba(124, 92, 255, 0.4);
  color: #c4b5fd;
}

.org-action-btn--delete:hover {
  background: rgba(255, 85, 102, 0.12);
  border-color: rgba(255, 85, 102, 0.4);
  color: #ff5566;
}

.org-action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Email link ──────────────────────────────────────────────────────── */
.org-data-table a {
  color: var(--accent-primary, #7c5cff);
  text-decoration: none;
}

.org-data-table a:hover {
  text-decoration: underline;
}

/* ── Role badges ─────────────────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Default (covers any role type not explicitly themed): slate */
.role-badge {
  background: rgba(136, 145, 167, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(136, 145, 167, 0.25);
}

/* Executive: magenta */
.role-badge--ceo,
.role-badge--cfo,
.role-badge--cto,
.role-badge--board_member,
.role-badge--executive {
  background: rgba(230, 60, 160, 0.12);
  color: #e63ca0;
  border: 1px solid rgba(230, 60, 160, 0.25);
}

/* Security: teal */
.role-badge--ciso,
.role-badge--security_lead,
.role-badge--incident_commander,
.role-badge--soc_analyst,
.role-badge--response_team {
  background: rgba(0, 212, 170, 0.12);
  color: #00d4aa;
  border: 1px solid rgba(0, 212, 170, 0.25);
}

/* Compliance / Legal: blue */
.role-badge--legal_counsel,
.role-badge--compliance_officer,
.role-badge--privacy_officer,
.role-badge--external_auditor {
  background: rgba(60, 180, 255, 0.12);
  color: #3cb4ff;
  border: 1px solid rgba(60, 180, 255, 0.25);
}

/* Communications / Marketing: amber */
.role-badge--communications_marketing,
.role-badge--communications_lead {
  background: rgba(255, 170, 0, 0.12);
  color: #ffaa00;
  border: 1px solid rgba(255, 170, 0, 0.25);
}

/* IT / Operations: purple */
.role-badge--it_director,
.role-badge--systems_administrator,
.role-badge--network_engineer,
.role-badge--risk_manager,
.role-badge--vendor_manager,
.role-badge--vendor_risk_manager,
.role-badge--hr_director {
  background: rgba(124, 92, 255, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(124, 92, 255, 0.25);
}

/* Other: gray */
.role-badge--other {
  background: rgba(136, 145, 167, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(136, 145, 167, 0.25);
}

/* ── Empty state ─────────────────────────────────────────────────────── */
.org-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted, #6b7f99);
}

.org-empty-state p {
  margin: 0;
  font-size: 0.875rem;
}

.org-import-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(50, 80, 120, 0.22);
  border-radius: 8px;
  background: rgba(10, 18, 32, 0.72);
}

.org-import-link {
  color: var(--accent-primary, #7c5cff);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.org-import-link:hover {
  text-decoration: underline;
}

.org-import-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: var(--color-text-muted, #94a3b8);
}

.org-import-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.org-import-status--create {
  background: rgba(0, 212, 170, 0.12);
  color: #00d4aa;
  border: 1px solid rgba(0, 212, 170, 0.24);
}

.org-import-status--update {
  background: rgba(124, 92, 255, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(124, 92, 255, 0.24);
}

.org-import-status--error {
  background: rgba(255, 85, 102, 0.12);
  color: #ff7b8a;
  border: 1px solid rgba(255, 85, 102, 0.24);
}

.org-import-preview-meta {
  margin-top: 6px;
  font-size: 0.74rem;
}

.org-import-preview-warning {
  color: #ffd78a;
}

.org-import-preview-error {
  color: #ff7b8a;
}

/* ── Pagination ──────────────────────────────────────────────────────── */
.org-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px;
}

.org-pagination button {
  padding: 6px 12px;
  border: 1px solid rgba(50, 80, 120, 0.3);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.org-pagination button:hover:not(:disabled) {
  background: rgba(124, 92, 255, 0.12);
  border-color: rgba(124, 92, 255, 0.4);
}

.org-pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.org-pagination .org-page-info {
  font-size: 0.82rem;
  color: var(--color-text-muted, #6b7f99);
}

/* ── Personnel Slide-Out Drawer ──────────────────────────────────────── */
.org-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  display: none;
  cursor: pointer;
}

.org-panel-overlay.open {
  display: block;
}

.org-slide-drawer {
  position: fixed;
  top: 0;
  right: -520px;
  width: 500px;
  height: 100vh;
  background: var(--bg-card, var(--color-surface-solid, #0f172a));
  border-left: 1px solid var(--border-default, rgba(255, 255, 255, 0.08));
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.5), -1px 0 0 rgba(124, 92, 255, 0.15);
  z-index: 200;
  transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.org-slide-drawer.open {
  right: 0;
}

/* Accent top border — purple-to-teal gradient */
.org-slide-drawer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary, #7c5cff) 0%, var(--accent-secondary, #00d4aa) 100%);
  z-index: 1;
}

.org-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.015);
}

.org-drawer-header-info {
  flex: 1;
  min-width: 0;
}

.org-drawer-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text, #f8fafc);
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.org-drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 12px;
}

.org-drawer-close-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--color-text-muted, #94a3b8);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.org-drawer-close-btn:hover {
  color: var(--color-text, #f8fafc);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
}

.org-drawer-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  scrollbar-width: none;
}

.org-drawer-body::-webkit-scrollbar {
  display: none;
}

.org-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.015);
}

/* Two-column row inside the drawer form */
.org-drawer-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Legacy modal row (kept for import modal) ────────────────────────── */
.org-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Light theme — drawer ────────────────────────────────────────────── */
[data-theme-variant="light"] .org-slide-drawer {
  background: var(--color-surface-solid, #ffffff);
  border-left-color: var(--color-border, rgba(100, 130, 200, 0.25));
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.12), -1px 0 0 rgba(124, 92, 255, 0.15);
}

[data-theme-variant="light"] .org-drawer-header {
  background: rgba(0, 0, 0, 0.02);
  border-bottom-color: rgba(100, 130, 200, 0.2);
}

[data-theme-variant="light"] .org-drawer-footer {
  background: rgba(0, 0, 0, 0.02);
  border-top-color: rgba(100, 130, 200, 0.2);
}

[data-theme-variant="light"] .org-drawer-title {
  color: #1e293b;
}

[data-theme-variant="light"] .org-drawer-close-btn {
  color: #64748b;
}

[data-theme-variant="light"] .org-drawer-close-btn:hover {
  color: #1e293b;
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

/* ── Light theme ─────────────────────────────────────────────────────── */
[data-theme-variant="light"] .org-section {
  background: linear-gradient(180deg, rgba(245, 248, 255, 0.98), rgba(240, 244, 252, 0.98));
  border-color: rgba(100, 130, 200, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

[data-theme-variant="light"] .org-section-header {
  background: linear-gradient(90deg,
    rgba(124, 92, 255, 0.08) 0%,
    rgba(124, 92, 255, 0.03) 35%,
    rgba(245, 248, 255, 0.9) 55%,
    rgba(0, 180, 100, 0.02) 72%,
    rgba(0, 180, 100, 0.04) 100%
  );
}

[data-theme-variant="light"] .org-form-label {
  color: #4a5568;
}

[data-theme-variant="light"] .org-dirty-notice {
  background: rgba(255, 170, 0, 0.06);
  border-color: rgba(255, 170, 0, 0.35);
  color: #b45309;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 540px) {
  .org-slide-drawer {
    width: 100vw;
    right: -100vw;
  }

  .org-drawer-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .content-area {
    padding: 20px 16px;
  }

  .page-header {
    flex-direction: column;
  }

  .org-form-grid {
    grid-template-columns: 1fr;
  }

  .org-section-header {
    flex-direction: column;
    gap: 10px;
  }

  .org-section-actions,
  .org-import-strip {
    align-items: stretch;
  }

  .org-filters-row {
    flex-direction: column;
  }

  .org-filter-select {
    min-width: 0;
    width: 100%;
  }

  .org-modal-row {
    grid-template-columns: 1fr;
  }

  .org-data-table {
    font-size: 0.78rem;
  }

  .org-data-table thead th,
  .org-data-table tbody td {
    padding: 8px 10px;
  }
}
