/* ==========================================================================
   Marketing site, auth, dashboard, community admin and staff panel
   ========================================================================== */

body.site {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 70% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%), var(--bg);
  font-size: 14px;
}

.container {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 16px;
}

/* Top navigation ---------------------------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--chrome) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-nav .container {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 58px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.01em;
  text-decoration: none !important;
}
.brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--accent);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
}
.brand img { height: 30px; width: 30px; border-radius: 6px; object-fit: cover; }
.site-nav .links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.site-nav .links a:not(.btn) {
  color: #c4ced8;
  padding: 6px 10px;
  border-radius: 4px;
  font-weight: 600;
}
.site-nav .links a:not(.btn):hover { color: #fff; background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--head-1);
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.announcement {
  padding: 8px 16px;
  text-align: center;
  font-weight: 600;
  background: var(--info);
  color: #fff;
}
.announcement.warn { background: var(--warn); color: #111; }
.announcement.critical { background: var(--danger); }

/* Hero ---------------------------------------------------------------------- */
.hero {
  padding: 72px 0 40px;
  text-align: center;
}
.hero .eyebrow {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 18px auto 14px;
  max-width: 880px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #fff;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero p.lead {
  max-width: 680px;
  margin: 0 auto 28px;
  font-size: 18px;
  color: var(--text-dim);
}
.hero .cta {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.shot {
  margin: 48px auto 0;
  max-width: 1120px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.shot img { display: block; width: 100%; height: auto; }

/* Sections --------------------------------------------------------------- */
.section { padding: 64px 0; }
.section h2.title {
  text-align: center;
  font-size: clamp(24px, 3.4vw, 36px);
  color: #fff;
  margin-bottom: 8px;
}
.section p.sub {
  text-align: center;
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 36px;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.feature {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.feature .ico {
  width: 26px;
  height: 26px;
  color: var(--accent);
  margin-bottom: 10px;
}
.feature h3 { font-size: 16px; color: #fff; }
.feature p { margin: 0; color: var(--text-dim); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}
.split h3 { font-size: 26px; color: #fff; }
.split ul { padding-left: 18px; color: var(--text-dim); line-height: 1.8; }

/* Pricing ------------------------------------------------------------------ */
.pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  align-items: stretch;
}
.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px 22px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
}
.plan.popular {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 20px 50px color-mix(in srgb, var(--accent) 22%, transparent);
}
.plan .tag {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.plan h3 { font-size: 18px; color: #fff; margin-bottom: 4px; }
.plan .price { font-size: 38px; font-weight: 800; color: #fff; margin: 10px 0; }
.plan .price small { font-size: 14px; color: var(--text-dim); font-weight: 600; }
.plan ul { list-style: none; padding: 0; margin: 10px 0 22px; flex: 1; }
.plan li { display: flex; gap: 8px; padding: 5px 0; color: var(--text-dim); }
.plan li .ico { color: var(--ok); margin-top: 2px; }

.site-footer {
  margin-top: 40px;
  padding: 26px 0;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 13px;
}
.site-footer .container { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--text-dim); }

/* Auth ----------------------------------------------------------------------- */
.auth-wrap {
  min-height: calc(100vh - 58px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 22px; color: #fff; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.btn.discord {
  background: #5865f2;
  border-color: #4752c4;
  color: #fff;
}
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 4px;
  color: var(--text-faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-error {
  padding: 8px 10px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  border: 1px solid var(--danger);
  color: #fecaca;
}

/* Dashboard / admin / staff panel shell ---------------------------------------- */
.page { padding: 26px 0 60px; }
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 24px; color: #fff; }
.page-head > .muted { width: 100%; margin-top: -8px; }
.page-head h1 + .muted { margin-top: 4px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.ccard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.ccard .head { display: flex; align-items: center; gap: 12px; }
.ccard .logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  flex: none;
  object-fit: cover;
}
.ccard h3 { margin: 0; font-size: 16px; color: #fff; }

.box {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.box + .box { margin-top: 14px; }
.box-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.box-head h2 { margin: 0; font-size: 15px; color: #fff; }
.box-head .help { margin-left: 0; }
.box-head .tools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.box-body { padding: 16px; }
.box-body.flush { padding: 0; overflow: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.grid-2 > .box + .box { margin-top: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.stat {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.stat .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.stat .value {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.stat .delta { font-size: 12px; color: var(--text-dim); }
.stat.accent .value { color: var(--accent); }
.stat.warn .value { color: var(--warn); }
.stat.danger .value { color: #f87171; }

/* Sidebar layout (admin + staff panel) */
.shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: calc(100vh - 58px);
}
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border-strong);
  padding: 14px 10px;
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
}
.sidebar .group {
  margin: 14px 8px 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 5px;
  color: var(--text-dim);
  font-weight: 600;
  text-decoration: none !important;
}
.sidebar a:hover { background: var(--hover); color: var(--text); }
.sidebar a.active { background: color-mix(in srgb, var(--accent) 20%, transparent); color: #fff; }
.sidebar a .badge { margin-left: auto; }
.shell-main { padding: 22px 24px 60px; min-width: 0; }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: #6b7280;
}
.status-dot.green { background: var(--ok); }
.status-dot.amber { background: var(--warn); }
.status-dot.red { background: var(--danger); }
.status-dot.blue { background: var(--info); }

/* List editor (admin config tables) */
.list-editor { width: 100%; border-collapse: collapse; font-size: 13px; }
.list-editor th {
  text-align: left;
  padding: 6px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.list-editor td { padding: 4px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list-editor td input[type="text"], .list-editor td input[type="number"], .list-editor td select { min-height: 26px; padding: 2px 6px; }
.list-editor td.handle { width: 54px; white-space: nowrap; }
.list-editor tr.dragging { opacity: 0.4; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: var(--head-1);
  border: 1px solid var(--border-strong);
  cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-top: 14px;
  background: var(--panel-alt);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.code-block {
  padding: 12px 14px;
  background: var(--cmd-bg);
  color: var(--cmd-text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre;
  overflow-x: auto;
  user-select: all;
}
.secret {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-family: var(--mono);
  word-break: break-all;
}

/* Tickets */
.thread { display: flex; flex-direction: column; gap: 10px; }
.thread .msg-b {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  max-width: 85%;
}
.thread .msg-b.staff { align-self: flex-end; background: color-mix(in srgb, var(--accent) 16%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.thread .msg-b.internal { align-self: flex-end; background: color-mix(in srgb, var(--warn) 14%, var(--panel)); border: 1px dashed var(--warn); }
.thread .msg-b .meta { font-size: 11px; color: var(--text-faint); margin-bottom: 4px; }
.thread .msg-b .body { white-space: pre-wrap; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 48px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { height: 10px; background: var(--panel-alt); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill { height: 100%; background: var(--accent); border-radius: 5px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 70px; }
.spark span { flex: 1; min-width: 4px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: 0.85; }

/* Light theme: headings that are white on dark backgrounds switch to the text colour. */
[data-theme="p1-light"] :is(.hero h1, .section h2.title, .feature h3, .split h3, .plan h3, .plan .price, .auth-card h1,
  .page-head h1, .ccard h3, .box-head h2, .stat .value, .sidebar a.active) {
  color: var(--text);
}
[data-theme="p1-light"] body.site { background: var(--bg); }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar .group { width: 100%; }
  .shell-main { padding: 16px; }
  .site-nav .links a.hide-sm { display: none; }
}

/* ---------------------------------------------------------------- documentation */
.docs { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; max-width: 1240px; margin: 0 auto; padding: 24px 24px 60px; }
.docs-nav { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 90px); overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.docs-nav nav { display: flex; flex-direction: column; }
.docs-nav a { color: var(--text-dim); text-decoration: none; padding: 4px 10px; border-left: 2px solid transparent; font-size: 13px; }
.docs-nav a.l1 { color: var(--text); font-weight: 600; margin-top: 8px; }
.docs-nav a.l2 { padding-left: 20px; font-size: 12.5px; }
.docs-nav a:hover { color: #fff; }
.docs-nav a.active { color: var(--accent); border-left-color: var(--accent); }
.docs-body { min-width: 0; line-height: 1.65; color: var(--text); }
.docs-body section { padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 26px; }
.docs-body section:last-child { border-bottom: none; }
.docs-body h1 { font-size: 34px; margin: 6px 0 8px; color: #fff; }
.docs-body h2 { font-size: 24px; margin: 8px 0 12px; color: #fff; scroll-margin-top: 80px; }
.docs-body h3 { font-size: 17px; margin: 24px 0 8px; color: #fff; scroll-margin-top: 80px; }
.docs-body section { scroll-margin-top: 70px; }
.docs-body p, .docs-body li { color: #c9d3dd; }
.docs-body ol, .docs-body ul { padding-left: 22px; }
.docs-body li { margin: 4px 0; }
.docs-body code { font-family: var(--mono); font-size: 0.88em; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; color: #e6edf3; }
.docs-body pre.code-block { margin: 10px 0; overflow: auto; }
.docs-body pre code { background: none; border: none; padding: 0; }
.docs-copy { position: absolute; top: 6px; right: 6px; opacity: 0.6; }
.docs-copy:hover { opacity: 1; }
.docs-body .lead { font-size: 17px; color: var(--text-dim); margin-top: 0; }
.docs-body .note { border-left: 3px solid var(--warn); background: rgba(245, 158, 11, 0.08); padding: 10px 14px; border-radius: 4px; margin: 12px 0; color: #e8dcc0; }
.docs-table { margin: 10px 0 14px; }
table.grid.docs-table td { white-space: normal; overflow: visible; text-overflow: clip; vertical-align: top; max-width: none; }
table.grid.docs-table td:first-child { white-space: nowrap; }
.docs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 18px; }
.docs-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); text-decoration: none; color: var(--text); }
.docs-card:hover { border-color: var(--accent); }
.docs-card span { color: var(--text-dim); font-size: 13px; }
@media (max-width: 860px) {
  .docs { grid-template-columns: 1fr; padding: 16px; }
  .docs-nav { position: static; max-height: none; }
  .docs-nav nav { display: none; }
  table.grid.docs-table td:first-child { white-space: normal; }
}
/* ---------------------------------------------------------------- landing FAQ */
details.faq { border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); margin-bottom: 10px; }
details.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 600; color: #fff; list-style: none; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: '+'; float: right; color: var(--text-dim); }
details.faq[open] summary::after { content: '–'; }
details.faq p { margin: 0; padding: 0 18px 16px; color: var(--text-dim); }