@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/plex-arabic-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/plex-arabic-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/plex-arabic-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/plex-latin-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/plex-latin-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/plex-latin-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --bg:          #080a09;
  --bg-1:        #0d100f;
  --bg-2:        #121615;
  --line:        rgb(126 235 175 / 0.11);
  --line-strong: rgb(126 235 175 / 0.22);

  --text:        #e7efe9;
  --text-dim:    #8fa098;

  --accent:      #37e08a;
  --accent-soft: rgb(55 224 138 / 0.10);
  --on-accent:   #05130b;

  --discord:       #5a63d8;
  --discord-hover: #4e56c6;
  --on-discord:    #ffffff;

  /* Functional only, not a second brand hue: form-validation failure. Never
     used decoratively (buttons, links, icons). */
  --danger:      #e0615c;
  --danger-soft: rgb(224 97 92 / 0.12);

  --sans: "Plex Arabic", system-ui, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", "Consolas", monospace;

  --r-sm: 8px;
  --r-md: 14px;

  --shell: 880px;
  --bar-h: 68px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(85% 55% at 50% 0%, rgb(55 224 138 / 0.07), transparent 70%),
    var(--bg);
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 700; line-height: 1.32; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.icon { width: 1.15em; height: 1.15em; fill: currentColor; flex: none; }

.shell { max-width: var(--shell); margin-inline: auto; padding-inline: 20px; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--bar-h);
  padding-inline: 20px;
  background: rgb(8 10 9 / 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 700;
  font-size: 1.05rem;
}
.topbar__brand img { width: 28px; height: 28px; flex: none; }

.topbar__tag {
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar__avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; }
.topbar__name { font-size: 0.9rem; color: var(--text-dim); }

/* ---------- Buttons (same component shape as Musaed-Web) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .22s var(--ease), border-color .22s var(--ease),
              color .22s var(--ease), box-shadow .22s var(--ease),
              transform .12s var(--ease);
}
.btn:active { transform: translateY(1px); }

/* Blurple is scoped to buttons that lead to/act on Discord, same rule as
   Musaed-Web (its CLAUDE.md §5) - here, that's login only. */
.btn--primary {
  background: var(--discord);
  color: var(--on-discord);
  box-shadow: 0 4px 16px rgb(90 99 216 / 0.22);
}
.btn--primary:hover {
  background: var(--discord-hover);
  box-shadow: 0 6px 22px rgb(90 99 216 / 0.30);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn--sm { padding: 8px 14px; font-size: 0.85rem; }

/* Destructive actions. Neutral at rest on purpose: --danger is declared above
   as functional-only and explicitly not for buttons, and a permanently red
   control would put a second hue on the page for something the admin is only
   *thinking* about. The colour arrives on hover/focus - the moment intent
   becomes real - and the confirm dialog is the actual stop. Deleting is also
   never the only way out: the type's own page offers "عطّل" right above it. */
.btn--danger {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn--danger:hover,
.btn--danger:focus-visible {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.btn__logo { width: 18px; height: 18px; flex: none; filter: brightness(0) invert(1); }

/* ---------- Cards ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
  padding: 26px;
  margin-block-end: 18px;
  transition: border-color .28s var(--ease);
}

.card--center {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  max-width: 480px;
  margin-inline: auto;
  margin-block: 48px;
}

.card--notfound {
  align-items: center;
  text-align: center;
}
/* Live countdown numeral on the rate-limit page. Mono + tabular figures so a
   ticking number keeps a constant width and the Arabic around it doesn't shift
   every second. Scoped to the digits only - the unit word beside it stays in
   the Arabic UI face, which is why they are separate elements. */
.countdown {
  font-family: var(--mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.notfound__code {
  font-family: var(--mono);
  font-size: 3.5rem;
  font-weight: 500;
  line-height: 1;
  color: var(--accent);
}

.page-head {
  padding-block: 40px 24px;
}
.page-head h1 { font-size: 1.6rem; }

/* ---------- Guild picker ---------- */

.guild-list { display: grid; gap: 10px; }

.guild-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
  min-height: 44px;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.guild-list a:hover { border-color: var(--accent); background: var(--bg-2); }
.guild-list img { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.guild-list span { font-weight: 600; }

/* ---------- Feature index ---------- */
/* Replaced five stacked forms on one page. Each card is a plain <a>, so it is
   focusable, keyboard-activatable and openable in a new tab with no JS. The
   global :focus-visible rule above already gives it an accent outline. */

.page-head__sub {
  margin-block-start: 6px;
  color: var(--text-dim);
  font-size: 0.925rem;
}

.crumbs {
  padding-block-start: 28px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-dim);
}
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.feature-grid {
  display: grid;
  /* Single column until there is genuinely room for two - a 2-up grid of long
     Arabic feature names wraps badly on a narrow laptop. */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  list-style: none;
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Comfortably past the 44px minimum target, and the whole card is the
     target rather than just the title. */
  padding: 18px 20px;
  min-height: 96px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  /* Colour only - a transform here would shift the neighbouring cards. */
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.feature-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-2);
}

.feature-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.feature-card__title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.32;
}
.feature-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.feature-card__locked { color: var(--text-dim); }

/* On / off / always-on. Distinguished by weight and fill, never by a second
   hue - the palette has one accent and that rule holds here too. */
.status {
  flex: none;
  padding: 3px 10px;
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.status--on {
  background: var(--accent-soft);
  color: var(--accent);
}
.status--always {
  border: 1px solid var(--line-strong);
  color: var(--text);
}
.status--off {
  border: 1px solid var(--line);
  color: var(--text-dim);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-block-start: 22px;
}

/* The Escape hint, injected by the script in base.html onto whichever link is
   already the way out. Latin glyphs, so `dir="ltr"` and the one place negative
   tracking is allowed - it is a keycap, never Arabic.
   Shown on every device on purpose: no media query can tell whether a physical
   keyboard is attached (`hover: none` is a pointer, not a keyboard - a tablet
   with a keyboard case matches it), so guessing would hide a working shortcut
   from people who have the key. It is one small chip either way. */
.kbd {
  display: inline-block;
  direction: ltr;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 0.72em;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-dim);
  vertical-align: middle;
}
/* On a link that is itself a hover target, the chip follows the link's colour
   rather than staying dim and looking detached from it. */
.btn:hover .kbd, .crumbs a:hover .kbd { border-color: currentColor; color: inherit; }

.empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text-dim);
  font-size: 0.925rem;
}

/* ---------- Ticket types ---------- */

.card__head { margin-block-end: 18px; }
.card__head h2 { font-size: 1.15rem; line-height: 1.32; }
.card__meta {
  margin-block-start: 6px;
  color: var(--text-dim);
  font-size: 0.875rem;
  /* 1.7 for Arabic body text - these run to two or three lines. */
  line-height: 1.7;
}

.type-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}

