/* ==========================================================================
   Classly Admin — design tokens
   ========================================================================== */

:root {
  /* Map the admin components to the consumer frontend's semantic tokens. */
  --font-sans: var(--font);
  --font-heading: Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --bg: var(--canvas);
  --surface-2: var(--canvas);
  --surface-hover: var(--nav-hover);
  --border: var(--line);
  --border-strong: var(--input-border);
  --text: var(--ink);
  --text-2: var(--nav-ink);
  --text-3: var(--muted);
  --accent-soft: var(--soft);
  --accent-text: var(--accent);
  --success: var(--accent);
  --success-soft: var(--soft);
  --warning: var(--warning-ink);
  --warning-soft: var(--warning-surface);
  --danger-text: var(--danger);
  --danger-soft: var(--danger-surface);
  --star: var(--help-icon);
  --inverse-bg: var(--ink);
  --inverse-text: var(--on-toast);
  --overlay: var(--backdrop);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent);
  --sidebar-bg: var(--sidebar);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px var(--input-shadow);
  --shadow-md: 0 4px 20px var(--popover-shadow);
  --shadow-lg: 0 30px 100px var(--dialog-shadow);

  --sidebar-width: 212px;
  --topbar-height: 56px;
  --control-height: 44px;
  --control-height-sm: 38px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.drawer-open,
body.modal-open,
body.nav-open {
  overflow: hidden;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

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

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--inverse-text);
  background: var(--inverse-bg);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.muted {
  color: var(--text-2);
}

.eyebrow {
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.empty-copy {
  color: var(--text-3);
  font-size: 13px;
}

.footnote {
  margin-top: 14px;
  color: var(--text-3);
  font-size: 12.5px;
}

/* ==========================================================================
   Controls
   ========================================================================== */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-height);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease;
}

.button-primary {
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 2px 2px var(--button-shadow);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button-secondary {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.button-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
}

.button-ghost {
  color: var(--text-2);
  background: transparent;
}

.button-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
}

.button-danger {
  border-color: var(--danger-border);
  color: var(--danger);
  background: var(--danger-surface);
}

.button-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.button-dark {
  color: var(--inverse-text);
  background: var(--inverse-bg);
}

.button-small {
  height: var(--control-height-sm);
  padding: 0 13px;
  font-size: 12px;
}

.button-large {
  height: 48px;
  font-size: 14px;
}

.button-wide {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  width: var(--control-height);
  height: var(--control-height);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-2);
  background: transparent;
  transition:
    background-color 120ms ease,
    color 120ms ease;
}

.icon-button:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
}

.icon-button .icon {
  width: 18px;
  height: 18px;
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--accent-text);
  background: none;
  font-size: 13px;
  font-weight: 500;
}

.text-button:hover:not(:disabled) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.input-field,
.select-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.input-field > span,
.select-field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
}

.input-field small,
.select-field small {
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 400;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  min-width: 0;
  height: var(--control-height);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

textarea {
  height: auto;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

select {
  padding-right: 12px;
  appearance: auto;
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}

input:not([type="checkbox"]):hover,
select:hover,
textarea:hover {
  border-color: var(--input-hover);
}

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  border-color: var(--input-border);
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  box-shadow: var(--shadow-sm);
}

input[type="date"] {
  min-width: 0;
}

input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

.select-field-compact select {
  width: auto;
  height: var(--control-height-sm);
  font-size: 13px;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}

.checkbox-field input {
  margin-top: 2px;
}

.form-error {
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--danger-text);
  background: var(--danger-soft);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface-hover);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: 0.85;
}

.badge-success {
  color: var(--success);
  background: var(--success-soft);
}

.badge-warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge-danger {
  color: var(--danger-text);
  background: var(--danger-soft);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface-hover);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.count-pill-accent {
  color: var(--on-accent);
  background: var(--accent);
}

.auth-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 500;
}

.copy-button {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
}

.copy-button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   App shell
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar,
.nav-backdrop,
.nav-close {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 24px 12px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  z-index: 8;
}

.sidebar,
.topbar {
  color: var(--text);
  font-family: var(--font-sans);
  line-height: normal;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 10px 32px;
}

.sidebar-logo,
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.9px;
  text-decoration: none;
}

