:root {
  --bg: #0c0f14;
  --panel: #151a22;
  --panel-strong: #1c2330;
  --text: #f5f7fb;
  --muted: #aeb7c6;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #7c3aed;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Tajawal", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.16), transparent 30rem),
    radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.18), transparent 32rem),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.site-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #5865f2, #22c55e);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.82rem;
}

.topnav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
}

.topnav a:hover,
.link-button:hover {
  color: var(--text);
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.hero,
.bot-hero,
.policy-header,
.admin-header {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr;
  gap: 28px;
  align-items: center;
  padding: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 26, 34, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.bot-hero,
.policy-header,
.admin-header {
  grid-template-columns: auto 1fr;
}

.admin-header {
  grid-template-columns: 1fr auto;
  margin-bottom: 22px;
}

.eyebrow {
  display: block;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 14px;
  font-size: 2rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

p {
  color: var(--muted);
  line-height: 1.8;
}

.hero-copy p,
.bot-hero p {
  max-width: 720px;
  font-size: 1.12rem;
}

.hero-actions,
.bot-actions,
.admin-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #5865f2, #22c55e);
  color: #fff;
  font-weight: 800;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.08);
}

.button.danger {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}

.button.ghost {
  background: transparent;
}

.button.small {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.button.full {
  width: 100%;
}

.button.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.hero-panel,
.link-panel,
.auth-card,
.editor-form,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.hero-panel {
  padding: 26px;
}

.metric strong {
  display: block;
  font-size: 4rem;
  line-height: 1;
}

.metric span,
.status-row,
.mini-list {
  color: var(--muted);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 24px 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--accent-2);
  box-shadow: 0 0 22px var(--accent-2);
}

.mini-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-list span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.section {
  padding: 58px 0 0;
}

.section-heading {
  margin-bottom: 22px;
}

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

.bot-card,
.admin-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.bot-card::before,
.admin-card::before,
.bot-hero::before,
.policy-header::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent), transparent 70%), transparent 48%);
  pointer-events: none;
}

.bot-card > *,
.admin-card > *,
.bot-hero > *,
.policy-header > * {
  position: relative;
}

.bot-card-link {
  display: block;
}

.bot-logo {
  width: 94px;
  height: 94px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--panel);
}

.bot-logo.large {
  width: 148px;
  height: 148px;
}

.small-logo {
  width: 64px;
  height: 64px;
}

.bot-card-copy {
  min-height: 132px;
  margin-top: 16px;
}

.bot-card-copy p {
  margin-bottom: 0;
}

.two-column {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 22px;
  align-items: start;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-list span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
}

.link-panel {
  padding: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(5, 7, 11, 0.58);
  outline: 0;
}

input:focus,
textarea:focus {
  border-color: #5865f2;
}

textarea {
  resize: vertical;
}

.policy-body {
  max-width: 900px;
  margin: 34px auto 0;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.policy-body p {
  color: #dbe2ed;
  white-space: pre-line;
}

.auth-layout {
  display: grid;
  min-height: 64vh;
  place-items: center;
}

.auth-card,
.editor-form {
  width: min(560px, 100%);
  padding: 28px;
}

.editor-form {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.editor-form > label {
  margin-bottom: 18px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

.legal-editor {
  direction: ltr;
  text-align: left;
  line-height: 1.7;
}

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

.stats-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 2.2rem;
  line-height: 1;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.ok {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
}

.badge.warn {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
}

.badge.bad {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
}

.server-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
  align-items: start;
}

.bot-tabs,
.server-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.bot-tabs {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.bot-tab {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
}

.bot-tab img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}

.bot-tab span,
.bot-tab small {
  display: block;
}

.bot-tab small {
  color: var(--muted);
}

.bot-tab.is-active,
.bot-tab:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
}

.server-panel,
.empty-state {
  padding: 18px;
}

.server-panel-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.server-panel-head h2,
.server-panel-head p {
  margin-bottom: 2px;
}

.server-table {
  display: grid;
  gap: 8px;
}

.server-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 100px 110px minmax(180px, auto);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(5, 7, 11, 0.28);
}

.server-row.table-head {
  color: var(--muted);
  font-weight: 800;
  background: transparent;
}

.server-row small {
  display: block;
  color: var(--muted);
}

.server-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.inline-control {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-control input,
.danger-zone input {
  min-width: 180px;
  padding: 9px 10px;
}

.danger-zone {
  position: relative;
}

.danger-zone summary {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(239, 68, 68, 0.42);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  cursor: pointer;
  list-style: none;
}

.danger-zone summary::-webkit-details-marker {
  display: none;
}

.danger-zone form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.log-table {
  display: grid;
  gap: 8px;
}

.log-row {
  display: grid;
  grid-template-columns: 170px 120px 140px minmax(180px, 0.8fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(5, 7, 11, 0.28);
}

.log-row.table-head {
  color: var(--muted);
  font-weight: 800;
  background: transparent;
}

.log-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.qr-code {
  width: 180px;
  max-width: 100%;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.admin-card-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.admin-card-head h2 {
  margin-bottom: 4px;
}

.admin-status {
  display: inline-flex;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.86rem;
  font-weight: 800;
}

.admin-status.is-on {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
}

.admin-status.is-off {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
}

.copy-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
}

.flash-success {
  border-color: rgba(34, 197, 94, 0.35);
}

.flash-error {
  border-color: rgba(239, 68, 68, 0.35);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 46px 0 26px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .hero,
  .bot-hero,
  .policy-header,
  .admin-header,
  .two-column {
    grid-template-columns: 1fr;
  }

  .bot-grid,
  .admin-grid,
  .stats-grid,
  .settings-grid,
  .server-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .server-row {
    grid-template-columns: 1fr;
  }

  .log-row {
    grid-template-columns: 1fr;
  }

  .server-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(100% - 20px, 1180px);
  }

  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav {
    width: 100%;
    justify-content: space-between;
  }

  .hero,
  .bot-hero,
  .policy-header,
  .admin-header,
  .policy-body,
  .auth-card,
  .editor-form {
    padding: 24px;
  }

  .bot-grid,
  .admin-grid,
  .stats-grid,
  .settings-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .inline-control,
  .danger-zone form {
    width: 100%;
  }

  .inline-control input,
  .danger-zone input,
  .inline-control button,
  .danger-zone button {
    width: 100%;
  }

  h1 {
    font-size: 2.35rem;
  }
}
