:root {
  color-scheme: dark;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --bg: #1e1e1e;
  --bg-deep: #141414;
  --surface: rgba(255, 255, 255, 0.02);
  --surface-strong: rgba(255, 255, 255, 0.04);
  --surface-glass: rgba(23, 23, 23, 0.74);
  --border: #2a2a2a;
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e5e7eb;
  --text-strong: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #9ca3af;
  --accent: #f43f5e;
  --accent-soft: #fb7185;
  --accent-warm: #f97316;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  background: radial-gradient(circle at top right, rgba(244, 63, 94, 0.12), transparent 32%),
    radial-gradient(circle at bottom left, rgba(249, 115, 22, 0.08), transparent 26%),
    var(--bg);
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  max-width: 980px;
  margin: 0 auto;
  padding:
    calc(32px + var(--safe-top))
    calc(24px + var(--safe-right))
    calc(72px + var(--safe-bottom))
    calc(24px + var(--safe-left));
  color: var(--text);
  background: transparent;
  line-height: 1.65;
}

body[data-page="admin-export"] {
  max-width: 1180px;
}

a {
  color: var(--accent-soft);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

button {
  cursor: pointer;
}

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

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.logo-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-strong);
}

.badge {
  padding: 8px 14px;
  background: linear-gradient(135deg, #2a2a2a 0%, #1c1c1c 100%);
  font-size: 13px;
  letter-spacing: 0.2px;
}

.pill {
  background: #111827;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 12px;
  border-color: #1f2937;
}

.pill-online {
  color: #d1fae5;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

.pill-offline {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

h1 {
  color: var(--text-strong);
  margin: 0 0 10px;
}

h2 {
  color: var(--accent);
  margin-top: 28px;
  margin-bottom: 10px;
}

ul {
  padding-left: 20px;
}

code {
  background: #111;
  padding: 2px 4px;
  border-radius: 4px;
}

section,
.panel {
  margin-bottom: 18px;
  padding: 18px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

section > :first-child,
.panel > :first-child,
.info-card > :first-child {
  margin-top: 0;
}

section > :last-child,
.panel > :last-child,
.info-card > :last-child {
  margin-bottom: 0;
}

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

.accent-bar {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft), var(--accent-warm));
  border-radius: 999px;
  margin: 12px 0 22px;
}

footer {
  margin-top: 28px;
  color: var(--text-dim);
  font-size: 13px;
}

.hero {
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.1), rgba(17, 17, 17, 0.42));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: -30% auto auto 58%;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(251, 113, 133, 0.24), transparent 70%);
  pointer-events: none;
}

.hero img {
  display: block;
}

.hero-copy,
.hero-side {
  position: relative;
  z-index: 1;
}

.hero-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

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

.panel-title h2,
.panel-title h3 {
  margin: 0;
  color: var(--text-strong);
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 14px;
}

.status-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: var(--surface-strong);
  color: var(--text-strong);
}

.status-banner[data-tone="info"] {
  border-color: rgba(96, 165, 250, 0.28);
}

.status-banner[data-tone="success"] {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.status-banner[data-tone="warning"] {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.status-banner[data-tone="danger"] {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

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

.hidden {
  display: none !important;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.field label {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.field input,
.search-input {
  min-height: 52px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(17, 17, 17, 0.72);
  color: var(--text-strong);
  padding: 0 16px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.field input:focus,
.search-input:focus {
  border-color: rgba(251, 113, 133, 0.75);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.16);
  transform: translateY(-1px);
}

.button-row,
.toolbar-actions,
.pagination,
.search-row,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button-primary,
.button-secondary,
.button-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  transition: transform 160ms ease, opacity 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button-primary:hover,
.button-secondary:hover,
.button-ghost:hover {
  transform: translateY(-1px);
}

.button-primary:focus-visible,
.button-secondary:focus-visible,
.button-ghost:focus-visible,
.user-button:focus-visible {
  outline: 2px solid rgba(251, 113, 133, 0.95);
  outline-offset: 3px;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-warm) 120%);
}

.button-secondary {
  color: var(--text-strong);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
}

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

.button-primary:disabled,
.button-secondary:disabled,
.button-ghost:disabled {
  opacity: 0.56;
  transform: none;
}

.dashboard-shell {
  display: grid;
  gap: 18px;
}

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

.info-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(17, 17, 17, 0.54));
  box-shadow: var(--shadow);
}

.info-card strong {
  color: var(--text-strong);
}

.info-card p,
.info-card ul,
.info-card ol {
  margin: 0;
  color: var(--text-muted);
}

.info-card ul,
.info-card ol {
  padding-left: 20px;
}

.info-card li + li {
  margin-top: 8px;
}

.inline-link {
  font-weight: 700;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.toolbar-meta {
  display: grid;
  gap: 4px;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.1fr);
}

.list-meta {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 14px;
}

.user-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.user-button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(17, 17, 17, 0.54));
  color: inherit;
  padding: 16px;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.user-button:hover {
  transform: translateY(-1px);
  border-color: rgba(251, 113, 133, 0.36);
}

.user-button.is-selected {
  border-color: rgba(251, 113, 133, 0.72);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.16), rgba(17, 17, 17, 0.66));
}

.user-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 4px;
}

.user-name {
  font-weight: 700;
  color: var(--text-strong);
}

.user-email,
.user-subline {
  color: var(--text-muted);
  font-size: 14px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-chip[data-status="active"] {
  color: #dcfce7;
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.12);
}

.status-chip[data-status="blocked"] {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.12);
}

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

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

.detail-field {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.detail-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.detail-value {
  color: var(--text-strong);
  word-break: break-word;
}

.label-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.state-card {
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
}

.state-card h3 {
  margin: 0 0 8px;
  color: var(--text-strong);
}

.state-card p {
  margin: 0;
  color: var(--text-muted);
}

.state-card + .state-card {
  margin-top: 12px;
}

.spacer-top {
  margin-top: 12px;
}

@media (max-width: 900px) {
  .action-grid,
  .dashboard-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  body {
    padding:
      calc(20px + var(--safe-top))
      calc(16px + var(--safe-right))
      calc(48px + var(--safe-bottom))
      calc(16px + var(--safe-left));
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }

  header img {
    height: 36px;
  }

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

  .badge {
    font-size: 12px;
    padding: 6px 12px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 16px;
    gap: 14px;
  }

  h1 {
    font-size: 1.4rem;
    line-height: 1.3;
  }

  h2 {
    font-size: 1.1rem;
    margin-top: 20px;
  }

  .meta {
    font-size: 0.92rem;
    line-height: 1.5;
  }

  section,
  .panel {
    padding: 14px 12px;
    margin-bottom: 14px;
  }

  ul {
    padding-left: 16px;
  }

  li {
    margin-bottom: 8px;
  }

  .pill {
    font-size: 11px;
  }

  .accent-bar {
    margin: 10px 0 18px;
  }

  footer {
    font-size: 12px;
  }

  .button-primary,
  .button-secondary,
  .button-ghost,
  .field input,
  .search-input {
    width: 100%;
  }
}