.sidebar-mark {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 26px;
  height: 26px;
  padding-bottom: 4px;
  border-radius: 8px;
  color: var(--on-accent);
  background: var(--accent);
  font-size: 21px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -2px;
}

.sidebar-dot {
  margin-left: -7px;
  color: var(--accent);
}

.sidebar-admin-label {
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
}

.primary-nav {
  display: grid;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--surface-hover);
}

.nav-item.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
}

.sidebar-account {
  position: relative;
  margin-top: auto;
  padding-top: 24px;
}

.account-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  background: var(--accent-soft);
}

.account-button > .icon {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--text-3);
}

.operator-avatar,
.table-avatar,
.drawer-avatar {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-text);
  background: var(--accent-soft);
  font-weight: 600;
}

.operator-avatar {
  width: 30px;
  height: 30px;
  color: var(--avatar-ink);
  background: var(--avatar);
  font-size: 12px;
}

.operator-copy {
  display: grid;
  min-width: 0;
}

.operator-copy strong,
.operator-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator-copy strong {
  font-size: 12px;
  font-weight: 600;
}

.operator-copy span {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 400;
}

.account-menu {
  position: absolute;
  bottom: calc(100% - 16px);
  left: 0;
  right: 0;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 4px 20px var(--popover-shadow);
}

.account-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--danger-text);
  font-size: 12px;
  text-align: left;
}

.account-menu .icon {
  width: 16px;
  height: 16px;
}

.account-menu button:hover,
.account-menu button:focus-visible {
  background: var(--danger-soft);
}

.workspace {
  min-width: 0;
  padding: 32px 40px 64px;
}

.workspace-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
}

