Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

12.7 KB
Raw Blame
.api-keys-page {
  padding: 2rem;
  width: 100%;
  box-sizing: border-box;
}

.api-keys-page .page-header {
  margin-bottom: 2rem;
}

/* H1 inherited from global */

.api-keys-page .api-keys-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.api-keys-page .keys-table-container {
  background: var(--bg-white);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  width: 100%;
  overflow-x: auto;
}

.api-keys-page .keys-table {
  width: 100%;
  font-size: 0.875rem;
  border-collapse: collapse;
}

/* Table header and row styling */
.api-keys-page .keys-table thead tr.table-row.header th {
  background: var(--bg-light);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  padding: 1.125rem 1.5rem;
  text-align: start;
}

.api-keys-page .keys-table tbody tr.table-row td {
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.api-keys-page .keys-table tbody tr.table-row:last-child td {
  border-bottom: none;
}

.api-keys-page .keys-table tbody tr.table-row:hover {
  background: rgba(37, 211, 102, 0.05);
}

.api-keys-page .keys-table tbody tr.table-row:nth-child(even) {
  background: rgba(148, 163, 184, 0.08);
}

.api-keys-page .keys-table tbody tr.table-row:nth-child(even):hover {
  background: rgba(37, 211, 102, 0.05);
}

.api-keys-page .name-cell {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.api-keys-page .key-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.api-keys-page .key-cell code {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--bg-light);
  padding: 0.375rem 0.625rem;
  border-radius: 4px;
  font-family: monospace;
  white-space: nowrap;
}

.api-keys-page .icon-btn-sm {
  padding: 0.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  flex-shrink: 0;
}

.api-keys-page .icon-btn-sm:hover {
  color: var(--text-primary);
}

.api-keys-page .permission-badge {
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  background: rgba(59, 130, 246, 0.12);
  color: var(--info);
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.api-keys-page .permission-badge:first-child:last-child {
  background: rgba(37, 211, 102, 0.1);
  color: var(--primary-text);
}

.api-keys-page .sessions-cell {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  max-width: 16rem;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-keys-page .sessions-cell.all {
  color: var(--text-muted);
}

.api-keys-page .session-scope-picker {
  margin: 0.75rem 0 0.5rem;
}

.api-keys-page .session-scope-toggle {
  display: inline;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--primary-text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
}

.api-keys-page .session-scope-toggle:hover:not(:disabled) {
  text-decoration: underline;
}

.api-keys-page .session-scope-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.api-keys-page .session-scope-hint,
.api-keys-page .session-scope-empty,
.api-keys-page .session-scope-widened {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.45;
  text-transform: none;
  letter-spacing: normal;
}

/* An empty selection grants every session, so it reads as a state rather than a hint. */
.api-keys-page .session-scope-widened {
  font-weight: 600;
  color: var(--text-primary);
}

.api-keys-page .session-scope-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-height: 14rem;
  overflow-y: auto;
}

.api-keys-page .session-scope-option {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin: 0;
  padding: 0.625rem 0.75rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.api-keys-page .session-scope-option:has(input:checked) {
  border-color: rgba(37, 211, 102, 0.45);
  background: rgba(37, 211, 102, 0.08);
}

.api-keys-page .session-scope-meta {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.api-keys-page .session-scope-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-keys-page .session-scope-phone {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.api-keys-page .session-scope-edit-name {
  margin: 0 0 1rem;
  color: var(--text-secondary);
}

.api-keys-page .actions-cell {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
}

.api-keys-page .icon-btn {
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  flex-shrink: 0;
}

.api-keys-page .icon-btn:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

.api-keys-page .icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--error-text);
}

.api-keys-page .permissions-reference {
  background: var(--bg-white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.api-keys-page .permissions-reference h3 {
  /* Inherits from H3 */
  margin-bottom: 1rem;
}

.api-keys-page .permissions-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.api-keys-page .perm-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  background: var(--bg-light);
  border-radius: var(--radius);
}

.api-keys-page .perm-item code {
  font-size: 0.8125rem;
  color: var(--primary-text);
  background: rgba(37, 211, 102, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  width: fit-content;
}

.api-keys-page .perm-item span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Empty Table State */
.api-keys-page .empty-table-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.api-keys-page .empty-table-state svg {
  margin-bottom: 1rem;
  opacity: 0.4;
  color: var(--text-muted);
}

.api-keys-page .empty-table-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
}

.api-keys-page .empty-table-state p {
  margin: 0;
  font-size: 0.875rem;
  max-width: 300px;
}

/* Confirmation Modal Styles */
.api-keys-page .confirm-modal {
  max-width: 400px;
}

.api-keys-page .confirm-icon-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.api-keys-page .confirm-warning-icon {
  color: var(--warning-text);
}

.api-keys-page .confirm-message {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0;
}

.api-keys-page .confirm-message strong {
  color: var(--text-primary);
}

/* Key limit fields (IP allow-list, chats, expiry) in the create and edit modals. */
.api-keys-page .modal-body > textarea {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: 'JetBrains Mono Variable', 'JetBrains Mono', monospace;
  background: var(--bg-light);
  box-sizing: border-box;
  resize: vertical;
}

.api-keys-page .modal-body > select,
.api-keys-page .modal-body > textarea {
  margin-bottom: 0.25rem;
}

.api-keys-page .key-field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

.api-keys-page .key-field-hint.error {
  color: var(--error-text);
  margin-bottom: 0.25rem;
}

.api-keys-page .key-expiry-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.25rem;
}

.api-keys-page .key-expiry-row input {
  flex: 1 1 auto;
}

.api-keys-page .key-expiry-row button {
  flex: none;
  white-space: nowrap;
}

.api-keys-page .key-signed-in-warning {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0 0 1rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--text-primary);
  font-size: 0.8125rem;
}

.api-keys-page .key-signed-in-warning svg {
  flex: none;
  margin-top: 0.125rem;
  color: var(--warning, #f59e0b);
}

.api-keys-page .restrictions-cell {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.8125rem;
}

.api-keys-page .restrictions-cell.none {
  color: var(--text-muted);
}

.api-keys-page .restriction-badge {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.api-keys-page .restriction-badge.expired {
  background: rgba(239, 68, 68, 0.12);
  border-color: transparent;
  color: var(--error-text);
}

/* Mobile Responsive */
/* Status badges — must apply on DESKTOP too (they were stranded inside the mobile media query,
   leaving every Active/Revoked badge unstyled on wide screens). */
.api-keys-page .status-badge {
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}

.api-keys-page .status-badge.active {
  background: rgba(37, 211, 102, 0.1);
  color: var(--primary-text);
}

.api-keys-page .status-badge.inactive {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error-text);
}

@media (max-width: 768px) {
  .api-keys-page {
    padding: 1rem;
  }

  .api-keys-page .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .api-keys-page .keys-table-container {
    overflow-x: visible;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  /* Switch to card layout on mobile */
  .api-keys-page .keys-table {
    display: block;
  }

  .api-keys-page .keys-table thead {
    display: none;
  }

  .api-keys-page .keys-table tbody {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .api-keys-page .keys-table tbody tr.table-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
  }

  .api-keys-page .keys-table tbody tr.table-row:hover,
  .api-keys-page .keys-table tbody tr.table-row:nth-child(even),
  .api-keys-page .keys-table tbody tr.table-row:nth-child(even):hover {
    background: var(--bg-white);
  }

  .api-keys-page .keys-table tbody tr.table-row td {
    padding: 0;
    border-bottom: none;
    display: block;
  }

  /* Name cell - prominent at top */
  .api-keys-page .keys-table tbody tr.table-row td:first-child {
    order: 1;
  }

  .api-keys-page .keys-table tbody tr.table-row td:first-child .name-cell {
    font-size: 1.125rem;
    font-weight: 600;
    display: block;
    color: var(--text-primary);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Key cell */
  .api-keys-page .keys-table tbody tr.table-row td:nth-child(2) {
    order: 2;
  }

  .api-keys-page .keys-table tbody tr.table-row td:nth-child(2) .key-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .api-keys-page .keys-table tbody tr.table-row td:nth-child(2) .key-cell code {
    font-size: 0.75rem;
    word-break: break-all;
    white-space: normal;
  }

  /* Role, sessions & status sit together as chips */
  .api-keys-page .keys-table tbody tr.table-row td:has(.permission-badge),
  .api-keys-page .keys-table tbody tr.table-row td:has(.sessions-cell),
  .api-keys-page .keys-table tbody tr.table-row td:has(.restrictions-cell),
  .api-keys-page .keys-table tbody tr.table-row td:has(.status-badge) {
    display: inline-block;
    order: 3;
    margin-inline-end: 0.5rem;
  }

  .api-keys-page .sessions-cell {
    max-width: 100%;
    white-space: normal;
  }

  /* Actions cell - bottom with separator */
  .api-keys-page .keys-table tbody tr.table-row td:last-child {
    order: 5;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
  }

  .api-keys-page .keys-table tbody tr.table-row td:last-child .actions-cell {
    justify-content: flex-start;
    gap: 0.5rem;
  }

  /* Permissions reference mobile */
  .api-keys-page .permissions-reference {
    padding: 1rem;
  }

  .api-keys-page .permissions-reference h3 {
    font-size: 0.9375rem;
  }
}

@media (max-width: 480px) {
  .api-keys-page .permissions-list {
    grid-template-columns: 1fr;
  }

  .api-keys-page {
    padding: 0.75rem;
  }
}