/* Auth Engine CSS — BEM only, NO Tailwind, NO global selectors */
/* Color scheme: primary #3d6fd9, secondary #8b55d4 (desaturated) */

/* ===== Card (public auth pages) ===== */
.auth--card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 2.5rem;
  width: 100%;
  max-width: 28rem;
}
.auth--card-title {
  font-family: "Space Grotesk", "Noto Sans JP", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem;
  text-align: center;
}
.auth--card-subtitle {
  font-size: 0.875rem;
  color: #64748b;
  text-align: center;
  margin: 0 0 2rem;
}

/* ===== Private Layout (sidebar + content) ===== */
.auth--private-layout {
  display: flex;
  min-height: calc(100vh - 8rem);
  max-width: 80rem;
  margin: 0 auto;
  width: 100%;
}
.auth--private-content {
  flex: 1;
  padding: 2rem 2.5rem;
  min-width: 0;
}
.auth--page-title {
  font-family: "Space Grotesk", "Noto Sans JP", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1.5rem;
}

/* ===== User Sidebar ===== */
.auth--user-sidebar {
  width: 16rem;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  flex-shrink: 0;
  padding: 1.5rem 0;
}
.auth--user-sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.75rem;
}
.auth--user-sidebar-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d6fd9, #8b55d4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.auth--user-sidebar-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.auth--user-sidebar-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth--user-sidebar-role {
  font-size: 0.75rem;
  color: #64748b;
}
.auth--user-sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}
.auth--user-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  color: #475569;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
.auth--user-sidebar-link:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}
.auth--user-sidebar-link--active {
  background-color: #eff6ff;
  color: #3d6fd9;
  border-left-color: #3d6fd9;
  font-weight: 600;
}
.auth--user-sidebar-icon {
  font-size: 1.25rem;
}

/* ===== Flash Messages ===== */
.auth--flash {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.auth--flash-notice {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.auth--flash-alert {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.auth--flash-warning {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.auth--flash-warning code {
  background: #fffbeb;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
  word-break: break-all;
}
.auth--flash-warning p {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
}
.auth--flash ul {
  margin: 0;
  padding-left: 1.25rem;
}

/* ===== Form Elements ===== */
.auth--field {
  margin-bottom: 1.25rem;
}
.auth--field label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  color: #334155;
  margin-bottom: 0.375rem;
}
.auth--input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.auth--input:focus {
  outline: none;
  border-color: #3d6fd9;
  box-shadow: 0 0 0 3px rgba(61, 111, 217, 0.1);
}
.auth--textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #0f172a;
  background: #fff;
  resize: vertical;
  font-family: "SFMono-Regular", "Menlo", monospace;
  box-sizing: border-box;
}
.auth--textarea:focus {
  outline: none;
  border-color: #3d6fd9;
  box-shadow: 0 0 0 3px rgba(61, 111, 217, 0.1);
}
.auth--select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #0f172a;
  background: #fff;
  box-sizing: border-box;
}
.auth--select:focus {
  outline: none;
  border-color: #3d6fd9;
  box-shadow: 0 0 0 3px rgba(61, 111, 217, 0.1);
}

/* ===== Buttons ===== */
.auth--actions {
  margin-top: 1.5rem;
}
.auth--btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.auth--btn-primary {
  background: linear-gradient(135deg, #3d6fd9, #8b55d4);
  color: #fff;
  width: 100%;
  padding: 0.75rem 1.25rem;
}
.auth--btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 4px 12px rgba(61, 111, 217, 0.3);
}
.auth--btn-secondary {
  background: #fff;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.auth--btn-secondary:hover {
  background: #f8fafc;
}
.auth--btn-ghost {
  background: none;
  color: #3d6fd9;
  padding: 0.5rem 0;
}
.auth--btn-ghost:hover {
  text-decoration: underline;
}
.auth--btn-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.auth--btn-danger:hover {
  background: #fecaca;
}

/* ===== Links Section (below forms) ===== */
.auth--links {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: #64748b;
}
.auth--links a {
  color: #3d6fd9;
  text-decoration: none;
  font-weight: 500;
}
.auth--links a:hover {
  text-decoration: underline;
}
.auth--links-divider {
  margin: 0 0.5rem;
  color: #cbd5e1;
}

/* ===== Data Tables ===== */
.auth--token-table,
.auth--key-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.auth--token-table th,
.auth--key-table th {
  text-align: left;
  font-weight: 600;
  color: #475569;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #e2e8f0;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
.auth--token-table td,
.auth--key-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
.auth--token-table tr:hover,
.auth--key-table tr:hover {
  background-color: #f8fafc;
}
.auth--token-table code,
.auth--key-table code {
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
}
.auth--table-actions {
  display: flex;
  gap: 0.5rem;
}
.auth--new-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #3d6fd9, #8b55d4);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 1.5rem;
}
.auth--new-link:hover {
  opacity: 0.9;
  box-shadow: 0 4px 12px rgba(61, 111, 217, 0.3);
}
.auth--empty-state {
  text-align: center;
  padding: 2rem;
  color: #94a3b8;
  font-size: 0.875rem;
}

/* ===== Profile Card ===== */
.auth--profile-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.auth--profile-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.auth--profile-card-avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d6fd9, #8b55d4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.auth--profile-card-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}
.auth--profile-card-role {
  font-size: 0.875rem;
  color: #64748b;
}
.auth--profile-card-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
}
.auth--profile-card-details dt {
  color: #64748b;
  font-weight: 500;
}
.auth--profile-card-details dd {
  color: #0f172a;
  margin: 0;
}
.auth--profile-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.auth--profile-card-badge--success {
  background: #dcfce7;
  color: #166534;
}
.auth--profile-card-badge--warning {
  background: #fef3c7;
  color: #92400e;
}

