:root {
  /* Palette */
  --bg-dark: #0a0a0c;
  --bg-panel: rgba(22, 22, 24, 0.7);
  --bg-panel-strong: rgba(16, 16, 18, 0.95);
  
  /* Accents */
  --gold-primary: #d4af45;
  --gold-dim: rgba(212, 175, 69, 0.15);
  --gold-glow: rgba(212, 175, 69, 0.4);
  
  /* Text Colors */
  --text-main: #f2eee8;
  --text-muted: rgba(242, 238, 232, 0.6);
  --text-subtle: rgba(242, 238, 232, 0.4);
  
  /* Status Colors */
  --status-error: #ff7878;
  --status-error-bg: rgba(255, 120, 120, 0.1);
  --status-success: #63d39f;
  --status-success-bg: rgba(99, 211, 159, 0.1);
  --status-info: #74b8ff;
  --status-info-bg: rgba(116, 184, 255, 0.1);
  
  /* Borders & Shadows */
  --border-light: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(212, 175, 69, 0.3);
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 0 20px rgba(212, 175, 69, 0.15);
  
  /* Radius */
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* Reset & Base */
* {
  box-sizing: border-box;
  outline: none;
}

html {
  background-color: var(--bg-dark);
  scroll-behavior: smooth;
}

body.admin-console-page {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(circle at 15% 50%, rgba(212, 175, 69, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(116, 184, 255, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  font-family: "Manrope", sans-serif;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

/* Typography */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 3.5rem;
  line-height: 1;
  color: var(--text-main);
}

h1 span {
  display: block;
  margin-top: 5px;
  color: var(--gold-primary);
  font-style: italic;
}

h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 2rem;
}

h4 {
  font-size: 1.4rem;
}

p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-muted);
}

input,
select,
button {
  font: inherit;
}

/* Scrollbar Styling (Webkit) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  border: 2px solid var(--bg-dark);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Layout Structures */
.admin-shell {
  max-width: 1720px;
  margin: 0 auto;
  padding: 60px 24px 100px;
  animation: fadeIn 0.8s ease-out;
}

.admin-hero {
  margin-bottom: 40px;
}

.admin-eyebrow,
.card-kicker {
  display: inline-block;
  padding: 6px 12px;
  margin-bottom: 24px;
  background: var(--gold-dim);
  border-left: 2px solid var(--gold-primary);
  color: var(--gold-primary);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.admin-lead {
  margin-top: 12px;
  max-width: 760px;
}

.admin-hero-note {
  max-width: 760px;
  margin-top: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.94rem;
}

.admin-stage {
  display: grid;
  gap: 24px;
}

/* Cards */
.admin-card,
.detail-stage {
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 40px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.admin-card:hover,
.detail-stage:hover {
  border-color: var(--border-gold);
}

.card-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.workspace-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: start;
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border-light);
}

.card-top > *,
.workspace-top > * {
  min-width: 0;
}

.workspace-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  text-align: right;
  max-width: min(100%, 420px);
}

.workspace-admin-id {
  display: grid;
  gap: 4px;
}