.view-stack {
  display: grid;
  gap: 16px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-heading {
  min-width: 0;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: 37px;
  font-weight: 400;
  letter-spacing: -1.25px;
  line-height: 1.16;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.updated-at {
  color: var(--text-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Surfaces
   ========================================================================== */

.panel,
.table-card,
.filter-card,
.metric-card,
.workspace-view > .table-state {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel {
  min-width: 0;
  padding: 20px;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 16px;
}

.section-heading h2,
.table-card-heading h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-heading p {
  color: var(--text-3);
  font-size: 12.5px;
}

.callout {
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: var(--warning-soft);
  font-size: 13.5px;
}

.callout.is-critical {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  background: var(--danger-soft);
}

/* Metrics ----------------------------------------------------------------- */

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

.metric-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px 18px;
}

.metric-card > span {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.metric-card > strong {
  margin: 8px 0 4px;
  overflow: hidden;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card > small {
  color: var(--text-3);
  font-size: 12.5px;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.filter-card {
  padding: 12px;
}

.filter-bar {
  display: flex;
  gap: 8px;
}

.search-field {
  position: relative;
  display: block;
  flex: 1;
  min-width: 0;
}

.search-glyph {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--text-3);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  padding-left: 36px;
  padding-right: 40px;
}

.search-shortcut {
  position: absolute;
  top: 50%;
  right: 10px;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-3);
  background: var(--surface-2);
  font-family: var(--font-sans);
  font-size: 11px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input:focus ~ .search-shortcut,
.search-field input:not(:placeholder-shown) ~ .search-shortcut {
  display: none;
}

.filter-toggle {
  display: none;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.filter-panel select,
.filter-panel input {
  height: var(--control-height-sm);
  font-size: 13px;
}

.filter-reset {
  height: var(--control-height-sm);
}

.audit-filter-form {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr) auto;
  align-items: end;
  gap: 12px;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  scroll-margin-top: 16px;
}

@media (max-width: 1023px) {
  .table-card {
    scroll-margin-top: calc(var(--topbar-height) + 12px);
  }
}

.table-card-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.table-card-heading p {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.table-wrapper {
  overflow-x: auto;
  transition: opacity 150ms ease;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper-scroll {
  max-height: 440px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13.5px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background-color 100ms ease;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.selection-column {
  width: 44px;
  padding-right: 0 !important;
}

.row-menu-column {
  width: 48px;
  text-align: right;
}

.user-row {
  cursor: pointer;
}

.user-row.is-selected,
.user-row.is-selected:hover {
  background: var(--accent-soft);
}

.user-row.is-open,
.user-row.is-open:hover {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.user-cell-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.user-cell-inner > span:last-child {
  display: grid;
  min-width: 0;
}

.table-avatar {
  width: 32px;
  height: 32px;
  font-size: 11.5px;
}

.user-primary {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-secondary {
  overflow: hidden;
  color: var(--text-3);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.users-table td[data-column="email"],
.users-table td[data-column="last_active_at"],
.users-table td[data-column="created_at"] {
  white-space: nowrap;
}

.row-open-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  background: none;
}

.row-open-button:hover,
.user-row:hover .row-open-button {
  color: var(--text);
  background: var(--surface-hover);
}

.table-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 160px;
  padding: 40px 24px;
  color: var(--text-2);
  text-align: center;
}

.table-state.is-error {
  color: var(--danger-text);
}

.table-card.is-loading .table-wrapper {
  opacity: 0.45;
  pointer-events: none;
}

.table-card.is-loading::before {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 35%;
  height: 2px;
  background: var(--accent);
  content: "";
  animation: loading-bar 900ms var(--ease) infinite;
}

@keyframes loading-bar {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(300%);
  }
}

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

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

#users-table-card .pagination,
#audit-table-card .pagination {
  justify-content: flex-end;
}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-indicator {
  margin-right: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pagination .icon-button {
  width: var(--control-height-sm);
  height: var(--control-height-sm);
  border-color: var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.pagination .icon-button .icon {
  width: 16px;
  height: 16px;
}

/* Bulk actions ------------------------------------------------------------ */

.bulk-bar {
  position: fixed;
  z-index: 30;
  bottom: 24px;
  left: calc(50% + var(--sidebar-width) / 2);
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100vw - var(--sidebar-width) - 32px);
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  animation: rise 180ms var(--ease);
}

.bulk-summary,
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bulk-summary strong {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.bulk-actions {
  gap: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 8px;
  }
}

/* ==========================================================================
   Operations
   ========================================================================== */

.operations-alert-list {
  display: grid;
  gap: 8px;
}

.operations-alert-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent);
  border-radius: var(--radius);
  background: var(--warning-soft);
}

.operations-alert-item.is-critical {
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
  background: var(--danger-soft);
}

.operations-alert-marker {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--warning);
}

.is-critical .operations-alert-marker {
  background: var(--danger);
}

.operations-alert-item strong {
  font-size: 13.5px;
  font-weight: 600;
}

.operations-alert-item p {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 13px;
}

.operations-worker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.operations-worker-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.operations-worker-card.status-degraded,
.operations-worker-card.status-unknown {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
}

.operations-worker-card.status-critical {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.operations-worker-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.operations-worker-heading h3 {
  font-size: 14px;
  font-weight: 600;
}

.operations-worker-heading p {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 12.5px;
}

.operations-worker-reason {
  margin: 10px 0 14px;
  color: var(--text-2);
  font-size: 13px;
}

.operations-worker-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.operations-worker-metrics dt {
  color: var(--text-3);
  font-size: 11.5px;
}

.operations-worker-metrics dd {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.operations-worker-error {
  margin-top: 12px;
  color: var(--danger-text);
  font-size: 12px;
}

#operations-queues-body td > strong,
#operations-queues-body td > span:not(.badge) {
  display: block;
}

#operations-queues-body td > strong {
  font-weight: 500;
  white-space: nowrap;
}

#operations-queues-body td > span:not(.badge) {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 12.5px;
}

.operations-queue-name {
  min-width: 170px;
}

.operations-queue-status {
  min-width: 150px;
}

#operations-queues-body td:nth-child(4) > span {
  white-space: nowrap;
}

.operations-outcome-warning > strong {
  color: var(--warning);
}

.operations-detail-cell {
  min-width: 220px;
}

.operations-detail-cell ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.operations-detail-cell li {
  color: var(--text-2);
  font-size: 12.5px;
}

.tone-warning {
  color: var(--warning) !important;
}

.tone-critical {
  color: var(--danger-text) !important;
}

/* ==========================================================================
   Subscriptions
   ========================================================================== */

.campaign-progress {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.campaign-progress progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-hover);
  appearance: none;
}

.campaign-progress progress::-webkit-progress-bar {
  background: var(--surface-hover);
}

.campaign-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.campaign-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.campaign-progress span {
  color: var(--text-3);
  font-size: 12.5px;
}

.campaign-job-copy {
  min-width: 240px;
  color: var(--text-2);
  font-size: 13px !important;
}

.campaign-request-copy {
  display: grid;
  min-width: 160px;
}

.campaign-request-copy strong {
  font-weight: 500;
}

.campaign-request-copy span {
  color: var(--text-3);
  font-size: 12.5px;
}

.campaign-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.campaign-action-button {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}

/* ==========================================================================
   Audit
   ========================================================================== */

.audit-evidence-content {
  display: grid;
  gap: 2px;
  min-width: 220px;
}

.audit-evidence-content .mono {
  color: var(--text-3);
  font-size: 11.5px;
}

.audit-evidence-content .copy-button {
  justify-self: start;
  margin-top: 4px;
}

#audit-body td:first-child {
  white-space: nowrap;
}

/* ==========================================================================
   User drawer
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  animation: fade 160ms ease;
}

.user-drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(520px, 100vw);
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: slide-in 220ms var(--ease);
}

.user-drawer:focus {
  outline: none;
}

@keyframes slide-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--border);
}

.drawer-header h2 {
  margin-top: 2px;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 24px;
  color: var(--text-2);
}

.drawer-state.is-error {
  color: var(--danger-text);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.user-identity-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 16px;
}

.drawer-avatar {
  width: 52px;
  height: 52px;
  font-size: 16px;
}

.user-identity-card h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.user-identity-card p {
  margin: 1px 0 8px;
  color: var(--text-3);
  font-size: 13px;
  word-break: break-all;
}

.drawer-tabs {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  gap: 20px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.drawer-tab {
  margin-bottom: -1px;
  padding: 10px 0 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  background: none;
  font-size: 13.5px;
  font-weight: 500;
}

.drawer-tab:hover {
  color: var(--text);
}

.drawer-tab.is-active {
  border-bottom-color: var(--text);
  color: var(--text);
}

.drawer-panel {
  padding: 0 20px 32px;
}

.detail-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
  border-bottom: 0;
}

.detail-section > h3,
.detail-section-heading h3 {
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}

.detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-section-heading h3 {
  margin: 0;
}

.detail-list {
  display: grid;
  margin: 0;
}

.detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row dt {
  flex-shrink: 0;
  color: var(--text-2);
  font-size: 13px;
}

.detail-row dd {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

.detail-row dd.mono {
  word-break: break-all;
}

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

.action-card-button {
  display: grid;
  gap: 3px;
  align-content: start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.action-card-button:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.action-card-button strong {
  font-size: 13.5px;
  font-weight: 500;
}

.action-card-button small {
  color: var(--text-3);
  font-size: 12px;
}

.action-card-button.is-danger strong {
  color: var(--danger-text);
}

.danger-zone > p {
  margin: -4px 0 12px;
  color: var(--text-2);
  font-size: 13px;
}

.danger-zone > h3 {
  color: var(--danger-text);
}

#erasure-actions {
  display: grid;
  gap: 8px;
}

#erasure-actions > p {
  color: var(--text-2);
  font-size: 13px;
}

.stack-list {
  display: grid;
  gap: 8px;
}

.stack-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stack-item strong {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
}

.stack-item span:not(.badge) {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 12.5px;
}

.timeline {
  display: grid;
}

.timeline-item {
  position: relative;
  padding: 0 0 18px 20px;
}

.timeline-item::before {
  position: absolute;
  top: 5px;
  left: 0;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.timeline-item::after {
  position: absolute;
  top: 18px;
  bottom: 0;
  left: 4px;
  width: 1px;
  background: var(--border);
  content: "";
}

.timeline-item:last-child::after {
  display: none;
}

.timeline-item strong {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
}

.timeline-item time {
  display: block;
  color: var(--text-3);
  font-size: 12px;
}

.timeline-item p {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 12.5px;
}

/* ==========================================================================
   Dialogs and toasts
   ========================================================================== */

.modal {
  width: min(520px, calc(100vw - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  overflow: visible;
}

.modal[open] {
  animation: dialog-in 180ms var(--ease);
}

.modal::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
  animation: fade 160ms ease;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

.modal-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-heading h2 {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-body {
  display: grid;
  gap: 20px;
  padding: 24px;
  overflow-y: auto;
}

.modal-copy {
  color: var(--text-2);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  background: var(--canvas);
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  color: var(--inverse-text);
  background: var(--inverse-bg);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: rise 200ms var(--ease);
  pointer-events: auto;
}

.toast::before {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--positive-border);
  content: "";
}

.toast.is-warning::before {
  background: var(--warning);
}

.toast.is-error::before {
  background: var(--danger);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1280px) {
  .filter-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-reset {
    justify-self: start;
  }

  .workspace {
    padding: 28px 28px 64px;
  }
}

@media (max-width: 1100px) {
  .two-column {
    grid-template-columns: minmax(0, 1fr);
  }

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

/* Off-canvas navigation ---------------------------------------------------- */

@media (max-width: 1023px) {
  .app-shell {
    display: block;
  }

  .topbar {
    position: sticky;
    z-index: 40;
    top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: calc(var(--topbar-height) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
  }

  .nav-backdrop {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: block;
    background: var(--overlay);
    animation: fade 160ms ease;
  }

  .sidebar {
    position: fixed;
    z-index: 80;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(240px, calc(100vw - 56px));
    height: auto;
    padding-top: calc(24px + env(safe-area-inset-top));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform 240ms var(--ease),
      visibility 0s linear 240ms;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 240ms var(--ease);
  }

  .nav-close {
    display: inline-grid;
    width: 24px;
    height: 26px;
    margin-left: auto;
  }

  .nav-item {
    min-height: 40px;
  }

  .workspace {
    padding: 24px 24px 96px;
  }

  .bulk-bar {
    left: 50%;
    max-width: calc(100vw - 32px);
  }
}

/* Phones and small tablets ------------------------------------------------ */

@media (max-width: 767px) {
  input:not([type="checkbox"]),
  select,
  textarea,
  .filter-panel select,
  .filter-panel input {
    font-size: 16px;
  }

  .workspace {
    padding: 20px 16px 104px;
  }

  .workspace-view {
    gap: 16px;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .page-header h1 {
    font-size: 30px;
  }

  .header-actions > .button,
  .header-actions > .select-field {
    flex: 1 1 auto;
  }

  .app-select select {
    width: 100%;
    min-width: 0;
  }

  .updated-at {
    flex-basis: 100%;
  }

  .search-shortcut {
    display: none;
  }

  .search-field input {
    padding-right: 12px;
  }

  .filter-toggle {
    display: inline-flex;
    padding: 0 12px;
  }

  .filter-toggle > span:not(.count-pill) {
    display: none;
  }

  .filter-panel {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-form.is-expanded .filter-panel {
    display: grid;
  }

  .filter-reset {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .audit-filter-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-grid {
    gap: 8px;
  }

  .metric-card {
    padding: 14px;
  }

  .metric-card > strong {
    font-size: 19px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .panel {
    padding: 16px;
  }

  .table-card-heading {
    padding: 14px 16px;
  }

  /* Tables become stacked cards. Labels come from data-label attributes
     that admin.js copies from each table header. */
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
  }

  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal !important;
  }

  .data-table td[data-label]::before {
    display: block;
    margin-bottom: 3px;
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 500;
    content: attr(data-label);
  }

  .data-table td:first-child,
  .data-table td[colspan],
  .operations-detail-cell,
  .audit-evidence,
  .campaign-job-copy {
    grid-column: 1 / -1;
  }

  .data-table td:first-child::before {
    display: none !important;
  }

  .data-table td[colspan] {
    text-align: center;
  }

  .operations-detail-cell,
  .campaign-progress,
  .campaign-request-copy,
  .campaign-job-copy,
  .audit-evidence-content,
  .user-cell-inner {
    min-width: 0;
  }

  .campaign-actions {
    justify-content: flex-start;
  }

  .row-menu-column {
    width: auto;
    text-align: left;
  }

  /* Users: checkbox and chevron pin to the card corners. */
  .users-table thead {
    position: static;
    display: block;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  .users-table thead tr {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
  }

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

  .users-table thead th.selection-column {
    position: static;
    display: flex;
    align-items: center;
    gap: 12px;
    width: auto;
    padding: 0;
    border: 0;
    background: none;
  }

  .users-table thead th.selection-column::after {
    color: var(--text-2);
    font-size: 12.5px;
    content: "Select page";
  }

  .users-table tbody tr {
    position: relative;
    padding: 14px 48px 14px 44px;
  }

  /* grid-column must stay auto: an explicit grid area would become the
     containing block and offset these absolutely positioned cells. */
  .users-table td.selection-column {
    position: absolute;
    top: 22px;
    left: 16px;
    grid-column: auto;
    width: auto;
  }

  .users-table td.row-menu-column {
    position: absolute;
    top: 16px;
    right: 10px;
    grid-column: auto;
  }

  .users-table td.user-cell {
    grid-column: 1 / -1;
  }

  .users-table td.user-cell::before {
    display: none !important;
  }

  .pagination {
    padding: 12px 16px;
  }

  .pagination-nav .button > span {
    display: none;
  }

  .pagination-nav .button {
    width: var(--control-height-sm);
    padding: 0;
  }

  .bulk-bar {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
    justify-content: space-between;
    max-width: none;
    transform: none;
  }

  .bulk-actions {
    padding-left: 12px;
  }

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

  .user-drawer {
    width: 100vw;
    border-left: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .drawer-panel {
    padding: 0 16px 32px;
  }

  .drawer-tabs {
    padding: 0 16px;
    overflow-x: auto;
  }

  .user-identity-card {
    padding: 20px 16px 16px;
  }

  .toast-region {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
  }
}

@media (max-width: 640px) {
  .modal {
    width: 100vw;
    margin: auto 0 0;
  }

  .modal[open] {
    animation: sheet-in 240ms var(--ease);
  }

  .modal-card {
    max-height: calc(100dvh - 32px);
    border-bottom: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .modal-actions .button {
    flex: 1;
  }

  @keyframes sheet-in {
    from {
      transform: translateY(40px);
      opacity: 0;
    }
  }
}

@media (max-width: 420px) {
  .bulk-summary .text-button {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* Home -------------------------------------------------------------------- */

.home-shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}

.home-shortcut {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.home-shortcut:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.home-shortcut > .icon {
  color: var(--accent);
  flex-shrink: 0;
}
.home-shortcut > span {
  flex: 1;
  min-width: 0;
}
.home-shortcut strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.home-shortcut small {
  display: block;
  margin-top: 5px;
  color: var(--text-3);
  line-height: 1.5;
}
.home-shortcut .home-shortcut-arrow {
  width: 16px;
  color: var(--text-3);
}
.home-state,
.home-updated {
  color: var(--text-3);
  font-size: 13px;
}
.home-state {
  padding: 16px 0;
}
.home-state.is-error {
  color: var(--danger-text);
}
.home-updated {
  margin-top: 16px;
  font-size: 12px;
}
.home-users-list,
.home-alerts {
  list-style: none;
  margin: 0;
  padding: 0;
}
.home-users-list li + li {
  border-top: 1px solid var(--border);
}
.home-user-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  color: var(--text);
  text-decoration: none;
}
.home-user-link:hover strong {
  color: var(--accent);
}
.home-user-copy {
  flex: 1;
  min-width: 0;
}
.home-user-copy strong,
.home-user-copy small {
  display: block;
  overflow-wrap: anywhere;
}
.home-user-copy strong {
  font-size: 14px;
  font-weight: 500;
}
.home-user-copy small,
.home-user-link time {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12px;
}
.home-user-link time {
  flex-shrink: 0;
}
.home-alerts li {
  margin-top: 12px;
}
@media (max-width: 480px) {
  .home-user-link {
    flex-wrap: wrap;
  }
  .home-user-link time {
    width: 100%;
    margin-left: 0;
  }
}

/* Support details use the same compact surfaces as authentication. */
.support-note {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
  margin: 8px 0 14px;
}
#support-detail .stack-item { margin-top: 8px; align-items: flex-start; }
#support-detail .stack-item > div,
#sessions-list .stack-item > div,
#auth-methods-list .stack-item > div { min-width: 0; overflow-wrap: anywhere; }
#support-detail .badge, .session-signout { flex-shrink: 0; }
#sessions-list .stack-item { align-items: flex-start; }
.session-device-id { font-family: var(--font-mono); font-size: 11px !important; }
#sessions-more-button { width: 100%; }
#drawer-support-tab { white-space: nowrap; }
#support-state { color: var(--text-2); font-size: 13px; }

.session-filter-help {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
}

/* Account statistics reuse the established metric cards and accessible charts. */
.users-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.users-tabs button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 12px 0;
  font: inherit;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.users-tabs button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--text);
}
.users-overview-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}
.users-overview-heading h2 {
  margin: 0 0 6px;
  font-size: 22px;
}
.users-overview-heading p,
.users-statistics-chart > p,
.users-statistics-definitions p {
  color: var(--text-2);
  line-height: 1.6;
}
.users-statistics-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0 24px;
}
.users-statistics-chart {
  --ink-2: var(--text-2);
  --ink-3: var(--text-3);
  --asc-accent: var(--accent);
  --asc-series-1: var(--accent);
  --asc-series-2: var(--help-icon);
  --asc-series-3: var(--nav-ink);
  --asc-series-4: var(--danger);
  --shadow-pop: var(--shadow-lg);
  padding: 24px;
  min-width: 0;
}
.users-statistics-chart h3 {
  margin: 0;
}
.users-statistics-freshness {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}
.users-statistics-notice {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.users-statistics-definitions {
  margin-top: 28px;
  max-width: 850px;
  font-size: 13px;
}
.users-statistics-definitions h3 {
  font-size: 14px;
}
@media (max-width: 700px) {
  .users-overview-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .users-statistics-metrics {
    grid-template-columns: 1fr;
  }
  .users-statistics-chart {
    --ink-2: var(--text-2);
    --ink-3: var(--text-3);
    --asc-accent: var(--accent);
    --asc-series-1: var(--accent);
    --asc-series-2: var(--help-icon);
    --asc-series-3: var(--nav-ink);
    --asc-series-4: var(--danger);
    --shadow-pop: var(--shadow-lg);
    padding: 16px;
  }
  .users-tabs {
    gap: 20px;
  }
}

.users-statistics-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 16px 0;
  font-size: 12px;
  color: var(--text-2);
}
.users-statistics-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.users-statistics-legend span::before {
  content: "";
  width: 24px;
  border-top: 2px solid var(--asc-series-1);
}
.users-statistics-legend .users-series-previous::before {
  border-top: 2px dashed var(--asc-series-2);
}
.users-statistics-chart .asc-chart-line[data-series="1"] {
  stroke-dasharray: 6 4;
}

/* Device-scoped push tools share the support drawer and modal tokens. */
.device-session {
  flex-wrap: wrap;
}
.device-session > div:first-child {
  flex: 1 1 100%;
}
.device-push-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.device-push-actions .text-button {
  font-size: 12px;
}
.device-push-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.device-push-modal {
  width: min(760px, calc(100vw - 32px));
}
.device-push-modal .modal-body {
  gap: 18px;
}
.push-fields {
  display: grid;
  gap: 16px;
}
.push-registration {
  padding: 14px 16px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
.push-registration strong {
  display: block;
  margin-bottom: 6px;
}
.push-registration dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 16px;
  font-size: 12px;
  margin: 0;
}
.push-registration dt {
  color: var(--text-3);
}
.push-registration dd {
  margin: 0;
  color: var(--text-2);
}
.push-delivery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.push-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.push-section-heading h3 {
  margin: 0;
  font-size: 14px;
}
.push-section-heading span,
.push-section-heading output {
  color: var(--text-3);
  font-size: 12px;
}
.push-json {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  tab-size: 2;
}
.push-payload-help {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}
.push-payload-help summary {
  cursor: pointer;
  font-weight: 500;
}
.push-payload-help p {
  margin: 8px 0;
}
.push-result {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--canvas);
  font-size: 13px;
  overflow-wrap: anywhere;
}
@media (max-width: 560px) {
  .push-delivery-grid {
    grid-template-columns: 1fr;
  }
  .device-push-modal .modal-body {
    padding: 16px;
  }
  .device-push-modal .modal-heading,
  .device-push-modal .modal-actions {
    padding: 14px 16px;
  }
}

@media (max-width: 640px) {
  .device-push-modal {
    width: 100vw;
  }
}
/* The policy editor follows the shared admin controls and stays usable on phones. */
.update-policy-form { max-width: 760px; }
.update-policy-form fieldset { border: 0; padding: 0; margin: 16px 0; display: grid; gap: 16px; min-width: 0; }
.update-policy-form label { display: grid; gap: 6px; }
.update-policy-form input[type="checkbox"] { width: 20px; height: 20px; }
.update-policy-translation { display: grid; gap: 8px; margin-bottom: 12px; }
.update-policy-form textarea { min-height: 100px; resize: vertical; }
