:root {
  --bg: #08080c;
  --bg-soft: #11111a;
  --surface: rgba(15, 15, 22, 0.92);
  --surface-strong: rgba(20, 18, 31, 0.98);
  --surface-soft: rgba(139, 92, 246, 0.08);
  --border: rgba(173, 156, 255, 0.12);
  --border-strong: rgba(139, 92, 246, 0.34);
  --text: #f7f4ff;
  --muted: #a39cb9;
  --accent: #8b5cf6;
  --accent-strong: #a78bfa;
  --success: #39d98a;
  --warning: #ffb648;
  --danger: #ff6b7d;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --radius: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --content-width: 1480px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  cursor: default;
  user-select: none;
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.22), transparent 30%),
    radial-gradient(circle at top right, rgba(90, 66, 181, 0.14), transparent 24%),
    linear-gradient(180deg, #08080c 0%, #0d0c14 100%);
  font-family: Inter, "SF Pro Display", "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

code {
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(139, 92, 246, 0.12);
  user-select: text;
}

select {
  cursor: pointer;
}

.mono {
  user-select: text;
}

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.16), transparent 25%),
    radial-gradient(circle at 80% 18%, rgba(91, 57, 191, 0.12), transparent 20%);
}

.app-shell {
  position: relative;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 28px;
}

.hidden {
  display: none !important;
}