.workspace-admin-id span,
.admin-field span,
.search-field span {
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.workspace-admin-id strong {
  color: var(--text-main);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

/* Forms */
.admin-form,
.managed-editor-form {
  display: grid;
  gap: 24px;
  margin-top: 32px;
}

.admin-field,
.search-field {
  display: grid;
  gap: 8px;
}

.admin-toggle-field {
  display: grid;
  gap: 8px;
}

input,
select {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 14px 16px;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

input::placeholder {
  color: var(--text-subtle);
}

input:focus,
select:focus {
  border-color: var(--gold-primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(212, 175, 69, 0.1);
}

select {
  color-scheme: dark;
  background-color: rgba(16, 16, 18, 0.96);
}

select option {
  background-color: #161618;
  color: var(--text-main);
}

select optgroup {
  background-color: #111113;
  color: var(--gold-primary);
  font-style: normal;
  font-weight: 700;
}

select option:checked {
  background-color: rgba(212, 175, 69, 0.22);
  color: var(--text-main);
}

.admin-toggle-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.admin-toggle-card:focus-within {
  border-color: var(--gold-primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(212, 175, 69, 0.1);
}

.admin-toggle-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--gold-primary);
  flex: 0 0 auto;
  padding: 0;
}

.admin-toggle-copy {
  display: grid;
  gap: 4px;
}

.admin-toggle-copy strong {
  color: var(--text-main);
  font-size: 0.96rem;
}

.admin-toggle-copy small {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.turnstile-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.turnstile-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.turnstile-copy span {
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.turnstile-copy strong {
  color: var(--text-main);
  font-size: 1rem;
}

.turnstile-widget {
  width: min(100%, 320px);
  min-height: 65px;
  justify-self: end;
}

.turnstile-actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.turnstile-status {
  flex: 1 1 280px;
  min-width: 0;
  margin: 0;
  font-size: 0.9rem;
}

.turnstile-status[data-tone="success"] {
  color: var(--status-success);
}

.turnstile-status[data-tone="error"] {
  color: var(--status-error);
}

.turnstile-status[data-tone="info"] {
  color: var(--status-info);
}

.admin-two-factor-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(212, 175, 69, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%),
    rgba(255, 255, 255, 0.02);
}

.admin-two-factor-copy {
  display: grid;
  gap: 8px;
}

.admin-two-factor-copy span,
.admin-two-factor-secret-wrap span {
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-two-factor-copy strong {
  color: var(--text-main);
  font-size: 1.05rem;
}

.admin-two-factor-copy p {
  max-width: 740px;
}

.admin-two-factor-setup {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
}

.admin-two-factor-qr-wrap {
  display: flex;
  justify-content: center;
}

.admin-two-factor-qr {
  width: min(100%, 220px);
  aspect-ratio: 1;
  border-radius: 18px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

.admin-two-factor-secret-wrap {
  display: grid;
  gap: 8px;
}

.admin-two-factor-secret-wrap code {
  display: block;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.96rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.admin-two-factor-actions {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 12px;
}

.admin-login-note {
  color: var(--text-subtle);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Buttons */
.workspace-button-row,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-primary-button,
.admin-ghost-button,
.admin-danger-button,
.role-save-button,
.ban-tool-button,
.profile-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  gap: 8px;
  /* Allow text wrapping on very small screens */
  white-space: normal; 
  text-align: center;
  text-decoration: none;
}

.admin-primary-button,
.role-save-button {
  background: linear-gradient(135deg, var(--gold-primary), #b8962f);
  color: #0f0f0f;
  box-shadow: 0 4px 15px rgba(212, 175, 69, 0.3);
}

.admin-primary-button:hover:not(:disabled),
.role-save-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(212, 175, 69, 0.4);
}

.admin-primary-button:active,
.role-save-button:active {
  transform: translateY(0);
}

.admin-ghost-button,
.ban-tool-button,
.profile-tool-button {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-main);
}

.admin-ghost-button:hover:not(:disabled),
.ban-tool-button:hover:not(:disabled),
.profile-tool-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
}

.admin-danger-button {
  background: rgba(255, 120, 120, 0.1);
  border: 1px solid rgba(255, 120, 120, 0.2);
  color: var(--status-error);
}

.admin-danger-button:hover:not(:disabled) {
  background: rgba(255, 120, 120, 0.2);
  border-color: var(--status-error);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Stats Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.admin-subpanel {
  display: grid;
  gap: 20px;
  margin-bottom: 28px;
  padding: 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(212, 175, 69, 0.04) 0%, rgba(255, 255, 255, 0.015) 100%),
    rgba(255, 255, 255, 0.015);
}

.subpanel-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
}

.admin-inline-meta {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.02);
}

.admin-inline-meta-label {
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-inline-meta strong {
  color: var(--gold-primary);
  font-size: 1.2rem;
}

.gemini-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 16px;
}

.gemini-slot-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.03);
}

.gemini-slot-card.is-active {
  border-color: var(--border-gold);
  box-shadow: var(--shadow-gold);
}

.gemini-slot-card.is-full {
  border-color: rgba(255, 120, 120, 0.32);
  background: rgba(255, 120, 120, 0.06);
}

.gemini-slot-card--empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 26px 18px;
}

.gemini-slot-card--empty strong {
  color: var(--text-main);
  font-size: 1rem;
}

.gemini-slot-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.gemini-slot-card-title {
  display: grid;
  gap: 4px;
}

.gemini-slot-card-title strong {
  color: var(--text-main);
  font-size: 1rem;
}

