/* ============================================================
 * credentials.css — Bank ABC Portal API Sandbox
 * Board 2: Self-Service Credential Dashboard (F-02)
 * V1.1 — Sesi 11
 *
 * Dependencies: tokens.css → base.css → components.css → app-layout.css
 * Zero hardcoded hex. Semua via var(--*).
 * Story anchor: DEV-01 credential warisan "Active" padahal expired.
 * ============================================================ */


/* ============================================================
 * 1. PAGE ROOT
 * ============================================================ */

.cred-root {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding-bottom: var(--space-12);
}


/* ============================================================
 * 2. PAGE HEADER (shared pattern — move to components.css Sesi 14)
 * ============================================================ */

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--surface-muted);
}

.dash-header__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-header__eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.dash-header__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  margin: 0;
}

.dash-header__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: var(--space-1) 0 0;
}

.dash-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  margin-top: 4px;
}


/* ============================================================
 * 3. SUCCESS BANNER (post-generate)
 * ============================================================ */

.cred-success-banner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--status-success-bg);
  border: 1px solid var(--status-success-border);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  color: var(--status-success);
  font-weight: var(--font-medium);
  animation: slideDown var(--transition-slow) ease;
}

.cred-success-banner::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--status-success);
  flex-shrink: 0;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ============================================================
 * 4. TOOLBAR
 * ============================================================ */

.cred-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.cred-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  height: 36px;
  padding: 0 var(--space-3);
  background-color: var(--surface-card);
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-full);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

.cred-search:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-subtle);
}

.cred-search__icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.cred-search__input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.cred-search__input::placeholder {
  color: var(--text-tertiary);
}

.cred-filter {
  height: 36px;
  padding: 0 var(--space-3);
  background-color: var(--surface-card);
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast);
}

.cred-filter:hover {
  border-color: var(--text-tertiary);
}

.cred-filter:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.cred-toolbar__spacer {
  flex: 1;
}


/* ============================================================
 * 5. TAB SWITCHER
 * ============================================================ */

.cred-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--surface-muted);
  gap: 0;
}

.cred-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  white-space: nowrap;
  transition: color var(--transition-fast),
              border-color var(--transition-fast);
  margin-bottom: -1px;
}

.cred-tab:hover {
  color: var(--text-primary);
}

.cred-tab--active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  font-weight: var(--font-semibold);
}

.cred-tab:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
}


/* ============================================================
 * 6. MAIN LAYOUT — F-03 panel (left) + table (right)
 * ============================================================ */

.cred-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  align-items: start;
}


/* ============================================================
 * 7. F-03 SIDE PANEL — WARNA LOCKED
 * --f03-bg / --f03-border / --f03-text (immutable)
 * ============================================================ */

.cred-f03-panel {
  background-color: var(--f03-bg);
  border: 1px solid var(--f03-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cred-f03-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cred-f03-panel__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--f03-text);
}

.cred-f03-panel__count {
  font-size: var(--text-xs);
  color: var(--f03-text);
  opacity: 0.7;
}

/* Filter pills dalam F-03 panel */
.cred-f03-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.cred-f03-filter {
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--f03-text);
  background: transparent;
  border: 1px solid var(--f03-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: var(--font-sans);
  opacity: 0.65;
  transition: opacity var(--transition-fast),
              background-color var(--transition-fast);
}

.cred-f03-filter:hover {
  opacity: 1;
}

.cred-f03-filter--active {
  background-color: var(--f03-border);
  color: var(--text-inverse);
  opacity: 1;
}

/* Project list */
.cred-f03-projects {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cred-f03-project {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background-color: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  cursor: default;
}

.cred-f03-project__indicator {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  margin-top: 4px;
}

.cred-f03-project__indicator--ok      { background-color: var(--status-success); }
.cred-f03-project__indicator--warning { background-color: var(--status-warning); }
.cred-f03-project__indicator--error   { background-color: var(--status-danger); }
.cred-f03-project__indicator--pending { background-color: var(--text-tertiary); }

.cred-f03-project__body {
  flex: 1;
  min-width: 0;
}

.cred-f03-project__name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--f03-text);
  display: block;
  line-height: var(--leading-snug);
}

