/* =========================================================
   Design tokens
   ========================================================= */
:root {
  --bg: #15111E;
  --bg-deep: #0F0C16;
  --surface: #1D1828;
  --surface-raised: #241F32;

  --ink: #F4EFE8;
  --ink-soft: #C9C0D6;
  --muted: #8D84A0;

  --line: rgba(244, 239, 232, 0.09);
  --line-strong: rgba(244, 239, 232, 0.16);

  --amber: #E8A33D;
  --amber-hover: #F2B65A;
  --amber-soft: rgba(232, 163, 61, 0.14);
  --amber-ink: #3A2707;

  --violet: #8B7FE8;
  --violet-soft: rgba(139, 127, 232, 0.16);

  --success: #4FD1A5;
  --success-soft: rgba(79, 209, 165, 0.14);

  --danger: #F0645F;
  --danger-soft: rgba(240, 100, 95, 0.14);
  --danger-hover: #F58581;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;

  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 22px;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 12px 32px rgba(0, 0, 0, 0.28);
  --shadow-sheet: -24px 0 60px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 24px 70px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 32px;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

.ic { width: 16px; height: 16px; flex-shrink: 0; }

/* =========================================================
   Nav
   ========================================================= */
.nav {
  border-bottom: 1px solid var(--line);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--amber);
  color: var(--amber-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
}

.nav__links {
  display: flex;
  gap: 22px;
}

.nav__links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.nav__links a.is-active { color: var(--ink); }

.nav__status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.status-dot.is-online { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.is-offline { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* =========================================================
   Hero + constellation
   ========================================================= */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse 900px 500px at 82% -10%, rgba(139,127,232,0.16), transparent 60%),
    radial-gradient(ellipse 700px 420px at 8% 110%, rgba(232,163,61,0.10), transparent 60%);
}

.hero__field {
  position: absolute;
  inset: 0;
  opacity: 0.9;
}
.hero__field svg { width: 100%; height: 100%; display: block; }

.constellation circle { fill: var(--amber); }
.constellation circle.v { fill: var(--violet); }
.constellation line { stroke: var(--line-strong); stroke-width: 1; }

.hero__inner {
  position: relative;
  padding: 76px 32px 56px;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber-hover);
  margin: 0 0 18px;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
  max-width: 14ch;
}

.hero__lede {
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0 0 40px;
}

.hero__stats {
  display: flex;
  gap: 44px;
  margin-bottom: 40px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-stat__value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.1rem;
  color: var(--ink);
}

.hero-stat__value--text {
  font-size: 1.3rem;
}

.hero-stat__label {
  font-size: 12.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 12px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--amber);
  color: var(--amber-ink);
  box-shadow: 0 1px 2px rgba(232,163,61,0.3), 0 8px 24px rgba(232,163,61,0.22);
}
.btn--primary:hover { background: var(--amber-hover); }

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.btn--ghost:hover { border-color: var(--muted); color: var(--ink); }

.btn--danger {
  background: var(--danger);
  color: #241111;
}
.btn--danger:hover { background: var(--danger-hover); }

.btn--block { width: 100%; }
.btn[hidden] { display: none; }

.link-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 10px;
  margin-top: 4px;
}
.link-danger:hover { text-decoration: underline; }
.link-danger[hidden] { display: none; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 44px;
}
.search .ic { color: var(--muted); }
.search input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  width: 230px;
  color: var(--ink);
}
.search input::placeholder { color: var(--muted); }

/* =========================================================
   Table
   ========================================================= */
.main { padding: 48px 32px 70px; }

.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

.datatable {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.datatable thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.datatable td {
  padding: 15px 24px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.datatable tbody tr:last-child td { border-bottom: none; }
.datatable tbody tr:hover { background: rgba(232, 163, 61, 0.045); }

.member-cell {
  display: flex;
  align-items: center;
  gap: 13px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--amber-ink);
  flex-shrink: 0;
}

.member-name { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.member-email { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

.username-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}

.id-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
}

.col-actions { text-align: right; width: 130px; }

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-raised); color: var(--ink); }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }

.row-empty td {
  text-align: center;
  color: var(--muted);
  padding: 52px 20px;
  font-size: 14px;
}

.stack-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 26px 4px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.stack-chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}

/* =========================================================
   Slide-over sheet
   ========================================================= */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 12, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}
.scrim.is-visible { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--bg-deep);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sheet);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 30px 30px 34px;
  overflow-y: auto;
}
.sheet.is-open { transform: translateX(0); }

.sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.sheet__eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--amber-hover);
  margin: 0 0 6px;
}

.sheet__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
}

.sheet__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.sheet__close:hover { background: var(--surface); color: var(--ink); }

.sheet__form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field__label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field__input {
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input::placeholder { color: var(--muted); }

.field__input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
  outline: none;
}

.sheet__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

/* =========================================================
   Confirm dialog
   ========================================================= */
.confirm {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%);
  width: min(360px, calc(100% - 40px));
  background: var(--bg-deep);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-pop);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  text-align: center;
}
.confirm.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.confirm__icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.confirm__icon .ic { width: 22px; height: 22px; }

.confirm__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  margin: 0 0 6px;
}
.confirm__body {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 22px;
}
.confirm__actions {
  display: flex;
  gap: 10px;
}

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 70;
  max-width: 90vw;
  box-shadow: var(--shadow-pop);
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 760px) {
  .nav__links { display: none; }
  .hero__inner { padding: 56px 24px 44px; }
  .hero__stats { gap: 30px; }
  .main { padding: 36px 20px 56px; }
  .search input { width: 150px; }
}

@media (max-width: 600px) {
  .col-username, .col-id { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .sheet { padding: 24px 20px 30px; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .search { width: 100%; }
  .search input { width: 100%; }
}