/* A row, not a card in a grid: types are an ordered list whose order is
   meaningful (it drives the dropdown), and a wrapping grid would hide that. */
.type-row__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.type-row__main:hover {
  border-color: var(--line-strong);
  background: var(--bg-2);
}

.type-row__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  /* Never negative on Arabic - it breaks the connected script. */
  letter-spacing: 0;
}
.type-row__emoji { font-size: 1.1rem; line-height: 1; }

.type-row__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Set apart by its own section rather than by colour, so the delete control
   can stay neutral until hover (see .btn--danger). */
.card--danger { border-color: var(--line-strong); }

/* ---------- Feature settings ---------- */

.feature__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-end: 16px;
}
.feature__head h2 { font-size: 1.15rem; }

.pill {
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.locked {
  padding: 12px 14px;
  margin-block-end: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 0.875rem;
}

.notice {
  padding: 12px 16px;
  margin-block-end: 18px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}
/* The success accent would be actively misleading on a failed save. Signalled
   with a neutral outline and body text rather than a red, because the palette
   has exactly one hue and the per-field messages below carry the detail. */
.notice--error {
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--text);
}

/* Standing information, not the result of an action - so it must not borrow
   the success accent that means "your change went through". */
.notice--hint {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-weight: 400;
  line-height: 1.7;
}
.notice--hint code {
  font-family: var(--mono);
  color: var(--text);
}

.field { margin-block-end: 18px; }

.field label {
  display: block;
  margin-block-end: 7px;
  font-size: 0.875rem;
  color: var(--text-dim);
}
.field__hint {
  display: block;
  margin-block-start: 5px;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.field input[type="text"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: border-color .2s var(--ease);
}
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--accent); }
.field input:disabled,
.field textarea:disabled,
.field select:disabled { opacity: 0.55; cursor: not-allowed; }

.field textarea { min-height: 90px; resize: vertical; line-height: 1.6; }


.field input[dir="ltr"] { text-align: end; font-family: var(--mono); }

.field--checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}
.field--checkbox label { margin: 0; color: var(--text); font-size: 0.95rem; }
.field--checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex: none;
}

.field__error {
  margin-block-start: 6px;
  color: var(--danger);
  font-size: 0.825rem;
}

/* ---------- Narrow ---------- */

@media (max-width: 480px) {
  .topbar { padding-inline: 14px; }
  .topbar__name { display: none; }
  .card { padding: 20px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}