.cred-f03-project__note {
  font-size: var(--text-xs);
  color: var(--f03-text);
  opacity: 0.7;
  display: block;
  margin-top: 1px;
}


/* ============================================================
 * 8. TABLE AREA
 * ============================================================ */

.cred-table-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

/* Bulk actions bar — slides in when rows selected */
.cred-bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background-color: var(--brand-primary-subtle);
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  animation: slideDown var(--transition-base) ease;
}

.cred-bulk-bar__label {
  color: var(--brand-primary);
  font-weight: var(--font-semibold);
  flex: 1;
}

/* Table wrapper */
.cred-table-wrapper {
  background-color: var(--surface-card);
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-xl);
  overflow: hidden;
  overflow-x: auto;
}

.cred-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.cred-table thead th {
  background-color: var(--surface-subtle);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--surface-muted);
  white-space: nowrap;
}

.cred-table thead th:first-child {
  width: 40px;
  padding-left: var(--space-4);
}

.cred-table tbody tr {
  border-bottom: 1px solid var(--surface-muted);
  transition: background-color var(--transition-fast);
}

.cred-table tbody tr:last-child {
  border-bottom: none;
}

.cred-table tbody tr:hover {
  background-color: var(--surface-subtle);
}

.cred-table tbody tr.cred-row--selected {
  background-color: var(--brand-primary-subtle);
}

.cred-table tbody td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  vertical-align: middle;
}

.cred-table tbody td:first-child {
  padding-left: var(--space-4);
}

/* Credential name cell */
.cred-name {
  font-weight: var(--font-medium);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-primary);
}

/* Expiry cell */
.cred-expiry {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.cred-expiry--critical {
  color: var(--status-danger);
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  gap: 4px;
}

.cred-expiry--warning {
  color: var(--status-warning);
  font-weight: var(--font-medium);
}

/* Action buttons in table */
.cred-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.cred-action-btn {
  padding: 4px var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: none;
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  transition: background-color var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast);
  white-space: nowrap;
}

.cred-action-btn:hover {
  background-color: var(--surface-subtle);
  border-color: var(--text-tertiary);
  color: var(--text-primary);
}

.cred-action-btn--danger:hover {
  background-color: var(--status-danger-bg);
  border-color: var(--status-danger);
  color: var(--status-danger);
}

.cred-action-btn--primary {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--text-on-brand);
}

.cred-action-btn--primary:hover {
  background-color: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
  color: var(--text-on-brand);
}

.cred-action-btn:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}


/* ============================================================
 * 9. STATUS BADGES (R-02 post-PIC: warna semantik)
 * ============================================================ */

.cred-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  white-space: nowrap;
}

.cred-status__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.cred-status--active {
  background-color: var(--status-success-bg);
  color: var(--status-success);
}
.cred-status--active .cred-status__dot { background-color: var(--status-success); }

.cred-status--expiring {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
}
.cred-status--expiring .cred-status__dot { background-color: var(--status-warning); }

.cred-status--expired {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
}
.cred-status--expired .cred-status__dot { background-color: var(--status-danger); }


/* ============================================================
 * 10. ENV BADGE (Production variant — not in components.css yet)
 * ============================================================ */

.badge-env-production {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--space-2);
  background-color: var(--brand-primary-subtle);
  border: 1px solid var(--brand-primary);
  color: var(--brand-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  white-space: nowrap;
}


/* ============================================================
 * 11. FOOTER BAR
 * ============================================================ */

.cred-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-5);
  background-color: var(--surface-subtle);
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}


/* ============================================================
 * 12. PLACEHOLDER PANELS (tab non-aktif)
 * ============================================================ */

.cred-placeholder-panel {
  background-color: var(--surface-card);
  border: 1px dashed var(--surface-muted);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.cred-placeholder-panel__icon {
  width: 40px;
  height: 40px;
  color: var(--text-tertiary);
  opacity: 0.5;
}

.cred-placeholder-panel__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

.cred-placeholder-panel__desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 320px;
  line-height: var(--leading-relaxed);
}


/* ============================================================
 * 13. GENERATE CREDENTIAL MODAL
 * ============================================================ */