/* ===== Settings Hub ===== */
.auth--settings-hub {
  margin-bottom: 1.5rem;
}
.auth--settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}
.auth--settings-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth--settings-card:hover {
  border-color: #3d6fd9;
  box-shadow: 0 2px 8px rgba(61, 111, 217, 0.08);
}
.auth--settings-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.375rem;
}
.auth--settings-card p {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0 0 0.75rem;
}
.auth--settings-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: #3d6fd9;
  text-decoration: none;
}
.auth--settings-link:hover {
  text-decoration: underline;
}

/* ===== TOTP QR Code ===== */
.auth--totp-qr {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
}
.auth--totp-qr p {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0 0 1rem;
}
.auth--totp-qr svg {
  max-width: 200px;
  height: auto;
  margin: 0 auto;
  display: block;
}

/* ===== Admin Nav Tabs ===== */
.auth--admin-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 1.5rem;
}
.auth--admin-nav__link {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.auth--admin-nav__link:hover {
  color: #0f172a;
}
.auth--admin-nav__link--active {
  color: #3d6fd9;
  border-bottom-color: #3d6fd9;
  font-weight: 600;
}

/* ===== Admin Toolbar ===== */
.auth--admin-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ===== Badges ===== */
.auth--badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.auth--badge--success {
  background: #dcfce7;
  color: #166534;
}
.auth--badge--danger {
  background: #fee2e2;
  color: #991b1b;
}
.auth--badge--muted {
  background: #f1f5f9;
  color: #64748b;
}
.auth--badge--role {
  background: #eff6ff;
  color: #3d6fd9;
}

/* ===== Small Button Variant ===== */
.auth--btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* ===== SSO Table ===== */
.auth--sso-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.auth--sso-table th {
  text-align: left;
  font-weight: 600;
  color: #475569;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #e2e8f0;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
.auth--sso-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
.auth--sso-table tr:hover {
  background-color: #f8fafc;
}
.auth--sso-table code {
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
}
.auth--text-muted {
  color: #94a3b8;
}

/* ===== SSO Endpoints Info ===== */
.auth--sso-endpoints {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}
.auth--sso-endpoints h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  margin: 0 0 0.75rem;
}
.auth--sso-endpoints dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.375rem 1rem;
  font-size: 0.8125rem;
  margin: 0;
}
.auth--sso-endpoints dt {
  color: #64748b;
  font-weight: 500;
}
.auth--sso-endpoints dd {
  margin: 0;
}
.auth--sso-endpoints code {
  background: #e2e8f0;
  padding: 0.0625rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
}

/* ===== SSO Buttons (Login / Registration) ===== */
.auth--sso-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: #94a3b8;
  font-size: 0.8125rem;
}
.auth--sso-divider::before,
.auth--sso-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}
.auth--sso-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.auth--sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  background: #fff;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.auth--sso-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.auth--sso-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.auth--sso-btn--github {
  color: #24292f;
}
.auth--sso-btn--github:hover {
  background: #f6f8fa;
  border-color: #d0d7de;
}
.auth--sso-btn--x {
  color: #0f1419;
}
.auth--sso-btn--x:hover {
  background: #f7f7f7;
  border-color: #cfd9de;
}

/* ===== Checkbox ===== */
.auth--checkbox {
  margin-right: 0.5rem;
}

/* ===== User Table ===== */
.auth--user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.auth--user-table th {
  text-align: left;
  font-weight: 600;
  color: #475569;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #e2e8f0;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
.auth--user-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
.auth--user-table tr:hover {
  background-color: #f8fafc;
}
.auth--user-table__row--discarded {
  opacity: 0.5;
}

/* ===== User Detail ===== */
.auth--user-detail__grid {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}
.auth--user-detail__grid dt {
  color: #64748b;
  font-weight: 500;
}
.auth--user-detail__grid dd {
  color: #0f172a;
  margin: 0;
}
.auth--user-detail__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