.card,
.auth-card,
.modal-card,
.metric-card,
.data-card,
.section-card,
.editor-card,
.list-row {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.card-soft {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
}

.auth-kicker {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.auth-shell {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(100%, 520px);
  border-radius: 32px;
  padding: 34px;
}

.auth-brand {
  margin-bottom: 24px;
}

.auth-brand h1 {
  margin: 10px 0 10px;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.05;
}

.auth-actions {
  margin-top: 20px;
}

.auth-remember {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(163, 189, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

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

.auth-remember-title {
  font-weight: 700;
  color: var(--text);
}

.auth-remember-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 54px;
  height: 32px;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 1px solid rgba(173, 156, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  transition: 0.2s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f7f4ff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  transition: 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
  border-color: rgba(139, 92, 246, 0.34);
  background: linear-gradient(135deg, rgba(109, 76, 255, 0.8), rgba(139, 92, 246, 0.92));
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 4px rgba(107, 211, 255, 0.12);
  border-color: rgba(107, 211, 255, 0.48);
}

.panel-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 56px);
}

.sidebar {
  position: sticky;
  top: 28px;
  align-self: start;
  border-radius: 30px;
  padding: 22px;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.sidebar-head h2,
.topbar h3,
.page-header h1,
.section-head h2,
.modal-head h3 {
  margin: 0;
}

.sidebar-worker {
  padding: 16px;
  margin-bottom: 18px;
}

.sidebar-worker strong {
  display: block;
  font-size: 17px;
  margin-bottom: 4px;
}

.sidebar-nav {
  display: grid;
  gap: 16px;
}

.nav-group {
  display: grid;
  gap: 10px;
}

.nav-group-title,
.eyebrow,
.small-label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 700;
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-align: left;
  transition: 0.2s ease;
}

.nav-button[aria-current="page"] {
  border-color: var(--border-strong);
}

.nav-button:hover,
.nav-button:focus-visible {
  border-color: rgba(139, 92, 246, 0.28);
  background: rgba(139, 92, 246, 0.08);
  outline: none;
}

.nav-button.active {
  border-color: var(--border-strong);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(139, 92, 246, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.nav-button-copy {
  min-width: 0;
  flex: 1 1 200px;
}

.nav-button-label {
  display: block;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.nav-button-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.nav-pill,
.meta-chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-pill {
  flex: 0 0 auto;
}

.nav-pill,
.meta-chip {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.meta-chip.success,
.badge.success {
  background: rgba(57, 217, 138, 0.14);
  color: #83f0b5;
}

.badge.info {
  background: rgba(139, 92, 246, 0.16);
  color: #c5b4ff;
}

.badge.warning {
  background: rgba(255, 182, 72, 0.16);
  color: #ffd18b;
}

.badge.danger {
  background: rgba(255, 107, 125, 0.16);
  color: #ff9caa;
}

.badge.neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.workspace {
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
}

.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 16, 0.62);
  backdrop-filter: blur(10px);
  z-index: 29;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 28px;
}

.topbar-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.content-stack {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.overview-grid,
.worker-profile-grid,
.detail-grid {
  display: grid;
  gap: 18px;
}

.worker-profile-grid {
  grid-template-columns: minmax(280px, 1.2fr) minmax(0, 1fr);
}

.profile-hero {
  display: grid;
  gap: 16px;
}

.profile-title-row,
.profile-inline,
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.profile-name {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
  line-height: 1.05;
}

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

.mini-stat {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 16px;
}

.mini-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.detail-card {
  width: min(100%, 780px);
  max-height: min(88vh, 920px);
  overflow: auto;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

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

.list-row.is-clickable {
  cursor: pointer;
}

.list-row.is-clickable:focus-visible {
  outline: none;
  border-color: rgba(139, 92, 246, 0.48);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}

.toast-host {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.toast {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(15, 26, 43, 0.95);
  box-shadow: var(--shadow);
  animation: toast-in 0.22s ease;
}

.toast.success {
  border-color: rgba(57, 217, 138, 0.3);
}

.toast.error {
  border-color: rgba(255, 107, 125, 0.3);
}

.page-header,
.section-head,
.section-toolbar,
.page-grid,
.metrics-grid,
.split-grid,
.list-stack,
.stats-grid,
.form-grid,
.hero-grid,
.admin-grid {
  display: grid;
  gap: 18px;
}

.page-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.page-header h1 {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.05;
}

.page-subtitle,
.muted {
  color: var(--muted);
}

.page-actions,
.inline-actions,
.modal-actions,
.toolbar-actions,
.button-row,
.filters-row,
.stat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.profile-page-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.profile-page-actions .btn {
  width: 100%;
}

.profile-actions-card {
  display: grid;
  gap: 16px;
}

.hero-grid,
.metrics-grid,
.stats-grid,
.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metric-card,
.section-card,
.editor-card,
.data-card {
  border-radius: 24px;
  padding: 22px;
}

.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 60%);
  pointer-events: none;
}

.metric-value {
  margin-top: 12px;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  line-height: 1;
}

.metric-caption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.split-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
}

.template-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.list-stack {
  align-content: start;
}

.template-item,
.list-row,
.summary-row,
.operation-row {
  border-radius: 18px;
}

.template-item,
.list-row {
  padding: 16px 18px;
}

.template-item {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  transition: 0.2s ease;
}

.template-item:hover,
.template-item:focus-visible,
.list-row:hover {
  border-color: rgba(139, 92, 246, 0.2);
  background: rgba(139, 92, 246, 0.06);
  outline: none;
}

.template-item.active {
  border-color: var(--border-strong);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(167, 139, 250, 0.08));
}

.list-row {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto;
  align-items: center;
}

.list-title,
.section-title {
  font-size: 16px;
  font-weight: 700;
}

.meta-line,
.small,
.subtle {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.data-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.section-card h2,
.editor-card h2,
.data-card h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.section-description {
  margin: 0;
  color: var(--muted);
}

.toolbar-card,
.empty-state,
.warning-panel,
.result-panel,
.sticky-save {
  border-radius: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.toolbar-card {
  background: rgba(255, 255, 255, 0.045);
}

.warning-panel {
  border-color: rgba(139, 92, 246, 0.22);
  background: rgba(139, 92, 246, 0.08);
}

.result-panel.success {
  border-color: rgba(57, 217, 138, 0.28);
  background: rgba(57, 217, 138, 0.08);
}

.empty-state {
  text-align: center;
  padding: 28px;
}

.empty-state h3 {
  margin: 0 0 10px;
}

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

.field-group label,
.field-label {
  font-size: 13px;
  font-weight: 700;
  color: #dce6ff;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

input[type="number"] {
  min-width: 88px;
}

.inline-input {
  width: 92px;
  max-width: 92px;
}

.inline-input-wide {
  width: 108px;
  max-width: 108px;
}

.inline-select {
  width: 122px;
  max-width: 122px;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(173, 156, 255, 0.16);
  background: rgba(10, 10, 16, 0.92);
  color: var(--text);
  transition: 0.2s ease;
  cursor: text;
  user-select: text;
}

textarea {
  min-height: 138px;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
.template-item:focus-visible,
.nav-button:focus-visible {
  outline: none;
  border-color: rgba(107, 211, 255, 0.48);
  box-shadow: 0 0 0 4px rgba(107, 211, 255, 0.12);
}

.checkbox-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(163, 189, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

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

.form-grid > .full,
.form-grid .field-group.full {
  grid-column: 1 / -1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  font-weight: 700;
  color: var(--text);
  transition: 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #f7f4ff;
  background: linear-gradient(135deg, #6d4cff, #8b5cf6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(173, 156, 255, 0.14);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(173, 156, 255, 0.14);
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b7d, #ff8e71);
}

.btn-block {
  width: 100%;
}

.pill-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-tab {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-weight: 700;
}

.pill-tab.active {
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.28);
  background: rgba(139, 92, 246, 0.14);
}

.pill-tab:hover,
.pill-tab:focus-visible {
  outline: none;
  border-color: rgba(139, 92, 246, 0.24);
  background: rgba(139, 92, 246, 0.08);
}

.panel-hero {
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.07), transparent 48%),
    var(--surface);
}

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

.compact-metric-card {
  padding: 18px;
}

.compact-metric-card .metric-value {
  font-size: clamp(22px, 3vw, 30px);
}

.drain-query-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 14px;
  align-items: end;
}

.drain-field {
  min-width: 0;
}

.btn-info-tile {
  min-height: 112px;
  border-radius: 24px;
  font-size: 20px;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.22), rgba(139, 92, 246, 0.12));
  border-color: rgba(167, 139, 250, 0.28);
}

.drain-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.drain-card {
  display: grid;
  gap: 16px;
}

.drain-card-head,
.drain-stat-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.drain-stat-line {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(173, 156, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.drain-nft-block {
  display: grid;
  gap: 12px;
}

.nft-pill-grid {
  display: grid;
  gap: 10px;
}

.nft-pill-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.nft-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(173, 156, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 12px;
  text-align: center;
}

.drain-action-stack {
  display: grid;
  gap: 12px;
}

.formatted-result pre {
  margin: 10px 0 0;
  white-space: pre-wrap;
  line-height: 1.65;
  color: var(--text);
}

.admin-menu-layout {
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 360px);
  margin-top: 18px;
}

.nested-card {
  background: rgba(255, 255, 255, 0.02);
  box-shadow: none;
}

.admin-function-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-function-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(173, 156, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.admin-function-card-live {
  border-color: rgba(139, 92, 246, 0.28);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.12), rgba(255, 255, 255, 0.03));
}

.compact-summary-row {
  min-height: 100%;
}

.admin-worker-row {
  background: rgba(255, 255, 255, 0.025);
}

.admin-worker-actions {
  justify-content: flex-end;
}

.admin-action-group {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(173, 156, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.admin-action-group-balance {
  border-color: rgba(139, 92, 246, 0.18);
  background: rgba(139, 92, 246, 0.06);
}

.admin-action-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-action-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-workers-stack {
  margin-top: 18px;
}

.summary-grid {
  display: grid;
  gap: 12px;
}

.summary-row,
.operation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.operation-row {
  flex-wrap: wrap;
}

.sticky-save {
  position: sticky;
  bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.form-message {
  min-height: 20px;
  margin: 0;
}

.error {
  color: #ff9fae;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 9, 16, 0.74);
  backdrop-filter: blur(14px);
  z-index: 40;
}

.modal-card {
  width: min(100%, 480px);
  border-radius: 28px;
  padding: 24px;
}

.modal-head {
  margin-bottom: 14px;
}

#confirmText {
  line-height: 1.6;
}

.skeleton {
  min-height: 180px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.08) 37%, rgba(255, 255, 255, 0.04) 63%),
    rgba(255, 255, 255, 0.03);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .panel-shell,
  .split-grid,
  .drain-grid,
  .template-grid,
  .worker-profile-grid {
    grid-template-columns: 1fr;
  }

  .admin-menu-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }

  .nav-group {
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 16px;
  }

  .content-stack {
    gap: 16px;
    margin-top: 16px;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 30;
    width: min(86vw, 360px);
    height: 100vh;
    overflow-y: auto;
    border-radius: 0 28px 28px 0;
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.24s ease;
    padding: 20px 18px 24px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .nav-pill {
    display: none;
  }

  .nav-button {
    padding: 12px 14px;
  }

  .nav-button-note {
    margin-top: 2px;
    font-size: 11px;
  }

  .workspace {
    min-width: 0;
  }

  .topbar,
  .page-header,
  .sticky-save,
  .summary-row,
  .operation-row {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar,
  .page-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .topbar {
    gap: 14px;
    padding: 18px;
  }

  .topbar-copy {
    gap: 8px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
  }

  .topbar-actions > * {
    min-width: 0;
  }

  .page-header {
    gap: 12px;
  }

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

  .profile-title-row,
  .profile-inline,
  .profile-actions,
  .drain-card-head,
  .drain-stat-line {
    align-items: stretch;
  }

  .metric-card,
  .section-card,
  .editor-card,
  .data-card {
    padding: 20px;
  }

  .metric-value,
  .compact-metric-card .metric-value {
    font-size: 26px;
  }

  .section-card h2,
  .editor-card h2,
  .data-card h2 {
    font-size: 20px;
  }

  .list-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .list-row > * {
    min-width: 0;
  }

  .list-row .data-points,
  .list-row .inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .list-row .inline-input {
    width: 100%;
    max-width: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

   .drain-query-row,
   .compact-hero-grid,
   .nft-pill-row {
    grid-template-columns: 1fr;
  }

  .detail-grid,
  .profile-kpis {
    grid-template-columns: 1fr;
  }

  .profile-page-actions {
    grid-template-columns: 1fr;
  }

  .admin-worker-actions {
    justify-content: stretch;
  }

  .admin-action-group {
    width: 100%;
  }

  .admin-action-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .auth-card,
  .topbar,
  .metric-card,
  .section-card,
  .editor-card,
  .data-card,
  .modal-card {
    border-radius: 22px;
  }

  .auth-card,
  .topbar,
  .metric-card,
  .section-card,
  .editor-card,
  .data-card,
  .modal-card,
  .list-row,
  .template-item {
    padding: 16px;
  }

  .app-shell {
    padding: 12px;
  }

  .content-stack {
    gap: 14px;
    margin-top: 14px;
  }

  .topbar {
    gap: 12px;
    padding: 16px;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .topbar-copy .eyebrow,
  .page-header .eyebrow {
    font-size: 10px;
  }

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

  .section-card h2,
  .editor-card h2,
  .data-card h2 {
    font-size: 18px;
  }

  .profile-name {
    font-size: 24px;
  }

  .metric-value,
  .compact-metric-card .metric-value {
    font-size: 22px;
  }

  .summary-row,
  .operation-row,
  .mini-stat {
    padding: 12px 14px;
  }

  .topbar-actions,
  .page-actions,
  .toolbar-actions,
  .filters-row,
  .button-row,
  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn,
  .pill-tab {
    width: 100%;
  }

  .mobile-menu-btn {
    width: 100%;
  }

  .sidebar {
    width: min(92vw, 340px);
    padding: 16px 14px 22px;
  }

  .admin-action-controls {
    grid-template-columns: 1fr;
  }
}