/* hidden attribute must win over display:flex — explicit override */
.cred-modal-backdrop[hidden] {
  display: none !important;
}

.cred-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.5);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.cred-modal {
  background-color: var(--surface-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn var(--transition-base) ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cred-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--surface-muted);
}

.cred-modal__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.cred-modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background-color var(--transition-fast),
              color var(--transition-fast);
}

.cred-modal__close:hover {
  background-color: var(--surface-subtle);
  color: var(--text-primary);
}

.cred-modal__close:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.cred-modal__body {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.cred-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--surface-muted);
}

/* Scope checkboxes */
.cred-scope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.cred-scope-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast),
              background-color var(--transition-fast);
}

.cred-scope-item:hover {
  border-color: var(--brand-primary);
  background-color: var(--brand-primary-subtle);
}

.cred-scope-item input[type="checkbox"] {
  accent-color: var(--brand-primary);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.cred-scope-item__label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Scope item — suggested state (auto-checked oleh sektor) */
.cred-scope-item--suggested {
  border-color: var(--brand-primary);
  background-color: var(--brand-primary-subtle);
}
.cred-scope-item--suggested .cred-scope-item__label {
  color: var(--brand-primary);
  font-weight: var(--font-semibold);
}

/* Sector package hint — banner muncul setelah sektor dipilih */
.sector-package-hint {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background-color: var(--status-info-bg);
  border: 1px solid var(--brand-primary-subtle);
  border-radius: var(--radius-md);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  animation: fadeInDown 0.2s ease;
}
.sector-package-hint[hidden] { display: none !important; }

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sector-package-hint__icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--brand-primary);
}
.sector-package-hint__name {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  display: block;
  margin-bottom: 1px;
}

/* À la carte note */
.scope-alacarte-note {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.scope-alacarte-note[hidden] { display: none !important; }

/* Environment radio */
.cred-env-options {
  display: flex;
  gap: var(--space-3);
}

.cred-env-option {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.cred-env-option:not(.cred-env-option--disabled):hover {
  border-color: var(--brand-primary);
}

.cred-env-option--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cred-env-option input[type="radio"] {
  accent-color: var(--brand-primary);
  flex-shrink: 0;
}

.cred-env-option__label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  display: block;
}

.cred-env-option__note {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  display: block;
  margin-top: 1px;
}


/* ============================================================
 * 14. RESPONSIVE
 * ============================================================ */

@media (min-width: 1024px) {
  .cred-layout {
    grid-template-columns: 220px 1fr;
  }
}

@media (max-width: 639px) {
  .cred-toolbar {
    gap: var(--space-2);
  }
  .cred-search {
    max-width: 100%;
  }
  .cred-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .cred-modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 85vh;
  }
}

/* ============================================================
 * 15. CREDENTIAL DETAIL DRAWER
 * Slide-in panel kanan. DEx: F1, F2, F8, F22, F25.
 * ============================================================ */

/* Row clickable state */
.cred-row--clickable {
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
.cred-row--clickable:hover td { background-color: var(--brand-primary-subtle); }
.cred-row--clickable:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: -2px; }
.cred-row--active td { background-color: var(--brand-primary-subtle); }
.cred-row--active .cred-name { color: var(--brand-primary); font-weight: var(--font-semibold); }

/* Drawer backdrop */
.cred-drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.35);
  z-index: calc(var(--z-modal) - 10);
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}
.cred-drawer-backdrop--open {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer panel */
.cred-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 92vw;
  background-color: var(--surface-card);
  box-shadow: -4px 0 32px rgba(15, 23, 42, 0.12);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.cred-drawer--open { transform: translateX(0); }

/* Drawer header */
.cred-drawer__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--surface-muted);
  flex-shrink: 0;
}
.cred-drawer__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cred-drawer__close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: var(--radius-md);
  color: var(--text-tertiary); cursor: pointer; flex-shrink: 0;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.cred-drawer__close:hover { background-color: var(--surface-subtle); color: var(--text-primary); }
.cred-drawer__close:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }

/* Sub-tabs inside drawer */
.cred-drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--surface-muted);
  flex-shrink: 0;
  background-color: var(--surface-subtle);
}
.cred-drawer-tab {
  flex: 1;
  padding: var(--space-2) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  text-align: center;
  white-space: nowrap;
}
.cred-drawer-tab:hover { color: var(--text-primary); }
.cred-drawer-tab--active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  font-weight: var(--font-semibold);
  background-color: var(--surface-card);
}

/* Drawer body */
.cred-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.cred-drawer-panel { display: flex; flex-direction: column; gap: var(--space-4); }
.cred-drawer-panel[hidden] { display: none; }

/* Detail field groups */
.cred-detail-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.cred-detail-section__title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--surface-muted);
}
.cred-detail-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cred-detail-row--inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.cred-detail-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--font-medium);
}
.cred-detail-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: var(--font-medium);
}
.cred-detail-value--mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

/* Masked secret with reveal toggle */
.cred-secret-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--surface-subtle);
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}
.cred-secret-value {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-primary);
  letter-spacing: 0.08em;
  word-break: break-all;
}
.cred-secret-toggle {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--text-link);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  padding: 2px var(--space-1);
  transition: opacity var(--transition-fast);
}
.cred-secret-toggle:hover { opacity: 0.75; }

/* Copy field */
.cred-copy-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--surface-subtle);
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}
.cred-copy-value {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cred-copy-btn {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  background: none;
  border: 1px solid var(--surface-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 2px var(--space-2);
  font-family: var(--font-sans);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.cred-copy-btn:hover { background-color: var(--surface-muted); color: var(--text-primary); }

/* Scope badge list */
.cred-scope-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.cred-scope-badge {
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: var(--font-medium);
  background-color: var(--brand-primary-subtle);
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary);
}

/* Audit log mini table */
.cred-audit-table { width: 100%; border-collapse: collapse; }
.cred-audit-table thead th { font-size: var(--text-xs); font-weight: var(--font-semibold); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--surface-muted); padding: var(--space-2) var(--space-2); text-align: left; }
.cred-audit-table tbody tr { border-bottom: 1px solid var(--surface-muted); }
.cred-audit-table tbody tr:last-child { border-bottom: none; }
.cred-audit-table tbody td { font-size: var(--text-xs); color: var(--text-secondary); padding: var(--space-2); vertical-align: top; }
.cred-audit-table tbody td.mono { font-family: var(--font-mono); color: var(--text-primary); }

/* IP / Callback list */
.cred-ip-list { display: flex; flex-direction: column; gap: var(--space-2); }
.cred-ip-row { display: flex; align-items: center; gap: var(--space-2); }
.cred-ip-value { flex: 1; font-family: var(--font-mono); font-size: var(--text-xs); background-color: var(--surface-subtle); border: 1px solid var(--surface-muted); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); color: var(--text-primary); }
.cred-ip-remove { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: none; border: 1px solid var(--surface-muted); border-radius: var(--radius-md); color: var(--status-danger); cursor: pointer; flex-shrink: 0; transition: background-color var(--transition-fast); }
.cred-ip-remove:hover { background-color: var(--status-danger-bg); }

/* Expiry notification toggle */
.cred-notif-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3); background-color: var(--surface-subtle); border: 1px solid var(--surface-muted); border-radius: var(--radius-md); gap: var(--space-3); }
.cred-notif-label { font-size: var(--text-xs); color: var(--text-secondary); }
.cred-notif-label strong { display: block; color: var(--text-primary); font-size: var(--text-sm); font-weight: var(--font-semibold); margin-bottom: 2px; }
.cred-toggle-switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.cred-toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.cred-toggle-slider { position: absolute; inset: 0; background-color: var(--surface-muted); border-radius: var(--radius-full); cursor: pointer; transition: background-color var(--transition-fast); }
.cred-toggle-slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background-color: white; border-radius: var(--radius-full); transition: transform var(--transition-fast); }
.cred-toggle-switch input:checked + .cred-toggle-slider { background-color: var(--brand-primary); }
.cred-toggle-switch input:checked + .cred-toggle-slider::before { transform: translateX(16px); }

