:root {
  --bg: #10131a;
  --panel: rgba(13, 22, 31, 0.82);
  --panel-border: rgba(157, 187, 255, 0.16);
  --card: rgba(9, 16, 23, 0.72);
  --text: #f6f7fb;
  --muted: #a9b2c6;
  --accent: #ff9154;
  --accent-2: #76d3ff;
  --success: #6fe0a8;
  --danger: #ff6d6d;
  --shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(118, 211, 255, 0.14), transparent 35%),
    radial-gradient(circle at top right, rgba(255, 145, 84, 0.12), transparent 28%),
    linear-gradient(160deg, #0b0e13 0%, #141b23 52%, #0d1118 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

body {
  position: relative;
}

.background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.background-glow {
  position: absolute;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.22;
}

.background-glow-left {
  left: -10rem;
  top: 2rem;
  background: var(--accent-2);
}

.background-glow-right {
  right: -8rem;
  bottom: 4rem;
  background: var(--accent);
}

.app-shell {
  position: relative;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 5rem;
}

.hero {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 1.8rem;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 0.4rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  line-height: 0.98;
}

h2 {
  font-size: 1.45rem;
}

.hero-copy,
.panel-copy,
.inline-message,
dd,
input,
textarea,
button {
  font-size: 0.98rem;
}

.hero-copy,
.panel-copy,
dd {
  color: var(--muted);
  line-height: 1.6;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 1.1rem;
  background: rgba(14, 25, 36, 0.72);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(118, 211, 255, 0.45);
  animation: pulse 1.8s infinite;
}

.panel {
  padding: 1.35rem;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.dashboard {
  display: grid;
  gap: 1.2rem;
}

.admin-workspace,
.dashboard-grid {
  display: grid;
  gap: 1.2rem;
}

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

.admin-workspace {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.9fr);
  align-items: start;
}

.admin-main,
.admin-sidebar {
  display: grid;
  gap: 1.2rem;
}

.admin-sidebar {
  position: sticky;
  top: 1rem;
}

.stack-form,
.inline-form {
  display: grid;
  gap: 0.9rem;
}

.inline-form {
  grid-template-columns: 1fr 2fr auto;
  align-items: end;
}

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

label {
  display: grid;
  gap: 0.45rem;
}

label span {
  color: var(--muted);
  font-size: 0.85rem;
}

input,
textarea,
button {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(160, 190, 255, 0.18);
  background: rgba(7, 13, 19, 0.76);
  color: var(--text);
  font-family: inherit;
  padding: 0.9rem 1rem;
}

textarea {
  resize: vertical;
  min-height: 10rem;
  font-family: "IBM Plex Mono", monospace;
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #ffb06f);
  color: #12151a;
  font-weight: 700;
  border: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(255, 145, 84, 0.2);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ghost-button {
  background: transparent;
  border: 1px solid rgba(160, 190, 255, 0.18);
  color: var(--text);
}

.text-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 3rem;
  padding: 0.8rem 1rem;
}

.wide {
  grid-column: span 1;
}

.wide-full {
  grid-column: 1 / -1;
}

.inline-message {
  min-height: 1.4rem;
  color: var(--accent-2);
}

.pages-list,
.detections-list {
  display: grid;
  gap: 0.9rem;
}

.page-row,
.detection-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid rgba(160, 190, 255, 0.12);
}

.page-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.8rem;
  align-items: center;
}

.page-meta strong,
.detection-header strong {
  display: block;
  font-size: 1rem;
}

.page-meta a,
.detection-links a {
  color: var(--accent-2);
}

.page-actions {
  display: flex;
  gap: 0.5rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.detection-tools {
  display: grid;
  gap: 0.65rem;
  justify-items: end;
}

.page-actions button {
  padding: 0.65rem 0.85rem;
}

.compact-button {
  min-height: 2.55rem;
  padding: 0.65rem 0.85rem;
}

.danger {
  background: linear-gradient(135deg, var(--danger), #ff9e9e);
}

.muted-button {
  background: rgba(160, 190, 255, 0.12);
  color: var(--text);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

dd {
  margin: 0.28rem 0 0;
}

.stat-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid rgba(160, 190, 255, 0.12);
}

.detection-card {
  display: grid;
  gap: 0.85rem;
}

.recent-post-card {
  gap: 0.75rem;
}

.detection-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.detection-links,
.detection-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(160, 190, 255, 0.18);
  background: rgba(160, 190, 255, 0.08);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
}

.replay-badge {
  border-color: rgba(255, 145, 84, 0.28);
  background: rgba(255, 145, 84, 0.12);
  color: #ffc18f;
}

.body-box {
  padding: 0.95rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(160, 190, 255, 0.08);
}

.body-box pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.87rem;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(118, 211, 255, 0.35);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(118, 211, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(118, 211, 255, 0);
  }
}

@media (max-width: 1100px) {
  .admin-workspace {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }
}

@media (max-width: 900px) {
  .hero,
  .dashboard-grid,
  .inline-form,
  .selector-form,
  .stat-grid,
  .page-row {
    grid-template-columns: 1fr;
  }
  .page-actions,
  .card-actions,
  .detection-tools {
    justify-content: flex-start;
    justify-items: start;
  }
}
