/* Dual-theme styles for Fuguang Account Auth Entry, Dropdown & Modals */
:root,
html[data-theme="light"] {
  --fg-auth-surface: #ffffff;
  --fg-auth-surface-muted: #f5f6f8;
  --fg-auth-border: rgba(15, 23, 42, 0.14);
  --fg-auth-text: #111827;
  --fg-auth-text-muted: #6b7280;
  --fg-auth-hover: rgba(15, 23, 42, 0.06);
  --fg-auth-input-bg: #ffffff;
  --fg-auth-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  --fg-auth-overlay: rgba(15, 23, 42, 0.45);
  --fg-auth-accent: #d97706;
  --fg-auth-accent-bg: rgba(245, 158, 11, 0.14);
  --fg-auth-danger: #dc2626;
  --fg-auth-danger-bg: rgba(220, 38, 38, 0.1);
  --fg-auth-success: #059669;
  --fg-auth-success-bg: rgba(5, 150, 105, 0.12);
}

html[data-theme="dark"] {
  --fg-auth-surface: #1b1d22;
  --fg-auth-surface-muted: #242730;
  --fg-auth-border: rgba(255, 255, 255, 0.12);
  --fg-auth-text: #f3f4f6;
  --fg-auth-text-muted: #9ca3af;
  --fg-auth-hover: rgba(255, 255, 255, 0.08);
  --fg-auth-input-bg: #121418;
  --fg-auth-shadow: 0 22px 60px rgba(0, 0, 0, 0.62);
  --fg-auth-overlay: rgba(0, 0, 0, 0.68);
  --fg-auth-accent: #f59e0b;
  --fg-auth-accent-bg: rgba(245, 158, 11, 0.18);
  --fg-auth-danger: #f87171;
  --fg-auth-danger-bg: rgba(248, 113, 113, 0.15);
  --fg-auth-success: #34d399;
  --fg-auth-success-bg: rgba(52, 211, 153, 0.15);
}

.fg-auth-root {
  position: relative;
  display: inline-flex;
  align-items: center;
  -webkit-app-region: no-drag;
}

.fg-auth-menu-wrap {
  position: relative;
}

.fg-auth-trigger {
  cursor: pointer;
  white-space: nowrap;
  -webkit-app-region: no-drag;
}

.fg-auth-username {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fg-auth-admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--fg-auth-accent);
  background: var(--fg-auth-accent-bg);
}

.fg-auth-role-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--fg-auth-text-muted);
  background: var(--fg-auth-hover);
}

.fg-auth-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 224px;
  background: var(--fg-auth-surface);
  color: var(--fg-auth-text);
  border: 1px solid var(--fg-auth-border);
  border-radius: 14px;
  box-shadow: var(--fg-auth-shadow);
  overflow: hidden;
  z-index: 99999;
}

.fg-auth-dropdown-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--fg-auth-border);
  background: var(--fg-auth-surface-muted);
}

.fg-auth-dropdown-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-auth-text);
}

.fg-auth-dropdown-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--fg-auth-text-muted);
}

.fg-auth-dropdown-actions {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fg-auth-menu-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-auth-text);
  font-size: 13px;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.fg-auth-menu-item:hover {
  background: var(--fg-auth-hover);
}

.fg-auth-menu-item-accent {
  color: var(--fg-auth-accent);
  font-weight: 600;
}

.fg-auth-menu-item-danger {
  color: var(--fg-auth-danger);
}

.fg-auth-menu-divider {
  height: 1px;
  margin: 4px 6px;
  background: var(--fg-auth-border);
}

.fg-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: var(--fg-auth-overlay);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.fg-auth-modal {
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--fg-auth-surface);
  color: var(--fg-auth-text);
  border: 1px solid var(--fg-auth-border);
  border-radius: 16px;
  box-shadow: var(--fg-auth-shadow);
  padding: 20px 22px;
  overflow-y: auto;
}

.fg-auth-modal-wide {
  max-width: 820px;
}

.fg-auth-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.fg-auth-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg-auth-text);
}