/* Drawer footer actions */
.cred-drawer__footer {
  flex-shrink: 0;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  background-color: var(--surface-subtle);
}
.cred-drawer__footer-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Alert banner in drawer */
.cred-drawer-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
}
.cred-drawer-alert--danger { background-color: var(--status-danger-bg); color: var(--status-danger); border: 1px solid var(--status-danger); }
.cred-drawer-alert--warning { background-color: var(--status-warning-bg); color: var(--status-warning); border: 1px solid var(--status-warning); }

@media (max-width: 639px) {
  .cred-drawer { width: 100%; max-width: 100%; }
}    [hidden] { display: none !important; }
    .cred-toolbar {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      flex-wrap: wrap;
    }
    .cred-toolbar .btn { white-space: nowrap; flex-shrink: 0; }

    /* ─── Authentication Guide ─── */
    .auth-guide { padding: var(--space-6) 0; max-width: 720px; }
    .auth-guide__intro { display:flex; gap:var(--space-4); padding:var(--space-4); background:var(--brand-primary-subtle,#EBF2FA); border:1px solid var(--brand-primary-border,#B3CDEF); border-radius:var(--radius-lg); margin-bottom:var(--space-5); }
    .auth-guide__intro-icon { flex-shrink:0; width:36px; height:36px; display:flex; align-items:center; justify-content:center; background:var(--color-primary-600,#003D79); color:#fff; border-radius:var(--radius-md); }
    .auth-guide__intro-title { font-size:var(--text-sm); font-weight:var(--font-semibold); color:var(--text-primary); margin:0 0 var(--space-1); }
    .auth-guide__intro-desc { font-size:var(--text-xs); color:var(--text-secondary); margin:0; line-height:1.6; }
    .auth-guide__spec-bar { display:flex; align-items:center; gap:var(--space-4); padding:var(--space-3) var(--space-4); background:var(--surface-subtle,#F8F9FA); border:1px solid var(--border-default); border-radius:var(--radius-md); margin-bottom:var(--space-6); flex-wrap:wrap; }
    .auth-guide__spec-item { display:flex; flex-direction:column; gap:2px; }
    .auth-guide__spec-label { font-size:10px; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:.04em; font-weight:var(--font-medium); }
    .auth-guide__spec-value { font-size:var(--text-xs); font-weight:var(--font-semibold); color:var(--text-primary); font-family:var(--font-mono); }
    .auth-guide__spec-divider { width:1px; height:28px; background:var(--border-default); }
    .auth-guide__steps { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:var(--space-6); }
    .auth-guide__step { border:1px solid var(--border-default); border-radius:var(--radius-lg); padding:var(--space-5); background:var(--surface-base,#fff); }
    .auth-guide__step-header { display:flex; gap:var(--space-3); margin-bottom:var(--space-4); }
    .auth-guide__step-num { flex-shrink:0; width:24px; height:24px; border-radius:50%; background:var(--color-primary-600,#003D79); color:#fff; font-size:11px; font-weight:var(--font-bold); display:flex; align-items:center; justify-content:center; margin-top:1px; }
    .auth-guide__step-title { font-size:var(--text-sm); font-weight:var(--font-semibold); color:var(--text-primary); margin:0 0 var(--space-1); }
    .auth-guide__step-desc { font-size:var(--text-xs); color:var(--text-secondary); margin:0; line-height:1.6; }
    .auth-guide__step-warning { display:flex; align-items:flex-start; gap:var(--space-2); padding:var(--space-3); background:var(--status-warning-bg,#FFFBEB); border:1px solid var(--status-warning,#F59E0B); border-radius:var(--radius-md); font-size:var(--text-xs); color:var(--text-primary); margin-top:var(--space-3); }
    .auth-guide__step-warning svg { flex-shrink:0; margin-top:1px; color:var(--status-warning,#F59E0B); }
    .auth-guide__code-block { border:1px solid var(--border-default); border-radius:var(--radius-md); overflow:hidden; }
    .auth-guide__code-header { display:flex; justify-content:space-between; align-items:center; padding:var(--space-2) var(--space-3); background:var(--surface-subtle,#F8F9FA); border-bottom:1px solid var(--border-default); }
    .auth-guide__code-lang { font-size:11px; color:var(--text-tertiary); font-family:var(--font-mono); }
    .auth-guide__copy-btn { font-size:11px; font-family:inherit; color:var(--text-link,#0066CC); background:none; border:none; cursor:pointer; padding:2px var(--space-2); border-radius:var(--radius-sm); transition:background 150ms; }
    .auth-guide__copy-btn:hover { background:var(--surface-raised); }
    .auth-guide__code { margin:0; padding:var(--space-4); background:#1a1d23; color:#e2e8f0; font-size:12px; font-family:var(--font-mono); overflow-x:auto; line-height:1.65; }
    .auth-guide__code code { font-family:inherit; }
    .auth-guide__inline-code { font-family:var(--font-mono); font-size:11px; background:var(--surface-subtle); padding:1px 5px; border-radius:3px; color:var(--text-primary); }
    .auth-guide__form-area { display:flex; flex-direction:column; gap:var(--space-3); }
    .auth-guide__form-label { font-size:var(--text-xs); font-weight:var(--font-medium); color:var(--text-secondary); }
    .auth-guide__textarea { font-family:var(--font-mono); font-size:12px; padding:var(--space-3); border:1px solid var(--border-default); border-radius:var(--radius-md); resize:vertical; color:var(--text-primary); background:var(--surface-base,#fff); line-height:1.5; transition:border-color 150ms; width:100%; box-sizing:border-box; }
    .auth-guide__textarea:focus { outline:none; border-color:var(--color-primary-600,#003D79); box-shadow:0 0 0 3px rgba(0,61,121,.1); }
    .auth-guide__submit-btn { align-self:flex-start; }
    .auth-guide__form-status { font-size:var(--text-xs); color:var(--status-success,#16A34A); margin:0; min-height:18px; }
    .auth-guide__demo-key { border:1px solid var(--status-success-border,#86EFAC); border-radius:var(--radius-lg); overflow:hidden; }
    .auth-guide__demo-key-header { display:flex; align-items:center; gap:var(--space-3); padding:var(--space-3) var(--space-4); background:var(--status-success-bg,#F0FDF4); border-bottom:1px solid var(--status-success-border,#86EFAC); }
    .auth-guide__demo-badge { font-size:11px; font-weight:var(--font-semibold); color:var(--status-success,#16A34A); background:rgba(22,163,74,.1); padding:2px 8px; border-radius:var(--radius-full); }
    .auth-guide__demo-note { font-size:var(--text-xs); color:var(--text-tertiary); }
    .auth-guide__demo-rows { padding:var(--space-4); display:flex; flex-direction:column; gap:var(--space-3); }
    .auth-guide__demo-row { display:flex; align-items:center; gap:var(--space-3); }
    .auth-guide__demo-label { font-size:var(--text-xs); color:var(--text-tertiary); width:120px; flex-shrink:0; }
    .auth-guide__demo-value-wrap { display:flex; align-items:center; gap:var(--space-2); flex:1; min-width:0; }
    .auth-guide__demo-value { font-family:var(--font-mono); font-size:12px; color:var(--text-primary); flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .auth-guide__sandbox-link { display:flex; align-items:center; gap:var(--space-2); padding:var(--space-3) var(--space-4); border-top:1px solid var(--status-success-border,#86EFAC); font-size:var(--text-xs); font-weight:var(--font-medium); color:var(--color-primary-600,#003D79); text-decoration:none; transition:background 150ms; }
    .auth-guide__sandbox-link:hover { background:var(--status-success-bg,#F0FDF4); }
    .auth-guide__rotation-steps { display:flex; flex-direction:column; gap:var(--space-4); margin-bottom:var(--space-4); }
    .auth-guide__rotation-item { display:flex; gap:var(--space-3); }
    .auth-guide__rotation-num { flex-shrink:0; width:20px; height:20px; border-radius:50%; border:1.5px solid var(--border-strong,#9CA3AF); color:var(--text-secondary); font-size:11px; font-weight:var(--font-semibold); display:flex; align-items:center; justify-content:center; margin-top:1px; }
    .auth-guide__rotation-title { font-size:var(--text-xs); font-weight:var(--font-semibold); color:var(--text-primary); margin:0 0 2px; }
    .auth-guide__rotation-desc { font-size:var(--text-xs); color:var(--text-secondary); margin:0; line-height:1.6; }
    .auth-guide__rotation-action { display:flex; align-items:center; gap:var(--space-3); padding-top:var(--space-3); border-top:1px solid var(--border-default); }
    .auth-guide__rotation-hint { font-size:var(--text-xs); color:var(--text-tertiary); }
    .auth-guide__faq { margin-top:var(--space-6); border:1px solid var(--border-default); border-radius:var(--radius-lg); overflow:hidden; }
    .auth-guide__faq-title { font-size:var(--text-xs); font-weight:var(--font-semibold); color:var(--text-secondary); padding:var(--space-3) var(--space-4); background:var(--surface-subtle); margin:0; border-bottom:1px solid var(--border-default); }
    .auth-guide__faq-item { border-bottom:1px solid var(--border-default); }
    .auth-guide__faq-item:last-child { border-bottom:none; }
    .auth-guide__faq-q { font-size:var(--text-xs); font-weight:var(--font-medium); color:var(--text-primary); padding:var(--space-3) var(--space-4); cursor:pointer; user-select:none; list-style:none; display:flex; justify-content:space-between; align-items:center; }
    .auth-guide__faq-q::-webkit-details-marker { display:none; }
    .auth-guide__faq-q::after { content:'+'; font-size:14px; color:var(--text-tertiary); margin-left:var(--space-3); flex-shrink:0; }
    details[open] .auth-guide__faq-q::after { content:'-'; }
    .auth-guide__faq-a { font-size:var(--text-xs); color:var(--text-secondary); padding:0 var(--space-4) var(--space-3); margin:0; line-height:1.6; }

    /* ═══ NEW: Auth status card ═══ */
    .auth-status-card {
      display: flex; align-items: center; gap: var(--space-4);
      padding: var(--space-4); border-radius: var(--radius-lg);
      border: 1px solid var(--border-default,#E5E7EB);
      background: var(--surface-base,#fff);
      margin-bottom: var(--space-5);
    }
    .auth-status-card--registered {
      border-color: #86EFAC;
      background: #F0FDF4;
    }
    .auth-status-card--empty {
      border-color: var(--status-warning,#D97706);
      background: #FFFBEB;
    }
    .auth-status-icon {
      width: 40px; height: 40px; border-radius: var(--radius-md);
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    }
    .auth-status-icon--ok   { background: #16A34A; color: #fff; }
    .auth-status-icon--warn { background: #D97706; color: #fff; }
    .auth-status-body { flex: 1; min-width: 0; }
    .auth-status-title { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--text-primary); margin: 0 0 2px; }
    .auth-status-desc  { font-size: var(--text-xs); color: var(--text-secondary); margin: 0; line-height: 1.5; }
    .auth-status-meta  { font-size: 11px; color: var(--text-tertiary); margin: 3px 0 0; font-family: var(--font-mono); }

    /* ═══ NEW: Registered keys table ═══ */
    .auth-registered-keys {
      border: 1px solid var(--border-default,#E5E7EB);
      border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-5);
    }
    .auth-registered-keys__header {
      display: flex; align-items: center; justify-content: space-between;
      padding: var(--space-3) var(--space-4);
      background: var(--surface-subtle,#F8F9FA); border-bottom: 1px solid var(--border-default,#E5E7EB);
    }
    .auth-registered-keys__title { font-size: var(--text-xs); font-weight: var(--font-semibold); color: var(--text-secondary); margin: 0; }
    .auth-key-row {
      display: flex; align-items: center; gap: var(--space-3);
      padding: var(--space-3) var(--space-4);
      border-bottom: 1px solid var(--border-default,#E5E7EB);
    }
    .auth-key-row:last-child { border-bottom: none; }
    .auth-key-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .auth-key-dot--active { background: #16A34A; }
    .auth-key-info { flex: 1; min-width: 0; }
    .auth-key-fingerprint { font-family: var(--font-mono); font-size: 11px; color: var(--text-primary); margin: 0; }
    .auth-key-meta { font-size: 11px; color: var(--text-tertiary); margin: 2px 0 0; }

    /* ═══ NEW: Auth accordion ═══ */
    .auth-accordion {
      border: 1px solid var(--border-default,#E5E7EB);
      border-radius: var(--radius-lg); overflow: hidden; margin-top: var(--space-4);
    }
    .auth-accordion__trigger {
      width: 100%; display: flex; align-items: center; gap: var(--space-3);
      padding: var(--space-3) var(--space-4);
      background: var(--surface-subtle,#F8F9FA); border: none; cursor: pointer;
      font-family: inherit; font-size: var(--text-xs); font-weight: var(--font-semibold);
      color: var(--text-secondary); text-align: left; transition: background 150ms;
    }
    .auth-accordion__trigger:hover { background: var(--surface-raised,#F3F4F6); }
    .auth-accordion__chevron { margin-left: auto; transition: transform 200ms; flex-shrink: 0; }
    .auth-accordion__trigger[aria-expanded="true"] .auth-accordion__chevron { transform: rotate(180deg); }
    .auth-accordion__body { border-top: 1px solid var(--border-default,#E5E7EB); }
    .auth-accordion__inner { padding: var(--space-4); }

    /* ═══ NEW: Dummy data panels: IP, Callback, Audit ═══ */
    .dummy-panel { padding: 0; }
    .dummy-panel-toolbar {
      display: flex; align-items: center; gap: var(--space-3);
      padding: var(--space-3) 0; flex-wrap: wrap;
    }
    .dummy-panel-toolbar .btn { margin-left: auto; }
    .dummy-table-wrap { overflow-x: auto; margin-bottom: var(--space-4); }
    .dummy-table { width: 100%; border-collapse: collapse; font-size: var(--text-xs); }
    .dummy-table th {
      text-align: left; padding: var(--space-2) var(--space-3);
      font-weight: var(--font-semibold); color: var(--text-tertiary);
      text-transform: uppercase; letter-spacing: 0.05em; font-size: 10px;
      border-bottom: 2px solid var(--border-default,#E5E7EB); white-space: nowrap;
    }
    .dummy-table td {
      padding: var(--space-3);
      border-bottom: 1px solid var(--border-default,#E5E7EB);
      color: var(--text-primary); vertical-align: middle;
    }
    .dummy-table tr:last-child td { border-bottom: none; }
    .dummy-table tr:hover td { background: var(--surface-subtle,#F8F9FA); }
    .dummy-badge {
      display: inline-flex; align-items: center; gap: 4px;
      font-size: 10px; font-weight: var(--font-semibold);
      padding: 2px 6px; border-radius: 9999px; white-space: nowrap;
    }
    .dummy-badge--ok      { background: #F0FDF4; color: #16A34A; }
    .dummy-badge--warn    { background: #FFFBEB; color: #D97706; }
    .dummy-badge--info    { background: #EFF6FF; color: #0284C7; }
    .dummy-badge--neutral { background: var(--surface-muted,#F3F4F6); color: var(--text-tertiary); }
    .dummy-mono { font-family: var(--font-mono); }
    .dummy-add-form {
      border: 1px solid var(--border-default,#E5E7EB); border-radius: var(--radius-lg);
      padding: var(--space-4); background: var(--surface-subtle,#F8F9FA); margin-top: var(--space-3);
    }
    .dummy-add-form__title { font-size: var(--text-xs); font-weight: var(--font-semibold); color: var(--text-secondary); margin: 0 0 var(--space-3); }
    .dummy-add-form__row { display: flex; gap: var(--space-2); align-items: flex-end; flex-wrap: wrap; }
    .dummy-add-form__row .form-input { font-family: var(--font-mono); font-size: var(--text-xs); height: 34px; flex: 1; min-width: 180px; }
    .dummy-info-note {
      font-size: var(--text-xs); color: var(--text-secondary);
      padding: var(--space-3) var(--space-4);
      background: #EFF6FF; border: 1px solid #BAE6FD;
      border-radius: var(--radius-md);
      display: flex; gap: var(--space-2); align-items: flex-start;
      margin-bottom: var(--space-4); line-height: 1.6;
    }

    .auth-guide__faq-list { padding: 0; }
    .auth-guide__form-hint { font-size: var(--text-xs); color: var(--text-tertiary); margin: 0; line-height: 1.5; }
