/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6875rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s, border-color 0.15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.btn-primary:hover {
  background: var(--orange-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}

.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-danger:hover {
  background: #991B1B;
  transform: translateY(-1px);
}

.btn-blue {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-blue:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-sm {
  font-size: 0.8125rem;
  padding: 0.5rem 0.875rem;
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: var(--space-sm);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.6875rem 0.875rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input-sm {
  width: auto;
  font-size: 0.75rem;
  padding: 0.25rem 0.375rem;
}

/* ---- Form Checkbox ---- */

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-checkbox-input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

.form-checkbox-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

/* ---- Form Hint ---- */

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ---- Auth Footer ---- */

.auth-separator {
  margin: 0 0.5rem;
  color: var(--text-muted);
}

/* ---- Cards ---- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.card-body {
  padding: var(--space-md);
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}

.card-header-label {
  color: var(--text-muted);
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

.card-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

/* ---- Form Row ---- */

.form-row {
  display: flex;
  gap: var(--space-md);
}

.form-row > .form-group {
  flex: 1;
}

/* ---- Flash Messages ---- */

.flash {
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  margin-bottom: var(--space-sm);
}

.flash-notice {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: #15803D;
}

.flash-alert {
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.2);
  color: var(--red);
}

/* ---- Tables ---- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

thead th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-surface);
}

/* ---- Table: Key-Value ---- */

.table-kv td:first-child {
  width: 12rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- Table: Cell Actions ---- */

.cell-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.card-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ---- Code ---- */

code {
  font-family: var(--mono);
  font-size: 0.8125rem;
  background: var(--bg-subtle);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: var(--text-secondary);
}

/* ---- Status Badges ---- */

.badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1875rem 0.5rem;
  border-radius: 0.25rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-active {
  background: rgba(22, 163, 74, 0.08);
  color: #15803D;
}

.badge-revoked {
  background: rgba(185, 28, 28, 0.08);
  color: var(--red);
}

.badge-info {
  background: var(--blue-light);
  color: var(--blue);
}

.badge-muted {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

/* ---- Section Headers ---- */

.section-header {
  margin-bottom: var(--space-md);
}

.section-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.section-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-lg);
}

.section-header-row .section-header {
  margin-bottom: 0;
}

.section-header-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* ---- Empty State ---- */

.empty-state {
  text-align: center;
  padding: var(--space-lg) var(--space-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.empty-state a {
  color: var(--blue);
  font-weight: 500;
}

/* ---- Status Dots ---- */

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot-green { background: #22c55e; }
.status-dot-red { background: #ef4444; }
.status-dot-yellow { background: #f59e0b; }

/* ---- Table Scroll ---- */

.table-scroll {
  overflow-x: auto;
}

.table-scroll-y {
  overflow-x: auto;
  overflow-y: auto;
}

.table-scroll thead tr,
.table-scroll-y thead tr {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 1;
}

/* ---- Pagination ---- */

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pagination-bar a {
  font-size: 0.75rem;
  color: var(--blue);
  font-weight: 500;
}

.pagination-links {
  display: flex;
  gap: 0.5rem;
}

/* ---- Danger Zone ---- */

.danger-zone {
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.danger-zone h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--red);
  margin-bottom: var(--space-xs);
}

.danger-zone p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ---- Text Utilities ---- */

.text-right { text-align: right; }
.text-nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-bold { font-weight: 600; }
.text-truncate {
  max-width: 20rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Spacing Utilities ---- */

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