.fg-auth-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fg-auth-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--fg-auth-border);
  background: transparent;
  color: var(--fg-auth-text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.fg-auth-close:hover {
  background: var(--fg-auth-hover);
  color: var(--fg-auth-text);
}

.fg-auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: var(--fg-auth-surface-muted);
  margin-bottom: 14px;
}

.fg-auth-tab {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-auth-text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.fg-auth-tab.is-active {
  background: var(--fg-auth-surface);
  color: var(--fg-auth-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.fg-auth-banner {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.fg-auth-banner-info {
  background: var(--fg-auth-surface-muted);
  color: var(--fg-auth-text-muted);
  border: 1px solid var(--fg-auth-border);
}

.fg-auth-banner-warn {
  background: var(--fg-auth-accent-bg);
  color: var(--fg-auth-accent);
}

.fg-auth-banner-error {
  background: var(--fg-auth-danger-bg);
  color: var(--fg-auth-danger);
}

.fg-auth-banner-success {
  background: var(--fg-auth-success-bg);
  color: var(--fg-auth-success);
}

.fg-auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fg-auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-auth-text);
}

.fg-auth-field input,
.fg-auth-filter-bar input,
.fg-auth-filter-bar select,
.fg-auth-inline-form input,
.fg-auth-inline-form select {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--fg-auth-border);
  background: var(--fg-auth-input-bg);
  color: var(--fg-auth-text);
  font-size: 13px;
  outline: none;
}

.fg-auth-field input:focus,
.fg-auth-filter-bar input:focus,
.fg-auth-filter-bar select:focus,
.fg-auth-inline-form input:focus,
.fg-auth-inline-form select:focus {
  border-color: var(--fg-auth-accent);
}

.fg-auth-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.fg-auth-desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--fg-auth-text-muted);
}

.fg-auth-claim-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fg-auth-btn {
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 140ms ease, background-color 140ms ease;
}

.fg-auth-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fg-auth-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.fg-auth-btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #111827;
}

.fg-auth-btn-secondary {
  background: var(--fg-auth-surface-muted);
  color: var(--fg-auth-text);
  border-color: var(--fg-auth-border);
}

.fg-auth-admin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--fg-auth-text-muted);
}

.fg-auth-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--fg-auth-surface-muted);
  border: 1px solid var(--fg-auth-border);
  margin-bottom: 12px;
}

.fg-auth-inline-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-auth-text);
}

.fg-auth-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.fg-auth-filter-bar input {
  flex: 1 1 200px;
}

.fg-auth-table-wrap {
  border: 1px solid var(--fg-auth-border);
  border-radius: 12px;
  overflow: auto;
  max-height: 46vh;
}

.fg-auth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fg-auth-table th,
.fg-auth-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--fg-auth-border);
  white-space: nowrap;
}

.fg-auth-table th {
  background: var(--fg-auth-surface-muted);
  color: var(--fg-auth-text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.fg-auth-empty {
  text-align: center !important;
  color: var(--fg-auth-text-muted);
  padding: 24px !important;
}

.fg-auth-cell-name {
  font-weight: 600;
}

.fg-auth-self-tag {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--fg-auth-hover);
  color: var(--fg-auth-text-muted);
}

.fg-auth-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.fg-auth-pill.is-admin {
  background: var(--fg-auth-accent-bg);
  color: var(--fg-auth-accent);
}

.fg-auth-pill.is-user {
  background: var(--fg-auth-hover);
  color: var(--fg-auth-text-muted);
}

.fg-auth-pill.is-active {
  background: var(--fg-auth-success-bg);
  color: var(--fg-auth-success);
}

.fg-auth-pill.is-disabled {
  background: var(--fg-auth-danger-bg);
  color: var(--fg-auth-danger);
}

.fg-auth-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fg-auth-link-btn {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--fg-auth-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.fg-auth-link-btn.is-danger {
  color: var(--fg-auth-danger);
}

.fg-auth-link-btn.is-success {
  color: var(--fg-auth-success);
}

.fg-auth-link-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