.gemini-slot-card-title span,
.gemini-slot-card-note,
.gemini-slot-card-meta {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.gemini-slot-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gemini-slot-card-stat {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.gemini-slot-card-stat span {
  color: var(--text-subtle);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gemini-slot-card-stat strong {
  color: var(--text-main);
  font-size: 1.15rem;
}

.summary-card {
  background: rgba(255, 255, 255, 0.02);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  color: var(--gold-primary);
  font-size: 2.5rem;
  line-height: 1;
}

.summary-card span {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Toolbar */
.toolbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 280px) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 24px;
}

.toolbar-note {
  color: var(--text-subtle);
  font-size: 0.9rem;
  text-align: right;
}

.admin-status {
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.admin-status[data-tone="success"] {
  color: var(--status-success);
  background: var(--status-success-bg);
  border-color: rgba(99, 211, 159, 0.2);
}

.admin-status[data-tone="error"] {
  color: var(--status-error);
  background: var(--status-error-bg);
  border-color: rgba(255, 120, 120, 0.2);
}

.admin-status[data-tone="info"] {
  color: var(--status-info);
  background: var(--status-info-bg);
  border-color: rgba(116, 184, 255, 0.2);
}

/* Table */
.table-shell {
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.admin-users-table {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  display: block;
}

.admin-users-table colgroup,
.admin-users-table thead {
  display: none;
}

.admin-users-table tbody {
  display: grid;
  gap: 16px;
}

.admin-users-table tbody tr {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr);
  gap: 16px 18px;
  align-items: start;
  width: 100%;
  padding: 20px 22px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015) 0%, rgba(255, 255, 255, 0) 100%),
    var(--bg-panel-strong);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
  position: relative;
  isolation: isolate;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.admin-users-table thead th {
  display: none;
}

.admin-users-table tbody td {
  display: grid;
  gap: 8px;
  padding: 0;
  border-bottom: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  vertical-align: top;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.user-cell,
.activity-cell,
.access-cell,
.actions-cell {
  min-width: 0;
}

.admin-users-table tbody td::before {
  content: attr(data-label);
  color: var(--text-subtle);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-users-table tbody tr:hover {
  border-color: var(--border-gold);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px);
}

.admin-users-table tbody tr:focus-within {
  z-index: 4;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 1px rgba(212, 175, 69, 0.25), 0 22px 48px rgba(0, 0, 0, 0.28);
}

.access-cell,
.actions-cell {
  grid-column: 1 / -1;
}

.actions-cell {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border-light);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.015) 100%),
    rgba(255, 255, 255, 0.02);
}

.user-main {
  display: grid;
  gap: 6px;
}

.user-main strong {
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.35;
}

.user-secondary {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.user-uid-code {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: var(--text-subtle);
  overflow-wrap: anywhere;
}

.user-provider-row {
  margin-top: 2px;
}

.activity-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.activity-metric {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.02);
}

.activity-label {
  color: var(--text-subtle);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.activity-metric strong {
  color: var(--text-main);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.45;
}

.pill-wrap,
.detail-stage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.user-action-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(240px, 0.95fr);
  gap: 14px;
  align-items: stretch;
}

.action-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.025);
}

.action-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.action-card-heading > * {
  min-width: 0;
}

.action-card-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.action-card-title strong {
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.3;
}

.action-card-kicker {
  color: var(--text-subtle);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.action-card-copy {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.action-card-profile {
  grid-template-rows: auto 1fr auto;
}

.action-card-button {
  margin-top: auto;
}

.action-card .admin-pill {
  max-width: 100%;
  white-space: normal;
}

/* Badges & Pills */
.access-badge,
.admin-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.access-badge[data-tone="success"],
.admin-pill-admin {
  background: rgba(212, 175, 69, 0.15);
  color: var(--gold-primary);
  border-color: rgba(212, 175, 69, 0.3);
}

.access-badge[data-tone="info"],
.admin-pill-teacher {
  background: rgba(116, 184, 255, 0.15);
  color: var(--status-info);
  border-color: rgba(116, 184, 255, 0.3);
}

.access-badge[data-tone="error"],
.admin-pill-ban,
.admin-pill-error {
  background: rgba(255, 120, 120, 0.15);
  color: var(--status-error);
  border-color: rgba(255, 120, 120, 0.3);
}

.access-badge[data-tone="warning"],
.admin-pill-warning {
  background: rgba(212, 175, 69, 0.12);
  color: var(--gold-primary);
  border-color: rgba(212, 175, 69, 0.24);
}

.access-badge[data-tone="neutral"],
.access-badge:not([data-tone]),
.admin-pill-student,
.admin-pill-provider,
.admin-pill-disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: var(--border-light);
}

/* Table Actions */
.role-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(144px, auto);
  gap: 10px;
  align-items: stretch;
}

.role-select {
  width: 100%;
  min-height: 46px;
}

.role-save-button {
  width: auto;
  min-width: 144px;
  min-height: 46px;
  padding: 12px 18px;
}

.ban-tool-stack {
  display: grid;
  gap: 10px;
}

