*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: #f5f5f7;
  background: #000;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(255, 255, 255, 0.06), transparent),
    #000;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Purge card (matches webview) ── */

.scene {
  perspective: 1200px;
  width: min(420px, calc(100vw - 40px));
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.scene-wide {
  width: min(1100px, calc(100vw - 40px));
  margin: 0 auto;
  animation: pageEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  position: relative;
  padding: 42px 36px 34px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #000;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
  isolation: isolate;
}

.card-wide {
  padding: 38px 40px 34px;
  overflow: visible;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05) 0%, transparent 35%);
  pointer-events: none;
  z-index: 1;
}

.card-swipe {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
  overflow: hidden;
}

.card-swipe-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  display: flex;
  animation: cardSwipe 14s linear infinite;
}

.card-swipe-band {
  flex: 0 0 50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    #000 0%, #070707 8%, #111 16%, #1b1b1b 24%, #252525 32%,
    #2c2c2c 38%, #303030 42%, #2c2c2c 46%, #252525 52%, #1b1b1b 60%,
    #111 68%, #070707 76%, #000 84%, #000 100%
  );
}

@keyframes cardSwipe {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

.card-content {
  position: relative;
  z-index: 2;
}

/* ── Layout ── */

.page-center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.page-dashboard {
  min-height: 100vh;
  padding: 32px 20px 48px;
}

/* ── Header / brand ── */

.signin-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.brand-logo-wrap {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-wrap-sm {
  width: 52px;
  height: 52px;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.1;
}

.subtitle {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.88rem;
  margin-top: 4px;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.dash-title-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-actions-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.signed-as {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.45);
}

.signed-as strong {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
}

/* ── Form fields ── */

.field {
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.5);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  background:
    linear-gradient(45deg, transparent 45%, rgba(255,255,255,0.45) 45%, rgba(255,255,255,0.45) 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, rgba(255,255,255,0.45) 45%, rgba(255,255,255,0.45) 55%, transparent 55%);
  cursor: pointer;
}

/* ── Custom select ── */

.select-wrap {
  position: relative;
  width: 100%;
}

.select-wrap-sm {
  width: auto;
  min-width: 132px;
}

.select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.select-wrap-sm .select-trigger {
  padding: 9px 12px;
  font-size: 0.82rem;
  border-radius: 12px;
}

.select-trigger:hover,
.select-wrap.is-open .select-trigger {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.55);
}

.select-wrap.is-open .select-trigger {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

.select-value {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-chevron {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-right: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.45);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s;
}

.select-wrap.is-open .select-chevron {
  transform: rotate(225deg) translateY(2px);
}

.select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 8, 8, 0.98);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}

.select-wrap.is-open .select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.select-option {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.select-wrap-sm .select-option {
  padding: 9px 10px;
  font-size: 0.82rem;
}

.select-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.select-option.is-selected {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.select-native {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* ── Buttons ── */

.btn-primary,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  border: 1px solid rgba(255, 255, 255, 0.22);
  white-space: nowrap;
}

.btn-primary {
  background: rgba(255, 255, 255, 0.92);
  color: #000;
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: #fff;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.82);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.btn-danger {
  border-color: rgba(255, 69, 58, 0.35);
  background: rgba(255, 69, 58, 0.08);
  color: #ff8a82;
}

.btn-danger:hover {
  border-color: rgba(255, 69, 58, 0.55);
  color: #ffb4ae;
}

.btn-sm {
  padding: 9px 12px;
  font-size: 0.82rem;
  border-radius: 12px;
}

.btn-block {
  width: 100%;
}

/* ── Alerts ── */

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 20px;
  font-size: 0.84rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.alert-error {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.72);
  border-color: rgba(255, 255, 255, 0.12);
}

.alert-success {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.16);
}

/* ── Dashboard stats ── */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
}

.dash-tile {
  padding: 18px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.35);
}

.dash-tile-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  margin-bottom: 8px;
}

.dash-tile-value {
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
}

/* ── Panels / grid ── */

.grid-2 {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
}

@media (max-width: 960px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.panel {
  padding: 24px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.35);
  overflow: visible;
}

.panel-title {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.panel > .panel-title {
  margin-bottom: 20px;
}

.panel-head .panel-title {
  margin-bottom: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 180px;
  max-width: 260px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.84rem;
  border-radius: 12px;
}

.panel-logs {
  margin-top: 16px;
}

/* ── Table ── */

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

.actions .select-wrap.is-open {
  z-index: 40;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: middle;
}

th {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}

td strong {
  color: #fff;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
}

.badge-active {
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.22);
}

.badge-banned,
.badge-expired {
  color: rgba(255, 255, 255, 0.45);
  border-color: rgba(255, 255, 255, 0.10);
}

.badge-failed {
  color: #ff8a82;
  border-color: rgba(255, 69, 58, 0.35);
  background: rgba(255, 69, 58, 0.08);
}

.badge-source {
  text-transform: capitalize;
}

.nowrap {
  white-space: nowrap;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.62);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form input {
  width: auto;
  min-width: 120px;
  padding: 9px 12px;
  font-size: 0.82rem;
  border-radius: 12px;
}

.muted {
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.84rem;
}

.empty-row td {
  padding: 32px 10px;
  text-align: center;
}

.footer-note {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.38);
}