.ban-tool-copy {
  font-size: 0.88rem;
  line-height: 1.55;
}

.ban-tool-button,
.profile-tool-button {
  width: 100%;
  min-height: 46px;
  min-width: 0;
  padding: 10px 14px;
  justify-self: stretch;
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-subtle);
}

/* Editor Section */
#managedUserEditor {
  margin-top: 32px;
  padding: 32px;
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(212, 175, 69, 0.03) 0%, rgba(0, 0, 0, 0) 100%), var(--bg-panel);
  box-shadow: var(--shadow-card), var(--shadow-gold);
}

.detail-stage-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.detail-stage-copy {
  margin-top: 12px;
}

.editor-section-title {
  margin-bottom: 16px;
  color: var(--text-main);
}

.managed-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.managed-editor-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.managed-editor-grid--ban {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.managed-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.ban-panel {
  grid-column: 1 / -1;
  background: rgba(255, 120, 120, 0.05);
  border: 1px solid rgba(255, 120, 120, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
}

.ban-panel-copy {
  margin-bottom: 16px;
}

.ban-panel h4 {
  color: var(--status-error);
  margin-bottom: 8px;
}

.detail-stage-note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.managed-editor-form > .admin-status {
  margin-top: 0;
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 1480px) {
  .user-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-card-profile {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1260px) {
  .admin-users-table tbody tr {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .access-cell,
  .actions-cell {
    grid-column: 1 / -1;
  }

  .user-action-grid,
  .activity-stack {
    grid-template-columns: 1fr;
  }

  .role-editor {
    grid-template-columns: 1fr;
  }

  .role-save-button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 1024px) {
  .workspace-top,
  .card-top,
  .toolbar-row,
  .subpanel-top,
  .turnstile-panel,
  .admin-two-factor-setup {
    grid-template-columns: 1fr;
  }

  .turnstile-widget {
    justify-self: start;
  }

  .detail-stage-top {
    flex-direction: column;
  }

  .workspace-actions {
    align-items: flex-start;
    text-align: left;
  }

  .managed-editor-grid,
  .managed-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .managed-editor-grid--ban {
    grid-template-columns: 1fr;
  }

  .toolbar-note {
    text-align: left;
  }

  h1 {
    font-size: 2.5rem;
  }
}

@media (max-width: 720px) {
  .admin-card,
  .detail-stage {
    padding: 24px;
  }

  .summary-grid,
  .managed-editor-grid,
  .managed-editor-grid--ban,
  .managed-stats-grid {
    grid-template-columns: 1fr;
  }

  .workspace-button-row,
  .form-actions,
  .turnstile-actions,
  .admin-two-factor-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .turnstile-widget {
    width: 100%;
    overflow-x: auto;
  }

  .summary-card strong {
    font-size: 2.1rem;
  }

  .gemini-slot-card-stats {
    grid-template-columns: 1fr;
  }

  .actions-cell {
    padding: 14px;
  }

  .admin-primary-button,
  .admin-ghost-button,
  .admin-danger-button,
  .role-save-button,
  .ban-tool-button,
  .profile-tool-button {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .admin-shell {
    padding-top: max(24px, calc(24px + env(safe-area-inset-top)));
    padding-right: max(14px, calc(14px + env(safe-area-inset-right)));
    padding-bottom: max(72px, calc(24px + env(safe-area-inset-bottom)));
    padding-left: max(14px, calc(14px + env(safe-area-inset-left)));
  }

  .admin-card,
  .detail-stage,
  .admin-subpanel {
    padding: 20px 16px;
  }

  .admin-hero {
    margin-bottom: 28px;
  }

  h1 {
    font-size: 2.1rem;
  }

  h2,
  h3 {
    font-size: 1.65rem;
  }

  .card-top,
  .workspace-top,
  .subpanel-top,
  .detail-stage-top {
    gap: 20px;
  }

  .workspace-top {
    margin-bottom: 24px;
    padding-bottom: 24px;
  }

  .admin-users-table tbody tr {
    padding: 14px;
    gap: 14px;
  }

  .actions-cell {
    padding: 12px;
  }

  .action-card {
    padding: 14px;
    border-radius: 14px;
  }

  .action-card-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-card .admin-pill {
    align-self: flex-start;
  }

  .user-uid-code {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    line-height: 1.5;
  }

  .user-secondary,
  .ban-tool-copy,
  .action-card-copy,
  .workspace-copy,
  .detail-stage-copy,
  .admin-hero-note,
  .admin-status {
    overflow-wrap: anywhere;
  }

  .summary-card strong {
    font-size: 1.9rem;
  }
}
